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
52bcefa1
"...composable_kernel.git" did not exist on "f677f7028ba0d48d64995bd4c2367fdc3c1b5e90"
Commit
52bcefa1
authored
Apr 02, 2016
by
TripleWhy
Committed by
Jesse Beder
Apr 01, 2016
Browse files
Make null handling YAML 1.2 compliant.
parent
34bd1a70
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
include/yaml-cpp/null.h
include/yaml-cpp/null.h
+2
-0
src/emitterutils.cpp
src/emitterutils.cpp
+2
-5
src/null.cpp
src/null.cpp
+4
-0
src/singledocparser.cpp
src/singledocparser.cpp
+2
-1
No files found.
include/yaml-cpp/null.h
View file @
52bcefa1
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#endif
#endif
#include "yaml-cpp/dll.h"
#include "yaml-cpp/dll.h"
#include <string>
namespace
YAML
{
namespace
YAML
{
class
Node
;
class
Node
;
...
@@ -17,6 +18,7 @@ inline bool operator==(const _Null&, const _Null&) { return true; }
...
@@ -17,6 +18,7 @@ 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
;
}
YAML_CPP_API
bool
IsNull
(
const
Node
&
node
);
// old API only
YAML_CPP_API
bool
IsNull
(
const
Node
&
node
);
// old API only
YAML_CPP_API
bool
IsNullString
(
const
std
::
string
&
str
);
extern
YAML_CPP_API
_Null
Null
;
extern
YAML_CPP_API
_Null
Null
;
}
}
...
...
src/emitterutils.cpp
View file @
52bcefa1
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include "stringsource.h"
#include "stringsource.h"
#include "yaml-cpp/binary.h" // IWYU pragma: keep
#include "yaml-cpp/binary.h" // IWYU pragma: keep
#include "yaml-cpp/ostream_wrapper.h"
#include "yaml-cpp/ostream_wrapper.h"
#include "yaml-cpp/null.h"
namespace
YAML
{
namespace
YAML
{
namespace
Utils
{
namespace
Utils
{
...
@@ -152,12 +153,8 @@ void WriteCodePoint(ostream_wrapper& out, int codePoint) {
...
@@ -152,12 +153,8 @@ void WriteCodePoint(ostream_wrapper& out, int codePoint) {
bool
IsValidPlainScalar
(
const
std
::
string
&
str
,
FlowType
::
value
flowType
,
bool
IsValidPlainScalar
(
const
std
::
string
&
str
,
FlowType
::
value
flowType
,
bool
allowOnlyAscii
)
{
bool
allowOnlyAscii
)
{
if
(
str
.
empty
())
{
return
false
;
}
// check against null
// check against null
if
(
str
==
"null"
)
{
if
(
IsNullString
(
str
)
)
{
return
false
;
return
false
;
}
}
...
...
src/null.cpp
View file @
52bcefa1
...
@@ -2,4 +2,8 @@
...
@@ -2,4 +2,8 @@
namespace
YAML
{
namespace
YAML
{
_Null
Null
;
_Null
Null
;
bool
IsNullString
(
const
std
::
string
&
str
)
{
return
str
.
empty
()
||
str
==
"~"
||
str
==
"null"
||
str
==
"Null"
||
str
==
"NULL"
;
}
}
}
src/singledocparser.cpp
View file @
52bcefa1
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/eventhandler.h"
#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
#include "yaml-cpp/mark.h"
#include "yaml-cpp/mark.h"
#include "yaml-cpp/null.h"
namespace
YAML
{
namespace
YAML
{
SingleDocParser
::
SingleDocParser
(
Scanner
&
scanner
,
const
Directives
&
directives
)
SingleDocParser
::
SingleDocParser
(
Scanner
&
scanner
,
const
Directives
&
directives
)
...
@@ -75,7 +76,7 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) {
...
@@ -75,7 +76,7 @@ void SingleDocParser::HandleNode(EventHandler& eventHandler) {
const
Token
&
token
=
m_scanner
.
peek
();
const
Token
&
token
=
m_scanner
.
peek
();
if
(
token
.
type
==
Token
::
PLAIN_SCALAR
&&
token
.
value
==
"null"
)
{
if
(
token
.
type
==
Token
::
PLAIN_SCALAR
&&
IsNullString
(
token
.
value
)
)
{
eventHandler
.
OnNull
(
mark
,
anchor
);
eventHandler
.
OnNull
(
mark
,
anchor
);
m_scanner
.
pop
();
m_scanner
.
pop
();
return
;
return
;
...
...
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