1 /**
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2018-2019 Bareos GmbH & Co. KG
5 
6    This program is Free Software; you can redistribute it and/or
7    modify it under the terms of version three of the GNU Affero General Public
8    License as published by the Free Software Foundation and included
9    in the file LICENSE.
10 
11    This program is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14    Affero General Public License for more details.
15 
16    You should have received a copy of the GNU Affero General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19    02110-1301, USA.
20 */
21 
22 #ifndef BAREOS_LIB_QUALIFIED_RESOURCE_NAME_TYPE_CONVERTER_H_
23 #define BAREOS_LIB_QUALIFIED_RESOURCE_NAME_TYPE_CONVERTER_H_ 1
24 
25 #include "include/bareos.h"
26 
27 class QualifiedResourceNameTypeConverter {
28  public:
29   QualifiedResourceNameTypeConverter(const std::map<int, std::string>& map);
30   bool ResourceToString(const std::string& name_of_resource,
31                         const int& r_type,
32                         std::string& str_out) const;
33   bool ResourceToString(const std::string& name_of_resource,
34                         const int& r_type,
35                         const std::string separator,
36                         std::string& str_out) const;
37   bool StringToResource(std::string& name_of_resource,
38                         int& r_type,
39                         const std::string& in) const;
40 
41   std::string ResourceTypeToString(const int& type) const;
42   int StringToResourceType(const std::string&) const;
43 
44  private:
45   const std::map<int, std::string> type_name_relation_map_;
46   const std::map<std::string, int> name_type_relation_map_;
47 };
48 
49 #endif /* BAREOS_LIB_QUALIFIED_RESOURCE_NAME_TYPE_CONVERTER_H_ */
50