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
979a9169
Commit
979a9169
authored
Sep 15, 2012
by
Jesse Beder
Browse files
Added small 'read' program to test reading a single doc (from stdin)
parent
1d1d6886
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
util/CMakeLists.txt
util/CMakeLists.txt
+3
-0
util/read.cpp
util/read.cpp
+30
-0
No files found.
util/CMakeLists.txt
View file @
979a9169
add_executable
(
sandbox sandbox.cpp
)
add_executable
(
sandbox sandbox.cpp
)
target_link_libraries
(
sandbox yaml-cpp
)
target_link_libraries
(
sandbox yaml-cpp
)
add_executable
(
read read.cpp
)
target_link_libraries
(
read yaml-cpp
)
util/read.cpp
0 → 100644
View file @
979a9169
#include "yaml-cpp/yaml.h"
#include "yaml-cpp/eventhandler.h"
#include <iostream>
class
NullEventHandler
:
public
YAML
::
EventHandler
{
public:
typedef
YAML
::
Mark
Mark
;
typedef
YAML
::
anchor_t
anchor_t
;
NullEventHandler
()
{}
virtual
void
OnDocumentStart
(
const
Mark
&
)
{}
virtual
void
OnDocumentEnd
()
{}
virtual
void
OnNull
(
const
Mark
&
,
anchor_t
)
{}
virtual
void
OnAlias
(
const
Mark
&
,
anchor_t
)
{}
virtual
void
OnScalar
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
,
const
std
::
string
&
)
{}
virtual
void
OnSequenceStart
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
)
{}
virtual
void
OnSequenceEnd
()
{}
virtual
void
OnMapStart
(
const
Mark
&
,
const
std
::
string
&
,
anchor_t
)
{}
virtual
void
OnMapEnd
()
{}
};
int
main
()
{
YAML
::
Parser
parser
(
std
::
cin
);
NullEventHandler
handler
;
parser
.
HandleNextDocument
(
handler
);
return
0
;
}
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