![]() |
VR-Forces 4.10 Class Documentation
|
Loads entity type enumerations from an XML file into a DtEnumDictionary. More...
Public Types | |
| typedef DtEnumLoader *(* | EnumLoaderCreator )() |
| Type for the creator function for this class. See setCreator. More... | |
| typedef std::list < DtEntityTypeRange > | Applicability |
| Type for specifying the applicability of an enumeration. More... | |
| typedef boost::function< bool(const DtFilename &, DtEnumDictionary &)> | FileLoaderFcn |
| The function prototype for loading an enumerations file. More... | |
| typedef boost::function< void(xmlNodePtr, const Applicability &, DtEnumDictionary &)> | XmlEntityTypeEntryReaderFcn |
| The function prototype for loading an individual entity type from an xml node. More... | |
| typedef boost::function< void(xmlNodePtr, DtEnumDictionary &)> | XmlEntryReaderFcn |
| The function prototype for loading a individual enumeration from an xml node. More... | |
Public Member Functions | |
| virtual | ~DtEnumLoader () |
| Destructor. More... | |
| virtual bool | loadFromFiles (const std::vector< DtFilename > &filenames, DtEnumDictionary &dict) |
| Loads the given files into the dictionary. More... | |
Add Interest in Enumerations | |
These methods can be used to tell the loader to read in enumerations that it does not support by default use standard formats. | |
| virtual void | addInterestInEnum (DtEnumUid uid) |
| Adds interest in a general enumeration. More... | |
| virtual void | addInterestInEnumRange (DtEnumUid lowerUid, DtEnumUid upperUid) |
| Adds interest in a range of general enumerations. More... | |
| virtual void | addInterestInEntityTypeEnum (DtEnumUid uid, DtEntityTypeField) |
| Adds interest in an entity type enumeration. More... | |
Registration/unregistration of Enumeration Reader Functions | |
These methods allow you to define custom functions for reading new file types or customizing how specific xml entries should be processed. Generally they are not needed by most users. If you wish the DtEnumLoader to read enumerations using existing functions for uids not read in by default, use #addInterestInEnumeration, addInterestInEnumRange, or addInterestInEntityTypeEnum. | |
| virtual void | registerFileLoader (const DtString &fileExt, FileLoaderFcn fcn) |
| Registers a function to load a specific file type. More... | |
| virtual void | unregisterFileLoader (const DtString &fileExt) |
| Remove a registered file loader. More... | |
| virtual void | registerUidEntryReader (DtEnumUid uid, XmlEntryReaderFcn fcn) |
| Registers a reader function for an enumeration with a specific uid. More... | |
| virtual void | unregisterUidEntryReader (DtEnumUid uid) |
| Remove a registered enumeration reader function. More... | |
| virtual void | registerUidRangeEntryReader (DtEnumUid lowerUid, DtEnumUid upperUid, XmlEntryReaderFcn fcn) |
| Registers a reader function for enumerations with a uid within a range of uid values (exclusive of the upperId). More... | |
| virtual void | unregisterUidRangeEntryReader (DtEnumUid lowerUid, DtEnumUid upperUid) |
| Remove a registered enumeration reader function that was defined by a range of uids. More... | |
| virtual void | registerEntityTypeUidEntryReader (DtEnumUid uid, XmlEntityTypeEntryReaderFcn fcn) |
| Registers a reader function for an entity type enumeration with a specific uid. More... | |
| virtual void | unregisterEntityTypeUidEntryReader (DtEnumUid uid) |
| Remove a registered entity type enumeration reader function. More... | |
| virtual void | registerEntityTypeFieldEntryReader (DtEntityTypeField lvl, XmlEntityTypeEntryReaderFcn fcn) |
| Registers a general reader function for an entity type enumeration for a specific field level (e.g kind, domain, etc.). More... | |
| virtual void | unregisterEntityTypeFieldEntryReader (DtEntityTypeField lvl) |
| Remove a registered entity type enumeration reader function that was defined by for a field level. More... | |
Static Public Member Functions | |
| static DtEnumLoader * | create () |
| Creates a new DtEnumLoader using the registered creator function. More... | |
| static void | setCreator (EnumLoaderCreator creator) |
| Sets the creator function used by create(). More... | |
Protected Types | |
| typedef std::map< DtString, FileLoaderFcn > | FileLoaderMap |
| typedef std::map< int, XmlEntryReaderFcn > | XmlUidReaderMap |
| typedef std::pair< int, int > | XmlUidRange |
| typedef std::map< XmlUidRange, XmlEntryReaderFcn > | XmlUidRangeReaderMap |
| typedef std::map< int, XmlEntityTypeEntryReaderFcn > | XmlEntityTypeUidReaderMap |
| typedef std::map < DtEntityTypeField, XmlEntityTypeEntryReaderFcn > | XmlEntityTypeLevelReaderMap |
Protected Member Functions | |
| DtEnumLoader () | |
| Constructor is protected. More... | |
| virtual void | registerDefaultLoaders () |
| Registers default loader and reader functions for processing enums files. More... | |
| virtual bool | loadFromXml (const DtFilename &fn, DtEnumDictionary &dict) |
| Default function used to load an xml enumerations file, such as SISO-REF-010.xml or MAK-Enums.xml. More... | |
| virtual DtEnumUid | processSingleLevelEntry (xmlNodePtr node, DtEnumDictionary::EnumMap &enums, DtString &name) const |
| Processes the node, fills the enums map and name, and returns the uid of the enumeration. More... | |
| virtual void | processMultiLevelEntry (xmlNodePtr node, DtEntityTypeField field, const DtEntityTypeRange &applic, DtEnumDictionary &dict) const |
| Processes the node, including any child nodes that also require processing, and adds all new enumerations to the dictionary. More... | |
| virtual void | setEntityTypeLevel (unsigned lvl, int lowerVal, int upperVal, DtEntityTypeRange &etRange) const |
| Sets the range of values for the field at the specified level of the entity type. More... | |
| virtual DtEntityTypeField | parseApplicability (const xmlChar *c, std::list< DtEntityTypeRange > &applics) const |
| Parses the applicability from the the xml text. More... | |
| virtual int | xmlCharToInt (const xmlChar *c) const |
| Converts an xmlChar string to an integer. More... | |
Default xml reader functions. | |
| virtual void | readEntityTypeEnum (xmlNodePtr node, DtEntityTypeField field, const Applicability &applics, DtEnumDictionary &dict) const |
| virtual void | readEntityTypesHierarchy (xmlNodePtr node, DtEnumDictionary &dict) const |
| virtual void | readEnum (xmlNodePtr node, DtEnumDictionary &dict) const |
Static Protected Attributes | |
| static EnumLoaderCreator | theCreator |
Loads entity type enumerations from an XML file into a DtEnumDictionary.
| typedef DtEnumLoader*(* DtEnumLoader::EnumLoaderCreator)() |
Type for the creator function for this class. See setCreator.
| typedef std::list<DtEntityTypeRange> DtEnumLoader::Applicability |
Type for specifying the applicability of an enumeration.
This indicates what higher level entity type fields a given enumeration can be used with. DtEntityTypeRange supports a range of values within a given level, but you may need multiple different ranges, hence the list.
| typedef boost::function<bool(const DtFilename&, DtEnumDictionary&)> DtEnumLoader::FileLoaderFcn |
The function prototype for loading an enumerations file.
| typedef boost::function<void(xmlNodePtr, const Applicability&, DtEnumDictionary&)> DtEnumLoader::XmlEntityTypeEntryReaderFcn |
The function prototype for loading an individual entity type from an xml node.
| typedef boost::function<void(xmlNodePtr, DtEnumDictionary&)> DtEnumLoader::XmlEntryReaderFcn |
The function prototype for loading a individual enumeration from an xml node.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
virtual |
Destructor.
|
protected |
Constructor is protected.
Should call create() to create your loader. Ensures the registered creator function is called.
|
static |
Creates a new DtEnumLoader using the registered creator function.
|
static |
Sets the creator function used by create().
Use this to override what DtEnumLoader is created by the application. This is how a user would register their own subclass that might add functions for reading new all new file types or for specific enumerations.
|
virtual |
Loads the given files into the dictionary.
Order matters, as files listed first will take precedence if there is a conflict. Returns true if successful.
|
virtual |
Adds interest in a general enumeration.
|
virtual |
Adds interest in a range of general enumerations.
|
virtual |
Adds interest in an entity type enumeration.
|
virtual |
Registers a function to load a specific file type.
|
virtual |
Remove a registered file loader.
|
virtual |
Registers a reader function for an enumeration with a specific uid.
|
virtual |
Remove a registered enumeration reader function.
|
virtual |
Registers a reader function for enumerations with a uid within a range of uid values (exclusive of the upperId).
This will be used only if there is no specific uid reader specified via registerUidEntryReader.
|
virtual |
Remove a registered enumeration reader function that was defined by a range of uids.
|
virtual |
Registers a reader function for an entity type enumeration with a specific uid.
|
virtual |
Remove a registered entity type enumeration reader function.
|
virtual |
Registers a general reader function for an entity type enumeration for a specific field level (e.g kind, domain, etc.).
This will be used only if there is no specific uid reader specified via registerEntityTypeUidEntryReader.
|
virtual |
Remove a registered entity type enumeration reader function that was defined by for a field level.
|
protectedvirtual |
Registers default loader and reader functions for processing enums files.
If not previously called, will be called by loadFromFiles() before starting load. Can be overridden in a subclass to provide different or additional default loaders.
|
protectedvirtual |
Default function used to load an xml enumerations file, such as SISO-REF-010.xml or MAK-Enums.xml.
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
|
protectedvirtual |
Processes the node, fills the enums map and name, and returns the uid of the enumeration.
|
protectedvirtual |
Processes the node, including any child nodes that also require processing, and adds all new enumerations to the dictionary.
|
protectedvirtual |
Sets the range of values for the field at the specified level of the entity type.
|
protectedvirtual |
Parses the applicability from the the xml text.
Converts an xmlChar string to an integer.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |