43 if (expr.
empty())
return false;
62 warn(fileName,lineNr,
"problem evaluating expression '{}': {}", expr,
m_err);
75 return c==
'&' || c==
'|' || c==
'!';
83 return (c>=
'A' && c<=
'Z') || (c>=
'a' && c<=
'z') || c==
'_';
88 return isAlpha(c) || (c>=
'0' && c<=
'9') || c==
'-' || c==
'.' || (
static_cast<unsigned char>(c)>=0x80);
98 if (opName==
"&&") {
return AND; }
99 if (opName==
"||") {
return OR; }
102 if (opName==
"!") {
return NOT; }
120 while (*
m_e ==
' ' || *
m_e ==
'\t' || *
m_e ==
'\n')
134 if (*
m_e ==
'(' || *
m_e ==
')')
182 while (opId==
AND || opId==
OR)
224 m_err=
"Parenthesis ) missing";
252 m_err=
"Unexpected end of expression";
257 m_err=
"Value expected";
273 case AND:
return lhs && rhs;
274 case OR:
return lhs || rhs;
286 if (varName ==
"YES")
return true;
287 if (varName ==
"NO")
return false;
289 return std::find(list.begin(),list.end(),varName.
str())!=list.end();
304 return((
static_cast<ConfigBool*
>(opt)->valueRef())?
"YES" :
"NO");
307 warn(fileName,lineNr,
308 "String setting '{}' not possible in conditional statement, ignored", expr);
311 return(*(
static_cast<ConfigEnum*
>(opt)->valueRef()));
315 warn(fileName,lineNr,
316 "List setting '{}' not possible in conditional statement, ignored", expr);
319 warn(fileName,lineNr,
320 "Obsolete setting '{}' not possible in conditional statement, ignored", expr);
323 warn(fileName,lineNr,
324 "Disabled setting '{}' not possible in conditional statement, ignored", expr);
327 warn(fileName,lineNr,
328 "Info setting '{}' not possible in conditional statement, ignored", expr);
331 warn(fileName,lineNr,
332 "Unknown error occurrence '{}', ignored", expr);
338 warn(fileName,lineNr,
339 "Unknown setting '{}' not possible in conditional statement, ignored", expr);
353 const char *p=expr.
data();
360 if (*p ==
'd' &&
DString(p).startsWith(
"doxyconfig"))
363 while (*p==
' ' || *p==
'\t') {p++;}
367 if ((c>=
'A' && c<=
'Z') || (c>=
'0' && c<=
'9') || c==
'_') bufConfig += c;
374 loc_expr +=
getConfig(fileName, lineNr, bufConfig);
DString m_token
holds the token
bool parse(const DString &fileName, int lineNr, const DString &expr)
parses and evaluates the given expression.
TOKENTYPE m_tokenType
type of the token
DString m_expr
holds the expression
int getOperatorId(const DString &opName)
returns the id of the given operator returns -1 if the operator is not recognized
bool parseLevel1()
conditional operators AND and OR
void getToken()
Get next token in the current string expr.
bool evalVariable(const DString &varName)
evaluate a variable
bool evalOperator(const int opId, bool lhs, bool rhs)
evaluate an operator for given values
const char * m_e
points to a character in expr
bool parseLevel3()
parenthesized expression or variable
Class representing a Boolean type option.
Class representing an enum type option.
static ConfigImpl * instance()
ConfigOption * get(const DString &name) const
Class representing an integer type option.
Abstract base class for any configuration option.
@ O_Disabled
Disabled compile time option.
@ O_Enum
A fixed set of items.
@ O_Obsolete
An obsolete option.
@ O_Info
A section header.
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
DString & setNum(short n)
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
const std::string & str() const
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
static bool isDelimiter(const char c)
checks if the given char c is a delimiter minus is checked apart, can be unary minus
static bool isAlphaNumSpec(const char c)
static DString resolveConfig(const DString &fileName, int lineNr, const DString &expr)
static DString getConfig(const DString &fileName, int lineNr, const DString &expr)
static DString error_str
Copyright (C) 1997-2015 by Dimitri van Heesch.
static bool isAlpha(const char c)
checks if the given char c is a letter or underscore
#define Config_getList(name)
std::vector< std::string > StringVector
#define warn(file, line, fmt,...)