Skip to content

Commit

Permalink
lib: added a function to create a qualified resource name with given …
Browse files Browse the repository at this point in the history
…separator
  • Loading branch information
franku committed Jul 4, 2019
1 parent 46c25a0 commit e95bfb7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 12 additions & 2 deletions core/src/lib/qualified_resource_name_type_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,25 @@ int QualifiedResourceNameTypeConverter::StringToResourceType(
bool QualifiedResourceNameTypeConverter::ResourceToString(
const std::string& name_of_resource,
const int& r_type,
const std::string separator,
std::string& str_out) const
{
std::string r_name = ResourceTypeToString(r_type);
if (r_name.empty()) { return false; }
str_out =
r_name + AsciiControlCharacters::RecordSeparator() + name_of_resource;
str_out = r_name + separator + name_of_resource;
return true;
}


bool QualifiedResourceNameTypeConverter::ResourceToString(
const std::string& name_of_resource,
const int& r_type,
std::string& str_out) const
{
std::string separator(1, AsciiControlCharacters::RecordSeparator());
return ResourceToString(name_of_resource, r_type, separator, str_out);
}

bool QualifiedResourceNameTypeConverter::StringToResource(
std::string& name_of_resource,
int& r_type,
Expand Down
6 changes: 5 additions & 1 deletion core/src/lib/qualified_resource_name_type_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ class QualifiedResourceNameTypeConverter {
QualifiedResourceNameTypeConverter(const std::map<int, std::string>& map);
bool ResourceToString(const std::string& name_of_resource,
const int& r_type,
std::string& out) const;
std::string& str_out) const;
bool ResourceToString(const std::string& name_of_resource,
const int& r_type,
const std::string separator,
std::string& str_out) const;
bool StringToResource(std::string& name_of_resource,
int& r_type,
const std::string& in) const;
Expand Down

0 comments on commit e95bfb7

Please sign in to comment.