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

Diff for /pegasus/src/Pegasus/Common/CIMFlavor.cpp between version 1.1 and 1.13

version 1.1, 2001/02/18 18:39:06 version 1.13, 2002/03/28 02:57:54
Line 1 
Line 1 
 //BEGIN_LICENSE  //%/////////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a  // Permission is hereby granted, free of charge, to any person obtaining a copy
 // copy of this software and associated documentation files (the "Software"),  // of this software and associated documentation files (the "Software"), to
 // to deal in the Software without restriction, including without limitation  // deal in the Software without restriction, including without limitation the
 // the rights to use, copy, modify, merge, publish, distribute, sublicense,  // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 // and/or sell copies of the Software, and to permit persons to whom the  // sell copies of the Software, and to permit persons to whom the Software is
 // Software is furnished to do so, subject to the following conditions:  // furnished to do so, subject to the following conditions:
 // //
 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL  // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING  // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER  // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 // 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.
 // //
 //END_LICENSE  //==============================================================================
 //BEGIN_HISTORY  
 // //
 // Author:  // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // $Log$  // Modified By:
 // Revision 1.1  2001/02/18 18:39:06  mike  
 // new  
 // //
 // Revision 1.1  2001/02/16 02:07:06  mike  //%/////////////////////////////////////////////////////////////////////////////
 // Renamed many classes and headers (using new CIM prefixes).  
 //  
 // Revision 1.1.1.1  2001/01/14 19:51:52  mike  
 // Pegasus import  
 //  
 //  
 //END_HISTORY  
  
 #include <cstring> #include <cstring>
 #include "CIMFlavor.h" #include "CIMFlavor.h"
 #include "Exception.h" #include "Exception.h"
 #include "XmlWriter.h" #include "XmlWriter.h"
   //#include <iostream>
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
   PEGASUS_USING_STD;
  
 const Uint32 CIMFlavor::NONE = 0; const Uint32 CIMFlavor::NONE = 0;
 const Uint32 CIMFlavor::OVERRIDABLE = 1; const Uint32 CIMFlavor::OVERRIDABLE = 1;
   const Uint32 CIMFlavor::ENABLEOVERRIDE = 1;
 const Uint32 CIMFlavor::TOSUBCLASS = 2; const Uint32 CIMFlavor::TOSUBCLASS = 2;
 const Uint32 CIMFlavor::TOINSTANCE = 4; const Uint32 CIMFlavor::TOINSTANCE = 4;
 const Uint32 CIMFlavor::TRANSLATABLE = 8; const Uint32 CIMFlavor::TRANSLATABLE = 8;
   const Uint32 CIMFlavor::TOSUBELEMENTS = TOSUBCLASS | TOINSTANCE;
   const Uint32 CIMFlavor::DISABLEOVERRIDE = 16;
   const Uint32 CIMFlavor::RESTRICTED = 32;
 const Uint32 CIMFlavor::DEFAULTS = OVERRIDABLE | TOSUBCLASS; const Uint32 CIMFlavor::DEFAULTS = OVERRIDABLE | TOSUBCLASS;
   // ATTN: P1 KS 24 March 2002 Change here to make TOINSTANCE part of the defaults
   //const Uint32 CIMFlavor::DEFAULTS = OVERRIDABLE | TOSUBCLASS| TOINSTANCE;
   const Uint32 CIMFlavor::ALL = OVERRIDABLE | DEFAULTS
                                                    | TRANSLATABLE | DISABLEOVERRIDE | RESTRICTED;
  
 static const char* _toString(Boolean x) static const char* _toString(Boolean x)
 { {
     return x ? "true" : "false";     return x ? "true" : "false";
 } }
   /** FlavorToMof Convert the Qualifier flavors to a string of MOF
       flavor keywords.
  
 String FlavorToString(Uint32 flavor)    <pre>
     Keyword            Function                             Default
       EnableOverride  Qualifier is overridable.               yes
       DisableOverride Qualifier cannot be overridden.          no
       ToSubclass      Qualifier is inherited by any subclass. yes
       Restricted      Qualifier applies only to the class     no
                       in which it is declared
       Translatable    Indicates the value of the qualifier
                       can be specified inmultiple languages   no
       NOTE: There is an open issue with the keyword toinstance.
   
       flavor            = ENABLEOVERRIDE | DISABLEOVERRIDE | RESTRICTED |
                           TOSUBCLASS | TRANSLATABLE
       DISABLEOVERRIDE   = "disableOverride"
   
       ENABLEOVERRIDE    = "enableoverride"
   
       RESTRICTED        = "restricted"
   
       TOSUBCLASS        = "tosubclass"
   
       TRANSLATABLE      = "translatable"
      </pre>
      The keyword toinstance is not in the CIMspecification. For the moment we are
      assuming that it is the same as the TOSubclass. We had a choice of using
      one entity for both or separating them and letting the compiler set both.
   
   */
   String FlavorToMof(Uint32 flavor)
 { {
     Boolean overridable = (flavor & CIMFlavor::OVERRIDABLE) != 0;     Boolean overridable = (flavor & CIMFlavor::OVERRIDABLE) != 0;
     Boolean toSubClass = (flavor & CIMFlavor::TOSUBCLASS) != 0;     Boolean toSubClass = (flavor & CIMFlavor::TOSUBCLASS) != 0;
Line 63 
Line 94 
  
     String tmp;     String tmp;
  
       tmp = "";
   
     if (!overridable)     if (!overridable)
         tmp += "OVERRIDABLE ";          tmp += "DisableOverride, ";
  
     if (!toSubClass)     if (!toSubClass)
         tmp += "TOSUBCLASS ";          tmp += "Restricted, ";
   
     if (toInstance)  
         tmp += "TOINSTANCE ";  
  
     if (translatable)     if (translatable)
         tmp += "TRANSLATABLE ";          tmp += "Translatable, ";
  
     if (tmp.getLength())      if (tmp.size())
         tmp.remove(tmp.getLength() - 1);          tmp.remove(tmp.size() - 2);
  
     return tmp;     return tmp;
 } }
  
   /*
   The XML Definition is, from XML Specification
   <!ENTITY % QualifierFlavor "OVERRIDABLE  (true|false)   'true'
                                 TOSUBCLASS   (true|false)   'true'
                                 TOINSTANCE   (true|false)   'false'
                                 TRANSLATABLE (true|false)   'false'">
   */
 void FlavorToXml(Array<Sint8>& out, Uint32 flavor) void FlavorToXml(Array<Sint8>& out, Uint32 flavor)
 { {
     Boolean overridable = (flavor & CIMFlavor::OVERRIDABLE) != 0;     Boolean overridable = (flavor & CIMFlavor::OVERRIDABLE) != 0;
Line 91 
Line 128 
     if (!overridable)     if (!overridable)
         out << " OVERRIDABLE=\"" << _toString(overridable) << "\"";         out << " OVERRIDABLE=\"" << _toString(overridable) << "\"";
  
       /*cout << "KSTEST XML " << hex << flavor << "  overridable = "
           << overridable
           << " " << FlavorToMof(flavor)
           << endl; */
   
     if (!toSubClass)     if (!toSubClass)
         out << " TOSUBCLASS=\"" << _toString(toSubClass) << "\"";         out << " TOSUBCLASS=\"" << _toString(toSubClass) << "\"";
  
Line 101 
Line 143 
         out << " TRANSLATABLE=\"" << _toString(translatable) << "\"";         out << " TRANSLATABLE=\"" << _toString(translatable) << "\"";
 } }
  
   
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2