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
1f4d8ee3
Commit
1f4d8ee3
authored
May 19, 2012
by
Jesse Beder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed parse
parent
06cb65c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
67 deletions
+0
-67
util/CMakeLists.txt
+0
-2
util/parse.cpp
+0
-65
No files found.
util/CMakeLists.txt
View file @
1f4d8ee3
add_executable
(
parse parse.cpp
)
target_link_libraries
(
parse yaml-cpp
)
util/parse.cpp
deleted
100644 → 0
View file @
06cb65c6
#include "yaml-cpp/yaml.h"
#include "yaml-cpp/eventhandler.h"
#include <fstream>
#include <iostream>
#include <vector>
struct
Params
{
bool
hasFile
;
std
::
string
fileName
;
};
Params
ParseArgs
(
int
argc
,
char
**
argv
)
{
Params
p
;
std
::
vector
<
std
::
string
>
args
(
argv
+
1
,
argv
+
argc
);
return
p
;
}
class
NullEventHandler
:
public
YAML
::
EventHandler
{
public
:
virtual
void
OnDocumentStart
(
const
YAML
::
Mark
&
)
{}
virtual
void
OnDocumentEnd
()
{}
virtual
void
OnNull
(
const
YAML
::
Mark
&
,
YAML
::
anchor_t
)
{}
virtual
void
OnAlias
(
const
YAML
::
Mark
&
,
YAML
::
anchor_t
)
{}
virtual
void
OnScalar
(
const
YAML
::
Mark
&
,
const
std
::
string
&
,
YAML
::
anchor_t
,
const
std
::
string
&
)
{}
virtual
void
OnSequenceStart
(
const
YAML
::
Mark
&
,
const
std
::
string
&
,
YAML
::
anchor_t
)
{}
virtual
void
OnSequenceEnd
()
{}
virtual
void
OnMapStart
(
const
YAML
::
Mark
&
,
const
std
::
string
&
,
YAML
::
anchor_t
)
{}
virtual
void
OnMapEnd
()
{}
};
void
parse
(
std
::
istream
&
input
)
{
try
{
YAML
::
Parser
parser
(
input
);
YAML
::
Node
doc
;
while
(
parser
.
GetNextDocument
(
doc
))
{
YAML
::
Emitter
emitter
;
emitter
<<
doc
;
std
::
cout
<<
emitter
.
c_str
()
<<
"
\n
"
;
}
}
catch
(
const
YAML
::
Exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
"
\n
"
;
}
}
int
main
(
int
argc
,
char
**
argv
)
{
Params
p
=
ParseArgs
(
argc
,
argv
);
if
(
argc
>
1
)
{
std
::
ifstream
fin
;
fin
.
open
(
argv
[
1
]);
parse
(
fin
);
}
else
{
parse
(
std
::
cin
);
}
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