Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

IdDictMan.cxx

Go to the documentation of this file.
00001 // $Header $
00002 
00003 #include "xmlUtil/id/IdDictMan.h"
00004 #include "xmlUtil/id/IdDict.h"
00005 #include <algorithm>
00006 
00007 namespace xmlUtil {
00008   IdDictMan * IdDictMan::me = 0;
00009 
00010   IdDictMan *IdDictMan::getPointer() {
00011     if (me == 0) {
00012       me = new IdDictMan();
00013     }
00014     return me;
00015   }
00016 
00017   IdDict *IdDictMan::findDict(std::string name) {
00018     unsigned int ix;
00019 
00020     for (ix = 0; ix < dictDir.size(); ix++) {
00021       IdDict *dict = (dictDir)[ix];
00022       if (name.compare(dict->getDictName()) == 0) return dict;
00023     }
00024     return 0;
00025   }
00026   
00027   IdDictMan::RetCode IdDictMan::registerDict(IdDict *dict) {
00028     // If already have a dictionary of this name, don't register
00029     if (findDict(dict->getDictName()) != 0) return DUPLICATE;
00030 
00031     dictDir.push_back(dict);
00032     return SUCCESS;
00033   }
00034 
00035   // Included for completeness.  
00036   IdDictMan::RetCode IdDictMan::removeDict(std::string name) {
00037 
00038     IdDict *dict = findDict(name);
00039     if (dict == 0) return NOTFOUND;
00040 
00041     std::remove(dictDir.begin(), dictDir.end(), dict);
00042     return SUCCESS;
00043   }
00044 
00045 
00046 }

Generated on Wed Oct 16 14:02:47 2002 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001