00001
00002 #ifndef XMLUTIL_NAMEDID_H
00003 #define XMLUTIL_NAMEDID_H
00004
00005 #include <vector>
00006 #include <string>
00007 #include <iostream>
00008 #include "xmlUtil/id/Identifier.h"
00009
00010 namespace xmlUtil {
00011
00013
00014
00017 typedef std::vector<std::string * > NameSeq;
00018
00019 class NamedId;
00020
00021 std::ostream& operator<<(std::ostream& s, const NameSeq& seq);
00022 std::ostream& operator<<(std::ostream& s, const Identifier& seq);
00023 std::ostream& operator<<(std::ostream& s, const NamedId& nId);
00024
00025 class NamedId {
00026 public:
00027 friend std::ostream& operator<<(std::ostream& s, const NamedId& nId);
00028
00030 NamedId(const int len = 0);
00031
00033 NamedId(const NamedId& toCopy);
00034
00036 NamedId(const NamedId& toCopy, unsigned int n);
00037
00038 ~NamedId();
00039
00040 struct IdField {
00041 std::string name;
00042 unsigned value;
00043 };
00044
00046 void addField(std::string name, unsigned value);
00047
00048 void addField(const IdField& newField);
00049
00050 unsigned int size() const {return m_fields->size();}
00052
00053 void popField(unsigned int n = 1);
00054
00056 bool hasSubpath(const NameSeq& subpath) const;
00057
00060 int hasField(std::string name) const;
00061
00062 Identifier *stripNames();
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 friend class DictNode;
00081 friend class IdOperation;
00082 friend class IdOpCompress;
00083
00084 protected:
00085 typedef std::vector <IdField* > Fields;
00086 typedef Fields::iterator FieldIt;
00087
00088 Fields *m_fields;
00089 };
00090
00091 }
00092 #endif
00093