From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03122.html | 1802 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1802 insertions(+) create mode 100644 docs/doxygen/nel/a03122.html (limited to 'docs/doxygen/nel/a03122.html') diff --git a/docs/doxygen/nel/a03122.html b/docs/doxygen/nel/a03122.html new file mode 100644 index 00000000..5cdce42a --- /dev/null +++ b/docs/doxygen/nel/a03122.html @@ -0,0 +1,1802 @@ + + +NeL: NLLIGO::CPrimNode class Reference + + + +
+

NLLIGO::CPrimNode Class Reference

#include <primitive.h> +

+

Inheritance diagram for NLLIGO::CPrimNode: +

+ +NLLIGO::IPrimitive +NLMISC::IClassable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Properties

bool addPropertyByName (const char *property_name, IProperty *result)
uint getNumProperty () const
virtual uint getNumVector () const=0
virtual const CPrimVectorgetPrimVector () const=0
bool getProperty (uint index, std::string &property_name, IProperty *&result)
bool getProperty (uint index, std::string &property_name, const IProperty *&result) const
bool getPropertyByName (const char *property_name, NLMISC::CRGBA &result) const
bool getPropertyByName (const char *property_name, const std::vector< std::string > *&result) const
bool getPropertyByName (const char *property_name, std::string &result) const
bool getPropertyByName (const char *property_name, std::vector< std::string > *&result) const
bool getPropertyByName (const char *property_name, std::string *&result) const
bool getPropertyByName (const char *property_name, IProperty *&result) const
bool getPropertyByName (const char *property_name, const IProperty *&result) const
void removeProperties ()
bool removeProperty (uint index)
bool removePropertyByName (const char *property_name)
virtual void write (xmlNodePtr xmlNode, const char *filename) const

Public Types

enum  { NotAnArray, +AtTheEnd = 0xffffffff + }

Public Member Functions

virtual IPrimitivecopy () const
virtual std::string getClassName ()=0
virtual CPrimVectorgetPrimVector ()
virtual bool read (xmlNodePtr xmlNode, const char *filename, uint version, CLigoConfig &config)

Data Fields

bool Expanded
virtual NLMISC_DECLARE_CLASS(CPrimNode) private const
+CPrimVector 
getPrimVector )() const
std::string Layer
std::string Name
+

Member Enumeration Documentation

+

+ + + + +
+ + +
anonymous enum [inherited] +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + + +
NotAnArray  +
AtTheEnd  +
+
+ +

+Definition at line 165 of file primitive.h. +

+

00166         {
+00167                 NotAnArray,
+00168                 AtTheEnd = 0xffffffff,
+00169         };
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::addPropertyByName const char *  property_name,
IProperty result
[inherited]
+
+ + + + + +
+   + + +

+Add a property If the property already exist, the method does nothing and returns false. The pointer will be deleted by the primitive using the ::delete operator. +

+Definition at line 1384 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties. +

+Referenced by NLLIGO::CPrimitives::convertAddPrimitive(), NLLIGO::CPrimitives::convertPrimitive(), and NLLIGO::IPrimitive::read(). +

+

01385 {
+01386         bool inserted = _Properties.insert (std::map<std::string, IProperty*>::value_type (property_name, result)).second;
+01387         if (inserted)
+01388         {
+01389                 return true;
+01390         }
+01391         return false;
+01392 }
+
+

+ + + + +
+ + + + + + + + + +
NLLIGO::IPrimitive * NLLIGO::CPrimNode::copy  )  const [virtual]
+
+ + + + + +
+   + + +

+Add a property If the property already exist, the method does nothing and returns false. The pointer will be deleted by the primitive using the ::delete operator. +

+Implements NLLIGO::IPrimitive. +

+Definition at line 398 of file primitive.cpp. +

+

