gloox
1.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
src
pubsubitem.cpp
1
/*
2
Copyright (c) 2005-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
#include "pubsubitem.h"
15
#include "tag.h"
16
17
namespace
gloox
18
{
19
20
namespace
PubSub
21
{
22
23
Item::Item
()
24
: m_payload( 0 )
25
{
26
}
27
28
Item::Item
(
const
Tag
* tag )
29
: m_payload( 0 )
30
{
31
if
( !tag || tag->
name
() !=
"item"
)
32
return
;
33
34
m_id = tag->
findAttribute
(
"id"
);
35
36
if
( tag->
children
().size() )
37
m_payload = tag->
children
().front()->clone();
38
}
39
40
Item::Item
(
const
Item
& item )
41
: m_payload( item.m_payload ? item.m_payload->clone() : 0 )
42
{
43
m_id = item.m_id;
44
}
45
46
Item::~Item
()
47
{
48
delete
m_payload;
49
}
50
51
Tag
*
Item::tag
()
const
52
{
53
Tag
* t =
new
Tag
(
"item"
);
54
t->
addAttribute
(
"id"
, m_id );
55
if
( m_payload )
56
t->
addChild
( m_payload->
clone
() );
57
58
return
t;
59
}
60
61
}
62
63
}
Generated on Thu Jun 27 2013 13:02:36 for gloox by
1.8.1.2