From 9f995b41e72b25c0c7ffe8e2568e166d86f27bcc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 4 Oct 2009 09:31:37 +0200 Subject: Add --{hxx,ixx,cxx}-suffix options --- cli/generator.cxx | 10 +++------- cli/options.cli | 7 ++++++- cli/options.cxx | 30 ++++++++++++++++++++++++------ cli/options.hxx | 18 +++++++++++++++--- cli/options.ixx | 24 +++++++++++++++++++++--- 5 files changed, 69 insertions(+), 20 deletions(-) (limited to 'cli') diff --git a/cli/generator.cxx b/cli/generator.cxx index 6c766e4..f7a9a1f 100644 --- a/cli/generator.cxx +++ b/cli/generator.cxx @@ -77,16 +77,12 @@ generate (options const& ops, semantics::cli_unit& unit, path const& p) { bool inl (!ops.suppress_inline ()); - string hxx_suffix (".hxx"); - string ixx_suffix (".ixx"); - string cxx_suffix (".cxx"); - path file (p.leaf ()); string base (file.base ().string ()); - string hxx_name (base + hxx_suffix); - string ixx_name (base + ixx_suffix); - string cxx_name (base + cxx_suffix); + string hxx_name (base + ops.hxx_suffix ()); + string ixx_name (base + ops.ixx_suffix ()); + string cxx_name (base + ops.cxx_suffix ()); path hxx_path (hxx_name); path ixx_path (ixx_name); diff --git a/cli/options.cli b/cli/options.cli index 3b78646..2ef8738 100644 --- a/cli/options.cli +++ b/cli/options.cli @@ -14,6 +14,11 @@ class options { bool --help; bool --version; - std::string --output-dir; + bool --suppress-inline; + + std::string --output-dir; + std::string --hxx-suffix = ".hxx"; + std::string --ixx-suffix = ".ixx"; + std::string --cxx-suffix = ".cxx"; }; diff --git a/cli/options.cxx b/cli/options.cxx index c2ad4fd..c38ca35 100644 --- a/cli/options.cxx +++ b/cli/options.cxx @@ -167,8 +167,11 @@ options (int argc, ::cli::unknown_mode arg) : help_ (), version_ (), + suppress_inline_ (), output_dir_ (), - suppress_inline_ () + hxx_suffix_ (".hxx"), + ixx_suffix_ (".ixx"), + cxx_suffix_ (".cxx") { _parse (1, argc, argv, opt, arg); } @@ -181,8 +184,11 @@ options (int start, ::cli::unknown_mode arg) : help_ (), version_ (), + suppress_inline_ (), output_dir_ (), - suppress_inline_ () + hxx_suffix_ (".hxx"), + ixx_suffix_ (".ixx"), + cxx_suffix_ (".cxx") { _parse (start, argc, argv, opt, arg); } @@ -195,8 +201,11 @@ options (int argc, ::cli::unknown_mode arg) : help_ (), version_ (), + suppress_inline_ (), output_dir_ (), - suppress_inline_ () + hxx_suffix_ (".hxx"), + ixx_suffix_ (".ixx"), + cxx_suffix_ (".cxx") { end = _parse (1, argc, argv, opt, arg); } @@ -210,8 +219,11 @@ options (int start, ::cli::unknown_mode arg) : help_ (), version_ (), + suppress_inline_ (), output_dir_ (), - suppress_inline_ () + hxx_suffix_ (".hxx"), + ixx_suffix_ (".ixx"), + cxx_suffix_ (".cxx") { end = _parse (start, argc, argv, opt, arg); } @@ -230,10 +242,16 @@ struct _cli_options_map_init &::cli::thunk; _cli_options_map_["--version"] = &::cli::thunk; - _cli_options_map_["--output-dir"] = - &::cli::thunk; _cli_options_map_["--suppress-inline"] = &::cli::thunk; + _cli_options_map_["--output-dir"] = + &::cli::thunk; + _cli_options_map_["--hxx-suffix"] = + &::cli::thunk; + _cli_options_map_["--ixx-suffix"] = + &::cli::thunk; + _cli_options_map_["--cxx-suffix"] = + &::cli::thunk; } } _cli_options_map_init_; diff --git a/cli/options.hxx b/cli/options.hxx index cf92229..2594947 100644 --- a/cli/options.hxx +++ b/cli/options.hxx @@ -210,11 +210,20 @@ class options bool const& version () const; + bool const& + suppress_inline () const; + std::string const& output_dir () const; - bool const& - suppress_inline () const; + std::string const& + hxx_suffix () const; + + std::string const& + ixx_suffix () const; + + std::string const& + cxx_suffix () const; private: int @@ -227,8 +236,11 @@ class options public: bool help_; bool version_; - std::string output_dir_; bool suppress_inline_; + std::string output_dir_; + std::string hxx_suffix_; + std::string ixx_suffix_; + std::string cxx_suffix_; }; #include "options.ixx" diff --git a/cli/options.ixx b/cli/options.ixx index ac93219..9e15c36 100644 --- a/cli/options.ixx +++ b/cli/options.ixx @@ -17,15 +17,33 @@ version () const return version_; } +inline bool const& options:: +suppress_inline () const +{ + return suppress_inline_; +} + inline std::string const& options:: output_dir () const { return output_dir_; } -inline bool const& options:: -suppress_inline () const +inline std::string const& options:: +hxx_suffix () const { - return suppress_inline_; + return hxx_suffix_; +} + +inline std::string const& options:: +ixx_suffix () const +{ + return ixx_suffix_; +} + +inline std::string const& options:: +cxx_suffix () const +{ + return cxx_suffix_; } -- cgit v1.1