mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 04:41:16 +00:00
Merged from core, rfaef276b1f6e
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Test
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!ret.ok) {
|
if(!ret.ok) {
|
||||||
std::cout << "Spec test " << index << " failed: " << name << "\n";
|
std::cout << "Parser test failed: " << name << "\n";
|
||||||
std::cout << ret.error << "\n";
|
std::cout << ret.error << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,3 +3,6 @@ target_link_libraries(parse yaml-cpp)
|
|||||||
|
|
||||||
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)
|
||||||
|
30
util/read.cpp
Normal file
30
util/read.cpp
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#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;
|
||||||
|
}
|
Reference in New Issue
Block a user