OW_CIMName.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright (C) 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 
00035 #include "OW_config.h"
00036 #include "OW_CIMName.hpp"
00037 #if defined(OW_HAVE_OSTREAM)
00038 #include <ostream>
00039 #else
00040 #include <iostream>
00041 #endif
00042 /* #endif defined(OW_HAVE_OSTREAM)*/
00043 
00044 namespace OW_NAMESPACE
00045 {
00046 
00048 CIMName::CIMName()
00049 {
00050 }
00051 
00053 CIMName::CIMName(const String& name)
00054    : m_name(name)
00055 {
00056 }
00057    
00059 CIMName::CIMName(const char* name)
00060    : m_name(name)
00061 {
00062 }
00063    
00065 CIMName::~CIMName()
00066 {
00067 }
00068 
00070 CIMName&
00071 CIMName::operator=(const String& name)
00072 {
00073    m_name = name;
00074    return *this;
00075 }
00076 
00078 CIMName&
00079 CIMName::operator=(const char* name)
00080 {
00081    m_name = name;
00082    return *this;
00083 }
00084 
00086 String
00087 CIMName::toString() const
00088 {
00089    return m_name;
00090 }
00091 
00093 void
00094 CIMName::readObject(std::istream &istrm)
00095 {
00096    m_name.readObject(istrm);
00097 }
00099 void
00100 CIMName::writeObject(std::ostream &ostrm) const
00101 {
00102    m_name.writeObject(ostrm);
00103 }
00104 
00106 bool 
00107 CIMName::isValid() const
00108 {
00109    return !m_name.empty();
00110 }
00111 
00113 CIMName::operator CIMName::safe_bool () const
00114 {
00115    return isValid() ? &CIMName::m_name : 0;
00116 }
00117    
00119 bool
00120 CIMName::operator!() const
00121 {
00122    return !isValid();
00123 }
00124 
00126 bool operator<(const CIMName& x, const CIMName& y)
00127 {
00128    return x.m_name.compareToIgnoreCase(y.m_name) < 0;
00129 }
00130 
00132 bool operator==(const CIMName& x, const CIMName& y)
00133 {
00134    return x.m_name.equalsIgnoreCase(y.m_name);
00135 }
00136 
00138 bool operator<=(const CIMName& x, const CIMName& y)
00139 {
00140     return !(y < x);
00141 }
00142 
00144 bool operator>(const CIMName& x, const CIMName& y)
00145 {
00146     return y < x;
00147 }
00148 
00150 bool operator>=(const CIMName& x, const CIMName& y)
00151 {
00152     return !(x < y);
00153 }
00154 
00156 bool operator!=(const CIMName& x, const CIMName& y)
00157 {
00158    return !(x == y);
00159 }
00160 
00162 std::ostream& operator<<(std::ostream& ostr, const CIMName& name)
00163 {
00164    ostr << name.toString();
00165    return ostr;
00166 }
00167 
00168 } // end namespace OW_NAMESPACE
00169 
00170 
00171 
00172 
00173 

Generated on Thu Feb 9 08:47:53 2006 for openwbem by  doxygen 1.4.6