Skip to content

Commit

Permalink
resource: added class qualified_resource_name_type_converter
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Aug 31, 2018
1 parent 2e82d69 commit 76fedfc
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/src/lib/CMakeLists.txt
Expand Up @@ -37,8 +37,8 @@ set(INCLUDE_FILES ../include/baconfig.h ../include/bareos.h
crypto.h crypto_cache.h devlock.h dlist.h fnmatch.h
guid_to_name.h htable.h ini.h lex.h lib.h lockmgr.h
md5.h mem_pool.h message.h mntent_cache.h ordered_cbuf.h parse_conf.h
plugins.h queue.h rblist.h runscript.h rwlock.h
scsi_crypto.h scsi_lli.h scsi_tapealert.h sellist.h
plugins.h qualified_resource_name_type_converter.h queue.h rblist.h
runscript.h rwlock.h scsi_crypto.h scsi_lli.h scsi_tapealert.h sellist.h
serial.h sha1.h smartall.h status.h tls.h tls_conf.h tree.h var.h
watchdog.h workq.h)

Expand All @@ -51,7 +51,7 @@ set (BAREOS_SRCS address_conf.cc alist.cc attr.cc attribs.cc base64.cc
devlock.cc dlist.cc edit.cc fnmatch.cc guid_to_name.cc hmac.cc htable.cc
jcr.cc json.cc lockmgr.cc md5.cc mem_pool.cc message.cc mntent_cache.cc
output_formatter.cc ordered_cbuf.cc passphrase.cc path_list.cc plugins.cc
bpoll.cc priv.cc
bpoll.cc priv.cc qualified_resource_name_type_converter.cc
queue.cc rblist.cc runscript.cc rwlock.cc scan.cc scsi_crypto.cc scsi_lli.cc
sellist.cc serial.cc sha1.cc signal.cc smartall.cc tls.cc
tls_gnutls.cc tls_conf_base.cc tls_conf_psk.cc tls_conf_cert.cc tls_openssl.cc tls_openssl_crl.cc
Expand Down
50 changes: 50 additions & 0 deletions core/src/lib/qualified_resource_name_type_converter.cc
@@ -0,0 +1,50 @@
/**
BAREOS® - Backup Archiving REcovery Open Sourced
Copyright (C) 2018-2018 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/

#include "qualified_resource_name_type_converter.h"

QualifiedResourceNameTypeConverter::QualifiedResourceNameTypeConverter(std::map<std::string, int> map)
{
name_type_relation_map_ = map;
}

std::string QualifiedResourceNameTypeConverter::ResourceTypeToString(int type)
{
if (name_type_relation_map_.empty()) {
return std::string();
}
return std::string();
}

int QualifiedResourceNameTypeConverter::StringToResourceType(const std::string &)
{
if (name_type_relation_map_.empty()) {
return -1;
}
return -1;
}

std::string QualifiedResourceNameTypeConverter::ResourceNameToFullyQualifiedString(
std::string name_of_resource,
int type_of_resource)
{
return std::string();
}
38 changes: 38 additions & 0 deletions core/src/lib/qualified_resource_name_type_converter.h
@@ -0,0 +1,38 @@
/**
BAREOS® - Backup Archiving REcovery Open Sourced
Copyright (C) 2018-2018 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/

#ifndef BAREOS_LIB_QUALIFIED_RESOURCE_NAME_TYPE_CONVERTER_H_
#define BAREOS_LIB_QUALIFIED_RESOURCE_NAME_TYPE_CONVERTER_H_ 1

#include <bareos.h>

class QualifiedResourceNameTypeConverter {
public:
QualifiedResourceNameTypeConverter(std::map<std::string, int> map = std::map<std::string, int>());
std::string ResourceTypeToString(int type);
std::string ResourceNameToFullyQualifiedString(std::string name_of_resource, int type_of_resource);
int StringToResourceType(const std::string &);

private:
std::map<std::string, int> name_type_relation_map_;
};

#endif /* BAREOS_LIB_QUALIFIED_RESOURCE_NAME_TYPE_CONVERTER_H_ */

0 comments on commit 76fedfc

Please sign in to comment.