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_CIMOBJECTPATH_HPP_INCLUDE_GUARD_ 00037 #define OWBI1_CIMOBJECTPATH_HPP_INCLUDE_GUARD_ 00038 #include "OWBI1_config.h" 00039 #include "OWBI1_COWIntrusiveReference.hpp" 00040 #include "OWBI1_CIMBase.hpp" 00041 #include "OWBI1_CIMFwd.hpp" 00042 #include "OWBI1_CIMNULL.hpp" 00043 #include "OWBI1_CIMName.hpp" // necessary for implicit conversion (const char* -> CIMName) to work 00044 00045 namespace OWBI1 00046 { 00047 00053 class OWBI1_OWBI1PROVIFC_API CIMObjectPath : public CIMBase 00054 { 00055 public: 00061 static String escape(const String& inString); 00067 static String unEscape(const String& inString); 00071 CIMObjectPath(); 00075 explicit CIMObjectPath(CIMNULL_t); 00080 explicit CIMObjectPath(const CIMName& className); 00086 explicit CIMObjectPath(const char* className); 00094 CIMObjectPath(const CIMName& className, const String& nspace); 00101 CIMObjectPath(const CIMName& className, 00102 const CIMPropertyArray& keys); 00108 CIMObjectPath(const String& ns, 00109 const CIMInstance& inst); 00114 CIMObjectPath(const CIMObjectPath& arg); 00115 00116 explicit CIMObjectPath(const detail::CIMObjectPathRepRef& rep); 00120 ~CIMObjectPath(); 00124 virtual void setNull(); 00130 CIMObjectPath& operator= (const CIMObjectPath& arg); 00135 CIMPropertyArray getKeys() const; 00142 CIMProperty getKey(const CIMName& keyName) const; 00150 CIMProperty getKeyT(const CIMName& keyName) const; 00157 CIMValue getKeyValue(const CIMName& name) const; 00163 bool keyHasValue(const CIMName& name) const; 00170 CIMObjectPath& setKeys(const CIMPropertyArray& newKeys); 00176 CIMObjectPath& setKeys(const CIMInstance& instance); 00184 CIMObjectPath& setKeyValue(const CIMName& name, const CIMValue& value); 00188 String getNameSpace() const; 00192 CIMUrl getNameSpaceUrl() const; 00196 String getHost() const; 00200 String getClassName() const; 00207 static CIMObjectPath parse(const String& instanceName); 00213 CIMObjectPath& setHost(const String& host); 00219 CIMObjectPath& setNameSpace(const String& ns); 00225 CIMObjectPath& setClassName(const CIMName& className); 00231 bool equals(const CIMObjectPath& op) const; 00232 00233 typedef detail::CIMObjectPathRepRef CIMObjectPath::*safe_bool; 00237 operator safe_bool () const; 00238 bool operator!() const; 00244 bool operator== (const CIMObjectPath& op) const 00245 { 00246 return equals(op); 00247 } 00248 00254 bool operator!= (const CIMObjectPath& op) const 00255 { 00256 return !equals(op); 00257 } 00261 CIMNameSpace getFullNameSpace() const; 00265 bool isClassPath() const; 00269 bool isInstancePath() const; 00273 virtual String toString() const; 00278 virtual String modelPath() const; 00283 virtual String toMOF() const; 00288 virtual void readObject(std::istream& istrm); 00293 virtual void writeObject(std::ostream& ostrm) const; 00294 00303 CIMObjectPath& syncWithClass(const CIMClass& theClass); 00304 00305 detail::CIMObjectPathRepRef getRep() const; 00306 private: 00307 00308 #ifdef OWBI1_WIN32 00309 #pragma warning (push) 00310 #pragma warning (disable: 4251) 00311 #endif 00312 00313 detail::CIMObjectPathRepRef m_rep; 00314 00315 #ifdef OWBI1_WIN32 00316 #pragma warning (pop) 00317 #endif 00318 00319 }; 00320 00321 OWBI1_OWBI1PROVIFC_API bool operator<(const CIMObjectPath& lhs, const CIMObjectPath& rhs); 00322 00323 } // end namespace OWBI1 00324 00325 #endif