aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/script/builtin-options.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-12-08 22:40:54 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-12-11 18:58:13 +0300
commitcb558e4bd2b817bc72275c2bbd90dfe9fe380af9 (patch)
tree83bb92e3dc8a7744b30a9c9cfd12106780f24691 /libbuild2/script/builtin-options.hxx
parentff0bf71889b041be794e8bd47d5be57f6eb07ad1 (diff)
Add export script pseudo-builtin
Diffstat (limited to 'libbuild2/script/builtin-options.hxx')
-rw-r--r--libbuild2/script/builtin-options.hxx118
1 files changed, 116 insertions, 2 deletions
diff --git a/libbuild2/script/builtin-options.hxx b/libbuild2/script/builtin-options.hxx
index d0d3c31..f6544cf 100644
--- a/libbuild2/script/builtin-options.hxx
+++ b/libbuild2/script/builtin-options.hxx
@@ -257,6 +257,8 @@ namespace build2
}
}
+#include <libbuild2/types.hxx>
+
namespace build2
{
namespace script
@@ -298,17 +300,35 @@ namespace build2
::build2::script::cli::unknown_mode option = ::build2::script::cli::unknown_mode::fail,
::build2::script::cli::unknown_mode argument = ::build2::script::cli::unknown_mode::stop);
- // Option accessors.
+ // Option accessors and modifiers.
//
const bool&
exact () const;
+ bool&
+ exact ();
+
+ void
+ exact (const bool&);
+
const bool&
newline () const;
+ bool&
+ newline ();
+
+ void
+ newline (const bool&);
+
const bool&
whitespace () const;
+ bool&
+ whitespace ();
+
+ void
+ whitespace (const bool&);
+
// Implementation details.
//
protected:
@@ -364,11 +384,17 @@ namespace build2
::build2::script::cli::unknown_mode option = ::build2::script::cli::unknown_mode::fail,
::build2::script::cli::unknown_mode argument = ::build2::script::cli::unknown_mode::stop);
- // Option accessors.
+ // Option accessors and modifiers.
//
const bool&
success () const;
+ bool&
+ success ();
+
+ void
+ success (const bool&);
+
// Implementation details.
//
protected:
@@ -384,6 +410,94 @@ namespace build2
public:
bool success_;
};
+
+ class export_options
+ {
+ public:
+ export_options ();
+
+ export_options (int& argc,
+ char** argv,
+ bool erase = false,
+ ::build2::script::cli::unknown_mode option = ::build2::script::cli::unknown_mode::fail,
+ ::build2::script::cli::unknown_mode argument = ::build2::script::cli::unknown_mode::stop);
+
+ export_options (int start,
+ int& argc,
+ char** argv,
+ bool erase = false,
+ ::build2::script::cli::unknown_mode option = ::build2::script::cli::unknown_mode::fail,
+ ::build2::script::cli::unknown_mode argument = ::build2::script::cli::unknown_mode::stop);
+
+ export_options (int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::build2::script::cli::unknown_mode option = ::build2::script::cli::unknown_mode::fail,
+ ::build2::script::cli::unknown_mode argument = ::build2::script::cli::unknown_mode::stop);
+
+ export_options (int start,
+ int& argc,
+ char** argv,
+ int& end,
+ bool erase = false,
+ ::build2::script::cli::unknown_mode option = ::build2::script::cli::unknown_mode::fail,
+ ::build2::script::cli::unknown_mode argument = ::build2::script::cli::unknown_mode::stop);
+
+ export_options (::build2::script::cli::scanner&,
+ ::build2::script::cli::unknown_mode option = ::build2::script::cli::unknown_mode::fail,
+ ::build2::script::cli::unknown_mode argument = ::build2::script::cli::unknown_mode::stop);
+
+ // Option accessors and modifiers.
+ //
+ const vector<string>&
+ unset () const;
+
+ vector<string>&
+ unset ();
+
+ void
+ unset (const vector<string>&);
+
+ bool
+ unset_specified () const;
+
+ void
+ unset_specified (bool);
+
+ const vector<string>&
+ clear () const;
+
+ vector<string>&
+ clear ();
+
+ void
+ clear (const vector<string>&);
+
+ bool
+ clear_specified () const;
+
+ void
+ clear_specified (bool);
+
+ // Implementation details.
+ //
+ protected:
+ bool
+ _parse (const char*, ::build2::script::cli::scanner&);
+
+ private:
+ bool
+ _parse (::build2::script::cli::scanner&,
+ ::build2::script::cli::unknown_mode option,
+ ::build2::script::cli::unknown_mode argument);
+
+ public:
+ vector<string> unset_;
+ bool unset_specified_;
+ vector<string> clear_;
+ bool clear_specified_;
+ };
}
}