#include <NamedId.h>
Public Methods | |
| NamedId (const int len=0) | |
| When length is known, best to allocate all at once at start. More... | |
| NamedId (const NamedId &toCopy) | |
| Copy constructor (should also have assignment operator). More... | |
| NamedId (const NamedId &toCopy, unsigned int n) | |
| Just copy first n fields to a new NamedId. More... | |
| ~NamedId () | |
| void | addField (std::string name, unsigned value) |
| Build a NamedId incrementally. More... | |
| void | addField (const IdField &newField) |
| unsigned int | size () const |
| void | popField (unsigned int n=1) |
| Delete field on the end. More... | |
| bool | hasSubpath (const NameSeq &subpath) const |
| Return true if initial field names are compatible with subpath. More... | |
| int | hasField (std::string name) const |
| Return index of first occurrence of specified field, or -1 if no occurrences. More... | |
| Identifier * | stripNames () |
Protected Types | |
| typedef std::vector< IdField * > | Fields |
| typedef Fields::iterator | FieldIt |
Protected Attributes | |
| Fields * | m_fields |
Friends | |
| class | DictNode |
| class | IdOperation |
| class | IdOpCompress |
| std::ostream & | operator<< (std::ostream &s, const NamedId &nId) |
| Output to an ostream. More... | |
|
|
|
|
|
Definition at line 85 of file NamedId.h. Referenced by NamedId(). |
|
|
When length is known, best to allocate all at once at start.
Definition at line 10 of file NamedId.cxx. References Fields, and m_fields.
|
|
|
Copy constructor (should also have assignment operator).
Definition at line 22 of file NamedId.cxx. References Fields, and m_fields.
|
|
||||||||||||
|
Just copy first n fields to a new NamedId.
Definition at line 27 of file NamedId.cxx. References Fields, and m_fields.
|
|
|
Definition at line 18 of file NamedId.cxx. References m_fields.
00018 {
00019 delete m_fields;
00020 }
|
|
|
Definition at line 45 of file NamedId.cxx. References m_fields.
00045 {
00046 IdField* field = new IdField(newField);
00047 m_fields->push_back(field);
00048 }
|
|
||||||||||||
|
Build a NamedId incrementally.
Definition at line 38 of file NamedId.cxx. References m_fields. Referenced by testConverter().
00038 {
00039 IdField* field = new IdField;
00040 field->name = name;
00041 field->value = value;
00042 m_fields->push_back(field);
00043 }
|
|
|
Return index of first occurrence of specified field, or -1 if no occurrences.
Definition at line 71 of file NamedId.cxx. References m_fields.
|
|
|
Return true if initial field names are compatible with subpath.
Definition at line 57 of file NamedId.cxx. References m_fields, and xmlUtil::NameSeq.
00057 {
00058 unsigned int pathLen = subpath.size();
00059 if (pathLen > m_fields->size()) return false;
00060
00061 // Else check one by one
00062 // FieldIt idIt = m_fields->begin();
00063 // NameSeq::iterator pathIt = path.begin();
00064
00065 for (unsigned int ix = 0; ix < pathLen; ix++) {
00066 if (subpath[ix]->compare(((*m_fields)[ix])->name) ) return false;
00067 }
00068 return true;
00069 }
|
|
|
Delete field on the end.
Definition at line 50 of file NamedId.cxx. References m_fields. Referenced by testConverter().
00050 {
00051 while (n > 0) {
00052 m_fields->pop_back();
00053 --n;
00054 }
00055 }
|
|
|
Definition at line 50 of file NamedId.h. References m_fields, and xmlUtil::NameSeq.
00050 {return m_fields->size();}
|
|
|
Definition at line 78 of file NamedId.cxx. References m_fields. Referenced by testConverter().
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
Output to an ostream.
Definition at line 88 of file NamedId.cxx.
00088 {
00089 if (nId.size() == 0) {
00090 s << "()" << std::endl;
00091 return s;
00092 }
00093 NamedId::Fields::const_iterator it = nId.m_fields->begin();
00094 s << "(" << (*it)->name << "=" << (*it)->value;
00095 ++it;
00096 while (it != nId.m_fields->end()) {
00097 s << ", " << std::endl << (*it)->name << "=" << (*it)->value;
00098 ++it;
00099 }
00100 s << ")" << std::endl;
00101 return s;
00102 }
|
|
|
Definition at line 88 of file NamedId.h. Referenced by addField(), hasField(), hasSubpath(), NamedId(), popField(), size(), stripNames(), and ~NamedId(). |
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001