1#if defined(HTML___NODE__HPP)  &&  !defined(HTML___NODE__INL)
2#define HTML___NODE__INL
3
4/*  $Id: node.inl 103491 2007-05-04 17:18:18Z kazimird $
5 * ===========================================================================
6 *
7 *                            PUBLIC DOMAIN NOTICE
8 *               National Center for Biotechnology Information
9 *
10 *  This software/database is a "United States Government Work" under the
11 *  terms of the United States Copyright Act.  It was written as part of
12 *  the author's official duties as a United States Government employee and
13 *  thus cannot be copyrighted.  This software/database is freely available
14 *  to the public for use. The National Library of Medicine and the U.S.
15 *  Government have not placed any restriction on its use or reproduction.
16 *
17 *  Although all reasonable efforts have been taken to ensure the accuracy
18 *  and reliability of the software and data, the NLM and the U.S.
19 *  Government do not and cannot warrant the performance or results that
20 *  may be obtained by using this software or data. The NLM and the U.S.
21 *  Government disclaim all warranties, express or implied, including
22 *  warranties of performance, merchantability or fitness for any particular
23 *  purpose.
24 *
25 *  Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author:  Eugene Vasilchenko
30 *
31 */
32
33
34inline
35const string& CNCBINode::GetName(void) const
36{
37    return m_Name;
38}
39
40
41inline
42bool CNCBINode::HaveChildren(void) const
43{
44#if NCBI_LIGHTWEIGHT_LIST
45    return !m_Children.empty();
46#else
47    return m_Children.get() != 0;
48#endif
49}
50
51
52inline
53CNCBINode::TChildren& CNCBINode::Children(void)
54{
55#if NCBI_LIGHTWEIGHT_LIST
56    return m_Children;
57#else
58    return *m_Children;
59#endif
60}
61
62
63inline
64const CNCBINode::TChildren& CNCBINode::Children(void) const
65{
66#if NCBI_LIGHTWEIGHT_LIST
67    return m_Children;
68#else
69    return *m_Children;
70#endif
71}
72
73
74inline
75CNCBINode::TChildren& CNCBINode::GetChildren(void)
76{
77#if NCBI_LIGHTWEIGHT_LIST
78    return m_Children;
79#else
80    TChildren* children = m_Children.get();
81    if ( !children )
82        m_Children.reset(children = new TChildren);
83    return *children;
84#endif
85}
86
87
88inline
89CNCBINode::TChildren::iterator CNCBINode::ChildBegin(void)
90{
91    return Children().begin();
92}
93
94
95inline
96CNCBINode::TChildren::iterator CNCBINode::ChildEnd(void)
97{
98    return Children().end();
99}
100
101
102inline
103CNCBINode* CNCBINode::Node(TChildren::iterator i)
104{
105    return &**i;
106}
107
108
109inline
110CNCBINode::TChildren::const_iterator CNCBINode::ChildBegin(void) const
111{
112    return Children().begin();
113}
114
115
116inline
117CNCBINode::TChildren::const_iterator CNCBINode::ChildEnd(void) const
118{
119    return Children().end();
120}
121
122
123inline
124const CNCBINode* CNCBINode::Node(TChildren::const_iterator i)
125{
126    return &**i;
127}
128
129
130inline
131CNCBINode* CNCBINode::AppendChild(CNCBINode* child)
132{
133    if ( child ) {
134        DoAppendChild(child);
135    }
136    return this;
137}
138
139
140inline
141CNCBINode* CNCBINode::AppendChild(CNodeRef& ref)
142{
143    DoAppendChild(ref.GetPointer());
144    return this;
145}
146
147
148inline
149bool CNCBINode::HaveAttributes(void) const
150{
151    return m_Attributes.get() != 0;
152}
153
154
155inline
156CNCBINode::TAttributes& CNCBINode::Attributes(void)
157{
158    return *m_Attributes;
159}
160
161
162inline
163const CNCBINode::TAttributes& CNCBINode::Attributes(void) const
164{
165    return *m_Attributes;
166}
167
168
169inline
170CNCBINode::TAttributes& CNCBINode::GetAttributes(void)
171{
172#if NCBI_LIGHTWEIGHT_LIST
173    return m_Attributes;
174#else
175    TAttributes* attributes = m_Attributes.get();
176    if ( !attributes ) {
177        m_Attributes.reset(attributes = new TAttributes);
178    }
179    return *attributes;
180#endif
181}
182
183
184inline
185void CNCBINode::SetAttribute(const string& name, const string& value)
186{
187    DoSetAttribute(name, value, false);
188}
189
190
191inline
192void CNCBINode::SetOptionalAttribute(const string& name, const string& value)
193{
194    if ( !value.empty() ) {
195        SetAttribute(name, value);
196    }
197}
198
199
200inline
201void CNCBINode::SetOptionalAttribute(const string& name, bool value)
202{
203    if ( value ) {
204        SetAttribute(name);
205    }
206}
207
208
209inline
210void CNCBINode::SetOptionalAttribute(const char* name, const string& value)
211{
212    if ( !value.empty() ) {
213        SetAttribute(name, value);
214    }
215}
216
217
218inline
219void CNCBINode::SetOptionalAttribute(const char* name, bool value)
220{
221    if ( value ) {
222        SetAttribute(name);
223    }
224}
225
226
227inline
228size_t CNCBINode::GetRepeatCount(void)
229{
230    return m_RepeatCount;
231}
232
233
234inline
235void CNCBINode::SetRepeatCount(size_t count)
236{
237    m_RepeatCount = count;
238}
239
240
241inline
242void CNCBINode::RepeatTag(bool repeat)
243{
244    m_RepeatTag = repeat;
245}
246
247
248inline
249bool CNCBINode::NeedRepeatTag(void)
250{
251    return m_RepeatTag;
252}
253
254#endif /* def HTML___NODE__HPP  &&  ndef HTML___NODE__INL */
255