summaryrefslogtreecommitdiffstats
path: root/src/lib/eval/eval_context.h
diff options
context:
space:
mode:
authorTomek Mrugalski <tomasz@isc.org>2017-03-23 15:42:01 +0100
committerTomek Mrugalski <tomasz@isc.org>2017-03-23 15:42:01 +0100
commit279fe78b1824ecda0efcd852c45c2a37b964337e (patch)
tree97358a64f70a48ff5536b7833b1d49cc3207e1d1 /src/lib/eval/eval_context.h
parent[5132] evaluate renamed to evaluateBool (diff)
downloadkea-279fe78b1824ecda0efcd852c45c2a37b964337e.tar.xz
kea-279fe78b1824ecda0efcd852c45c2a37b964337e.zip
[5132] expressions evaluated to string added
Diffstat (limited to 'src/lib/eval/eval_context.h')
-rw-r--r--src/lib/eval/eval_context.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lib/eval/eval_context.h b/src/lib/eval/eval_context.h
index 053e8cf64b..eb914d2d9e 100644
--- a/src/lib/eval/eval_context.h
+++ b/src/lib/eval/eval_context.h
@@ -34,6 +34,14 @@ public:
class EvalContext
{
public:
+
+ /// @brief Specifies what type of expression the parser is expected to see
+ typedef enum {
+ PARSER_BOOL, ///< expression is expected to evaluate to bool
+ PARSER_STRING ///< expression is expected to evaluate to string
+ } ParserType;
+
+
/// @brief Default constructor.
///
/// @param option_universe Option universe: DHCPv4 or DHCPv6. This is used
@@ -48,16 +56,19 @@ public:
isc::dhcp::Expression expression;
/// @brief Method called before scanning starts on a string.
- void scanStringBegin();
+ ///
+ /// @param type specifies type of the expression to be parsed
+ void scanStringBegin(ParserType type);
/// @brief Method called after the last tokens are scanned from a string.
void scanStringEnd();
/// @brief Run the parser on the string specified.
///
- /// @param str string to be written
+ /// @param str string to be parsed
+ /// @param type type of the expression expected/parser type to be created
/// @return true on success.
- bool parseString(const std::string& str);
+ bool parseString(const std::string& str, ParserType type = PARSER_BOOL);
/// @brief The name of the file being parsed.
/// Used later to pass the file name to the location tracker.