00001 /******************************************************************************* 00002 * Copyright (C) 2001-2004 Vintela, Inc. All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions are met: 00006 * 00007 * - Redistributions of source code must retain the above copyright notice, 00008 * this list of conditions and the following disclaimer. 00009 * 00010 * - Redistributions in binary form must reproduce the above copyright notice, 00011 * this list of conditions and the following disclaimer in the documentation 00012 * and/or other materials provided with the distribution. 00013 * 00014 * - Neither the name of Vintela, Inc. nor the names of its 00015 * contributors may be used to endorse or promote products derived from this 00016 * software without specific prior written permission. 00017 * 00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 00019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00020 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00021 * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS 00022 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00023 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00024 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00025 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00026 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00027 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00028 * POSSIBILITY OF SUCH DAMAGE. 00029 *******************************************************************************/ 00030 00036 #ifndef OWBI1_CIMPROPERTY_HPP_INCLUDE_GUARD_ 00037 #define OWBI1_CIMPROPERTY_HPP_INCLUDE_GUARD_ 00038 #include "OWBI1_config.h" 00039 #include "OWBI1_COWIntrusiveReference.hpp" 00040 #include "OWBI1_CIMElement.hpp" 00041 #include "OWBI1_CIMFwd.hpp" 00042 #include "OWBI1_CIMDataType.hpp" 00043 #include "OWBI1_CIMNULL.hpp" 00044 #include "OWBI1_WBEMFlags.hpp" 00045 #include "OWBI1_CIMName.hpp" // necessary for implicit conversion (const char* -> CIMName) to work 00046 00047 namespace OWBI1 00048 { 00049 00054 class OWBI1_OWBI1PROVIFC_API CIMProperty : public CIMElement 00055 { 00056 public: 00057 static const char* const NAME_PROPERTY; 00061 CIMProperty(); 00065 explicit CIMProperty(CIMNULL_t); 00070 explicit CIMProperty(const CIMName& name); 00076 explicit CIMProperty(const char* name); 00082 CIMProperty(const CIMName& name, const CIMValue& value); 00088 CIMProperty(const CIMName& name, const CIMDataType& dt); 00093 CIMProperty(const CIMProperty& arg); 00094 00095 explicit CIMProperty(const detail::CIMPropertyRepRef& rep); 00099 ~CIMProperty(); 00103 virtual void setNull(); 00109 CIMProperty& operator= (const CIMProperty& arg); 00110 00111 typedef detail::CIMPropertyRepRef CIMProperty::*safe_bool; 00115 operator safe_bool () const; 00116 bool operator!() const; 00121 CIMQualifierArray getQualifiers() const; 00128 CIMProperty& setQualifiers(const CIMQualifierArray& quals); 00133 CIMName getOriginClass() const; 00139 CIMProperty& setOriginClass(const CIMName& originCls); 00145 CIMProperty& setValue(const CIMValue& val); 00149 CIMValue getValue() const; 00154 CIMValue getValueT() const; 00160 CIMProperty& setDataType(const CIMDataType& type); 00166 CIMProperty& setDataType(const CIMDataType::Type& type); 00170 CIMDataType getDataType() const; 00174 Int32 getSize() const; 00180 CIMProperty& setDataSize(Int32 size); 00186 CIMProperty& setOverridingProperty(const CIMName& opname); 00190 CIMName getOverridingProperty() const; 00194 bool isReference() const; 00201 CIMQualifier getQualifier(const CIMName& name) const; 00208 CIMQualifier getQualifierT(const CIMName& name) const; 00214 CIMProperty& setQualifier(const CIMQualifier& qual); 00220 bool addQualifier(const CIMQualifier& qual); 00226 bool removeQualifier(const CIMName& name); 00230 bool isKey() const; 00236 CIMProperty& setPropagated(bool propagated=true); 00241 bool getPropagated() const; 00245 virtual CIMName getName() const; 00250 virtual void setName(const CIMName& name); 00255 virtual void writeObject(std::ostream &ostrm) const; 00262 virtual void writeObject(std::ostream &ostrm, 00263 WBEMFlags::EIncludeQualifiersFlag includeQualifiers) const; 00264 00269 virtual void readObject(std::istream &istrm); 00273 virtual String toString() const; 00274 00279 virtual String toMOF() const; 00280 00287 bool hasTrueQualifier(const CIMName& name) const; 00288 00289 detail::CIMPropertyRepRef getRep() const; 00290 private: 00291 00292 #ifdef OWBI1_WIN32 00293 #pragma warning (push) 00294 #pragma warning (disable: 4251) 00295 #endif 00296 00297 detail::CIMPropertyRepRef m_rep; 00298 00299 #ifdef OWBI1_WIN32 00300 #pragma warning (pop) 00301 #endif 00302 00303 }; 00304 00305 OWBI1_OWBI1PROVIFC_API bool operator<(const CIMProperty& x, const CIMProperty& y); 00306 00307 } // end namespace OWBI1 00308 00309 #endif