Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
410b0c2f
Commit
410b0c2f
authored
Jul 10, 2018
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(UniXML): added insertNext() function
parent
9c3a8cb0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
UniXML.h
include/UniXML.h
+4
-1
UniXML.cc
src/Various/UniXML.cc
+10
-4
No files found.
include/UniXML.h
View file @
410b0c2f
...
...
@@ -159,9 +159,12 @@ namespace uniset
// Добавить новый дочерний узел
static
xmlNode
*
createChild
(
xmlNode
*
node
,
const
std
::
string
&
title
,
const
std
::
string
&
text
);
// Добавить следующий узел
// Добавить следующий узел
(добавление в конец списка узлов на уровне node)
static
xmlNode
*
createNext
(
xmlNode
*
node
,
const
std
::
string
&
title
,
const
std
::
string
&
text
);
// Создать новый узел следующим за node
static
xmlNode
*
insertNext
(
xmlNode
*
node
,
const
std
::
string
&
title
,
const
std
::
string
&
text
);
// Удалить указанный узел и все вложенные узлы
static
void
removeNode
(
xmlNode
*
node
);
...
...
src/Various/UniXML.cc
View file @
410b0c2f
...
...
@@ -159,10 +159,7 @@ string UniXML::getProp(const xmlNode* node, const string& name) noexcept
xmlChar
*
text
=
::
xmlGetProp
((
xmlNode
*
)
node
,
(
const
xmlChar
*
)
name
.
c_str
());
if
(
text
==
NULL
)
{
xmlFree
(
text
);
return
""
;
}
try
{
...
...
@@ -224,7 +221,7 @@ xmlNode* UniXML::createChild(xmlNode* node, const string& title, const string& t
return
::
xmlNewChild
(
node
,
NULL
,
(
const
xmlChar
*
)
title
.
c_str
(),
(
const
xmlChar
*
)
text
.
c_str
());
}
// -----------------------------------------------------------------------------
xmlNode
*
UniXML
::
createNext
(
xmlNode
*
node
,
const
string
&
title
,
const
string
&
text
)
xmlNode
*
UniXML
::
createNext
(
xmlNode
*
node
,
const
string
&
title
,
const
string
&
text
)
{
if
(
node
->
parent
)
return
createChild
(
node
->
parent
,
title
,
text
);
...
...
@@ -232,6 +229,15 @@ xmlNode* UniXML::createNext(xmlNode* node, const string& title, const string& te
return
0
;
}
// -----------------------------------------------------------------------------
xmlNode
*
UniXML
::
insertNext
(
xmlNode
*
node
,
const
string
&
title
,
const
string
&
text
)
{
xmlNode
*
newNode
=
createNext
(
node
,
title
,
text
);
if
(
newNode
)
return
::
xmlAddNextSibling
(
node
,
newNode
);
return
0
;
}
// -----------------------------------------------------------------------------
/// Удаление указанного узла со всеми вложенными
void
UniXML
::
removeNode
(
xmlNode
*
node
)
{
...
...
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