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 #include "OWBI1_config.h" 00037 #include "OWBI1_CIMScope.hpp" 00038 #include "OWBI1_CIMScopeRep.hpp" 00039 #include "OWBI1_String.hpp" 00040 #include "OW_String.hpp" 00041 00042 namespace OWBI1 00043 { 00044 00045 using namespace detail; 00046 using std::istream; 00047 using std::ostream; 00048 00050 CIMScope::CIMScope() 00051 : m_rep(new CIMScopeRep(OpenWBEM::CIMScope())) 00052 { 00053 } 00054 00056 CIMScope::CIMScope(Scope scopeVal) 00057 : m_rep(new CIMScopeRep(OpenWBEM::CIMScope(OpenWBEM::CIMScope::Scope(scopeVal)))) 00058 { 00059 } 00061 CIMScope::CIMScope(const CIMScope& arg) 00062 : CIMBase(arg) 00063 , m_rep(arg.m_rep) 00064 { 00065 } 00066 00068 CIMScope::CIMScope(const detail::CIMScopeRepRef& rep) 00069 : m_rep(rep) 00070 { 00071 } 00072 00074 CIMScope::~CIMScope() 00075 { 00076 } 00077 00079 CIMScope& 00080 CIMScope::operator= (const CIMScope& arg) 00081 { 00082 m_rep = arg.m_rep; 00083 return *this; 00084 } 00085 00087 CIMScope::Scope 00088 CIMScope::getScope() const 00089 { 00090 return Scope(m_rep->scope.getScope()); 00091 } 00092 00094 bool 00095 CIMScope::equals(const CIMScope& arg) const 00096 { 00097 return m_rep->scope.equals(arg.m_rep->scope); 00098 } 00100 bool 00101 CIMScope::operator == (const CIMScope& arg) const 00102 { 00103 return equals(arg); 00104 } 00106 bool 00107 CIMScope::operator != (const CIMScope& arg) const 00108 { 00109 return !equals(arg); 00110 } 00111 00113 CIMScope::operator safe_bool () const 00114 { 00115 return m_rep->scope ? &CIMScope::m_rep : 0; 00116 } 00118 bool 00119 CIMScope::operator!() const 00120 { 00121 return !m_rep->scope; 00122 } 00124 bool operator<(const CIMScope& x, const CIMScope& y) 00125 { 00126 return *x.getRep() < *y.getRep(); 00127 } 00128 00130 String 00131 CIMScope::toString() const 00132 { 00133 return toMOF(); 00134 } 00136 String 00137 CIMScope::toMOF() const 00138 { 00139 return m_rep->scope.toMOF().c_str(); 00140 } 00142 void 00143 CIMScope::readObject(istream &istrm) 00144 { 00145 m_rep->scope.readObject(istrm); 00146 } 00148 void 00149 CIMScope::writeObject(ostream &ostrm) const 00150 { 00151 m_rep->scope.writeObject(ostrm); 00152 } 00153 00155 void 00156 CIMScope::setNull() 00157 { 00158 m_rep->scope.setNull(); 00159 } 00160 00162 CIMScopeRepRef 00163 CIMScope::getRep() const 00164 { 00165 return m_rep; 00166 } 00167 00168 } // end namespace OWBI1 00169