data: saving graph nodes with short name only
This change saves only the short names in the node, getName() no only gives the short version. The fullName is assembled from the parent nodes on demand using the getFullName() method.
This commit is contained in:
@@ -6,10 +6,37 @@
|
||||
|
||||
namespace utility
|
||||
{
|
||||
std::vector<std::string> split(const std::string& str, char delimiter);
|
||||
std::vector<std::string> split(const std::string& str, const std::string& delimiter);
|
||||
template<typename ContainerType = std::vector<std::string>>
|
||||
ContainerType split(const std::string& str, char delimiter);
|
||||
|
||||
template<typename ContainerType = std::vector<std::string>>
|
||||
ContainerType split(const std::string& str, const std::string& delimiter);
|
||||
|
||||
bool isPrefix(const std::string& prefix, const std::string& text);
|
||||
}
|
||||
|
||||
template<typename ContainerType>
|
||||
ContainerType utility::split(const std::string& str, char delimiter)
|
||||
{
|
||||
return split<ContainerType>(str, std::string(1, delimiter));
|
||||
}
|
||||
|
||||
template<typename ContainerType>
|
||||
ContainerType utility::split(const std::string& str, const std::string& delimiter)
|
||||
{
|
||||
size_t pos = 0;
|
||||
size_t oldPos = 0;
|
||||
ContainerType c;
|
||||
|
||||
do
|
||||
{
|
||||
pos = str.find(delimiter, oldPos);
|
||||
c.push_back(str.substr(oldPos, pos - oldPos));
|
||||
oldPos = pos + delimiter.size();
|
||||
}
|
||||
while (pos != std::string::npos);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif // UTILITY_STRING_H
|
||||
|
||||
Reference in New Issue
Block a user