00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef JID_H__
00016 #define JID_H__
00017
00018 #include "macros.h"
00019
00020 #include <string>
00021
00022 namespace gloox
00023 {
00030 class GLOOX_API JID
00031 {
00032 public:
00033
00037 JID() {}
00038
00043 JID( const std::string& jid ) { setJID( jid ); }
00044
00048 ~JID() {}
00049
00054 void setJID( const std::string& jid );
00055
00060 const std::string& full() const { return m_full; }
00061
00066 const std::string& bare() const { return m_bare; }
00067
00073 JID bareJID() const { return JID( bare() ); }
00074
00081 GLOOX_DEPRECATED JID fullJID() const { return JID( full() ); }
00082
00087 void setUsername( const std::string& username );
00088
00093 void setServer( const std::string& server );
00094
00099 void setResource( const std::string& resource );
00100
00105 const std::string& username() const { return m_username; }
00106
00111 const std::string& server() const { return m_server; }
00112
00117 const std::string& serverRaw() const { return m_serverRaw; }
00118
00123 const std::string& resource() const { return m_resource; }
00124
00130 GLOOX_DEPRECATED bool empty() const { return m_server.empty(); }
00131
00136 bool operator==( const JID& right ) const { return full() == right.full(); }
00137
00142 bool operator!=( const JID& right ) const { return full() != right.full(); }
00143
00147 operator bool() const { return !m_server.empty(); }
00148
00149 private:
00150 std::string m_resource;
00151 std::string m_username;
00152 std::string m_server;
00153 std::string m_serverRaw;
00154 std::string m_bare;
00155 std::string m_full;
00156
00160 void setStrings() { setBare(); setFull(); }
00161
00166 void setBare();
00167
00171 void setFull();
00172 };
00173
00174 }
00175
00176 #endif // JID_H__