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/a03117.html | 700 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 700 insertions(+) create mode 100644 docs/doxygen/nel/a03117.html (limited to 'docs/doxygen/nel/a03117.html') diff --git a/docs/doxygen/nel/a03117.html b/docs/doxygen/nel/a03117.html new file mode 100644 index 00000000..041ce475 --- /dev/null +++ b/docs/doxygen/nel/a03117.html @@ -0,0 +1,700 @@ + + +NeL: NLLIGO::CPrimitives class Reference + + + +
+

NLLIGO::CPrimitives Class Reference

#include <primitive.h> +

+


Detailed Description

+This class is a ligo primitives set +

+ +

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

Public Member Functions

void convert (const CPrimRegion &region)
 CPrimitives (const CPrimitives &other)
 CPrimitives ()
CPrimitivesoperator= (const CPrimitives &other)
bool read (xmlNodePtr xmlNode, const char *filename, CLigoConfig &config)
void write (xmlNodePtr root, const char *filename) const
void write (xmlDocPtr xmlNode, const char *filename) const
 ~CPrimitives ()

Data Fields

CPrimNodeRootNode

Private Member Functions

void convertAddPrimitive (IPrimitive *child, const IPrimitive *prim, bool hidden)
void convertPrimitive (const IPrimitive *prim, bool hidden)
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLLIGO::CPrimitives::CPrimitives  ) 
+
+ + + + + +
+   + + +

+ +

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

+

01731 {
+01732         RootNode = static_cast<CPrimNode *> (CClassRegistry::create ("CPrimNode"));
+01733 }
+
+

+ + + + +
+ + + + + + + + + + +
NLLIGO::CPrimitives::CPrimitives const CPrimitives other  ) 
+
+ + + + + +
+   + + +

+ +

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

+References RootNode. +

+

01738 {
+01739         RootNode = static_cast<CPrimNode *> (((IPrimitive*)other.RootNode)->copy ());
+01740 }
+
+

+ + + + +
+ + + + + + + + + +
NLLIGO::CPrimitives::~CPrimitives  ) 
+
+ + + + + +
+   + + +

+ +

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

+

01745 {
+01746         delete RootNode;
+01747 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NLLIGO::CPrimitives::convert const CPrimRegion region  ) 
+
+ + + + + +
+   + + +

+ +

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

+References convertPrimitive(), NLLIGO::IPrimitive::removeChildren(), NLLIGO::IPrimitive::removeProperties(), uint, NLLIGO::CPrimRegion::VHidePaths, NLLIGO::CPrimRegion::VHidePoints, NLLIGO::CPrimRegion::VHideZones, NLLIGO::CPrimRegion::VPaths, NLLIGO::CPrimRegion::VPoints, and NLLIGO::CPrimRegion::VZones. +

+

