Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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 220 of file OSGVRMLWriteAction.h.


Constructor & Destructor Documentation

VRMLWriteAction::FCInfo::FCInfo void   ) 
 

Definition at line 100 of file OSGVRMLWriteAction.cpp.

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

VRMLWriteAction::FCInfo::FCInfo const FCInfo source  ) 
 

Definition at line 108 of file OSGVRMLWriteAction.cpp.

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

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

VRMLWriteAction::FCInfo::~FCInfo void   ) 
 

Definition at line 120 of file OSGVRMLWriteAction.cpp.

References _bOwnName, and _szName.

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


Member Function Documentation

Char8 VRMLWriteAction::FCInfo::mapChar Char8  c  ) 
 

Definition at line 126 of file OSGVRMLWriteAction.cpp.

Referenced by convertName().

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

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

Definition at line 142 of file OSGVRMLWriteAction.cpp.

References mapChar().

Referenced by setName().

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

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

Definition at line 164 of file OSGVRMLWriteAction.cpp.

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

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

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

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

Definition at line 171 of file OSGVRMLWriteAction.cpp.

References _bOwnName, and _szName.

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

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

void VRMLWriteAction::FCInfo::incUse void   ) 
 

Definition at line 193 of file OSGVRMLWriteAction.cpp.

References _iTimesUsed.

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

00194 {
00195     _iTimesUsed++;
00196 }

UInt32 VRMLWriteAction::FCInfo::getUse void   )  const
 

Definition at line 198 of file OSGVRMLWriteAction.cpp.

References _iTimesUsed.

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

00199 {
00200     return _iTimesUsed;
00201 }

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

Definition at line 203 of file OSGVRMLWriteAction.cpp.

References _szName.

Referenced by osg::VRMLWriteAction::writeComponentTransformEnter(), osg::VRMLWriteAction::writeGeoCommon(), osg::VRMLWriteAction::writeGroupEnter(), and osg::VRMLWriteAction::writeTransformEnter().

00204 {
00205     return _szName;
00206 }

bool VRMLWriteAction::FCInfo::getWritten void   )  const
 

Definition at line 208 of file OSGVRMLWriteAction.cpp.

References _bWritten.

Referenced by osg::VRMLWriteAction::writeComponentTransformEnter(), osg::VRMLWriteAction::writeGeoCommon(), osg::VRMLWriteAction::writeGroupEnter(), and osg::VRMLWriteAction::writeTransformEnter().

00209 {
00210     return _bWritten;
00211 }

void VRMLWriteAction::FCInfo::setWritten void   ) 
 

Definition at line 213 of file OSGVRMLWriteAction.cpp.

References _bWritten.

Referenced by osg::VRMLWriteAction::writeComponentTransformEnter(), osg::VRMLWriteAction::writeGeoCommon(), osg::VRMLWriteAction::writeGroupEnter(), and osg::VRMLWriteAction::writeTransformEnter().

00214 {
00215     _bWritten = true;
00216 }

Int32 VRMLWriteAction::FCInfo::clear void   ) 
 

Definition at line 218 of file OSGVRMLWriteAction.cpp.

References _bOwnName, _bWritten, _iTimesUsed, and _szName.

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

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


Member Data Documentation

Int32 osg::VRMLWriteAction::FCInfo::_iTimesUsed [private]
 

Definition at line 224 of file OSGVRMLWriteAction.h.

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

bool osg::VRMLWriteAction::FCInfo::_bOwnName [private]
 

Definition at line 225 of file OSGVRMLWriteAction.h.

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

Char8* osg::VRMLWriteAction::FCInfo::_szName [private]
 

Definition at line 226 of file OSGVRMLWriteAction.h.

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

bool osg::VRMLWriteAction::FCInfo::_bWritten [private]
 

Definition at line 227 of file OSGVRMLWriteAction.h.

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


The documentation for this struct was generated from the following files:
Generated on Thu Aug 25 04:14:06 2005 for OpenSG by  doxygen 1.4.3