Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
yaml-cpp
Commits
bcdda402
"vscode:/vscode.git/clone" did not exist on "f8e1a7be3b156a83ffb04f7eb4e8e35356b68242"
Commit
bcdda402
authored
Nov 08, 2012
by
Jesse Beder
Browse files
Added Node::clear() function
parent
eb02dd8d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
include/yaml-cpp/node/impl.h
include/yaml-cpp/node/impl.h
+6
-1
include/yaml-cpp/node/node.h
include/yaml-cpp/node/node.h
+1
-0
test/new-api/nodetests.cpp
test/new-api/nodetests.cpp
+10
-0
No files found.
include/yaml-cpp/node/impl.h
View file @
bcdda402
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
namespace
YAML
namespace
YAML
{
{
inline
Node
::
Node
()
:
m_pNode
(
0
)
inline
Node
::
Node
()
:
m_pNode
(
NULL
)
{
{
}
}
...
@@ -168,6 +168,11 @@ namespace YAML
...
@@ -168,6 +168,11 @@ namespace YAML
return
*
this
;
return
*
this
;
}
}
inline
void
Node
::
clear
()
{
m_pNode
=
NULL
;
}
template
<
typename
T
>
template
<
typename
T
>
inline
void
Node
::
Assign
(
const
T
&
rhs
)
inline
void
Node
::
Assign
(
const
T
&
rhs
)
{
{
...
...
include/yaml-cpp/node/node.h
View file @
bcdda402
...
@@ -56,6 +56,7 @@ namespace YAML
...
@@ -56,6 +56,7 @@ namespace YAML
bool
is
(
const
Node
&
rhs
)
const
;
bool
is
(
const
Node
&
rhs
)
const
;
template
<
typename
T
>
Node
&
operator
=
(
const
T
&
rhs
);
template
<
typename
T
>
Node
&
operator
=
(
const
T
&
rhs
);
Node
&
operator
=
(
const
Node
&
rhs
);
Node
&
operator
=
(
const
Node
&
rhs
);
void
clear
();
// size/iterator
// size/iterator
std
::
size_t
size
()
const
;
std
::
size_t
size
()
const
;
...
...
test/new-api/nodetests.cpp
View file @
bcdda402
...
@@ -443,6 +443,15 @@ namespace Test
...
@@ -443,6 +443,15 @@ namespace Test
YAML_ASSERT
(
xy
);
YAML_ASSERT
(
xy
);
return
true
;
return
true
;
}
}
TEST
ClearNode
()
{
YAML
::
Node
node
=
YAML
::
Load
(
"[1, 2, 3]"
);
YAML_ASSERT
(
!
node
.
IsNull
());
node
.
clear
();
YAML_ASSERT
(
node
.
IsNull
());
return
true
;
}
}
}
void
RunNodeTest
(
TEST
(
*
test
)(),
const
std
::
string
&
name
,
int
&
passed
,
int
&
total
)
{
void
RunNodeTest
(
TEST
(
*
test
)(),
const
std
::
string
&
name
,
int
&
passed
,
int
&
total
)
{
...
@@ -501,6 +510,7 @@ namespace Test
...
@@ -501,6 +510,7 @@ namespace Test
RunNodeTest
(
&
Node
::
CloneMap
,
"clone map"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
CloneMap
,
"clone map"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
CloneAlias
,
"clone alias"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
CloneAlias
,
"clone alias"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
ForceInsertIntoMap
,
"force insert into map"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
ForceInsertIntoMap
,
"force insert into map"
,
passed
,
total
);
RunNodeTest
(
&
Node
::
ClearNode
,
"clear node"
,
passed
,
total
);
std
::
cout
<<
"Node tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
std
::
cout
<<
"Node tests: "
<<
passed
<<
"/"
<<
total
<<
" passed
\n
"
;
return
passed
==
total
;
return
passed
==
total
;
...
...
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