00001
00002
00003 #ifndef XMLUTIL_DICTFIELDMAN_H
00004 #define XMLUTIL_DICTFIELDMAN_H
00005
00006 #include <string>
00007 #ifdef __GNUG__
00008 #include <hash_map>
00009 #else
00010 #include <map>
00011 #endif
00012
00013 #include "xmlUtil/id/DictObject.h"
00014
00015 namespace xmlUtil {
00018 class DictField;
00019 class DictVisitor;
00020
00021
00022 #ifdef __GNUG__
00023 struct eqstr {
00024 bool operator()(const char* s1, const char* s2) const
00025 {
00026 return strcmp(s1, s2) == 0;
00027 }
00028 };
00029 typedef std::hash_map<const char *, DictField*, std::hash<const char *>, eqstr>
00030 Registry;
00031 #else
00032 struct ltstr {
00033 bool operator()(const char* s1, const char* s2) const
00034 {
00035 return strcmp(s1, s2) < 0;
00036 }
00037 };
00038 typedef std::map<const char *, DictField*, ltstr> Registry;
00039 #endif
00040
00041 class DictFieldMan : public DictObject {
00042 public:
00043
00044 DictFieldMan(int size = 0);
00045 ~DictFieldMan();
00046
00047
00048 bool accept(DictVisitor* vis);
00049 void signup(DictField *field);
00050 const DictField * const find(const std::string& name) const;
00051
00052 private:
00053
00054
00055
00056 Registry *m_reg;
00057
00058 };
00059 }
00060 #endif