#include <IdDict.h>
Inheritance diagram for xmlUtil::IdDict::

Public Types | |
| enum | Constituents { nodeHierarchy = 1, fieldManager = 2 } |
Public Methods | |
| IdDict (DOM_Element elt) | |
| ~IdDict () | |
| bool | isValid () |
| Verify that dictionary is valid. More... | |
| bool | idOk (const Identifier &id) const |
| Verify that supplied identifier is valid w.r.t. the idDict. More... | |
| bool | idOk (const NamedId &id) const |
| Verify that supplied named identifier is valid w.r.t. the idDict. More... | |
| bool | nameSeqOk (const NameSeq &seq) const |
| Verify that the sequence of field names corresponds to at least one valid identifier. More... | |
| NamedId * | getNamedId (const Identifier &id) const |
| Given an identifier, return a full NamedIdentifier (conceptually a sequence of (name, value) pairs). More... | |
| const std::string & | getDictName () const |
| int | getMajorVersion () const |
| int | getMinorVersion () const |
| int | getPatchVersion () const |
| DictNode & | getRoot () const |
| bool | accept (DictVisitor *vis) |
| bool | accept (DictVisitor *vis, unsigned constituentMask) |
Protected Methods | |
| IdDict (DictNode *root) | |
| Following constructor may be used by friend IdConverter to build output dictionary. More... | |
| bool | addChild (DictNode *parent, DictNode *newNode) |
| Link up newNode to parent; also ask m_fieldMan to add the field if it's new. More... | |
Protected Attributes | |
| DictFieldMan * | m_fieldMan |
| DictNode * | m_root |
| std::string | m_name |
| int | m_major |
| int | m_minor |
| int | m_patch |
Friends | |
| class | IdConverter |
| Extra accept function to allow caller to choose among constituents of dictionary to visit. May choose all, just node hierarchy, or just field manager. More... | |
|
|
Definition at line 43 of file IdDict.h.
00043 {nodeHierarchy = 1,
00044 fieldManager = 2};
|
|
|
Definition at line 13 of file IdDict.cxx. References m_fieldMan, m_major, m_minor, m_name, m_patch, and m_root.
00013 {
00014 // Check that element has the right tag name: idDict
00015 // Caller probably will have done this already
00016 assert(elt.getTagName().equals("idDict"));
00017
00018 // Store information from attributes
00019 m_name = std::string(xml::Dom::getAttribute(elt, "name"));
00020
00021 std::string intVal = xml::Dom::getAttribute(elt, "major");
00022 m_major = atoi(intVal.c_str());
00023
00024 intVal = xml::Dom::getAttribute(elt, "minor");
00025 m_minor = atoi(intVal.c_str());
00026
00027 intVal = xml::Dom::getAttribute(elt, "patch");
00028 m_patch = atoi(intVal.c_str());
00029
00030 // Check number of children. This is an upper bound
00031 // on number of fields we have to store
00032 int size = (elt.getChildNodes()).getLength();
00033 m_fieldMan = new DictFieldMan(size);
00034
00035 DOM_Element fieldElt = xml::Dom::getFirstChildElement(elt);
00036
00037 // Register all the fields
00038 while ((fieldElt.getNodeName()).equals("field")) {
00039 // DOM_Element fieldElt = static_cast<DOM_Element&>(fieldNode);
00040 DictField* field = new DictField(fieldElt);
00041 m_fieldMan->signup(field);
00042 fieldElt = xml::Dom::getSiblingElement(fieldElt);
00043 }
00044 // Finally make the hierarchy of constraints on Identifiers
00045 m_root = new DictNode(fieldElt, 0, m_fieldMan);
00046 }
|
|
|
Definition at line 48 of file IdDict.cxx. References m_fieldMan, and m_root.
00048 {
00049 /* First get rid of hierarchy of nodes, then get rid of
00050 our DictFieldMan object. The latter will delete all the
00051 fields
00052 */
00053 delete m_root;
00054 delete m_fieldMan;
00055 }
|
|
|
Following constructor may be used by friend IdConverter to build output dictionary.
|
|
||||||||||||
|
Definition at line 62 of file IdDict.cxx. References fieldManager, m_fieldMan, m_root, and nodeHierarchy.
00062 {
00063 bool status = true;
00064
00065 if (!vis->visitDict(this)) return false;
00066
00067 if (mask & nodeHierarchy)
00068 status = m_root->accept(vis);
00069
00070 if (status && (mask & fieldManager)) {
00071 status &= m_fieldMan->accept(vis);
00072 }
00073 return status;
00074 }
|
|
|
Reimplemented from xmlUtil::DictObject. Definition at line 57 of file IdDict.cxx. Referenced by isValid().
00057 {
00058 return accept(vis, 0xffffffff);
00059 }
|
|
||||||||||||
|
Link up newNode to parent; also ask m_fieldMan to add the field if it's new.
Definition at line 103 of file IdDict.cxx.
00103 {
00104 /* Started to write something to add field if not already
00105 registered, but whoever has created newNode should
00106 already have done this */
00107 return parent->addChild(newNode);
00108 }
|
|
|
Definition at line 71 of file IdDict.h. References m_name. Referenced by main().
00071 {return m_name;};
|
|
|
Definition at line 72 of file IdDict.h. References m_major.
00072 {return m_major;};
|
|
|
Definition at line 73 of file IdDict.h. References m_minor.
00073 {return m_minor;};
|
|
|
Given an identifier, return a full NamedIdentifier (conceptually a sequence of (name, value) pairs).
Definition at line 97 of file IdDict.cxx. References m_root.
00097 {
00098 NamedId *named = new NamedId;
00099 m_root->allowIdentifier(id, named);
00100 return named;
00101 }
|
|
|
Definition at line 74 of file IdDict.h. References m_patch.
00074 {return m_patch;};
|
|
|
Definition at line 75 of file IdDict.h. References m_root.
00075 {return *m_root;};
|
|
|
Verify that supplied named identifier is valid w.r.t. the idDict.
Definition at line 88 of file IdDict.cxx. References m_root.
00088 {
00089 return m_root->allowNamedId(id);
00090 }
|
|
|
Verify that supplied identifier is valid w.r.t. the idDict.
Definition at line 84 of file IdDict.cxx. References m_root.
00084 {
00085 return m_root->allowIdentifier(id);
00086 }
|
|
|
Verify that dictionary is valid.
Definition at line 77 of file IdDict.cxx. References accept(). Referenced by main().
00077 {
00078 DictValidVisitor visitor;
00079
00080 accept(&visitor);
00081 return visitor.wasValid();
00082 }
|
|
|
Verify that the sequence of field names corresponds to at least one valid identifier.
Definition at line 92 of file IdDict.cxx. References m_root, and xmlUtil::NameSeq.
00092 {
00093 return m_root->allowNameSeq(seq);
00094 }
|
|
|
Extra accept function to allow caller to choose among constituents of dictionary to visit. May choose all, just node hierarchy, or just field manager.
|
|
|
|
|
|
Definition at line 104 of file IdDict.h. Referenced by getMajorVersion(), and IdDict(). |
|
|
Definition at line 105 of file IdDict.h. Referenced by getMinorVersion(), and IdDict(). |
|
|
Definition at line 103 of file IdDict.h. Referenced by getDictName(), and IdDict(). |
|
|
Definition at line 106 of file IdDict.h. Referenced by getPatchVersion(), and IdDict(). |
|
|
Definition at line 102 of file IdDict.h. Referenced by accept(), getNamedId(), getRoot(), IdDict(), idOk(), nameSeqOk(), and ~IdDict(). |
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001