OWBI1_CIMFlavor.cpp

Go to the documentation of this file.
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_CIMFlavor.hpp"
00038 #include "OWBI1_CIMFlavorRep.hpp"
00039 #include "OWBI1_String.hpp"
00040 #include "OW_String.hpp"
00041 #if defined(OWBI1_HAVE_ISTREAM) && defined(OWBI1_HAVE_OSTREAM)
00042 #include <istream>
00043 #include <ostream>
00044 #else
00045 #include <iostream>
00046 #endif
00047 
00048 namespace OWBI1
00049 {
00050 
00051 using namespace detail;
00052 using std::ostream;
00053 using std::istream;
00055 String
00056 CIMFlavor::toString() const
00057 {
00058    return m_rep->flavor.toString().c_str();
00059 }
00061 String
00062 CIMFlavor::toMOF() const
00063 {
00064    return m_rep->flavor.toMOF().c_str();
00065 }
00067 void
00068 CIMFlavor::readObject(istream &istrm)
00069 {
00070    m_rep->flavor.readObject(istrm);
00071 }
00072 
00074 void
00075 CIMFlavor::writeObject(ostream &ostrm) const
00076 {
00077    m_rep->flavor.writeObject(ostrm);
00078 }
00079 
00081 void
00082 CIMFlavor::setNull()
00083 {
00084    m_rep->flavor.setNull();
00085 }
00086 
00088 CIMFlavor::operator safe_bool () const
00089 {  
00090    return m_rep->flavor ? &CIMFlavor::m_rep : 0; 
00091 }
00092 
00094 bool 
00095 CIMFlavor::operator!() const
00096 {  
00097    return !m_rep->flavor; 
00098 }
00099 
00101 CIMFlavor::CIMFlavor(Flavor iflavor) 
00102    : m_rep(new CIMFlavorRep(OpenWBEM::CIMFlavor(OpenWBEM::CIMFlavor::Flavor(iflavor))))
00103 {
00104 }
00105 
00107 CIMFlavor::CIMFlavor()
00108    : m_rep(new CIMFlavorRep(OpenWBEM::CIMFlavor()))
00109 {
00110 }
00111 
00113 CIMFlavor::CIMFlavor(const CIMFlavor& arg)
00114    : CIMBase(arg)
00115    , m_rep(arg.m_rep)
00116 {
00117 }
00118 
00120 CIMFlavor::CIMFlavor(const detail::CIMFlavorRepRef& rep)
00121    : m_rep(rep)
00122 {
00123 }
00124 
00126 CIMFlavor& 
00127 CIMFlavor::operator= (const CIMFlavor& arg)
00128 {
00129    m_rep = arg.m_rep;
00130    return *this;
00131 }
00133 bool 
00134 CIMFlavor::isValid()
00135 {
00136    return m_rep->flavor.isValid();
00137 }
00138 
00140 bool 
00141 CIMFlavor::equals(const CIMFlavor& arg)
00142 {
00143    return m_rep->flavor.equals(arg.m_rep->flavor);
00144 }
00146 bool 
00147 CIMFlavor::operator== (const CIMFlavor& arg)
00148 {
00149    return equals(arg);
00150 }
00152 bool 
00153 CIMFlavor::operator!= (const CIMFlavor& arg)
00154 {
00155    return (equals(arg) == false);
00156 }
00158 Int32 
00159 CIMFlavor::getFlavor() const 
00160 {  
00161    return m_rep->flavor.getFlavor(); 
00162 }
00163 
00165 bool operator<(const CIMFlavor& x, const CIMFlavor& y)
00166 {
00167    return *x.getRep() < *y.getRep();
00168 }
00169 
00171 // static 
00172 bool
00173 CIMFlavor::validFlavor(Int32 iflavor)
00174 {
00175    return OpenWBEM::CIMFlavor::validFlavor(iflavor);
00176 }
00177 
00179 detail::CIMFlavorRepRef 
00180 CIMFlavor::getRep() const
00181 {
00182    return m_rep;
00183 }
00184 
00185 } // end namespace OWBI1
00186 

Generated on Thu Feb 9 08:48:25 2006 for openwbem by  doxygen 1.4.6