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

  1 mike  1.9 //%/////////////////////////////////////////////////////////////////////////////
  2           //
  3           // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
  4           //
  5           // Permission is hereby granted, free of charge, to any person obtaining a copy
  6           // of this software and associated documentation files (the "Software"), to 
  7           // deal in the Software without restriction, including without limitation the 
  8           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
  9           // sell copies of the Software, and to permit persons to whom the Software is
 10           // furnished to do so, subject to the following conditions:
 11           // 
 12           // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 13           // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 14           // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 15           // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 16           // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 17           // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 18           // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 19           // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 20           //
 21           //==============================================================================
 22 mike  1.9 //
 23           // Author: Mike Brasher (mbrasher@bmc.com)
 24           //
 25           // Modified By:
 26           //
 27           //%/////////////////////////////////////////////////////////////////////////////
 28           
 29           #include <cstring>
 30           #include "CIMScope.h"
 31           #include "XmlWriter.h"
 32           
 33           PEGASUS_NAMESPACE_BEGIN
 34           
 35           const Uint32 CIMScope::NONE = 0;
 36           const Uint32 CIMScope::CLASS = 1;
 37           const Uint32 CIMScope::ASSOCIATION = 2;
 38           const Uint32 CIMScope::INDICATION = 4;
 39           const Uint32 CIMScope::PROPERTY = 8;
 40           const Uint32 CIMScope::REFERENCE = 16;
 41           const Uint32 CIMScope::METHOD = 32;
 42           const Uint32 CIMScope::PARAMETER = 64;
 43 mike  1.9 const Uint32 CIMScope::ANY = (1 | 2 | 4 | 8 | 16 | 32 | 64 );
 44           
 45           String ScopeToString(Uint32 scope)
 46           {
 47               String tmp;
 48           
 49               if (scope & CIMScope::CLASS)
 50           	tmp += "CLASS ";
 51           
 52               if (scope & CIMScope::ASSOCIATION)
 53           	tmp += "ASSOCIATION ";
 54           
 55               if (scope & CIMScope::INDICATION)
 56           	tmp += "INDICATION ";
 57           
 58               if (scope & CIMScope::PROPERTY)
 59           	tmp += "PROPERTY ";
 60           
 61               if (scope & CIMScope::REFERENCE)
 62           	tmp += "REFERENCE ";
 63           
 64 mike  1.9     if (scope & CIMScope::METHOD)
 65           	tmp += "METHOD ";
 66           
 67               if (scope & CIMScope::PARAMETER)
 68           	tmp += "PARAMETER ";
 69           
 70               if (tmp.size())
 71           	tmp.remove(tmp.size() - 1);
 72           
 73               return tmp;
 74           }
 75           
 76           void ScopeToXml(Array<Sint8>& out, Uint32 scope)
 77           {
 78               if (scope)
 79               {
 80           	out << "<SCOPE";
 81           
 82           	if (scope & CIMScope::CLASS)
 83           	    out << " CLASS=\"true\"";
 84           
 85 mike  1.9 	if (scope & CIMScope::ASSOCIATION)
 86           	    out << " ASSOCIATION=\"true\"";
 87           
 88           	if (scope & CIMScope::REFERENCE)
 89           	    out << " REFERENCE=\"true\"";
 90           
 91           	if (scope & CIMScope::PROPERTY)
 92           	    out << " PROPERTY=\"true\"";
 93           
 94           	if (scope & CIMScope::METHOD)
 95           	    out << " METHOD=\"true\"";
 96           
 97           	if (scope & CIMScope::PARAMETER)
 98           	    out << " PARAMETER=\"true\"";
 99           
100           	if (scope & CIMScope::INDICATION)
101           	    out << " INDICATION=\"true\"";
102           
103           	out << "/>";
104               }
105           }
106 mike  1.9 
107           PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2