(file) Return to CIMObjectPath.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/CIMObjectPath.cpp between version 1.6 and 1.7

version 1.6, 2002/06/01 00:56:26 version 1.7, 2002/07/30 16:14:53
Line 138 
Line 138 
     }     }
  
     KeyBindingRep(     KeyBindingRep(
         const String& name,          const CIMName& name,
         const String& value,         const String& value,
         KeyBinding::Type type)         KeyBinding::Type type)
         : _name(name), _value(value), _type(type)         : _name(name), _value(value), _type(type)
Line 160 
Line 160 
         return *this;         return *this;
     }     }
  
     String _name;      CIMName _name;
     String _value;     String _value;
     KeyBinding::Type _type;     KeyBinding::Type _type;
 }; };
Line 176 
Line 176 
     _rep = new KeyBindingRep(*x._rep);     _rep = new KeyBindingRep(*x._rep);
 } }
  
 KeyBinding::KeyBinding(const String& name, const String& value, Type type)  KeyBinding::KeyBinding(const CIMName& name, const String& value, Type type)
 { {
     _rep = new KeyBindingRep(name, value, type);     _rep = new KeyBindingRep(name, value, type);
 } }
Line 192 
Line 192 
     return *this;     return *this;
 } }
  
 const String& KeyBinding::getName() const  const CIMName& KeyBinding::getName() const
 { {
     return _rep->_name;     return _rep->_name;
 } }
  
 void KeyBinding::setName(const String& name)  void KeyBinding::setName(const CIMName& name)
 { {
     _rep->_name = name;     _rep->_name = name;
 } }
Line 246 
Line 246 
 Boolean operator==(const KeyBinding& x, const KeyBinding& y) Boolean operator==(const KeyBinding& x, const KeyBinding& y)
 { {
     return     return
         CIMName::equal(x.getName(), y.getName()) &&          x.getName().equal(y.getName()) &&
         String::equal(x.getValue(), y.getValue()) &&         String::equal(x.getValue(), y.getValue()) &&
         x.getType() == y.getType();         x.getType() == y.getType();
 } }
Line 273 
Line 273 
  
     CIMObjectPathRep(     CIMObjectPathRep(
         const String& host,         const String& host,
         const String& nameSpace,          const CIMNamespaceName& nameSpace,
         const String& className,          const CIMName& className,
         const Array<KeyBinding>& keyBindings)         const Array<KeyBinding>& keyBindings)
         : _host(host), _nameSpace(nameSpace),         : _host(host), _nameSpace(nameSpace),
         _className(className), _keyBindings(keyBindings)         _className(className), _keyBindings(keyBindings)
Line 302 
Line 302 
     //     //
     String _host;     String _host;
  
     String _nameSpace;      CIMNamespaceName _nameSpace;
     String _className;      CIMName _className;
     Array<KeyBinding> _keyBindings;     Array<KeyBinding> _keyBindings;
 }; };
  
Line 338 
Line 338 
  
 CIMObjectPath::CIMObjectPath( CIMObjectPath::CIMObjectPath(
     const String& host,     const String& host,
     const String& nameSpace,      const CIMNamespaceName& nameSpace,
     const String& className,      const CIMName& className,
     const Array<KeyBinding>& keyBindings)     const Array<KeyBinding>& keyBindings)
 { {
     // Test the objectName out to see if we get an exception     // Test the objectName out to see if we get an exception
Line 370 
Line 370 
  
 void CIMObjectPath::set( void CIMObjectPath::set(
     const String& host,     const String& host,
     const String& nameSpace,      const CIMNamespaceName& nameSpace,
     const String& className,      const CIMName& className,
     const Array<KeyBinding>& keyBindings)  throw(IllformedObjectName, IllegalName)     const Array<KeyBinding>& keyBindings)  throw(IllformedObjectName, IllegalName)
 { {
    setHost(host);    setHost(host);
Line 454 
Line 454 
 Boolean CIMObjectPath::_parseNamespaceElement( Boolean CIMObjectPath::_parseNamespaceElement(
     const String& objectName,     const String& objectName,
     char*& p,     char*& p,
     String& nameSpace)      CIMNamespaceName& nameSpace)
 { {
     // If we don't find a valid namespace name followed by a ':', we     // If we don't find a valid namespace name followed by a ':', we
     // assume we're not looking at a namespace name.     // assume we're not looking at a namespace name.
  
       char* colon = strchr(p, ':');
       if (!colon)
       {
           return false;
       }
   
     //----------------------------------------------------------------------     //----------------------------------------------------------------------
     // Validate the namespace path.  Namespaces must match the following     // Validate the namespace path.  Namespaces must match the following
     // regular expression: "[A-Za-z_]+(/[A-Za-z_]+)*"     // regular expression: "[A-Za-z_]+(/[A-Za-z_]+)*"
     //----------------------------------------------------------------------     //----------------------------------------------------------------------
  
     char* q = p;      String namespaceName = String(p, colon - p);
       if (!CIMNamespaceName::legal(namespaceName))
     for (;;)  
     {     {
         // Pass the next token:          throw IllformedObjectName(objectName);
   
         if (!*q || (!isalpha(*q) && *q != '_'))  
             return false;  
   
         q++;  
   
         while (isalnum(*q) || *q == '_')  
             q++;  
   
         if (!*q)  
             return false;  
   
         if (*q == ':')  
             break;  
   
         if (*q == '/')  
         {  
             q++;  
             continue;  
         }  
   
         return false;  
     }     }
       nameSpace = namespaceName;
  
     nameSpace.assign(p, q - p);      p = colon+1;
     p = ++q;  
     return true;     return true;
 } }
  
Line 573 
Line 556 
         }         }
  
         *equalsign = 0;         *equalsign = 0;
         String keyString(p);          CIMName keyString(p);
  
         if (!CIMName::legal(keyString))         if (!CIMName::legal(keyString))
             throw IllformedObjectName(objectName);             throw IllformedObjectName(objectName);
Line 736 
Line 719 
         // ATTN: remove this later: a reference should only be able to hold         // ATTN: remove this later: a reference should only be able to hold
         // an instance name.         // an instance name.
  
         _rep->_className.assign(p);          _rep->_className = p;
         return;         return;
     }     }
  
     _rep->_className.assign(p, dot - p);      String className = String(p, dot - p);
       if (!CIMName::legal(className))
       {
           throw IllformedObjectName(objectName);
       }
       _rep->_className = className;
  
     // Advance past dot:     // Advance past dot:
  
