diff options
| author | jhurst <jhurst@cinecert.com> | 2016-12-07 18:11:32 +0000 |
|---|---|---|
| committer | jhurst <> | 2016-12-07 18:11:32 +0000 |
| commit | dec4ef68baee633aac30f4b3e0aab6553c22f967 (patch) | |
| tree | dc4f1bbdc6023604ec380393eebd1aebaae3236d /src/KM_util.h | |
| parent | 74e6b1105dffe52c6f347d723507ab346eabbb5a (diff) | |
o Improved IMSC-1 profile detection. May not yet be perfect, experimentation
encouraged!
o Refactored XML element & attribute visitation to KM_xml.h
o Added km_join() template to KM_util.h
Diffstat (limited to 'src/KM_util.h')
| -rwxr-xr-x | src/KM_util.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/KM_util.h b/src/KM_util.h index 4834891..e8004c1 100755 --- a/src/KM_util.h +++ b/src/KM_util.h @@ -543,6 +543,27 @@ namespace Kumu // adjacent instances of the separator. E.g., "/foo//bar/" will return ["", "foo", "", "bar", ""]. std::list<std::string> km_token_split(const std::string& str, const std::string& separator); + // Join the tokens in the given list using delimiter. If prefix is defined then each token + // will be concatenated with the prefix before being added to the composite string. + template <class T> + std::string + km_join(const T& list, const std::string& delimiter, const std::string& prefix = "") + { + std::string result; + + for ( typename T::const_iterator i = list.begin(); i != list.end(); ++i ) + { + if ( i != list.begin() ) + { + result += delimiter; + } + + result += prefix + *i; + } + + return result; + } + } // namespace Kumu |
