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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2