00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00036 #ifndef OWBI1_CIMURL_HPP_INCLUDE_GUARD_
00037 #define OWBI1_CIMURL_HPP_INCLUDE_GUARD_
00038 #include "OWBI1_config.h"
00039 #include "OWBI1_CIMBase.hpp"
00040 #include "OWBI1_COWIntrusiveReference.hpp"
00041 #include "OWBI1_CIMNULL.hpp"
00042 #include "OWBI1_Types.hpp"
00043 #include "OWBI1_CommonFwd.hpp"
00044 
00045 namespace OWBI1
00046 {
00047 
00052 class OWBI1_OWBI1PROVIFC_API CIMUrl : public CIMBase
00053 {
00054 private:
00055    struct URLData;
00056    friend bool operator<(const CIMUrl::URLData& x,
00057          const CIMUrl::URLData& y);
00058 public:
00062    CIMUrl();
00066    explicit CIMUrl(CIMNULL_t);
00072    explicit CIMUrl(const String& spec);
00080    CIMUrl(const String& protocol, const String& host,
00081       const String& file, Int32 port=0);
00086    CIMUrl(const CIMUrl& arg);
00087    
00097    CIMUrl(const CIMUrl& context, const String& spec);
00101    ~CIMUrl();
00105    virtual void setNull();
00111    CIMUrl& operator= (const CIMUrl& arg);
00112 
00113    typedef COWIntrusiveReference<URLData> CIMUrl::*safe_bool;
00114    operator safe_bool () const
00115       {  return m_pdata ? &CIMUrl::m_pdata : 0; }
00116    bool operator!() const
00117       {  return !m_pdata; }
00123    bool equals(const CIMUrl& arg) const;
00129    bool operator== (const CIMUrl& arg) const
00130          {  return equals(arg); }
00137    bool operator!= (const CIMUrl& arg) const
00138       {  return !equals(arg); }
00142    String getSpec() const;
00146    String getProtocol() const;
00152    CIMUrl& setProtocol(const String& protocol);
00156    String getHost() const;
00162    CIMUrl& setHost(const String& host);
00166    Int32 getPort() const;
00170    String getFile() const;
00174    String getRef() const;
00181    bool sameFile(const CIMUrl& arg) const;
00185    bool isLocal() const;
00190    virtual void readObject(std::istream &istrm);
00195    virtual void writeObject(std::ostream &ostrm) const;
00199    virtual String toString() const;
00203    virtual String toMOF() const;
00204 private:
00205    void setLocalHost();
00206    void setComponents();
00207    void buildSpec();
00208    void checkRef();
00209    void setDefaultValues();
00210 
00211 #ifdef OWBI1_WIN32
00212 #pragma warning (push)
00213 #pragma warning (disable: 4251)
00214 #endif
00215 
00216    COWIntrusiveReference<URLData> m_pdata;
00217 
00218 #ifdef OWBI1_WIN32
00219 #pragma warning (pop)
00220 #endif
00221 
00222    friend OWBI1_OWBI1PROVIFC_API bool operator<(const CIMUrl& lhs, const CIMUrl& rhs);
00223 };
00224 
00225 } 
00226 
00227 #endif