1 | #include "attribute.hpp" |
---|
2 | #include "base_type.hpp" |
---|
3 | |
---|
4 | namespace xmlioserver |
---|
5 | { |
---|
6 | namespace tree |
---|
7 | { |
---|
8 | /// ////////////////////// Définitions ////////////////////// /// |
---|
9 | CAttribute::CAttribute(const StdString & id) |
---|
10 | : CObject(id), CBaseType() |
---|
11 | , value() |
---|
12 | { /* Ne rien faire de plus */ } |
---|
13 | |
---|
14 | CAttribute::CAttribute(const CAttribute & attribut) |
---|
15 | : CObject(attribut.getId()),CBaseType() |
---|
16 | { |
---|
17 | this->value = attribut.getAnyValue(); |
---|
18 | } |
---|
19 | |
---|
20 | CAttribute::~CAttribute(void) |
---|
21 | { /* Ne rien faire de plus */ } |
---|
22 | |
---|
23 | ///-------------------------------------------------------------- |
---|
24 | |
---|
25 | const boost::any & CAttribute::getAnyValue(void) const |
---|
26 | { |
---|
27 | return (this->value); |
---|
28 | } |
---|
29 | |
---|
30 | |
---|
31 | void CAttribute::setAnyValue(const boost::any & value) |
---|
32 | { |
---|
33 | this->value = value; |
---|
34 | } |
---|
35 | |
---|
36 | void CAttribute::clear(void) |
---|
37 | { |
---|
38 | this->value = boost::any(); |
---|
39 | } |
---|
40 | |
---|
41 | //--------------------------------------------------------------- |
---|
42 | |
---|
43 | bool CAttribute::isEmpty(void) const |
---|
44 | { |
---|
45 | return (this->value.empty()); |
---|
46 | } |
---|
47 | |
---|
48 | const StdString & CAttribute::getName(void) const |
---|
49 | { |
---|
50 | return (this->getId()); |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | ///-------------------------------------------------------------- |
---|
55 | |
---|
56 | } // namespace tree |
---|
57 | |
---|
58 | CMessage& operator<<(CMessage& msg,tree::CAttribute& type) |
---|
59 | { |
---|
60 | msg.push(type) ; |
---|
61 | return msg ; |
---|
62 | } |
---|
63 | |
---|
64 | CMessage& operator<<(CMessage& msg, const tree::CAttribute& type) |
---|
65 | { |
---|
66 | msg.push(*type.duplicate()) ; |
---|
67 | return msg ; |
---|
68 | } |
---|
69 | |
---|
70 | CBufferOut& operator<<(CBufferOut& buffer, tree::CAttribute& type) |
---|
71 | { |
---|
72 | |
---|
73 | if (!type.toBuffer(buffer)) ERROR("CBufferOut& operator<<(CBufferOut& buffer, tree::CAttribute& type)", |
---|
74 | <<"Buffer remain size is to low for size type") ; |
---|
75 | return buffer ; |
---|
76 | } |
---|
77 | |
---|
78 | CBufferIn& operator>>(CBufferIn& buffer, tree::CAttribute& type) |
---|
79 | { |
---|
80 | |
---|
81 | if (!type.fromBuffer(buffer)) ERROR("CBufferInt& operator>>(CBufferIn& buffer, tree::CAttribute& type)", |
---|
82 | <<"Buffer remain size is to low for size type") ; |
---|
83 | return buffer ; |
---|
84 | } |
---|
85 | |
---|
86 | } // namespace xmlioserver |
---|