00399 {
+00400         return new CPrimNode (*this);
+00401 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getChild IPrimitive *&  result,
uint  childId
[inherited]
+
+ + + + + +
+   + + +

+Get a child primitive +

+Definition at line 1303 of file primitive.cpp. +

+References nlwarning, and uint. +

+

01304 {
+01305         if (childId < _Children.size ())
+01306         {
+01307                 result = _Children[childId];
+01308                 return true;
+01309         }
+01310         else
+01311         {
+01312                 nlwarning ("NLLIGO::IPrimitive::getChild : invalid index (index : %d, size %d).", childId, _Children.size ());
+01313         }
+01314         return false;
+01315 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getChild const IPrimitive *&  result,
uint  childId
const [inherited]
+
+ + + + + +
+   + + +

+Get a child primitive +

+Definition at line 1287 of file primitive.cpp. +

+References nlwarning, and uint. +

+Referenced by NLLIGO::CPrimitives::convertPrimitive(), NLSOUND::CBackgroundSoundManager::loadAudioFromPrimitives(), NLSOUND::CBackgroundSoundManager::loadEffectsFromPrimitives(), NLSOUND::CBackgroundSoundManager::loadSamplesFromPrimitives(), and NLSOUND::CBackgroundSoundManager::loadSoundsFromPrimitives(). +

+

01288 {
+01289         if (childId < _Children.size ())
+01290         {
+01291                 result = _Children[childId];
+01292                 return true;
+01293         }
+01294         else
+01295         {
+01296                 nlwarning ("NLLIGO::IPrimitive::getChild : invalid index (index : %d, size %d).", childId, _Children.size ());
+01297         }
+01298         return false;
+01299 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getChildId uint childId,
const IPrimitive child
const [inherited]
+
+ + + + + +
+   + + +

+Get the id of the child, return 0xffffffff if not found +

+Definition at line 1713 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_ChildId, and uint. +

+

01714 {
+01715         childId = child->_ChildId;
+01716         return true;
+01717 }
+
+

+ + + + +
+ + + + + + + + + +
virtual std::string NLMISC::IClassable::getClassName  )  [pure virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. +

+Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize().

+

+ + + + +
+ + + + + + + + + +
uint NLLIGO::IPrimitive::getNumChildren  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get the children primitive count +

+Definition at line 183 of file primitive.h. +

+References uint. +

+Referenced by NLLIGO::CPrimitives::convertPrimitive(), NLSOUND::CBackgroundSoundManager::loadAudioFromPrimitives(), NLSOUND::CBackgroundSoundManager::loadEffectsFromPrimitives(), NLSOUND::CBackgroundSoundManager::loadSamplesFromPrimitives(), and NLSOUND::CBackgroundSoundManager::loadSoundsFromPrimitives(). +

+

00184         {
+00185                 return _Children.size ();
+00186         }
+
+

+ + + + +
+ + + + + + + + + +
uint NLLIGO::IPrimitive::getNumProperty  )  const [inherited]
+
+ + + + + +
+   + + +

+Get a num properties +

+Definition at line 1721 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties, and uint. +

+

01722 {
+01723         return _Properties.size ();
+01724 }
+
+

+ + + + +
+ + + + + + + + + +
virtual uint NLLIGO::IPrimitive::getNumVector  )  const [pure virtual, inherited]
+
+ + + + + +
+   + + +

+Add a property If the property already exist, the method does nothing and returns false. The pointer will be deleted by the primitive using the ::delete operator. +

+Implemented in NLLIGO::CPrimPoint, NLLIGO::CPrimPath, and NLLIGO::CPrimZone. +

+Referenced by NLSOUND::CBackgroundSoundManager::loadSoundsFromPrimitives().

+

+ + + + +
+ + + + + + + + + +
const IPrimitive* NLLIGO::IPrimitive::getParent  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Get a child primitive +

+Definition at line 199 of file primitive.h. +

+

00200         {
+00201                 return _Parent;
+00202         }
+
+

+ + + + +
+ + + + + + + + + +
IPrimitive* NLLIGO::IPrimitive::getParent  )  [inline, inherited]
+
+ + + + + +
+   + + +

+Get the parent primtive +

+Definition at line 195 of file primitive.h. +

+Referenced by NLLIGO::CLigoConfig::canBeChild(), and NLLIGO::CLigoConfig::getPrimitiveClass(). +

+

00196         {
+00197                 return _Parent;
+00198         }
+
+

+ + + + +
+ + + + + + + + + +
virtual const CPrimVector* NLLIGO::IPrimitive::getPrimVector  )  const [pure virtual, inherited]
+
+ + + + + +
+   + + +

