Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yaml-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
yaml-cpp
Commits
d506dae9
Commit
d506dae9
authored
Jul 31, 2009
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added IsNull function
parent
7a899204
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
include/null.h
+4
-0
src/null.cpp
+6
-0
yaml-reader/parsertests.cpp
+2
-5
No files found.
include/null.h
View file @
d506dae9
...
@@ -6,10 +6,14 @@
...
@@ -6,10 +6,14 @@
namespace
YAML
namespace
YAML
{
{
class
Node
;
struct
_Null
{};
struct
_Null
{};
inline
bool
operator
==
(
const
_Null
&
,
const
_Null
&
)
{
return
true
;
}
inline
bool
operator
==
(
const
_Null
&
,
const
_Null
&
)
{
return
true
;
}
inline
bool
operator
!=
(
const
_Null
&
,
const
_Null
&
)
{
return
false
;
}
inline
bool
operator
!=
(
const
_Null
&
,
const
_Null
&
)
{
return
false
;
}
bool
IsNull
(
const
Node
&
node
);
extern
_Null
Null
;
extern
_Null
Null
;
}
}
...
...
src/null.cpp
View file @
d506dae9
#include "null.h"
#include "null.h"
#include "node.h"
namespace
YAML
namespace
YAML
{
{
_Null
Null
;
_Null
Null
;
bool
IsNull
(
const
Node
&
node
)
{
return
node
.
Read
(
Null
);
}
}
}
yaml-reader/parsertests.cpp
View file @
d506dae9
...
@@ -261,8 +261,7 @@ namespace Test
...
@@ -261,8 +261,7 @@ namespace Test
doc
[
0
]
>>
output
;
doc
[
0
]
>>
output
;
if
(
output
!=
"hello"
)
if
(
output
!=
"hello"
)
return
false
;
return
false
;
doc
[
1
]
>>
output
;
if
(
!
IsNull
(
doc
[
1
]))
if
(
output
!=
"~"
)
return
false
;
return
false
;
doc
[
2
]
>>
output
;
doc
[
2
]
>>
output
;
if
(
output
!=
"world"
)
if
(
output
!=
"world"
)
...
@@ -297,9 +296,7 @@ namespace Test
...
@@ -297,9 +296,7 @@ namespace Test
YAML
::
Node
doc
;
YAML
::
Node
doc
;
parser
.
GetNextDocument
(
doc
);
parser
.
GetNextDocument
(
doc
);
std
::
string
output
;
if
(
!
IsNull
(
doc
[
"empty value"
]))
doc
[
"empty value"
]
>>
output
;
if
(
output
!=
"~"
)
return
false
;
return
false
;
return
true
;
return
true
;
...
...
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