Line 771 
Line 759 
     _rep->_host = host;     _rep->_host = host;
 } }
  
 const String& CIMObjectPath::getNameSpace() const  const CIMNamespaceName& CIMObjectPath::getNameSpace() const
 { {
     return _rep->_nameSpace;     return _rep->_nameSpace;
 } }
  
 void CIMObjectPath::setNameSpace(const String& nameSpace) throw(IllegalName)  void CIMObjectPath::setNameSpace(const CIMNamespaceName& nameSpace)
 {  
     String temp;  
   
     // check each namespace segment (delimted by '/') for correctness  
   
     for(Uint32 i = 0; i < nameSpace.size(); i += temp.size() + 1)  
     {  
         // isolate the segment beginning at i and ending at the first  
         // ocurrance of '/' after i or eos  
   
         temp = nameSpace.subString(i, nameSpace.subString(i).find('/'));  
   
         // check segment for correctness  
   
         if(!CIMName::legal(temp))  
         {         {
             throw IllegalName() ;  
         }  
     }  
   
    _rep->_nameSpace = nameSpace;    _rep->_nameSpace = nameSpace;
 } }
  
 const String& CIMObjectPath::getClassName() const  const CIMName& CIMObjectPath::getClassName() const
 { {
     return _rep->_className;     return _rep->_className;
 } }
  
 void CIMObjectPath::setClassName(const String& className) throw(IllegalName)  void CIMObjectPath::setClassName(const CIMName& className)
 { {
     if (!CIMName::legal(className))  
         throw IllegalName();  
   
     _rep->_className = className;     _rep->_className = className;
 } }
  
Line 839 
Line 805 
  
     // Get the namespace (if we have a host name, we must write namespace):     // Get the namespace (if we have a host name, we must write namespace):
  
     if (_rep->_nameSpace.size() || _rep->_host.size())      if (!_rep->_nameSpace.isNull() || _rep->_host.size())
     {     {
         objectName += _rep->_nameSpace;         objectName += _rep->_nameSpace;
         objectName += ":";         objectName += ":";
Line 892 
Line 858 
  
     // ATTN-RK-P2-20020510: Need to make hostname and namespace lower case?     // ATTN-RK-P2-20020510: Need to make hostname and namespace lower case?
  
     ref._rep->_className.toLower();      String classNameLower = ref._rep->_className;
       classNameLower.toLower();
       ref._rep->_className = classNameLower;
  
     for (Uint32 i = 0, n = ref._rep->_keyBindings.size(); i < n; i++)     for (Uint32 i = 0, n = ref._rep->_keyBindings.size(); i < n; i++)
     {     {
         ref._rep->_keyBindings[i]._rep->_name.toLower();          String keyBindingNameLower = ref._rep->_keyBindings[i]._rep->_name;
           keyBindingNameLower.toLower();
           ref._rep->_keyBindings[i]._rep->_name = keyBindingNameLower;
     }     }
  
     return ref.toString(includeHost);     return ref.toString(includeHost);
Line 911 
Line 881 
 { {
     return     return
         String::equal(_rep->_host, x._rep->_host) &&         String::equal(_rep->_host, x._rep->_host) &&
         CIMName::equal(_rep->_nameSpace, x._rep->_nameSpace) &&          _rep->_nameSpace.equal(x._rep->_nameSpace) &&
         CIMName::equal(_rep->_className, x._rep->_className) &&          _rep->_className.equal(x._rep->_className) &&
         _rep->_keyBindings == x._rep->_keyBindings;         _rep->_keyBindings == x._rep->_keyBindings;
 } }
  


Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2