+Add a property If the property already exist, the method does nothing and returns false. The pointer will be deleted by the primitive using the ::delete operator. +

+Implemented in NLLIGO::CPrimPoint, NLLIGO::CPrimPath, and NLLIGO::CPrimZone.

+

+ + + + +
+ + + + + + + + + +
virtual CPrimVector* NLLIGO::CPrimNode::getPrimVector  )  [virtual]
+
+ + + + + +
+   + + +

+Add a property If the property already exist, the method does nothing and returns false. The pointer will be deleted by the primitive using the ::delete operator. +

+Implements NLLIGO::IPrimitive.

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getProperty uint  index,
std::string &  property_name,
IProperty *&  result
[inherited]
+
+ + + + + +
+   + + +

+Get a properties by its index This is method (iterate a list) is slower than getPropertyByName (look up in a map). +

+Definition at line 1081 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties, index, nlwarning, and uint. +

+

01082 {
+01083         // Look for the property
+01084         std::map<std::string, IProperty*>::iterator ite = _Properties.begin ();
+01085         while (ite != _Properties.end ())
+01086         {
+01087                 if (index == 0)
+01088                 {
+01089                         property_name = ite->first;
+01090                         result = ite->second;
+01091                         return true;
+01092                 }
+01093                 index--;
+01094                 ite ++;
+01095         }
+01096         nlwarning ("NLLIGO::IPrimitive::getProperty : invalid index (index : %d, size : %d).", index, _Properties.size ());
+01097         return false;
+01098 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getProperty uint  index,
std::string &  property_name,
const IProperty *&  result
const [inherited]
+
+ + + + + +
+   + + +

+Get a properties by its index This is method (iterate a list) is slower than getPropertyByName (look up in a map). +

+Definition at line 1060 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties, index, nlwarning, and uint. +

+

01061 {
+01062         // Look for the property
+01063         std::map<std::string, IProperty*>::const_iterator ite = _Properties.begin ();
+01064         while (ite != _Properties.end ())
+01065         {
+01066                 if (index == 0)
+01067                 {
+01068                         property_name = ite->first;
+01069                         result = ite->second;
+01070                         return true;
+01071                 }
+01072                 index--;
+01073                 ite ++;
+01074         }
+01075         nlwarning ("NLLIGO::IPrimitive::getProperty : invalid index (index : %d, size : %d).", index, _Properties.size ());
+01076         return false;
+01077 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getPropertyByName const char *  property_name,
NLMISC::CRGBA result
const [inherited]
+
+ + + + + +
+   + + +

+Get a color property with its name. Return false if the property is not found or is not a string array property. +

+Definition at line 1218 of file primitive.cpp. +

+References NLLIGO::CPropertyColor::Color, NLLIGO::IPrimitive::getPropertyByName(), and nlwarning. +

+

01219 {
+01220         // Get the property
+01221         IProperty *prop;
+01222         if (getPropertyByName (property_name, prop))
+01223         {
+01224                 const CPropertyColor *colorProp = dynamic_cast<const CPropertyColor *> (prop);
+01225                 if (colorProp)
+01226                 {
+01227                         result = colorProp->Color;
+01228                         return true;
+01229                 }
+01230                 else
+01231                 {
+01232                         nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a color.", property_name);
+01233                 }
+01234         }
+01235         return false;
+01236 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getPropertyByName const char *  property_name,
const std::vector< std::string > *&  result
const [inherited]
+
+ + + + + +
+   + + +

+Get a string array property with its name. Return false if the property is not found or is not a string array property. +

+Definition at line 1196 of file primitive.cpp. +

+References NLLIGO::IPrimitive::getPropertyByName(), nlwarning, and NLLIGO::CPropertyStringArray::StringArray. +

+

01197 {
+01198         // Get the property
+01199         IProperty *prop;
+01200         if (getPropertyByName (property_name, prop))
+01201         {
+01202                 const CPropertyStringArray *strProp = dynamic_cast<const CPropertyStringArray *> (prop);
+01203                 if (strProp)
+01204                 {
+01205                         result = &(strProp->StringArray);
+01206                         return true;
+01207                 }
+01208                 else
+01209                 {
+01210                         nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name);
+01211                 }
+01212         }
+01213         return false;
+01214 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getPropertyByName const char *  property_name,
std::string &  result
const [inherited]
+
+ + + + + +
+   + + +

+Get a string property with its name. Return false if the property is not found or is not a string property. +

+Definition at line 1152 of file primitive.cpp. +

+References NLLIGO::IPrimitive::getPropertyByName(), nlwarning, and NLLIGO::CPropertyString::String. +

+

01153 {
+01154         // Get the property
+01155         const IProperty *prop;
+01156         if (getPropertyByName (property_name, prop))
+01157         {
+01158                 const CPropertyString *strProp = dynamic_cast<const CPropertyString *> (prop);
+01159                 if (strProp)
+01160                 {
+01161                         result = strProp->String;
+01162                         return true;
+01163                 }
+01164                 else
+01165                 {
+01166                         nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name);
+01167                 }
+01168         }
+01169         return false;
+01170 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getPropertyByName const char *  property_name,
std::vector< std::string > *&  result
const [inherited]
+
+ + + + + +
+   + + +

+Get a string array property with its name. Return false if the property is not found or is not a string array property. +

+Definition at line 1174 of file primitive.cpp. +

+References NLLIGO::IPrimitive::getPropertyByName(), nlwarning, and NLLIGO::CPropertyStringArray::StringArray. +

+

01175 {
+01176         // Get the property
+01177         IProperty *prop;
+01178         if (getPropertyByName (property_name, prop))
+01179         {
+01180                 CPropertyStringArray *strProp = dynamic_cast<CPropertyStringArray *> (prop);
+01181                 if (strProp)
+01182                 {
+01183                         result = &(strProp->StringArray);
+01184                         return true;
+01185                 }
+01186                 else
+01187                 {
+01188                         nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name);
+01189                 }
+01190         }
+01191         return false;
+01192 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getPropertyByName const char *  property_name,
std::string *&  result
const [inherited]
+
+ + + + + +
+   + + +

+Get a string property with its name. Return false if the property is not found or is not a string property. +

+Definition at line 1130 of file primitive.cpp. +

+References NLLIGO::IPrimitive::getPropertyByName(), nlwarning, and NLLIGO::CPropertyString::String. +

+

01131 {
+01132         // Get the property
+01133         IProperty *prop;
+01134         if (getPropertyByName (property_name, prop))
+01135         {
+01136                 CPropertyString *strProp = dynamic_cast<CPropertyString *> (prop);
+01137                 if (strProp)
+01138                 {
+01139                         result = &(strProp->String);
+01140                         return true;
+01141                 }
+01142                 else
+01143                 {
+01144                         nlwarning ("NLLIGO::IPrimitive::getPropertyByName : property (%s) in not a string.", property_name);
+01145                 }
+01146         }
+01147         return false;
+01148 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getPropertyByName const char *  property_name,
IProperty *&  result
const [inherited]
+
+ + + + + +
+   + + +

+Get a property with its name +

+Definition at line 1116 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties. +

+

01117 {
+01118         // Look for the property
+01119         std::map<std::string, IProperty*>::const_iterator ite = _Properties.find (property_name);
+01120         if (ite != _Properties.end ())
+01121         {
+01122                 result = ite->second;
+01123                 return true;
+01124         }
+01125         return false;
+01126 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::getPropertyByName const char *  property_name,
const IProperty *&  result
const [inherited]
+
+ + + + + +
+   + + +

+Get a property with its name +

+Definition at line 1102 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties. +

+Referenced by NLLIGO::CPrimitiveConfigurations::belong(), NLLIGO::CLigoConfig::canBeChild(), NLLIGO::CLigoConfig::canBeRoot(), NLLIGO::CPrimitives::convertPrimitive(), NLLIGO::CLigoConfig::getPrimitiveClass(), NLLIGO::CLigoConfig::getPrimitiveColor(), NLLIGO::IPrimitive::getPropertyByName(), NLLIGO::CLigoConfig::isPrimitiveDeletable(), NLLIGO::CLigoConfig::isPrimitiveLinked(), NLSOUND::CBackgroundSoundManager::loadAudioFromPrimitives(), NLSOUND::CBackgroundSoundManager::loadEffectsFromPrimitives(), NLSOUND::CBackgroundSoundManager::loadSamplesFromPrimitives(), NLSOUND::CBackgroundSoundManager::loadSoundsFromPrimitives(), NLLIGO::IPrimitive::read(), and NLLIGO::CPrimitiveClass::CParameter::translateAutoname(). +

+

01103 {
+01104         // Look for the property
+01105         std::map<std::string, IProperty*>::const_iterator ite = _Properties.find (property_name);
+01106         if (ite != _Properties.end ())
+01107         {
+01108                 result = ite->second;
+01109                 return true;
+01110         }
+01111         return false;
+01112 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::IPrimitive::insertChild IPrimitive primitive,
uint  index = AtTheEnd
[inherited]
+
+ + + + + +
+   + + +

+Insert a child primitive before the index. The pointer will be deleted by the parent primitive using the ::delete operator. return false if the index is invalid +

+Definition at line 1349 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Parent, NLLIGO::IPrimitive::AtTheEnd, index, uint, and NLLIGO::IPrimitive::updateChildId(). +

+Referenced by NLLIGO::CPrimitives::convertAddPrimitive(), NLLIGO::CPrimitives::convertPrimitive(), and NLLIGO::IPrimitive::read(). +

+

01350 {
+01351         // At the end ?
+01352         if (index == AtTheEnd)
+01353                 index = _Children.size ();
+01354 
+01355         // Index valid ?
+01356         if (index>_Children.size ())
+01357                 return false;
+01358 
+01359         // Insert
+01360         _Children.insert (_Children.begin () + index, primitive);
+01361 
+01362         // Update child id
+01363         updateChildId (index);
+01364 
+01365         // Link to the parent
+01366         primitive->_Parent = this;
+01367 
+01368         return true;
+01369 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLLIGO::CPrimNode::read xmlNodePtr  xmlNode,
const char *  filename,
uint  version,
CLigoConfig config
[virtual]
+
+ + + + + +
+   + + +

+Add a property If the property already exist, the method does nothing and returns false. The pointer will be deleted by the primitive using the ::delete operator. +

+Reimplemented from NLLIGO::IPrimitive. +

+Definition at line 370 of file primitive.cpp. +

+References uint. +

+

00371 {
+00372         return IPrimitive::read (xmlNode, filename, version, config);
+00373 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLLIGO::IPrimitive::removeChild uint  childId  )  [inherited]
+
+ + + + + +
+   + + +

+Remove a child primitive +

+Definition at line 1319 of file primitive.cpp. +

+References nlwarning, uint, and NLLIGO::IPrimitive::updateChildId(). +

+

01320 {
+01321         if (childId < _Children.size ())
+01322         {
+01323                 delete _Children[childId];
+01324                 _Children.erase (_Children.begin()+childId);
+01325                 updateChildId (childId);
+01326                 return true;
+01327         }
+01328         else
+01329         {
+01330                 nlwarning ("NLLIGO::IPrimitive::removeChild : invalid index (index : %d, size %d).", childId, _Children.size ());
+01331         }
+01332         return false;
+01333 }
+
+

+ + + + +
+ + + + + + + + + +
void NLLIGO::IPrimitive::removeChildren  )  [inherited]
+
+ + + + + +
+   + + +

+Remove all children primitives +

+Definition at line 1337 of file primitive.cpp. +

+References uint. +

+Referenced by NLLIGO::CPrimitives::convert(), NLLIGO::IPrimitive::operator=(), NLLIGO::CPrimitives::read(), and NLLIGO::IPrimitive::~IPrimitive(). +

+

01338 {
+01339         // Erase children
+01340         for (uint i=0; i<_Children.size (); i++)
+01341         {
+01342                 delete _Children[i];
+01343         }
+01344         _Children.clear ();
+01345 }
+
+

+ + + + +
+ + + + + + + + + +
void NLLIGO::IPrimitive::removeProperties  )  [inherited]
+
+ + + + + +
+   + + +

+Remove all the properties +

+Definition at line 1274 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties. +

+Referenced by NLLIGO::CPrimitives::convert(), NLLIGO::IPrimitive::operator=(), NLLIGO::CPrimitives::read(), and NLLIGO::IPrimitive::~IPrimitive(). +

+

01275 {
+01276         std::map<std::string, IProperty*>::iterator ite = _Properties.begin ();
+01277         while (ite != _Properties.end ())
+01278         {
+01279                 delete ite->second;
+01280                 ite++;
+01281         }
+01282         _Properties.clear ();
+01283 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLLIGO::IPrimitive::removeProperty uint  index  )  [inherited]
+
+ + + + + +
+   + + +

+Remove a property This is method (iterate a list) is slower than removePropertyByName (look up in a map). +

+Definition at line 1240 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties, index, nlwarning, and uint. +

+

01241 {
+01242         // Look for the property
+01243         std::map<std::string, IProperty*>::iterator ite = _Properties.begin ();
+01244         while (ite != _Properties.end ())
+01245         {
+01246                 if (index == 0)
+01247                 {
+01248                         _Properties.erase (ite);
+01249                         return true;
+01250                 }
+01251                 index--;
+01252                 ite ++;
+01253         }
+01254         nlwarning ("NLLIGO::IPrimitive::removeProperty : invalid index (index : %d, size : %d).", index, _Properties.size ());
+01255         return false;
+01256 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLLIGO::IPrimitive::removePropertyByName const char *  property_name  )  [inherited]
+
+ + + + + +
+   + + +

+Remove a property by its name +

+Definition at line 1260 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties. +

+

01261 {
+01262         // Look for the property
+01263         std::map<std::string, IProperty*>::iterator ite = _Properties.find (property_name);
+01264         if (ite != _Properties.end ())
+01265         {
+01266                 _Properties.erase (ite);
+01267                 return true;
+01268         }
+01269         return false;
+01270 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLLIGO::IPrimitive::write xmlNodePtr  xmlNode,
const char *  filename
const [virtual, inherited]
+
+ + + + + +
+   + + +

+Add a property If the property already exist, the method does nothing and returns false. The pointer will be deleted by the primitive using the ::delete operator. +

+Reimplemented in NLLIGO::CPrimPoint, NLLIGO::CPrimPath, and NLLIGO::CPrimZone. +

+Definition at line 1627 of file primitive.cpp. +

+References NLLIGO::IPrimitive::_Properties, NLMISC::CRGBA::A, NLMISC::CRGBA::B, NLLIGO::CPropertyColor::Color, NLLIGO::IPrimitive::Expanded, NLMISC::CRGBA::G, NLMISC::CRGBA::R, NLLIGO::CPropertyString::String, NLLIGO::CPropertyStringArray::StringArray, NLMISC::toString(), and uint. +

+

01628 {
+01629         // Save the expanded flag
+01630         if (!Expanded)
+01631                 xmlSetProp (xmlNode, (const xmlChar*)"EXPANDED", (const xmlChar*)"false");
+01632 
+01633         // Set the type
+01634         xmlSetProp (xmlNode, (const xmlChar*)"TYPE", (const xmlChar*)(const_cast<IPrimitive*> (this)->getClassName ().c_str ()));
+01635 
+01636         // Save the properties
+01637         std::map<std::string, IProperty*>::const_iterator ite = _Properties.begin ();
+01638         while (ite != _Properties.end ())
+01639         {
+01640                 // Not a default property ?
+01641                 if (!ite->second->Default)
+01642                 {
+01643                         // Create new nodes
+01644                         xmlNodePtr propNode = xmlNewChild ( xmlNode, NULL, (const xmlChar*)"PROPERTY", NULL);
+01645                         xmlNodePtr nameNode = xmlNewChild ( propNode, NULL, (const xmlChar*)"NAME", NULL);
+01646                         xmlNodePtr textNode = xmlNewText ((const xmlChar *)(ite->first.c_str ()));
+01647                         xmlAddChild (nameNode, textNode);
+01648 
+01649                         // Type
+01650                         const CPropertyString *str = dynamic_cast<const CPropertyString *> (ite->second);
+01651                         if (str)
+01652                         {
+01653                                 // Set the type
+01654                                 xmlSetProp (propNode, (const xmlChar*)"TYPE", (const xmlChar*)"string");
+01655 
+01656                                 // Create new nodes
+01657                                 xmlNodePtr stringNode = xmlNewChild ( propNode, NULL, (const xmlChar*)"STRING", NULL);
+01658                                 xmlNodePtr textNode = xmlNewText ((const xmlChar *)(str->String.c_str ()));
+01659                                 xmlAddChild (stringNode, textNode);
+01660                         }
+01661                         else
+01662                         {
+01663                                 // Should be an array
+01664                                 const CPropertyStringArray *array = dynamic_cast<const CPropertyStringArray *> (ite->second);
+01665                                 if (array)
+01666                                 {
+01667                                         // Set the type
+01668                                         xmlSetProp (propNode, (const xmlChar*)"TYPE", (const xmlChar*)"string_array");
+01669 
+01670                                         // For each strings in the array
+01671                                         for (uint i=0; i<array->StringArray.size (); i++)
+01672                                         {
+01673                                                 // Create new nodes
+01674                                                 xmlNodePtr stringNode = xmlNewChild ( propNode, NULL, (const xmlChar*)"STRING", NULL);
+01675                                                 xmlNodePtr textNode = xmlNewText ((const xmlChar *)(array->StringArray[i].c_str ()));
+01676                                                 xmlAddChild (stringNode, textNode);
+01677                                         }
+01678                                 }
+01679                                 else
+01680                                 {
+01681                                         // Should be a color
+01682                                         const CPropertyColor *color = safe_cast<const CPropertyColor *> (ite->second);
+01683 
+01684                                         // Set the type
+01685                                         xmlSetProp (propNode, (const xmlChar*)"TYPE", (const xmlChar*)"color");
+01686 
+01687                                         // Create new nodes
+01688                                         xmlNodePtr colorNode = xmlNewChild ( propNode, NULL, (const xmlChar*)"COLOR", NULL);
+01689                                         xmlSetProp (colorNode, (const xmlChar*)"R", (const xmlChar*)toString (color->Color.R).c_str ());
+01690                                         xmlSetProp (colorNode, (const xmlChar*)"G", (const xmlChar*)toString (color->Color.G).c_str ());
+01691                                         xmlSetProp (colorNode, (const xmlChar*)"B", (const xmlChar*)toString (color->Color.B).c_str ());
+01692                                         xmlSetProp (colorNode, (const xmlChar*)"A", (const xmlChar*)toString (color->Color.A).c_str ());
+01693                                 }
+01694                         }
+01695                 }
+01696 
+01697                 ite++;
+01698         }
+01699 
+01700         // Save the children
+01701         for (uint i=0; i<_Children.size (); i++)
+01702         {
+01703                 // New node
+01704                 xmlNodePtr childNode = xmlNewChild ( xmlNode, NULL, (const xmlChar*)"CHILD", NULL);
+01705 
+01706                 // Write it
+01707                 _Children[i]->write (childNode, filename);
+01708         }
+01709 }
+
+


Field Documentation

+

+ + + + +
+ + +
bool NLLIGO::IPrimitive::Expanded [inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 163 of file primitive.h. +

+Referenced by NLLIGO::IPrimitive::operator=(), NLLIGO::IPrimitive::read(), and NLLIGO::IPrimitive::write().

+

+ + + + +
+ + +
CPrimVector * NLLIGO::CPrimNode::getPrimVector +
+
+ + + + + +
+   + + +

+ +

+Definition at line 391 of file primitive.cpp. +

+

00392 {
+00393         return NULL;
+00394 }
+
+

+ + + + +
+ + +
std::string NLLIGO::IPrimitive::Layer [inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 159 of file primitive.h. +

+Referenced by NLLIGO::CPrimitives::convertPrimitive(), and NLLIGO::IPrimitive::operator=().

+

+ + + + +
+ + +
std::string NLLIGO::IPrimitive::Name [inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 160 of file primitive.h. +

+Referenced by NLLIGO::CPrimitives::convertAddPrimitive(), and NLLIGO::IPrimitive::operator=().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 12:49:08 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1