diff options
author | Anchor Linden <anchor@lindenlab.com> | 2018-02-28 22:42:23 -0800 |
---|---|---|
committer | Anchor Linden <anchor@lindenlab.com> | 2018-02-28 22:42:23 -0800 |
commit | 618179a71722e47115a6b021a1eb2be99e46322f (patch) | |
tree | 7cb94aef6fe27ed0497790f07f8c190cf1944f92 /indra/llvfs/lldir.h | |
parent | bfbcd6d16931819c43eea8e83963c9f86c6892dd (diff) | |
parent | 5a12a88f7b53bb99a6b302c35d891a8ecee59855 (diff) |
Merge
Diffstat (limited to 'indra/llvfs/lldir.h')
-rw-r--r-- | indra/llvfs/lldir.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index b219c6e29f..e233413a7f 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -202,9 +202,28 @@ class LLDir /// Append specified @a name to @a destpath, separated by getDirDelimiter() /// if both are non-empty. void append(std::string& destpath, const std::string& name) const; - /// Append specified @a name to @a path, separated by getDirDelimiter() - /// if both are non-empty. Return result, leaving @a path unmodified. - std::string add(const std::string& path, const std::string& name) const; + /// Variadic form: append @a name0 and @a name1 and arbitrary other @a + /// names to @a destpath, separated by getDirDelimiter() as needed. + template <typename... NAMES> + void append(std::string& destpath, const std::string& name0, const std::string& name1, + const NAMES& ... names) const + { + // In a typical recursion case, we'd accept (destpath, name0, names). + // We accept (destpath, name0, name1, names) because it's important to + // delegate the two-argument case to the non-template implementation. + append(destpath, name0); + append(destpath, name1, names...); + } + + /// Append specified @a names to @a path, separated by getDirDelimiter() + /// as needed. Return result, leaving @a path unmodified. + template <typename... NAMES> + std::string add(const std::string& path, const NAMES& ... names) const + { + std::string destpath(path); + append(destpath, names...); + return destpath; + } protected: // Does an add() or append() call need a directory delimiter? |