diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-01-17 16:06:27 +0000 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2018-01-17 16:06:27 +0000 |
commit | e36745eb986ec9dd04c7f4f6d7a7249b7d5286a2 (patch) | |
tree | e2107a6f3afd57fcc817a5b8ea3566295105d0d4 /indra/llvfs/lldir.h | |
parent | 500aaa16ff2aa35b318176fd01cfaba47376f5a5 (diff) | |
parent | 7acbd8ed8d73c507675d45360df07d232c431a8b (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? |