(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.13 and 1.23

version 1.13, 2001/06/16 23:10:03 version 1.23, 2002/03/22 00:48:58
Line 34 
Line 34 
 #include "XmlWriter.h" #include "XmlWriter.h"
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
   PEGASUS_USING_STD;
  
 CIMQualifierList::CIMQualifierList() CIMQualifierList::CIMQualifierList()
 { {
Line 96 
Line 97 
     const String& nameSpace,     const String& nameSpace,
     Uint32 scope,     Uint32 scope,
     Boolean isInstancePart,     Boolean isInstancePart,
     CIMQualifierList& inheritedQualifiers)      CIMQualifierList& inheritedQualifiers,
       Boolean propagateQualifiers)
 { {
     // For each qualifier in the qualifiers array, the following     // For each qualifier in the qualifiers array, the following
     // is checked:     // is checked:
Line 118 
Line 120 
     for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++)     for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++)
     {     {
         CIMQualifier q = _qualifiers[i];         CIMQualifier q = _qualifiers[i];
           //cout << "KSTEST  Qualifier resolve for Name = " << q.getName() << endl;
         //----------------------------------------------------------------------         //----------------------------------------------------------------------
         // 1. Check to see if it's declared.         // 1. Check to see if it's declared.
         //----------------------------------------------------------------------         //----------------------------------------------------------------------
Line 142 
Line 144 
 #if 0 #if 0
         // ATTN:  These lines throw a bogus exception if the qualifier has         // ATTN:  These lines throw a bogus exception if the qualifier has
         // a valid scope (such as Scope::ASSOCIATION) which is not Scope::CLASS         // a valid scope (such as Scope::ASSOCIATION) which is not Scope::CLASS
         // grb 1/16/01          // ks Mar 2002
         if (!(qd.getScope() & scope))         if (!(qd.getScope() & scope))
             throw BadQualifierScope(qd.getName(), ScopeToString(scope));             throw BadQualifierScope(qd.getName(), ScopeToString(scope));
 #endif #endif
Line 155 
Line 157 
         // abstract qualifier as non-overridable but then they override it.         // abstract qualifier as non-overridable but then they override it.
         // For now it is just disabled. This problem exists in both XML and         // For now it is just disabled. This problem exists in both XML and
         // CIM schema.         // CIM schema.
            //cout << "KSTEST QUal resolve Propagate 1 " << q.getName() << endl;
 #if 0 #if 0
         Uint32 pos = inheritedQualifiers.find(q.getName());         Uint32 pos = inheritedQualifiers.find(q.getName());
  
         if (pos != PEG_NOT_FOUND)         if (pos != PEG_NOT_FOUND)
         {         {
             CIMConstQualifier iq = inheritedQualifiers.getQualifier(pos);              CIMConstQualifier iq = inheritedQualifiers.getQualifier(pos);{
  
             if (!(iq.getFlavor() & CIMFlavor::OVERRIDABLE))             if (!(iq.getFlavor() & CIMFlavor::OVERRIDABLE))
                 throw BadQualifierOverride(q.getName());                 throw BadQualifierOverride(q.getName());
         }         }
           }
 #endif #endif
     }     }
  
Line 173 
Line 176 
     // Propagate qualifiers to subclass or to instance that do not have     // Propagate qualifiers to subclass or to instance that do not have
     // already have those qualifiers:     // already have those qualifiers:
     //--------------------------------------------------------------------------     //--------------------------------------------------------------------------
   
     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);
           //cout << "KSTEST inherited  propagate loop 2 " <<  iq.getName()
           //<< " flavor " << iq.getFlavor << " count " << i << endl;
   
           // ATTN-DE-P1-This next test is incorrect. It is a temporary, hard-coded
           // HACK to avoid propagating the "Abstract" Qualifier to subclasses
           //if (CIMName::equal(iq.getName(), "Abstract"))
           //   continue;
  
         if (isInstancePart)         if (isInstancePart)
         {         {
             if (!(iq.getFlavor() & CIMFlavor::TOINSTANCE))              if (!(iq.getFlavor() && CIMFlavor::TOINSTANCE))
                 continue;                 continue;
         }         }
         else         else
         {         {
             if (!(iq.getFlavor() & CIMFlavor::TOSUBCLASS))              if (!(iq.getFlavor() && 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).         // then propagate it (and set the propagated flag to true).
Line 195 
Line 205 
         if (find(iq.getName()) != PEG_NOT_FOUND)         if (find(iq.getName()) != PEG_NOT_FOUND)
             continue;             continue;
  
           /*
           cout << "KSTEST resolve Propagate " << iq.getName() << " true= " << true
           << " flavor= " << iq.getFlavor()
           << " TOSUBCLASS " << (iq.getFlavor() && CIMFlavor::TOSUBCLASS) << endl;
           */
   
           if (propagateQualifiers)
           {
         CIMQualifier q = iq.clone();         CIMQualifier q = iq.clone();
         q.setPropagated(true);         q.setPropagated(true);
         _qualifiers.prepend(q);         _qualifiers.prepend(q);
     }     }
 } }
   }
  
 void CIMQualifierList::toXml(Array<Sint8>& out) const void CIMQualifierList::toXml(Array<Sint8>& out) const
 { {
Line 207 
Line 226 
         _qualifiers[i].toXml(out);         _qualifiers[i].toXml(out);
 } }
  
   /** 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(Array<Sint8>& out) const
   {
       // if no qualifiers, return
       if (_qualifiers.size() == 0)
           return;
   
       // Qualifier leading bracket.
       out <<"[";
   
       // 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 << ", \n";
           _qualifiers[i].toMof(out);
       }
   
       // Terminating bracket
       out << "]";
   }
   
   
 void CIMQualifierList::print(PEGASUS_STD(ostream) &os) const void CIMQualifierList::print(PEGASUS_STD(ostream) &os) const
 { {
     Array<Sint8> tmp;     Array<Sint8> tmp;
Line 223 
Line 273 
         return false;         return false;
  
     for (Uint32 i = 0; i < count; i++)     for (Uint32 i = 0; i < count; i++)
         return _qualifiers[i].identical(x._qualifiers[i]);      {
           if (!_qualifiers[i].identical(x._qualifiers[i]))
               return false;
       }
  
     return true;     return true;
 } }


Legend:
Removed from v.1.13  
changed lines
  Added in v.1.23

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2