libhomegear-base  0.7
Base library for Homegear and Homegear family modules.
HomegearDeviceTranslation.h
Go to the documentation of this file.
1 /* Copyright 2013-2019 Homegear GmbH
2  *
3  * libhomegear-base is free software: you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public License as
5  * published by the Free Software Foundation, either version 3 of the
6  * License, or (at your option) any later version.
7  *
8  * libhomegear-base is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with libhomegear-base. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  * In addition, as a special exception, the copyright holders give
18  * permission to link the code of portions of this program with the
19  * OpenSSL library under certain conditions as described in each
20  * individual source file, and distribute linked combinations
21  * including the two.
22  * You must obey the GNU Lesser General Public License in all respects
23  * for all of the code used other than OpenSSL. If you modify
24  * file(s) with this exception, you may extend this exception to your
25  * version of the file(s), but you are not obligated to do so. If you
26  * do not wish to do so, delete this exception statement from your
27  * version. If you delete this exception statement from all source
28  * files in the program, then also delete it here.
29 */
30 
31 #ifndef HOMEGEARDEVICETRANSLATION_H_
32 #define HOMEGEARDEVICETRANSLATION_H_
33 
34 #include <string>
35 #include <memory>
36 #include <unordered_map>
37 
38 namespace rapidxml
39 {
40 class xml_node;
41 }
42 
43 using namespace rapidxml;
44 
45 namespace BaseLib
46 {
47 
48 class SharedObjects;
49 
50 namespace DeviceDescription
51 {
52 
54 
58 typedef std::shared_ptr<HomegearDeviceTranslation> PHomegearDeviceTranslation;
59 
64 {
65 public:
67  {
68  std::string label;
69  std::string description;
70  };
71 
72  HomegearDeviceTranslation(BaseLib::SharedObjects* baseLib, std::string xmlFilename);
73  virtual ~HomegearDeviceTranslation();
74 
75  //{{{ XML entries
76  std::string lang;
77  std::unordered_map<std::string, std::string> typeDescriptions;
78  std::unordered_map<std::string, std::string> typeLongDescriptions;
79  std::unordered_map<std::string, std::unordered_map<std::string, ParameterTranslation>> configParameters;
80  std::unordered_map<std::string, std::unordered_map<std::string, ParameterTranslation>> linkParameters;
81  std::unordered_map<std::string, std::unordered_map<std::string, ParameterTranslation>> variables;
82  //}}}
83 
84  bool loaded() { return _loaded; }
85 protected:
86  BaseLib::SharedObjects* _bl = nullptr;
87  bool _loaded = false;
88 
89  void load(std::string xmlFilename);
90  void parseXML(xml_node* node);
91 };
92 }
93 }
94 
95 #endif
std::unordered_map< std::string, std::unordered_map< std::string, ParameterTranslation > > variables
Definition: HomegearDeviceTranslation.h:81
std::string label
Definition: HomegearDeviceTranslation.h:68
This is the base library main class.
Definition: BaseLib.h:95
std::unordered_map< std::string, std::unordered_map< std::string, ParameterTranslation > > linkParameters
Definition: HomegearDeviceTranslation.h:80
Definition: BaseLib.cpp:34
Class defining a Homegear device translation.
Definition: HomegearDeviceTranslation.h:63
std::unordered_map< std::string, std::unordered_map< std::string, ParameterTranslation > > configParameters
Definition: HomegearDeviceTranslation.h:79
std::string lang
Definition: HomegearDeviceTranslation.h:76
bool loaded()
Definition: HomegearDeviceTranslation.h:84
std::shared_ptr< HomegearDeviceTranslation > PHomegearDeviceTranslation
Helper type for HomegearDeviceTranslation pointers.
Definition: HomegearDeviceTranslation.h:53
std::unordered_map< std::string, std::string > typeDescriptions
Definition: HomegearDeviceTranslation.h:77
std::unordered_map< std::string, std::string > typeLongDescriptions
Definition: HomegearDeviceTranslation.h:78
std::string description
Definition: HomegearDeviceTranslation.h:69
Class representing a node of XML document.
Definition: rapidxml.h:539
Definition: BinaryPayload.h:38