resource.h
/*
Copyright (c) 2004-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef RESOURCE_H__
#define RESOURCE_H__
#include "presence.h"
#include "util.h"
#include <string>
namespace gloox
{
class Presence;
class GLOOX_API Resource
{
friend class RosterItem;
public:
Resource( int priority, const std::string& msg, Presence::PresenceType presence )
: m_priority( priority ), m_message( msg ), m_presence( presence ) {}
virtual ~Resource()
{
util::clearList( m_extensions );
}
int priority() const { return m_priority; }
const std::string& message() const { return m_message; }
Presence::PresenceType presence() const { return m_presence; }
const StanzaExtensionList& extensions() const { return m_extensions; }
private:
void setPriority( int priority ) { m_priority = priority; }
void setMessage( std::string message ) { m_message = message; }
void setStatus( Presence::PresenceType presence ) { m_presence = presence; }
void setExtensions( const StanzaExtensionList& exts )
{
util::clearList( m_extensions );
StanzaExtensionList::const_iterator it = exts.begin();
for( ; it != exts.end(); ++it )
{
m_extensions.push_back( (*it)->clone() );
}
}
int m_priority;
std::string m_message;
std::string m_name;
Presence::PresenceType m_presence;
StanzaExtensionList m_extensions;
};
}
#endif // RESOURCE_H__
gloox::Presence
An abstraction of a presence stanza.
Definition presence.h:33
gloox::Presence::PresenceType
PresenceType
Definition presence.h:43
gloox::Resource::priority
int priority() const
Definition resource.h:62
gloox::Resource::extensions
const StanzaExtensionList & extensions() const
Definition resource.h:81
gloox::Resource::~Resource
virtual ~Resource()
Definition resource.h:53
gloox::Resource::Resource
Resource(int priority, const std::string &msg, Presence::PresenceType presence)
Definition resource.h:47
gloox::Resource::message
const std::string & message() const
Definition resource.h:68
gloox::Resource::presence
Presence::PresenceType presence() const
Definition resource.h:74
gloox::util::clearList
void clearList(std::list< T * > &L)
Definition util.h:152
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::StanzaExtensionList
std::list< const StanzaExtension * > StanzaExtensionList
Definition gloox.h:1272