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

Diff for /pegasus/src/Pegasus/Common/CIMQualifierList.cpp between version 1.64 and 1.73.2.1

version 1.64, 2008/02/29 18:55:06 version 1.73.2.1, 2013/06/03 22:35:12
Line 1 
Line 1 
 //%2006////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;  // Source License; you may not use this file except in compliance with the
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.  // License.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;  //
 // EMC Corporation; VERITAS Software Corporation; The Open Group.  // Permission is hereby granted, free of charge, to any person obtaining a
 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;  // copy of this software and associated documentation files (the "Software"),
 // EMC Corporation; Symantec Corporation; The Open Group.  // to deal in the Software without restriction, including without limitation
 //  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // and/or sell copies of the Software, and to permit persons to whom the
 // of this software and associated documentation files (the "Software"), to  // Software is furnished to do so, subject to the following conditions:
 // deal in the Software without restriction, including without limitation the  //
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // The above copyright notice and this permission notice shall be included
 // sell copies of the Software, and to permit persons to whom the Software is  // in all copies or substantial portions of the Software.
 // furnished to do so, subject to the following conditions:  //
 //  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  //////////////////////////////////////////////////////////////////////////
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 37 
Line 35 
 #include "CIMQualifierDecl.h" #include "CIMQualifierDecl.h"
 #include "CIMName.h" #include "CIMName.h"
 #include "XmlWriter.h" #include "XmlWriter.h"
 #include "MofWriter.h"  
 #include <Pegasus/Common/Tracer.h> #include <Pegasus/Common/Tracer.h>
 #include <Pegasus/Common/MessageLoader.h> #include <Pegasus/Common/MessageLoader.h>
 #include "StrLit.h" #include "StrLit.h"
Line 127 
Line 124 
     CIMScope scope, // Scope of the entity being resolved.     CIMScope scope, // Scope of the entity being resolved.
     Boolean isInstancePart,     Boolean isInstancePart,
     CIMQualifierList& inheritedQualifiers,     CIMQualifierList& inheritedQualifiers,
     Boolean propagateQualifiers)  // Apparently not used ks 24 mar 2002      Boolean propagateQualifiers)
 { {
     _keyIndex = PEGASUS_ORDEREDSET_INDEX_UNKNOWN;     _keyIndex = PEGASUS_ORDEREDSET_INDEX_UNKNOWN;
  
Line 175 
Line 172 
             throw BadQualifierType(q.getName().getString ());             throw BadQualifierType(q.getName().getString ());
         }         }
  
 #ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
         //----------------------------------------------------------------------         //----------------------------------------------------------------------
         // 3. If the qualifier is the EmbeddedInstance qualifier, then check         // 3. If the qualifier is the EmbeddedInstance qualifier, then check
         // that the class specified by the qualifier exists in the namespace.         // that the class specified by the qualifier exists in the namespace.
         //----------------------------------------------------------------------         //----------------------------------------------------------------------
         if (q.getName().equal(CIMName("EmbeddedInstance")))          if (q.getName().equal(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE))
         {         {
             String className;             String className;
             q.getValue().get(className);             q.getValue().get(className);
Line 188 
Line 184 
                     CIMName(className));                     CIMName(className));
             if (classDef.isUninitialized())             if (classDef.isUninitialized())
             {             {
                 String embeddedInstType("EmbeddedInstance(\"");  
                 embeddedInstType = embeddedInstType + className + "\")";  
                 PEG_METHOD_EXIT();                 PEG_METHOD_EXIT();
                 throw BadQualifierType(embeddedInstType);                  throw BadQualifierType(
                        PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE.getString(),
                        className);
             }             }
         }         }
 #endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT  
  
         //----------------------------------------------------------------------         //----------------------------------------------------------------------
         // 4. Check the scope: Must be legal for this qualifier         // 4. Check the scope: Must be legal for this qualifier
Line 263 
Line 258 
             }             }
  
             Resolver::resolveQualifierFlavor(             Resolver::resolveQualifierFlavor(
                 q, CIMFlavor (qd.getFlavor ()), false);                  q, CIMFlavor (qd.getFlavor ()));
         }         }
         else  // qualifier exists in superclass         else  // qualifier exists in superclass
         {   ////// Make Const again         {   ////// Make Const again
Line 290 
Line 285 
             }             }
  
             Resolver::resolveQualifierFlavor(             Resolver::resolveQualifierFlavor(
                 q, CIMFlavor(iq.getFlavor()), true);                  q, CIMFlavor(iq.getFlavor()));
         }         }
     }   // end of this objects qualifier loop     }   // end of this objects qualifier loop
  
