Convert Delphi type to C++ type
Three problems: (Delphi type) (example)
TAGLCoordVariantBit = (aglLatPole0,aglLonPlus,aglDegrees);
TAGLCoordVariant = set of TAGLCoordVariantBit;
TCoordType = Cardinal;
PCoordSpec = ^TCoordSpec;
TCoordSpec = record
Pole, Origin: TSpherePoint;
TAGLCircleType = (aglTwoPtCircle,aglPoleLatCircle,aglPoleDistCircle);
TAGLCircle = packed record
case TAGLCircleType of aglTwoPtCircle: (Pt2: TSpherePoint);
aglPoleLatCircle: (Latitude: Double);
aglPoleDistCircle: (Distance: Double);
Pleace, how to convert in C++?
Your going to have to explain what this stuff is in a generic language(or wait on someone who knows both). For example, is the ^variable a pointer?
type looks like a class or struct (these are nearly identical in c++).
This might get you started:
struct container //create a user type with fields
int field1; //machine word integer
float field2; //a ieee small float
double field3; //ieee larger float
int * ip; //a pointer to an integer
int array; // an array of 100 integers.
bool b; //'true' or 'false' (keywords) 0 is false, nonzero is true.
container x; //create a variable of your type
x.field1 = 3; // use a field.
converting these structures to C isn't going to be that easy since pascal (it's pure pascal btw, not Delphi, which is just an IDE) has a few built-in types that don't exist in C, boolean for instace (which you can fake using int) or worse yet: sets. It's easier to convert it to C++, using std::set but that's probably too advanced for someone who hasn't used C++ and the STL before. My advice: don't try to create the spitting image of these data structures in C. Instead, go the drawing board and see what your C app really needs. You may find out that some pascal features are an artifact of pascal itself (i.e., its weak at pointers, so it uses different constructs, it's strong at enum types so there are plenty of them and so on).
By Maria Modeste in forum Java
Last Post: 10-12-2005, 02:08 PM
By swapnil_paranja in forum C++
Last Post: 06-30-2005, 06:55 AM
By Lily in forum Database
Last Post: 06-10-2002, 11:10 AM
By Bob Russell in forum .NET
Last Post: 05-29-2002, 12:07 PM
By Tahui in forum VB Classic
Last Post: 11-22-2000, 10:24 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center