gloox 1.0
|
00001 /* 00002 Copyright (c) 2004-2009 by Jakob Schroeter <js@camaya.net> 00003 This file is part of the gloox library. http://camaya.net/gloox 00004 00005 This software is distributed under a license. The full license 00006 agreement can be found in the file LICENSE in this distribution. 00007 This software may not be copied, modified, sold or distributed 00008 other than expressed in the named license agreement. 00009 00010 This software is distributed without any warranty. 00011 */ 00012 00013 00014 #ifndef RESOURCE_H__ 00015 #define RESOURCE_H__ 00016 00017 #include "presence.h" 00018 #include "util.h" 00019 00020 #include <string> 00021 00022 namespace gloox 00023 { 00024 00025 class Presence; 00026 00035 class GLOOX_API Resource 00036 { 00037 00038 friend class RosterItem; 00039 00040 public: 00047 Resource( int priority, const std::string& msg, Presence::PresenceType presence ) 00048 : m_priority( priority ), m_message( msg ), m_presence( presence ) {} 00049 00053 virtual ~Resource() 00054 { 00055 util::clearList( m_extensions ); 00056 } 00057 00062 int priority() const { return m_priority; } 00063 00068 const std::string& message() const { return m_message; } 00069 00074 Presence::PresenceType presence() const { return m_presence; } 00075 00081 const StanzaExtensionList& extensions() const { return m_extensions; } 00082 00083 private: 00084 void setPriority( int priority ) { m_priority = priority; } 00085 void setMessage( std::string message ) { m_message = message; } 00086 void setStatus( Presence::PresenceType presence ) { m_presence = presence; } 00087 void setExtensions( const StanzaExtensionList& exts ) 00088 { 00089 StanzaExtensionList::const_iterator it = exts.begin(); 00090 for( ; it != exts.end(); ++it ) 00091 { 00092 m_extensions.push_back( (*it)->clone() ); 00093 } 00094 } 00095 00096 int m_priority; 00097 std::string m_message; 00098 std::string m_name; 00099 Presence::PresenceType m_presence; 00100 StanzaExtensionList m_extensions; 00101 00102 }; 00103 00104 } 00105 00106 #endif // RESOURCE_H__