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
20
votes
2 answers

yaml-cpp Easiest way to iterate through a map with undefined values

I'd like to obtain every node in a map without knowing the keys. My YAML looks like this: characterType : type1 : attribute1 : something attribute2 : something type2 : attribute1 : something attribute2 : something I don't know how many…
delephin
  • 1,085
  • 1
  • 8
  • 10
13
votes
1 answer

fatal error: yaml-cpp/yaml.h: No such file or directory

I am trying to compile my own c++/qt5.2 app which uses yaml-cpp under Ubuntu 14.04. While issuing the make command I get the following error fatal error: yaml-cpp/yaml.h: No such file or directory on the line: #include How can I…
user1251007
  • 15,891
  • 14
  • 50
  • 76
10
votes
1 answer

Optional keys with yaml-cpp 0.5.1

A previous answer describes how to check if a key exists in a yaml node using YAML::Node::FindValue("parameter"). Unfortunately, I can't call this in the latest version (0.5.1): error: ‘class YAML::Node’ has no member named ‘FindValue’ Is this…
paco_uk
  • 445
  • 1
  • 5
  • 15
9
votes
8 answers

Compiler error with yaml-cpp - undefined reference to `YAML::detail::node_data::convert_to_map`

Here's the complete log: /tmp/ccCvErNZ.o: In function `YAML::detail::node& YAML::detail::node_data::get(std::string const&,…
apoorvumang
  • 169
  • 1
  • 2
  • 8
8
votes
2 answers

How to use yaml-cpp in a C++ program on Linux?

I have recently decided to use yaml as my configuration file technology, and am writing a c++ linux application on OpenSuse 11.3. The problem is that even after successfully installing cmake, compilling yaml-cpp as shown on the yaml-cpp docs page, I…
JWL
  • 13,591
  • 7
  • 57
  • 63
8
votes
1 answer

Save a YAML Emitter content to a file with YAML-CPP

I just started playing around with yaml-cpp, I managed to build it properly and run some of the examples from the yaml-cpp wiki but I can't find a way to save my emitter to a file. Is this not possible? I mean the PyYAML library has a 'dump'…
somada141
  • 81
  • 1
  • 2
8
votes
1 answer

Parsing yaml with yaml cpp

I am trying to parse a yaml usign yaml-cpp. This is my yaml: --- configuration: - height: 600 - widht: 800 - velocity: 1 - scroll: 30 types: - image: resources/images/grass.png name: grass - image: resources/images/water.png …
jmoren
  • 93
  • 1
  • 4
8
votes
3 answers

How to load YAML file via yaml-cpp?

I am very new to yaml-cpp. I tried the simplest program, but it failed and, and I couldn't find the answer from GitHub repository. #include #include "yaml-cpp/yaml.h" using namespace std; int main() { YAML::Node config =…
user001
  • 377
  • 2
  • 4
  • 8
7
votes
1 answer

Finding correct cmake configuration for yaml-cpp library

I was trying to use yaml-cpp in my project. It took me half an hour to correctly link the library by experimenting with the following names. After I finally stumbled across them in this file, I settled for this: find_package(yaml-cpp…
Gerry
  • 1,938
  • 3
  • 18
  • 25
7
votes
2 answers

Emitting JSON with yaml-cpp?

I'm using yaml-cpp on a for a variety of things on my project. Now I want to write out some data as JSON. Since JSON is a subset of YAML, at least for the features I need, I understand it should be possible to set some options in yaml-cpp to…
Jim
  • 651
  • 2
  • 7
  • 15
7
votes
1 answer

How to read a yaml node array into std::vector

A total noob with yaml-cpp. I have a node something like this: numbers : [1,2,3,4,5] In the CPP file, I want to parse into a vector: std::vector vi = node["numbers"]; This doesn't work. I can't find any documentation other than the tutorial-…
user2155055
  • 73
  • 1
  • 1
  • 3
7
votes
2 answers

Obtain Type of Value Stored in YAML::Node for yaml-cpp

Given this code: void LoadFromYaml(const YAML::Node& node){ const YAML::Node& Data=node["Data"]; if(Data){ if(Data.ValueIsInt)// Do something with integer. if(Data.ValueIsFloat)// Do something with float. …
ARandomFurry
  • 203
  • 3
  • 9
6
votes
1 answer

yaml-cpp read sequence in item

How can I read this YAML file with yaml-cpp: sensors: - id: 5 hardwareId: 28-000005a32133 type: 1 - id: 6 hardwareId: 28-000005a32132 type: 4 I can't understand how can I get sensors item, to use it. As I understand sensors is…
Dm3Ch
  • 621
  • 1
  • 10
  • 26
6
votes
2 answers

yaml-cpp parsing strings

Is it possible to parse YAML formatted strings with yaml-cpp? There isn't a YAML::Parser::Parser(std::string&) constructor. (I'm getting a YAML string via libcurl from a http-server.)
Jason
  • 63
  • 1
  • 3
6
votes
2 answers

Does YAML::Node have a Mark structure?

I know that during parsing, yaml-cpp can throw an exception that has nice file location (line and column number) information for where the exception occurred. How about post-parse? Is there any mechanism to determine the (first) line number of a…
zorch
  • 61
  • 1
1
2 3
20 21