diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-28 07:24:22 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-28 07:24:22 +0200 |
commit | 648b616c86e05c74b9ad25ad2bb5e5adf4172619 (patch) | |
tree | 16daf0db543e17b2e5fd90ac65d33f2de563d896 /cli/context.hxx | |
parent | 6d52ac69e940a6be6c15c5c6f84a183bf56899c8 (diff) |
Add support for file expansion in prologue/epilogue files
This is similar to variable expansion ($name$) except here we detect if the
name starts with ./ or ../ and treat it as a path relative to the prologue/
epilogue file.
Diffstat (limited to 'cli/context.hxx')
-rw-r--r-- | cli/context.hxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/cli/context.hxx b/cli/context.hxx index f16f8c2..cdc0aa5 100644 --- a/cli/context.hxx +++ b/cli/context.hxx @@ -13,6 +13,7 @@ #include <cstddef> // std::size_t #include <cutl/shared-ptr.hxx> +#include <cutl/fs/path.hxx> #include "options.hxx" #include "semantics.hxx" @@ -44,6 +45,9 @@ public: typedef std::size_t size_t; typedef std::string string; + typedef cutl::fs::path path; + typedef cutl::fs::invalid_path invalid_path; + typedef ::options options_type; typedef ::usage usage_type; typedef ::class_doc class_doc_type; @@ -111,13 +115,19 @@ public: void format_line (output_type, string&, const char*, size_t); - // Substitute doc variable expansions ($var$). + // Substitute doc variable expansions ($var$). Var must be a C identifier. + // If the path is not NULL, then also recognize names that start with either + // ./ or ../ and treat them as files relative to path. Such file expansions + // are substituted with the files' contents. // static string - substitute (const string&, semantics::cli_unit&); + substitute (const string&, semantics::cli_unit&, const path* = 0); string - substitute (const string& s) {return substitute (s, unit);} + substitute (const string& s, const path* p = 0) + { + return substitute (s, unit, p); + } public: static string const& |