Questions tagged [yaml-cpp]

yaml-cpp is an open source C++ library, for parsing and emitting YAML.

yaml-cpp is an open source C++ library, hosted on GitHub, for parsing and emitting YAML.

314 questions
4
votes
2 answers

How to preserve inserting order in yaml cpp

I have created a yamlmap which contains keys and values as strings and i have saved this to a text file.While loading the same text file the keys containing the strings are sorted automatically by yaml.Now i want to load the string names in the same…
vishnu
  • 363
  • 3
  • 20
4
votes
4 answers

Yaml-cpp (new API): Problems mixing maps and scalars in a sequence

I have a very simple problem parsing a yaml file of this form: - Foo - Bar: b1: 5 I would like to parse the top level keys as strings namely "Foo" and "Bar". As you can see the first entry in the sequence is a scalar and the second is a map…
user3293204
  • 151
  • 1
  • 4
  • 9
4
votes
2 answers

Idiomatic way to traverse nodes by reference

Starting with a string representing a path to a node that I want to retrieve data from, such as "a.b.c". Currently, the code that I am using to transverse the node hierarchy to reach that node looks something like this (may not compile, but you get…
Canute Bigler
  • 220
  • 1
  • 9
4
votes
2 answers

How to set an emit style for a particular yaml-cpp node

I'm emitting a YAML document as follows: YAML::Node doc; // ...populate doc... YAML::Emitter out; out << doc; Somewhere in the hierarchy of nodes I have a particular sequence that I would like to emit in the Flow style while everything else should…
Martin
  • 176
  • 3
  • 8
3
votes
1 answer

YAML to be used between C++ and Perl

I'm attempting to parse a YAML file output from Perl's YAML::Tiny using C++. As a C++ & YAML newbie, I'm using HowToParseADocument as a starting point. The monsters.yaml file, if created by using YAML::Tiny, looks like: --- name: Ogre position: [0,…
jim
  • 41
  • 2
3
votes
1 answer

Why do some Conan packages delete CMake Package information

I'm relatively new to Conan. I'm trying to use packages provided by conan in a very natural cmake way...i.e. I don't want anything conan specific in the consuming library's CMakeLists.txt. I just want to find_package my dependency,…
schrödinbug
  • 692
  • 9
  • 19
3
votes
1 answer

How to emit a string with quotes using yaml-cpp?

I want to emit a string with quotes using yaml-cpp so it looks like time_stamp: "August 10, 2011 01:37:52" in the output yaml file. How do I do it? Thanks.
Snow Wang
  • 41
  • 2
3
votes
1 answer

C++ reference inconsistency

I'm using the yaml-cpp library to parse yaml. Abbreviated sample: YAML::Node def = YAML::LoadFile(defFile); for (auto itemPair = def.begin(); itemPair != def.end(); ++itemPair) { // Grab a reference so `itemPair->second` doesn't need to be…
Vultour
  • 373
  • 4
  • 15
3
votes
2 answers

How to build a node with yaml-cpp?

I want to use yaml-cpp for a project of mine to generate a yaml-file however I have trouble figuring out how exactly I have to go about this. The yaml file I need to emit should look like this: action_counts: version: 0.3 subtree: - name:…
Necrotos
  • 61
  • 8
3
votes
1 answer

How to link library correctly in cmake?

I'm using yaml-cpp library recently. I follow the config file in "yaml-cpp-config.cmake.in" which content is # - Config file for the yaml-cpp package # It defines the following variables # YAML_CPP_INCLUDE_DIR - include directory # …
hankyuan
  • 31
  • 3
3
votes
1 answer

How to parse a file with yaml-cpp

I have a yaml file that looks like this: construction_cone_1: model: construction_cone model_type: sdf position: [ 1.2, 3.4, 0.0 ] orientation: [ 0.0, 0.0, 0 ] construction_cone_2: model: construction_cone model_type: sdf position:…
Federico Nardi
  • 510
  • 7
  • 19
3
votes
2 answers

Unable to build a usable yaml-cpp library (shared or static) with gcc 3.2.3 in Windows

I unfortunately am forced to use gcc 3.2.3 (MinGW) due to the 3rd party code base having issues with later versions of gcc. With gcc 3.2.3, I can build a static library (yaml-cpp.a) just fine (by editing the CMakeLists.txt file to remove the…
Gerry
  • 51
  • 3
3
votes
1 answer

Error at line 0, column 0: bad conversion while loading YAML file

Below is the yaml sample file which I have already validated through YAMLint URL but while loading this file with yaml-cpp library function LoadFile, I am getting error: "Error at line 0, column 0: bad conversion while loading YAML file" sample…
user2997518
  • 812
  • 6
  • 17
3
votes
1 answer

Convert user data types in yaml-cpp

This is example from tutorial from here: There is such class: struct Vec3 { double x, y, z; bool operator==(Vec3& other) const { return other.x == this->x && other.y == this->y && other.z == this->z;}}; This code for converting yaml data to user…
Kenenbek Arzymatov
  • 8,439
  • 19
  • 58
  • 109
3
votes
2 answers

confused by YAML::NodeType::Undefined with yaml-cpp

I have a test yaml file that I am trying to parse using yaml-cpp. test.yaml testConfig: # this points to additional config files to be parsed includes: required: "thing1.yaml" optional: "thing2.yaml" #some extraneous…
1 2
3
20 21