osg::VRMLWriteAction::FCInfo Struct Reference

List of all members.

Public Member Functions

 FCInfo (void)
 FCInfo (const FCInfo &source)
 ~FCInfo (void)
Char8 mapChar (Char8 c)
void convertName (Char8 *&szName)
void setName (const Char8 *szName)
void buildName (const Char8 *szTypename, UInt32 uiContainerId)
void incUse (void)
UInt32 getUse (void) const
const Char8getName (void) const
bool getWritten (void) const
void setWritten (void)
Int32 clear (void)

Private Attributes

Int32 _iTimesUsed
bool _bOwnName
Char8_szName
bool _bWritten


Detailed Description

Definition at line 221 of file OSGVRMLWriteAction.h.


Constructor & Destructor Documentation

VRMLWriteAction::FCInfo::FCInfo ( void   ) 

Definition at line 101 of file OSGVRMLWriteAction.cpp.

00101                                   :
00102     _iTimesUsed(0     ),
00103     _bOwnName   (false),
00104     _szName     (NULL ),
00105     _bWritten    (false)
00106 {
00107 }

VRMLWriteAction::FCInfo::FCInfo ( const FCInfo source  ) 

Definition at line 109 of file OSGVRMLWriteAction.cpp.

References _bOwnName, _szName, and osg::stringDup().

00109                                                   :
00110     _iTimesUsed(source._iTimesUsed),
00111     _bOwnName  (source._bOwnName  ),
00112     _szName    (NULL              ),
00113     _bWritten   (source._bWritten   )
00114 {
00115     if(_bOwnName == true)
00116     {
00117         stringDup(source._szName, _szName);
00118     }
00119 }

VRMLWriteAction::FCInfo::~FCInfo ( void   ) 

Definition at line 121 of file OSGVRMLWriteAction.cpp.

References _bOwnName, and _szName.

00122 {
00123     if(_bOwnName == true)
00124         delete [] _szName;
00125 }


Member Function Documentation

Char8 VRMLWriteAction::FCInfo::mapChar ( Char8  c  ) 

Definition at line 127 of file OSGVRMLWriteAction.cpp.

Referenced by convertName().

00128 {
00129     // These are taken from the VRML97 reference document
00130     static char badchars[] = {  
00131         0x22, 0x23, 0x27, 0x2c, 0x2e, 0x5b, 0x5c, 0x5d, 0x7b, 0x7d, 0x7f
00132     };
00133     
00134     if (c <= 0x20) return '_';
00135     
00136     for(Int16 i = 0; i < sizeof(badchars); ++i)
00137         if(c == badchars[i])
00138             return '_';
00139     
00140     return c;
00141 }

void VRMLWriteAction::FCInfo::convertName ( Char8 *&  szName  ) 

Definition at line 143 of file OSGVRMLWriteAction.cpp.

References mapChar().

Referenced by setName().

00144 {       
00145     if(szName == NULL)
00146         return;
00147     
00148     for(UInt32 i = 0; i < strlen(szName); i++)
00149     {
00150         szName[i] = mapChar(szName[i]);
00151     }
00152     
00153     // first char a number a plus or a minus? add an _
00154     if((szName[0] >= 0x30 && szName[0] <= 0x39) ||
00155         szName[0] == 0x2b || szName[0] == 0x2d)
00156     {
00157         Char8 *newstring = new char [strlen(szName) + 2];
00158         
00159         newstring[0] = '_';
00160         strcpy(newstring + 1, szName);
00161         delete[] szName;
00162         szName = newstring;
00163     }
00164 }

void VRMLWriteAction::FCInfo::setName ( const Char8 szName  ) 

Definition at line 166 of file OSGVRMLWriteAction.cpp.

References _bOwnName, _szName, convertName(), and osg::stringDup().

Referenced by osg::VRMLWriteAction::addNodeUse().

00167 {
00168     stringDup(szName, _szName);
00169     convertName(_szName);
00170     _bOwnName = true;
00171 }

void VRMLWriteAction::FCInfo::buildName ( const Char8 szTypename,
UInt32  uiContainerId 
)

Definition at line 173 of file OSGVRMLWriteAction.cpp.

References _bOwnName, and _szName.

Referenced by osg::VRMLWriteAction::addContainerUse(), and osg::VRMLWriteAction::addNodeUse().

00175 {
00176     if(_szName != NULL)
00177         return;
00178 
00179     if(szTypename != NULL)
00180     {
00181         _szName = new Char8[strlen(szTypename) + 32];
00182 
00183         sprintf(_szName, "%s_%u", szTypename, uiContainerId);
00184     }
00185     else
00186     {
00187         _szName = new Char8[64];
00188         
00189         sprintf(_szName, "UType_%u", uiContainerId);
00190     }
00191 
00192     _bOwnName = true;
00193 }

void VRMLWriteAction::FCInfo::incUse ( void   ) 

Definition at line 195 of file OSGVRMLWriteAction.cpp.

References _iTimesUsed.

Referenced by osg::VRMLWriteAction::addContainerUse(), and osg::VRMLWriteAction::addNodeUse().

00196 {
00197     _iTimesUsed++;
00198 }

UInt32 VRMLWriteAction::FCInfo::getUse ( void   )  const

const Char8 * VRMLWriteAction::FCInfo::getName ( void   )  const

bool VRMLWriteAction::FCInfo::getWritten ( void   )  const

void VRMLWriteAction::FCInfo::setWritten ( void   ) 

Int32 VRMLWriteAction::FCInfo::clear ( void   ) 

Definition at line 220 of file OSGVRMLWriteAction.cpp.

References _bOwnName, _bWritten, _iTimesUsed, and _szName.

Referenced by osg::VRMLWriteAction::write().

00221 {
00222     _iTimesUsed = 0;
00223 
00224     if(_bOwnName == true)
00225     {
00226         delete [] _szName;
00227     }
00228 
00229     _bOwnName = false;
00230     _szName   = NULL;
00231     _bWritten  = false;
00232 
00233     return 0;
00234 }


Member Data Documentation

Definition at line 225 of file OSGVRMLWriteAction.h.

Referenced by clear(), getUse(), and incUse().

Definition at line 226 of file OSGVRMLWriteAction.h.

Referenced by buildName(), clear(), FCInfo(), setName(), and ~FCInfo().

Definition at line 227 of file OSGVRMLWriteAction.h.

Referenced by buildName(), clear(), FCInfo(), getName(), setName(), and ~FCInfo().

Definition at line 228 of file OSGVRMLWriteAction.h.

Referenced by clear(), getWritten(), and setWritten().


The documentation for this struct was generated from the following files:

Generated on Mon Mar 17 12:05:28 2008 for OpenSG by  doxygen 1.5.5