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

Diff for /pegasus/src/Pegasus/Common/CIMScope.cpp between version 1.1 and 1.21

version 1.1, 2001/02/18 18:39:06 version 1.21, 2005/02/05 22:59:23
Line 1 
Line 1 
 //BEGIN_LICENSE  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
   // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // 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 copy
   // of this software and associated documentation files (the "Software"), to
   // deal in the Software without restriction, including without limitation the
   // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   // sell copies of the Software, and to permit persons to whom the Software is
   // furnished to do so, subject to the following conditions:
   //
   // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
   // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
   // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
   // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
   // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
   // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   // 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.
   //
   //==============================================================================
   //
   // Author: Mike Brasher (mbrasher@bmc.com)
   //
   // Modified By: Carol Ann Krug Graves, Hewlett-Packard Company
   //                (carolann_graves@hp.com)
   //              Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a  //%/////////////////////////////////////////////////////////////////////////////
 // copy of this software and associated documentation files (the "Software"),  
 // to deal in the Software without restriction, including without limitation  
 // the rights to use, copy, modify, merge, publish, distribute, sublicense,  
 // and/or sell copies of the Software, and to permit persons to whom the  
 // Software is furnished to do so, subject to the following conditions:  
 //  
 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  
 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL  
 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
 // LIABILITY, WHETHER IN AN 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:  
 //  
 // $Log$  
 // 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:53:12  mike  
 // Pegasus import  
 //  
 //  
 //END_HISTORY  
  
 #include <cstring> #include <cstring>
   #include <Pegasus/Common/InternalException.h>
 #include "CIMScope.h" #include "CIMScope.h"
 #include "XmlWriter.h"  
  
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 namespace CIMScope  const CIMScope CIMScope::NONE = 0;
   const CIMScope CIMScope::CLASS = 1;
   const CIMScope CIMScope::ASSOCIATION = 2;
   const CIMScope CIMScope::INDICATION = 4;
   const CIMScope CIMScope::PROPERTY = 8;
   const CIMScope CIMScope::REFERENCE = 16;
   const CIMScope CIMScope::METHOD = 32;
   const CIMScope CIMScope::PARAMETER = 64;
   const CIMScope CIMScope::ANY = CIMScope::CLASS + CIMScope::ASSOCIATION +
                                  CIMScope::INDICATION + CIMScope::PROPERTY +
                                  CIMScope::REFERENCE + CIMScope::METHOD +
                                  CIMScope::PARAMETER;
   
   CIMScope::CIMScope ()
       : cimScope (CIMScope::NONE.cimScope)
 { {
     const Uint32 NONE = 0;  
     const Uint32 CLASS = 1;  
     const Uint32 ASSOCIATION = 2;  
     const Uint32 INDICATION = 4;  
     const Uint32 PROPERTY = 8;  
     const Uint32 REFERENCE = 16;  
     const Uint32 METHOD = 32;  
     const Uint32 PARAMETER = 64;  
     const Uint32 ANY = (1 | 2 | 4 | 8 | 16 | 32 | 64 );  
 } }
  
 String ScopeToString(Uint32 scope)  CIMScope::CIMScope (const CIMScope & scope)
       : cimScope (scope.cimScope)
 { {
     String tmp;  }
   
     if (scope & CIMScope::CLASS)  
         tmp += "CLASS ";  
   
     if (scope & CIMScope::ASSOCIATION)  
         tmp += "ASSOCIATION ";  
   
     if (scope & CIMScope::INDICATION)  
         tmp += "INDICATION ";  
   
     if (scope & CIMScope::PROPERTY)  
         tmp += "PROPERTY ";  
  
     if (scope & CIMScope::REFERENCE)  CIMScope::CIMScope (const Uint32 scope)
         tmp += "REFERENCE ";      : cimScope (scope)
   {
       PEGASUS_ASSERT (scope < 128);
   }
  
     if (scope & CIMScope::METHOD)  CIMScope & CIMScope::operator= (const CIMScope & scope)
         tmp += "METHOD ";  {
       this->cimScope = scope.cimScope;
       return *this;
   }
  
     if (scope & CIMScope::PARAMETER)  void CIMScope::addScope (const CIMScope & scope)
         tmp += "PARAMETER ";  {
       this->cimScope |= scope.cimScope;
   }
  
     if (tmp.getLength())  Boolean CIMScope::hasScope (const CIMScope & scope) const
         tmp.remove(tmp.getLength() - 1);  {
       return ((this->cimScope & scope.cimScope) == scope.cimScope);
   }
  
     return tmp;  Boolean CIMScope::equal (const CIMScope & scope) const
   {
       return (this->cimScope == scope.cimScope);
 } }
  
 void ScopeToXml(Array<Sint8>& out, Uint32 scope)  CIMScope CIMScope::operator+ (const CIMScope & scope) const
 { {
     if (scope)      return CIMScope(this->cimScope | scope.cimScope);
   }
   
   String CIMScope::toString () const
     {     {
         out << "<SCOPE";      String tmp;
  
         if (scope & CIMScope::CLASS)      if (this->hasScope (CIMScope::CLASS))
             out << " CLASS=\"true\"";          tmp.append("CLASS ");
  
         if (scope & CIMScope::ASSOCIATION)      if (this->hasScope (CIMScope::ASSOCIATION))
             out << " ASSOCIATION=\"true\"";          tmp.append("ASSOCIATION ");
  
         if (scope & CIMScope::REFERENCE)      if (this->hasScope (CIMScope::INDICATION))
             out << " REFERENCE=\"true\"";          tmp.append("INDICATION ");
  
         if (scope & CIMScope::PROPERTY)      if (this->hasScope (CIMScope::PROPERTY))
             out << " PROPERTY=\"true\"";          tmp.append("PROPERTY ");
  
         if (scope & CIMScope::METHOD)      if (this->hasScope (CIMScope::REFERENCE))
             out << " METHOD=\"true\"";          tmp.append("REFERENCE ");
  
         if (scope & CIMScope::PARAMETER)      if (this->hasScope (CIMScope::METHOD))
             out << " PARAMETER=\"true\"";          tmp.append("METHOD ");
  
         if (scope & CIMScope::INDICATION)      if (this->hasScope (CIMScope::PARAMETER))
             out << " INDICATION=\"true\"";          tmp.append("PARAMETER ");
  
         out << "/>";      if (tmp.size())
     }          tmp.remove(tmp.size() - 1);
   
       return tmp;
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2