Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
biboumi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
98
Issues
98
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
louiz’
biboumi
Commits
d33a3b7d
Commit
d33a3b7d
authored
May 30, 2014
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XmlNode::get_children, to get a list of matching children instead of the first
parent
6bde78b5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
src/xmpp/xmpp_stanza.cpp
src/xmpp/xmpp_stanza.cpp
+11
-0
src/xmpp/xmpp_stanza.hpp
src/xmpp/xmpp_stanza.hpp
+5
-1
No files found.
src/xmpp/xmpp_stanza.cpp
View file @
d33a3b7d
...
...
@@ -162,6 +162,17 @@ XmlNode* XmlNode::get_child(const std::string& name, const std::string& xmlns) c
return
nullptr
;
}
std
::
vector
<
XmlNode
*>
XmlNode
::
get_children
(
const
std
::
string
&
name
,
const
std
::
string
&
xmlns
)
const
{
std
::
vector
<
XmlNode
*>
res
;
for
(
auto
&
child
:
this
->
children
)
{
if
(
child
->
name
==
name
&&
child
->
get_tag
(
"xmlns"
)
==
xmlns
)
res
.
push_back
(
child
);
}
return
res
;
}
XmlNode
*
XmlNode
::
add_child
(
XmlNode
*
child
)
{
child
->
parent
=
this
;
...
...
src/xmpp/xmpp_stanza.hpp
View file @
d33a3b7d
...
...
@@ -86,9 +86,13 @@ public:
*/
std
::
string
get_tail
()
const
;
/**
* Get a pointer to the first child element with that name
* Get a pointer to the first child element with that name
and that xml namespace
*/
XmlNode
*
get_child
(
const
std
::
string
&
name
,
const
std
::
string
&
xmlns
)
const
;
/**
* Get a vector of all the children that have that name and that xml namespace.
*/
std
::
vector
<
XmlNode
*>
get_children
(
const
std
::
string
&
name
,
const
std
::
string
&
xmlns
)
const
;
/**
* Add a node child to this node. Assign this node to the child’s parent.
* Returns a pointer to the newly added child.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment