Public Member Functions | Static Public Attributes

FBPropertyBaseEnum< tType > Class Template Reference

Search for all occurrences

Detailed Description

template<class tType>
class FBPropertyBaseEnum< tType >

Base template class for enum properties. Note: Index values of enum type must start from 0 and increase sequentially.

Definition at line 745 of file fbproperties.h.

#include <fbproperties.h>

Inheritance diagram for FBPropertyBaseEnum< tType >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 FBPropertyBaseEnum ()
 Constructor.
 ~FBPropertyBaseEnum ()
 Destructor.
 FBPropertyBaseEnum (const FBPropertyBaseEnum< tType > &pValue)
 FBPropertyBaseEnum.
 operator tType () const
 Overloaded cast to tType operator.
virtual const char * EnumList (int pIndex) override
 Return the string of an enum value.
virtual const char * AsString (FBDataAsStringFlag pFlag=kFBDataAsStringUI) override
 Get as string.
virtual bool SetString (const char *pString) override
 Set enum value by equivalent string.
void operator= (tType pValue)
 Overloaded = operator.

Static Public Attributes

static const char * mStrings []
 String list.

Constructor & Destructor Documentation

FBPropertyBaseEnum ( ) [inline]

Constructor.

Definition at line 753 of file fbproperties.h.

{}  
~FBPropertyBaseEnum ( ) [inline]

Destructor.

Definition at line 756 of file fbproperties.h.

        {

        }  
FBPropertyBaseEnum ( const FBPropertyBaseEnum< tType > &  pValue) [inline]

FBPropertyBaseEnum.

Parameters:
pValueFBPropertyBaseEnum.

Definition at line 764 of file fbproperties.h.

{ operator=((tType)pValue ); }

Member Function Documentation

void operator= ( tType  pValue) [inline]

Overloaded = operator.

Set the value of the current object using Set function.

Parameters:
pValueValue to set for object.

Reimplemented from FBPropertyBase< tType, kFBPT_enum >.

Definition at line 771 of file fbproperties.h.

{ SetData( &pValue ); }
operator tType ( ) const [inline]

Overloaded cast to tType operator.

Get the value of the current object using Get function.

Returns:
tType cast of current object.

Reimplemented from FBPropertyBase< tType, kFBPT_enum >.

Definition at line 778 of file fbproperties.h.

{ tType Value; GetData( &Value,sizeof(Value) ); return Value; } 
virtual const char* EnumList ( int  pIndex) [inline, override, virtual]

Return the string of an enum value.

Parameters:
pIndexEnum value to get string for.
Returns:
String value of enum specified by pIndex.

Reimplemented from FBProperty.

Definition at line 780 of file fbproperties.h.

        {   
            if( FBPropertyBaseEnum::IsInternal() )
            {
                return FBProperty::EnumList( pIndex );
            }
            else if(mStrings)
            {
                return mStrings[pIndex]; 
            }
            else
            {
                assert(mStrings || FBPropertyBaseEnum::IsInternal());
                return NULL;
            }
        }
virtual const char* AsString ( FBDataAsStringFlag  pFlag = kFBDataAsStringUI) [inline, override, virtual]

Get as string.

Parameters:
pFlagSpecifies the purpose of returned string it defaults to kFBDataAsStringUI.
Returns:
String list.

Reimplemented from FBProperty.

Definition at line 801 of file fbproperties.h.

virtual bool SetString ( const char *  pString) [inline, override, virtual]

Set enum value by equivalent string.

Parameters:
pStringString to set for enum property, with format same as AsString(kFBDataAsStringPersistence)
Returns:
True if success.

Reimplemented from FBProperty.

Definition at line 807 of file fbproperties.h.

        {
            int         Count=0;
            const char *    tmpstr;
            while ((tmpstr=EnumList( Count ))!=NULL) {
                if (strcmp(tmpstr,pString)==0) {
                    FBPropertyBaseEnum::SetData( &Count );
                    return true;
                }
                Count++;
            }
            return false;
        }

Member Data Documentation

const char* mStrings[] [static]

String list.

Definition at line 750 of file fbproperties.h.


The documentation for this class was generated from the following file: