Skip to content

Commit

Permalink
conf
Browse files Browse the repository at this point in the history
DirUrl should hold the collection value information
  • Loading branch information
tnut committed Mar 28, 2024
1 parent 3bda7f1 commit 0a7829c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace cards {
struct DirUrl {
std::string dir;
std::string url;
std::string collection;
};

class Conf
Expand All @@ -25,6 +26,7 @@ class Conf
std::string username();
std::string password();
std::string database();

std::string arch();
std::string logdir();
std::vector<std::string> groups();
Expand Down
19 changes: 19 additions & 0 deletions src/string_utils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,25 @@ std::set<std::string> parseDelimitedSetList(const std::string& s, const char *de
delete[] cstr;
return list;
}
const std::vector<std::string> parseDelimitedVectorList
(const std::string& s, const char& c)
{
std::string b{""};
std::vector<std::string> v;

for (auto n:s)
{
if(n != c) b+=n; else
if(n == c && b != "")
{
v.push_back(b);
b="";
}
}
if(b != "")
v.push_back(b);
return v;
}
std::string stripWhiteSpace(const std::string& s)
{
if ( s.empty() )
Expand Down
3 changes: 3 additions & 0 deletions src/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ std::string stripWhiteSpace(const std::string& s);
std::vector<std::string> parseDelimitedVectorList
(const std::string& s, const char *delimiter);

const std::vector<std::string> parseDelimitedVectorList
(const std::string& s, const char& c);

/* populate a set of string with delimited characters */
std::set<std::string> parseDelimitedSetList
(const std::string& s, const char *delimiter);
Expand Down

0 comments on commit 0a7829c

Please sign in to comment.