version 1.7, 2001/06/16 23:10:03
|
version 1.22, 2006/01/30 16:16:47
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001 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. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) | // Author: Mike Brasher (mbrasher@bmc.com) |
// | // |
// Modified By: |
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#include <cstring> | #include <cstring> |
|
#include <Pegasus/Common/InternalException.h> |
#include "CIMScope.h" | #include "CIMScope.h" |
#include "XmlWriter.h" |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
const Uint32 CIMScope::NONE = 0; |
const CIMScope CIMScope::NONE = 0; |
const Uint32 CIMScope::CLASS = 1; |
const CIMScope CIMScope::CLASS = 1; |
const Uint32 CIMScope::ASSOCIATION = 2; |
const CIMScope CIMScope::ASSOCIATION = 2; |
const Uint32 CIMScope::INDICATION = 4; |
const CIMScope CIMScope::INDICATION = 4; |
const Uint32 CIMScope::PROPERTY = 8; |
const CIMScope CIMScope::PROPERTY = 8; |
const Uint32 CIMScope::REFERENCE = 16; |
const CIMScope CIMScope::REFERENCE = 16; |
const Uint32 CIMScope::METHOD = 32; |
const CIMScope CIMScope::METHOD = 32; |
const Uint32 CIMScope::PARAMETER = 64; |
const CIMScope CIMScope::PARAMETER = 64; |
const Uint32 CIMScope::ANY = (1 | 2 | 4 | 8 | 16 | 32 | 64 ); |
const CIMScope CIMScope::ANY = CIMScope::CLASS + CIMScope::ASSOCIATION + |
|
CIMScope::INDICATION + CIMScope::PROPERTY + |
|
CIMScope::REFERENCE + CIMScope::METHOD + |
|
CIMScope::PARAMETER; |
| |
String ScopeToString(Uint32 scope) |
CIMScope::CIMScope () |
|
: cimScope (CIMScope::NONE.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) |
CIMScope::CIMScope (const CIMScope & scope) |
tmp += "PROPERTY "; |
: cimScope (scope.cimScope) |
|
{ |
|
} |
| |
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.size()) |
Boolean CIMScope::hasScope (const CIMScope & scope) const |
tmp.remove(tmp.size() - 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 |