diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-03-29 00:45:30 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-04-04 13:35:14 +0300 |
commit | dd973d03bf5f3f439dcdacbb22470105e66e698a (patch) | |
tree | 6856ab313c75f3459df80511c98d3f788bf1c22b /bbot/variable | |
parent | c72bbd5d04084547c53e9593af4d76d9e5135a53 (diff) |
Implement manifests and build_config
Diffstat (limited to 'bbot/variable')
-rw-r--r-- | bbot/variable | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/bbot/variable b/bbot/variable new file mode 100644 index 0000000..c210dc0 --- /dev/null +++ b/bbot/variable @@ -0,0 +1,49 @@ +// file : bbot/variable -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BBOT_VARIABLE +#define BBOT_VARIABLE + +#include <string> +#include <vector> +#include <cstdint> // uint64_t +#include <stdexcept> // invalid_argument + +#include <bbot/export> + +namespace bbot +{ + //@@ invalid_argument + // + class LIBBBOT_EXPORT invalid_variable: public std::invalid_argument + { + public: + invalid_variable (std::uint64_t p, const std::string& d) + : invalid_argument (d), pos (p) {} + + std::uint64_t pos; // Zero-based. + }; + + // String in the name=value format. Can contain single or double quoted + // substrings. No escaping is supported. The name must not contain spaces. + // Throw variable_error if the string doesn't conform with the above + // constraints. + // + struct LIBBBOT_EXPORT variable: std::string + { + variable (std::string); + + // Remove a single level of quotes. Don't validate the format or the + // correctness of the quotation. Note that the variable can potentially be + // modified through the std::string interface in a way that breaks + // format/quoting. + // + std::string + unquoted () const; + }; + + using variables = std::vector<variable>; +} + +#endif // BBOT_VARIABLE |