01960 {
+01961         // Delete
+01962         RootNode->removeChildren ();
+01963         RootNode->removeProperties ();
+01964 
+01965         // For each primitives
+01966         uint i;
+01967         for (i=0; i<region.VPoints.size (); i++)
+01968         {
+01969                 convertPrimitive (&(region.VPoints[i]), region.VHidePoints[i]);
+01970         }
+01971         for (i=0; i<region.VPaths.size (); i++)
+01972         {
+01973                 convertPrimitive (&(region.VPaths[i]), region.VHidePaths[i]);
+01974         }
+01975         for (i=0; i<region.VZones.size (); i++)
+01976         {
+01977                 convertPrimitive (&(region.VZones[i]), region.VHideZones[i]);
+01978         }
+01979 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLLIGO::CPrimitives::convertAddPrimitive IPrimitive child,
const IPrimitive prim,
bool  hidden
[private]
+
+ + + + + +
+   + + +

+ +

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

+References NLLIGO::IPrimitive::addPropertyByName(), NLLIGO::IPrimitive::insertChild(), NLLIGO::IPrimitive::Name, and NLLIGO::CPropertyString::String. +

+Referenced by convertPrimitive(). +

+

01840 {
+01841         // The primitve
+01842         IPrimitive *primitive = NULL;
+01843 
+01844         // What kind of primitive ?
+01845         const CPrimPoint *oldPoint = dynamic_cast<const CPrimPoint *>(prim);
+01846         if (oldPoint)
+01847         {
+01848                 // Create a primitive
+01849                 CPrimPoint *point = static_cast<CPrimPoint *> (CClassRegistry::create ("CPrimPoint"));
+01850                 primitive = point;
+01851 
+01852                 // Copy it
+01853                 *point = *oldPoint;
+01854         }
+01855         else
+01856         {
+01857                 // Path ?
+01858                 const CPrimPath *oldPath = dynamic_cast<const CPrimPath *>(prim);
+01859                 if (oldPath)
+01860                 {
+01861                         // Create a primitive
+01862                         CPrimPath *path = static_cast<CPrimPath *> (CClassRegistry::create ("CPrimPath"));
+01863                         primitive = path;
+01864 
+01865                         // Copy it
+01866                         *path = *oldPath;
+01867                 }
+01868                 else
+01869                 {
+01870                         const CPrimZone *oldZone = safe_cast<const CPrimZone *>(prim);
+01871                         if (oldZone)
+01872                         {
+01873                                 // Create a primitive
+01874                                 CPrimZone *zone = static_cast<CPrimZone *> (CClassRegistry::create ("CPrimZone"));
+01875                                 primitive = zone;
+01876 
+01877                                 // Copy it
+01878                                 *zone = *oldZone;
+01879                         }
+01880                 }
+01881         }
+01882 
+01883         // Primitive has been created ?
+01884         if (primitive)
+01885         {
+01886                 // Create a property for the name
+01887                 CPropertyString *nameProp = new CPropertyString;
+01888                 nameProp->String = prim->Name;
+01889 
+01890                 // Add the property
+01891                 primitive->addPropertyByName ("name", nameProp);
+01892 
+01893                 // The primitive is hidden ?
+01894                 if (hidden)
+01895                 {
+01896                         // Create a property for hidden
+01897                         nameProp = new CPropertyString;
+01898 
+01899                         // Add the property
+01900                         primitive->addPropertyByName ("hidden", nameProp);
+01901                 }
+01902 
+01903                 // Add the child
+01904                 child->insertChild (primitive);
+01905         }
+01906 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLLIGO::CPrimitives::convertPrimitive const IPrimitive prim,
bool  hidden
[private]
+
+ + + + + +
+   + + +

+ +

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

+References NLLIGO::IPrimitive::addPropertyByName(), convertAddPrimitive(), NLLIGO::IPrimitive::getChild(), NLLIGO::IPrimitive::getNumChildren(), NLLIGO::IPrimitive::getPropertyByName(), NLLIGO::IPrimitive::insertChild(), NLLIGO::IPrimitive::Layer, nlverify, NLLIGO::CPropertyString::String, and uint. +

+Referenced by convert(). +

+

01911 {
+01912         // Look for the group
+01913         uint numChildren = RootNode->getNumChildren ();
+01914         uint j;
+01915         for (j=0; j<numChildren; j++)
+01916         {
+01917                 IPrimitive *child;
+01918                 nlverify (RootNode->getChild (child, j));
+01919                 const IProperty *prop;
+01920                 if (child->getPropertyByName ("name", prop))
+01921                 {
+01922                         // Prop string
+01923                         const CPropertyString *name = dynamic_cast<const CPropertyString *>(prop);
+01924                         if (name)
+01925                         {
+01926                                 // This one ?
+01927                                 if (name->String == prim->Layer)
+01928                                 {
+01929                                         convertAddPrimitive (child, prim, hidden);
+01930                                         break;
+01931                                 }
+01932                         }
+01933                 }
+01934         }
+01935 
+01936         // Not found ?
+01937         if (j==numChildren)
+01938         {
+01939                 // Create a node
+01940                 CPrimNode *primNode = static_cast<CPrimNode *> (CClassRegistry::create ("CPrimNode"));
+01941         
+01942                 // Create a property for the layer
+01943                 CPropertyString *nameProp = new CPropertyString;
+01944                 nameProp->String = prim->Layer;
+01945 
+01946                 // Add the property
+01947                 primNode->addPropertyByName ("name", nameProp);
+01948 
+01949                 // Add the child
+01950                 RootNode->insertChild (primNode);
+01951 
+01952                 // Add the primitive
+01953                 convertAddPrimitive (primNode, prim, hidden);
+01954         }
+01955 }
+
+

+ + + + +
+ + + + + + + + + + +
CPrimitives & NLLIGO::CPrimitives::operator= const CPrimitives other  ) 
+
+ + + + + +
+   + + +

+ +

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

+References RootNode. +

+

01752 {
+01753         RootNode = static_cast<CPrimNode *> (((IPrimitive*)other.RootNode)->copy ());
+01754         return *this;
+01755 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLLIGO::CPrimitives::read xmlNodePtr  xmlNode,
const char *  filename,
CLigoConfig config
+
+ + + + + +
+   + + +

+ +

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

+References NLLIGO::Error(), NLLIGO::GetFirstChildNode(), NLLIGO::GetPropertyString(), nlassert, NLLIGO_PRIMITVE_VERSION, NLLIGO::IPrimitive::removeChildren(), NLLIGO::IPrimitive::removeProperties(), uint, and NLLIGO::XMLError(). +

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

+

01760 {
+01761         nlassert (xmlNode);
+01762 
+01763         // Clear the primitives
+01764         RootNode->removeChildren ();
+01765         RootNode->removeProperties ();
+01766 
+01767         // Get the name
+01768         if (strcmp ((const char*)xmlNode->name, "PRIMITIVES") == 0)
+01769         {
+01770                 // Get the version
+01771                 string versionName = "0";
+01772                 if (GetPropertyString (versionName, filename, xmlNode, "VERSION"))
+01773                 {
+01774                         // Get the version
+01775                         uint version = atoi (versionName.c_str ());
+01776 
+01777                         // Check the version
+01778                         if (version <= NLLIGO_PRIMITVE_VERSION)
+01779                         {
+01780                                 // Read the primitives
+01781                                 xmlNode = GetFirstChildNode (xmlNode, filename, "ROOT_PRIMITIVE");
+01782                                 if (xmlNode)
+01783                                 {
+01784                                         // Read the primitive tree
+01785                                         ((IPrimitive*)RootNode)->read (xmlNode, filename, version, config);
+01786                                 }
+01787                         }
+01788                         else
+01789                         {
+01790                                 Error (filename, "CPrimitives::read : Unknown file version (%d)", version);
+01791                                 return false;
+01792                         }
+01793                 }
+01794                 else
+01795                 {
+01796                         return false;
+01797                 }
+01798         }
+01799         else
+01800         {
+01801                 XMLError (xmlNode, filename, "This XML document is not a NeL primitive file");
+01802                 return false;
+01803         }
+01804 
+01805         return true;
+01806 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLLIGO::CPrimitives::write xmlNodePtr  root,
const char *  filename
const
+
+ + + + + +
+   + + +

+ +

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

+References nlassert, NLLIGO_PRIMITVE_VERSION, and NLMISC::toString(). +

+

01824 {
+01825         nlassert (root);
+01826 
+01827         // Version node
+01828         xmlSetProp (root, (const xmlChar*)"VERSION", (const xmlChar*)toString (NLLIGO_PRIMITVE_VERSION).c_str ());
+01829 
+01830         // The primitive root node
+01831         xmlNodePtr nameNode = xmlNewChild ( root, NULL, (const xmlChar*)"ROOT_PRIMITIVE", NULL);
+01832 
+01833         // Write the primitive tree
+01834         ((IPrimitive*)RootNode)->write (nameNode, filename);
+01835 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLLIGO::CPrimitives::write xmlDocPtr  xmlNode,
const char *  filename
const
+
+ + + + + +
+   + + +

+ +

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

+References nlassert. +

+

01811 {
+01812         nlassert (doc);
+01813 
+01814         // Primitive node
+01815         xmlNodePtr primNode = xmlNewDocNode (doc, NULL, (const xmlChar*)"PRIMITIVES", NULL);
+01816         xmlDocSetRootElement (doc, primNode);
+01817 
+01818         write (primNode, filename);
+01819 }
+
+


Field Documentation

+

+ + + + +
+ + +
CPrimNode* NLLIGO::CPrimitives::RootNode +
+
+ + + + + +
+   + + +

+ +

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

+Referenced by CPrimitives(), NLSOUND::CBackgroundSoundManager::load(), and operator=().

+


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