Re: How I translate this in C++ fom Delphi ?


2003-06-24 10:15:09 AM
cppbuilder113
"Andrei Ariescu" < XXXX@XXXXX.COM >wrote in message
Quote
No ... this is not what I want ...

What I want is :

typedef enum {goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine,
goRangeSelect, goDrawFocusSelected, goRowSizing, goColSizing, goRowMoving,
goColMoving, goEditing, goTabs, goRowSelect, goAlwaysShowEditor,
goThumbTracking} TGridOption;
typedef Set<TGridOption, goFixedVertLine, goThumbTracking>TGridOptions;

I know that "if goRowSelect in Options" is translated to if (
Options.Contains(goRowSelect) ), so how should I write " if [goRowSelect,
goEditing, goTabs] in Options " ????
Contains() only accepts single elements, so you could:
1) Use brute force:
if ( Options.Contains(goRowSelect) && Options.Contains( goEditing ) && ... )
2) or create a new Set containing the items you are looking for, do an
intersection between the sets, and see if the intersection is equal to the
new Set. This is untested code, but the basic idea behind it should be
correct:
// begin untested code
Set MySet;
// initialize MySet
MySet << goRowSelect << goEditing << goTabs;
// if this test is 'true', Options SHOULD contain goRowSelect, goEditing,
and goTabs
// (it might also contain other elements)
if ( (Options * MySet) == MySet ) ...
// end untested code
- Dennis