libzypp 17.37.17
tvmsettings.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
9
10#ifndef ZYPP_SHARED_TVM_TVMSETTINGS_H_INCLUDED
11#define ZYPP_SHARED_TVM_TVMSETTINGS_H_INCLUDED
12
13#include <string>
14#include <vector>
15#include <yaml-cpp/node/node.h>
16
17namespace zypp::test {
18
20 {
21 struct Device {
22 std::string name; // the device name
23 std::string insertedPath; // the path what is currently inserted into the device
24 };
25 std::vector<Device> devices;
26 };
27}
28
29namespace YAML {
30 template<>
31 struct convert<zypp::test::TVMSettings> {
32 static Node encode(const zypp::test::TVMSettings& rhs) {
33 Node node;
34 node["devices"] = rhs.devices;
35 return node;
36 }
37
38 static bool decode(const Node& node, zypp::test::TVMSettings& rhs) {
39 if(!node.IsMap() || !node["devices"] ) {
40 return false;
41 }
42
43 rhs.devices = node["devices"].as<std::vector<zypp::test::TVMSettings::Device>>();
44 return true;
45 }
46 };
47
48 template<>
49 struct convert<zypp::test::TVMSettings::Device> {
50 static Node encode(const zypp::test::TVMSettings::Device& rhs) {
51 Node node;
52 node["name"] = rhs.name;
53 node["insertedPath"] = rhs.insertedPath;
54 return node;
55 }
56
57 static bool decode(const Node& node, zypp::test::TVMSettings::Device& rhs) {
58 if(!node.IsMap() || !node["name"] || !node["insertedPath"] ) {
59 return false;
60 }
61
62 rhs.name = node["name"].as<std::string>();
63 rhs.insertedPath = node["insertedPath"].as<std::string>();
64 return true;
65 }
66 };
67}
68
69
70#endif
Easy-to use interface to the ZYPP dependency resolver.
static Node encode(const zypp::test::TVMSettings &rhs)
Definition tvmsettings.h:32
static bool decode(const Node &node, zypp::test::TVMSettings &rhs)
Definition tvmsettings.h:38
static bool decode(const Node &node, zypp::test::TVMSettings::Device &rhs)
Definition tvmsettings.h:57
static Node encode(const zypp::test::TVMSettings::Device &rhs)
Definition tvmsettings.h:50
std::vector< Device > devices
Definition tvmsettings.h:25