31 lines
744 B
C++
31 lines
744 B
C++
#include <iostream>
|
|
#include <fstream>
|
|
#include <sstream>
|
|
#include "yamal.hpp"
|
|
|
|
int main(int argc, char* argv[]) {
|
|
/*if (argc < 2) {
|
|
std::cerr << "Usage: " << argv[0] << " <yaml_file>\n";
|
|
return 1;
|
|
}*/
|
|
|
|
std::ifstream file("data/room/01.yaml"); //argv[1]);
|
|
if (!file) {
|
|
std::cerr << "Error: Could not open file " << argv[1] << "\n";
|
|
return 1;
|
|
}
|
|
|
|
std::ostringstream buffer;
|
|
buffer << file.rdbuf();
|
|
std::string yamlText = buffer.str();
|
|
|
|
yamal_ns::yamal root;
|
|
root.deserialize(yamlText);
|
|
|
|
//for (auto &att : root.attributes())
|
|
// std::cout << att.first << ": " << att.second.asString() << std::endl;
|
|
|
|
std::cout << root.serialize() << std::endl;
|
|
|
|
return 0;
|
|
} |