diff options
author | Thomas Nelson <rider@lindenlab.com> | 2018-01-23 08:55:58 -0800 |
---|---|---|
committer | Thomas Nelson <rider@lindenlab.com> | 2018-01-23 08:55:58 -0800 |
commit | 6489598d57571d5b984cb37eec4dd4421ce86c2a (patch) | |
tree | 87584ba45f81e0f6877f8eaafce53e821bf924a8 /indra/llvfs/lldir.h | |
parent | 1b8c2b5ebbe0d42f147730bc9b6528fa8c6796ce (diff) | |
parent | d97d7c52068b71bd99b10db046c6a0688b61a254 (diff) |
Merged lindenlab/viewer64 into default
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? |