gloox
1.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
src
softwareversion.cpp
1
/*
2
Copyright (c) 2008-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 "softwareversion.h"
16
#include "tag.h"
17
18
namespace
gloox
19
{
20
21
SoftwareVersion::SoftwareVersion
(
const
std::string& name,
22
const
std::string& version,
23
const
std::string& os )
24
:
StanzaExtension
(
ExtVersion
), m_name( name ), m_version( version ), m_os( os )
25
{
26
}
27
28
SoftwareVersion::SoftwareVersion
(
const
Tag
* tag )
29
:
StanzaExtension
(
ExtVersion
)
30
{
31
if
( !tag )
32
return
;
33
34
Tag
* t = tag->
findChild
(
"name"
);
35
if
( t )
36
m_name = t->
cdata
();
37
38
t = tag->
findChild
(
"version"
);
39
if
( t )
40
m_version = t->
cdata
();
41
42
t = tag->
findChild
(
"os"
);
43
if
( t )
44
m_os = t->
cdata
();
45
}
46
47
SoftwareVersion::~SoftwareVersion
()
48
{
49
}
50
51
const
std::string&
SoftwareVersion::filterString
()
const
52
{
53
static
const
std::string filter =
"/iq/query[@xmlns='"
+
XMLNS_VERSION
+
"']"
;
54
return
filter;
55
}
56
57
Tag
*
SoftwareVersion::tag
()
const
58
{
59
Tag
* t =
new
Tag
(
"query"
);
60
t->
setXmlns
(
XMLNS_VERSION
);
61
62
if
( !m_name.empty() )
63
new
Tag
( t,
"name"
, m_name );
64
65
if
( !m_version.empty() )
66
new
Tag
( t,
"version"
, m_version );
67
68
if
( !m_os.empty() )
69
new
Tag
( t,
"os"
, m_os );
70
71
return
t;
72
}
73
74
}
Generated on Thu Jun 27 2013 13:02:36 for gloox by
1.8.1.2