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

DictField.cxx

Go to the documentation of this file.
00001 // $Header
00002 
00003 #include "xmlUtil/id/DictField.h"
00004 #include "xml/Dom.h"
00005 
00006 namespace xmlUtil {
00007   DictField::DictField(DOM_Element elt) {
00008     DOM_Element child = xml::Dom::getFirstChildElement(elt);
00009 
00010     if (child != DOM_Element())
00011       m_constraints = new DictConstraints(child);
00012     else m_constraints = 0;
00013 
00014     m_name = std::string(xml::Dom::transToChar(elt.getAttribute("name")));
00015   }
00016 
00017   bool DictField::allowed(unsigned value) const {
00018     if (m_constraints) return m_constraints->allowed(value);
00019     else return true;
00020   }
00021 
00022   DictField::DictField(const DictField& toCopy) : DictObject(toCopy) {
00023     deepCopy(toCopy);
00024   }
00025 
00026   DictField& DictField::operator=(const DictField& d) {
00027     if (this != &d) {
00028       if (m_constraints) delete m_constraints;
00029       deepCopy(d);
00030     }
00031     return *this;
00032   }
00033 
00034   void DictField::deepCopy(const DictField& toCopy) {
00035     m_name = toCopy.m_name;
00036     if (toCopy.m_constraints) {
00037       m_constraints = new DictConstraints(*(toCopy.m_constraints));
00038     }
00039     else m_constraints = 0;
00040   }
00041 
00042 }

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