![]() ![]() |
![]() |
File: [Pegasus] / pegasus / src / Pegasus / Common / Attic / InstanceDecl.h
(download)
Revision: 1.1.1.1 (vendor branch), Sun Jan 14 19:52:38 2001 UTC (23 years, 5 months ago) by mike Branch: pegasus CVS Tags: opengroup Changes since 1.1: +0 -0 lines Pegasus import |
//BEGIN_LICENSE // // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM // // 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: InstanceDecl.h,v $ // Revision 1.1.1.1 2001/01/14 19:52:38 mike // Pegasus import // // //END_HISTORY #ifndef Pegasus_InstanceDecl_h #define Pegasus_InstanceDecl_h #include <Pegasus/Common/Config.h> #include <Pegasus/Common/InstanceDeclRep.h> PEGASUS_NAMESPACE_BEGIN //////////////////////////////////////////////////////////////////////////////// // // InstanceDecl // //////////////////////////////////////////////////////////////////////////////// class ConstInstanceDecl; class PEGASUS_COMMON_LINKAGE InstanceDecl { public: InstanceDecl() : _rep(0) { } InstanceDecl(const InstanceDecl& x) { Inc(_rep = x._rep); } InstanceDecl& operator=(const InstanceDecl& x) { if (x._rep != _rep) { Dec(_rep); Inc(_rep = x._rep); } return *this; } // Throws IllegalName if className argument not legal CIM identifier. InstanceDecl(const String& className) { _rep = new InstanceDeclRep(className); } ~InstanceDecl() { Dec(_rep); } const String& getClassName() const { _checkRep(); return _rep->getClassName(); } // Throws AlreadyExists. InstanceDecl& addQualifier(const Qualifier& qualifier) { _checkRep(); _rep->addQualifier(qualifier); return *this; } Uint32 findQualifier(const String& name) { _checkRep(); return _rep->findQualifier(name); } Uint32 findQualifier(const String& name) const { _checkRep(); return _rep->findQualifier(name); } Qualifier getQualifier(Uint32 pos) { _checkRep(); return _rep->getQualifier(pos); } ConstQualifier getQualifier(Uint32 pos) const { _checkRep(); return _rep->getQualifier(pos); } Uint32 getQualifierCount() const { _checkRep(); return _rep->getQualifierCount(); } InstanceDecl& addProperty(const Property& x) { _checkRep(); _rep->addProperty(x); return *this; } Uint32 findProperty(const String& name) { _checkRep(); return _rep->findProperty(name); } Uint32 findProperty(const String& name) const { _checkRep(); return _rep->findProperty(name); } Property getProperty(Uint32 pos) { _checkRep(); return _rep->getProperty(pos); } ConstProperty getProperty(Uint32 pos) const { _checkRep(); return _rep->getProperty(pos); } Uint32 getPropertyCount() const { _checkRep(); return _rep->getPropertyCount(); } operator int() const { return _rep != 0; } void resolve(DeclContext* declContext, const String& nameSpace) { _checkRep(); _rep->resolve(declContext, nameSpace); } void toXml(Array<Sint8>& out) const { _checkRep(); _rep->toXml(out); } void print() const { _checkRep(); _rep->print(); } Boolean identical(const ConstInstanceDecl& x) const; InstanceDecl clone() const { return InstanceDecl(_rep->clone()); } private: InstanceDecl(InstanceDeclRep* rep) : _rep(rep) { } void _checkRep() const { if (!_rep) throw UnitializedHandle(); } InstanceDeclRep* _rep; friend class ConstInstanceDecl; }; //////////////////////////////////////////////////////////////////////////////// // // ConstInstanceDecl // //////////////////////////////////////////////////////////////////////////////// class PEGASUS_COMMON_LINKAGE ConstInstanceDecl { public: ConstInstanceDecl() : _rep(0) { } ConstInstanceDecl(const ConstInstanceDecl& x) { Inc(_rep = x._rep); } ConstInstanceDecl(const InstanceDecl& x) { Inc(_rep = x._rep); } ConstInstanceDecl& operator=(const ConstInstanceDecl& x) { if (x._rep != _rep) { Dec(_rep); Inc(_rep = x._rep); } return *this; } ConstInstanceDecl& operator=(const InstanceDecl& x) { if (x._rep != _rep) { Dec(_rep); Inc(_rep = x._rep); } return *this; } // Throws IllegalName if className argument not legal CIM identifier. ConstInstanceDecl(const String& className) { _rep = new InstanceDeclRep(className); } ~ConstInstanceDecl() { Dec(_rep); } const String& getClassName() const { _checkRep(); return _rep->getClassName(); } Uint32 findQualifier(const String& name) const { _checkRep(); return _rep->findQualifier(name); } ConstQualifier getQualifier(Uint32 pos) const { _checkRep(); return _rep->getQualifier(pos); } Uint32 getQualifierCount() const { _checkRep(); return _rep->getQualifierCount(); } Uint32 findProperty(const String& name) const { _checkRep(); return _rep->findProperty(name); } ConstProperty getProperty(Uint32 pos) const { _checkRep(); return _rep->getProperty(pos); } Uint32 getPropertyCount() const { _checkRep(); return _rep->getPropertyCount(); } operator int() const { return _rep != 0; } void toXml(Array<Sint8>& out) const { _checkRep(); _rep->toXml(out); } void print() const { _checkRep(); _rep->print(); } Boolean identical(const ConstInstanceDecl& x) const { x._checkRep(); _checkRep(); return _rep->identical(x._rep); } ConstInstanceDecl clone() const { return InstanceDecl(_rep->clone()); } private: ConstInstanceDecl(InstanceDeclRep* rep) : _rep(rep) { } void _checkRep() const { if (!_rep) throw UnitializedHandle(); } InstanceDeclRep* _rep; friend class InstanceDecl; }; PEGASUS_NAMESPACE_END #endif /* Pegasus_InstanceDecl_h */
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |