gloox 1.0.27
resource.h
1/*
2 Copyright (c) 2004-2023 by Jakob Schröter <js@camaya.net>
3 This file is part of the gloox library. http://camaya.net/gloox
4
5 This software is distributed under a license. The full license
6 agreement can be found in the file LICENSE in this distribution.
7 This software may not be copied, modified, sold or distributed
8 other than expressed in the named license agreement.
9
10 This software is distributed without any warranty.
11*/
12
13
14#ifndef RESOURCE_H__
15#define RESOURCE_H__
16
17#include "presence.h"
18#include "util.h"
19
20#include <string>
21
22namespace gloox
23{
24
25 class Presence;
26
35 class GLOOX_API Resource
36 {
37
38 friend class RosterItem;
39
40 public:
47 Resource( int priority, const std::string& msg, Presence::PresenceType presence )
48 : m_priority( priority ), m_message( msg ), m_presence( presence ) {}
49
53 virtual ~Resource()
54 {
55 util::clearList( m_extensions );
56 }
57
62 int priority() const { return m_priority; }
63
68 const std::string& message() const { return m_message; }
69
74 Presence::PresenceType presence() const { return m_presence; }
75
81 const StanzaExtensionList& extensions() const { return m_extensions; }
82
83 private:
84 void setPriority( int priority ) { m_priority = priority; }
85 void setMessage( std::string message ) { m_message = message; }
86 void setStatus( Presence::PresenceType presence ) { m_presence = presence; }
87 void setExtensions( const StanzaExtensionList& exts )
88 {
89 util::clearList( m_extensions );
90 StanzaExtensionList::const_iterator it = exts.begin();
91 for( ; it != exts.end(); ++it )
92 {
93 m_extensions.push_back( (*it)->clone() );
94 }
95 }
96
97 int m_priority;
98 std::string m_message;
99 std::string m_name;
100 Presence::PresenceType m_presence;
101 StanzaExtensionList m_extensions;
102
103 };
104
105}
106
107#endif // RESOURCE_H__
Holds resource attributes.
Definition resource.h:36
int priority() const
Definition resource.h:62
const StanzaExtensionList & extensions() const
Definition resource.h:81
virtual ~Resource()
Definition resource.h:53
Resource(int priority, const std::string &msg, Presence::PresenceType presence)
Definition resource.h:47
const std::string & message() const
Definition resource.h:68
Presence::PresenceType presence() const
Definition resource.h:74
An abstraction of a roster item.
Definition rosteritem.h:41
The namespace for the gloox library.
Definition adhoc.cpp:28
std::list< const StanzaExtension * > StanzaExtensionList
Definition gloox.h:1272