1 #include "yaml-cpp/yaml.h"
2 #include "yaml-cpp/eventhandler.h"
12 Params
ParseArgs(int argc
, char **argv
) {
15 std::vector
<std::string
> args(argv
+ 1, argv
+ argc
);
20 class NullEventHandler
: public YAML::EventHandler
23 virtual void OnDocumentStart(const YAML::Mark
&) {}
24 virtual void OnDocumentEnd() {}
26 virtual void OnNull(const YAML::Mark
&, YAML::anchor_t
) {}
27 virtual void OnAlias(const YAML::Mark
&, YAML::anchor_t
) {}
28 virtual void OnScalar(const YAML::Mark
&, const std::string
&, YAML::anchor_t
, const std::string
&) {}
30 virtual void OnSequenceStart(const YAML::Mark
&, const std::string
&, YAML::anchor_t
) {}
31 virtual void OnSequenceEnd() {}
33 virtual void OnMapStart(const YAML::Mark
&, const std::string
&, YAML::anchor_t
) {}
34 virtual void OnMapEnd() {}
37 void parse(std::istream
& input
)
40 YAML::Parser
parser(input
);
42 while(parser
.GetNextDocument(doc
)) {
43 YAML::Emitter emitter
;
45 std::cout
<< emitter
.c_str() << "\n";
47 } catch(const YAML::Exception
& e
) {
48 std::cerr
<< e
.what() << "\n";
52 int main(int argc
, char **argv
)
54 Params p
= ParseArgs(argc
, argv
);