56 lines
2.5 KiB
C++
56 lines
2.5 KiB
C++
#pragma once
|
|
|
|
#include "dtcore/inc/dtstring.h"
|
|
#include "dtcore/inc/dtset.h"
|
|
|
|
namespace dt
|
|
{
|
|
|
|
class ScriptStatementExpressionParserDescriptor;
|
|
class ScriptStatementExpressionParserInfo;
|
|
class TestDescriptor;
|
|
|
|
// Class used during statement expression parsing. It holds
|
|
// contextual information like the variable name, possible value
|
|
// list, optional zone name and the parser descriptor
|
|
class ScriptStatementExpressionParserInfo
|
|
{
|
|
public:
|
|
DT_CORE_DLL_ENTRY ScriptStatementExpressionParserInfo(const ScriptStatementExpressionParserDescriptor* parserDesc,
|
|
const String& context,
|
|
const TestDescriptor* testDescriptor,
|
|
const Set<String>& possibleValues = Set<String>(),
|
|
const String& optionalZoneName = String::Blank());
|
|
DT_CORE_DLL_ENTRY ~ScriptStatementExpressionParserInfo();
|
|
|
|
// return the statement expression parser descriptor
|
|
DT_CORE_DLL_ENTRY const ScriptStatementExpressionParserDescriptor* GetParserDescriptor() const;
|
|
// return the context which is the key to be used to store the
|
|
// parsed value in the outParamters map
|
|
DT_CORE_DLL_ENTRY const String& GetContext() const;
|
|
// return current test descriptor, needed internally for decoupling Test logic from parser so that
|
|
// the parser can be used and tested as a standalone module.
|
|
DT_CORE_DLL_ENTRY const TestDescriptor* GetTestDescriptor() const;
|
|
// return a set of possible values to restrict to
|
|
DT_CORE_DLL_ENTRY const Set<String>& GetPossibleValues() const;
|
|
// return the option zone name or empty if IsOptional is false
|
|
DT_CORE_DLL_ENTRY const String& GetOptionalZoneName() const;
|
|
// return true if the optional zone name is not empty, which
|
|
// means you are within an optional zone
|
|
DT_CORE_DLL_ENTRY bool IsOptional() const;
|
|
|
|
// Used internally to compose recursive expressions like
|
|
// optional zones within expressions or another optional zone
|
|
DT_CORE_DLL_ENTRY void AddChild(ScriptStatementExpressionParserInfo* parserInfo);
|
|
DT_CORE_DLL_ENTRY const Vector<ScriptStatementExpressionParserInfo*>& GetChildren() const;
|
|
|
|
private:
|
|
const ScriptStatementExpressionParserDescriptor* m_ParserDescriptor;
|
|
const String m_Context;
|
|
const TestDescriptor* m_TestDescriptor;
|
|
const Set<String> m_PossibleValues;
|
|
const String m_OptionalZoneName;
|
|
Vector<ScriptStatementExpressionParserInfo*> m_Children;
|
|
};
|
|
|
|
}
|