- Treballant en el deserialitzador
This commit is contained in:
17
main.cpp
17
main.cpp
@@ -1,9 +1,20 @@
|
||||
#include <iostream>
|
||||
#include "yamal.hpp"
|
||||
|
||||
std::string readFileToString(const std::string& filename) {
|
||||
std::ifstream ifs(filename);
|
||||
if (!ifs) {
|
||||
throw std::runtime_error("Cannot open file: " + filename);
|
||||
}
|
||||
std::ostringstream oss;
|
||||
oss << ifs.rdbuf(); // dump the whole stream buffer into oss
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
yamal root;
|
||||
root["room"]["name"] = "THE JAIL";
|
||||
yamal root = yamal_parser::parse(readFileToString("test.yaml"));
|
||||
|
||||
/*root["room"]["name"] = "THE JAIL";
|
||||
root["room"]["name"].setQuoted(true);
|
||||
root["room"]["bgColor"] = "bright_blue";
|
||||
root["room"]["connections"]["up"] = "null";
|
||||
@@ -40,7 +51,7 @@ int main(int argc, char* argv[]) {
|
||||
root["room"].setBlankLine(false);
|
||||
root["tilemap"].setComment("Tilemap: 16 filas x 32 columnas (256x192 píxeles @ 8px/tile)");
|
||||
root["tilemap"].appendComment("Índices de tiles (-1 = vacío)");
|
||||
root["room"]["bgColor"].setInlineComment("Azul oscuro");
|
||||
root["room"]["bgColor"].setInlineComment("Azul oscuro");*/
|
||||
std::cout << root.serialize() << std::endl;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user