gloox
1.1-svn
Main Page
Related Pages
Namespaces
Classes
Files
File List
src
rap.cpp
1
/*
2
Copyright (c) 2009 by Jakob Schroeter <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
15
#include "rap.h"
16
#include "tag.h"
17
18
#include <cstdlib>
19
20
namespace
gloox
21
{
22
23
RAP::RAP
(
const
Tag
* tag )
24
:
StanzaExtension
(
ExtRAP
), m_primary( false )
25
{
26
if
( !tag || tag->
name
() !=
"rap"
|| tag->
xmlns
() !=
XMLNS_RAP
)
27
return
;
28
29
m_ns = tag->
findAttribute
(
"ns"
);
30
m_num = strtol( tag->
findAttribute
(
"num"
).c_str(), 0, 10 );
31
32
m_primary = tag->
hasChild
(
"primary"
);
33
}
34
35
RAP::RAP
(
const
std::string& ns,
int
num )
36
:
StanzaExtension
(
ExtRAP
), m_ns( ns ), m_num( num ), m_primary( false )
37
{
38
}
39
40
RAP::~RAP
()
41
{
42
}
43
44
const
std::string&
RAP::filterString
()
const
45
{
46
static
const
std::string filter =
"/presence/rap[@xmlns='"
+
XMLNS_RAP
+
"']"
;
47
return
filter;
48
}
49
50
Tag
*
RAP::tag
()
const
51
{
52
Tag
* t =
new
Tag
(
"rap"
);
53
t->
setXmlns
(
XMLNS_RAP
);
54
t->
addAttribute
(
"ns"
, m_ns );
55
t->
addAttribute
(
"num"
, m_num );
56
if
( m_primary )
57
new
Tag
( t,
"primary"
);
58
59
return
t;
60
}
61
62
}
Generated on Thu Jun 27 2013 13:43:27 for gloox by
1.8.1.2