Line 299 
Line 294 
     // already have those qualifiers:     // already have those qualifiers:
     //--------------------------------------------------------------------------     //--------------------------------------------------------------------------
  
       if (propagateQualifiers)
       {
     for (Uint32 i = 0, n = inheritedQualifiers.getCount(); i < n; i++)     for (Uint32 i = 0, n = inheritedQualifiers.getCount(); i < n; i++)
     {     {
         CIMQualifier iq = inheritedQualifiers.getQualifier(i);         CIMQualifier iq = inheritedQualifiers.getQualifier(i);
  
         if (isInstancePart)         if (isInstancePart)
         {         {
             if (!(iq.getFlavor ().hasFlavor                  if (!(iq.getFlavor().hasFlavor(CIMFlavor::TOINSTANCE)))
                   (CIMFlavor::TOINSTANCE)))  
                 continue;                 continue;
         }         }
         else         else
         {         {
             if (!(iq.getFlavor ().hasFlavor                  if (!(iq.getFlavor().hasFlavor(CIMFlavor::TOSUBCLASS)))
                   (CIMFlavor::TOSUBCLASS)))  
                 continue;                 continue;
         }         }
  
         // If the qualifiers list does not already contain this qualifier,         // If the qualifiers list does not already contain this qualifier,
         // then propagate it (and set the propagated flag to true).  Else we              // then propagate it (and set the propagated flag to true).  Else
         // keep current value. Note we have already eliminated any possibity              // we keep current value. Note we have already eliminated any
         // that a nonoverridable qualifier can be in the list.              // possibility that a nonoverridable qualifier can be in the list.
         // Note that there is no exists() function ATTN:KS 25 Mar 2002  
         if (find(iq.getName()) != PEG_NOT_FOUND)         if (find(iq.getName()) != PEG_NOT_FOUND)
             continue;             continue;
  
Line 328 
Line 322 
         q.setPropagated(true);         q.setPropagated(true);
         _qualifiers.insert(0, q);         _qualifiers.insert(0, q);
     }     }
     PEG_METHOD_EXIT();  
 }  
   
 void CIMQualifierList::toXml(Buffer& out) const  
 {  
     for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++)  
         XmlWriter::appendQualifierElement(out, _qualifiers[i]);  
 } }
       PEG_METHOD_EXIT();
 /** toMof - Generates MOF output for a list of CIM Qualifiers.  
     The qualifiers may be class, property, parameter, etc.  
     The BNF for this is:  
     <pre>  
     qualifierList       = "[" qualifier *( "," qualifier ) "]"  
     </pre>  
     Produces qualifiers as a string on without nl.  
     */  
 void CIMQualifierList::toMof(Buffer& out) const  
 {  
     // if no qualifiers, return  
     if (_qualifiers.size() == 0)  
         return;  
   
     // Qualifier leading bracket.  
     out.append('[');  
   
     // Loop to list qualifiers  
     for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++)  
     {  
         // if second or greater, add comma separator  
         if (i > 0)  
             out << STRLIT(", \n");  
         MofWriter::appendQualifierElement(out, _qualifiers[i]);  
     }  
   
     // Terminating bracket  
     out.append(']');  
 } }
  
   
 void CIMQualifierList::print(PEGASUS_STD(ostream) &os) const void CIMQualifierList::print(PEGASUS_STD(ostream) &os) const
 { {
     Buffer tmp;     Buffer tmp;
     toXml(tmp);      for (Uint32 i = 0, n = getCount(); i < n; i++)
           XmlWriter::appendQualifierElement(tmp, _qualifiers[i]);
     os << tmp.getData() << PEGASUS_STD(endl);     os << tmp.getData() << PEGASUS_STD(endl);
 } }
  
Line 433 
Line 392 
     return false;     return false;
 } }
  
   CIMQualifierList& CIMQualifierList::addUnchecked(const CIMQualifier& qualifier)
   {
       if (qualifier.isUninitialized())
           throw UninitializedObjectException();
   
       _qualifiers.append(qualifier);
   
       if (_keyIndex == PEGASUS_ORDEREDSET_INDEX_UNKNOWN &&
               qualifier._rep->_name == _KEY)
           _keyIndex = _qualifiers.size()-1;
   
       return *this;
   }
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.64  
changed lines
  Added in v.1.73.2.1

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2