\hypertarget{xbexp_8h_source}{}\doxysection{xbexp.\+h} \label{xbexp_8h_source}\index{/mnt/1Tdata/xbase/xbase64-\/4.0.3/src/include/xbexp.h@{/mnt/1Tdata/xbase/xbase64-\/4.0.3/src/include/xbexp.h}} \mbox{\hyperlink{xbexp_8h}{Go to the documentation of this file.}} \begin{DoxyCode}{0} \DoxyCodeLine{1 \textcolor{comment}{/* xbexp.h}} \DoxyCodeLine{2 \textcolor{comment}{}} \DoxyCodeLine{3 \textcolor{comment}{XBase64 Software Library}} \DoxyCodeLine{4 \textcolor{comment}{}} \DoxyCodeLine{5 \textcolor{comment}{Copyright (c) 1997,2003,2014,2022 Gary A Kunkel}} \DoxyCodeLine{6 \textcolor{comment}{}} \DoxyCodeLine{7 \textcolor{comment}{The xb64 software library is covered under the terms of the GPL Version 3, 2007 license.}} \DoxyCodeLine{8 \textcolor{comment}{}} \DoxyCodeLine{9 \textcolor{comment}{Email Contact:}} \DoxyCodeLine{10 \textcolor{comment}{}} \DoxyCodeLine{11 \textcolor{comment}{ XDB-\/devel@lists.sourceforge.net}} \DoxyCodeLine{12 \textcolor{comment}{ XDB-\/users@lists.sourceforge.net}} \DoxyCodeLine{13 \textcolor{comment}{}} \DoxyCodeLine{14 \textcolor{comment}{*/}} \DoxyCodeLine{15 } \DoxyCodeLine{16 } \DoxyCodeLine{17 \textcolor{preprocessor}{\#ifndef \_\_XB\_EXP\_H\_\_}} \DoxyCodeLine{18 \textcolor{preprocessor}{\#define \_\_XB\_EXP\_H\_\_}} \DoxyCodeLine{19 } \DoxyCodeLine{20 } \DoxyCodeLine{21 \textcolor{comment}{// \#ifdef CMAKE\_COMPILER\_IS\_GNUCC}} \DoxyCodeLine{22 \textcolor{comment}{// \#pragma interface}} \DoxyCodeLine{23 \textcolor{comment}{// \#endif}} \DoxyCodeLine{24 } \DoxyCodeLine{25 } \DoxyCodeLine{26 } \DoxyCodeLine{27 \textcolor{preprocessor}{\#ifdef XB\_FUNCTION\_SUPPORT}} \DoxyCodeLine{28 \textcolor{preprocessor}{\#define XB\_EXP\_CHAR 'C'}} \DoxyCodeLine{29 \textcolor{preprocessor}{\#define XB\_EXP\_DATE 'D'}} \DoxyCodeLine{30 \textcolor{preprocessor}{\#define XB\_EXP\_LOGICAL 'L'}} \DoxyCodeLine{31 \textcolor{preprocessor}{\#define XB\_EXP\_NUMERIC 'N'}} \DoxyCodeLine{32 \textcolor{preprocessor}{\#define XB\_EXP\_UNKNOWN 'U'}} \DoxyCodeLine{33 \textcolor{preprocessor}{\#endif}} \DoxyCodeLine{34 } \DoxyCodeLine{35 \textcolor{preprocessor}{\#ifdef XB\_EXPRESSION\_SUPPORT}} \DoxyCodeLine{36 } \DoxyCodeLine{37 \textcolor{preprocessor}{\#define XB\_EXP\_CONSTANT 'C'}} \DoxyCodeLine{38 \textcolor{preprocessor}{\#define XB\_EXP\_FUNCTION 'F'}} \DoxyCodeLine{39 \textcolor{preprocessor}{\#define XB\_EXP\_FIELD 'D'}} \DoxyCodeLine{40 \textcolor{preprocessor}{\#define XB\_EXP\_OPERATOR 'O'}} \DoxyCodeLine{41 \textcolor{preprocessor}{\#define XB\_EXP\_NOTROOT 'N' }\textcolor{comment}{// not root node, needs further parsing}} \DoxyCodeLine{42 \textcolor{preprocessor}{\#define XB\_EXP\_PRE\_OPERATOR 'B' }\textcolor{comment}{// (B)efore) pre increment, pre decrement}} \DoxyCodeLine{43 \textcolor{preprocessor}{\#define XB\_EXP\_POST\_OPERATOR 'A' }\textcolor{comment}{// (A)fter) post increment, pre decrement}} \DoxyCodeLine{44 } \DoxyCodeLine{45 \textcolor{preprocessor}{\#define XB\_END\_OF\_EXPRESSION -\/100}} \DoxyCodeLine{46 } \DoxyCodeLine{47 \textcolor{comment}{// \#define XB\_UNBALANCED\_PARENS -\/101}} \DoxyCodeLine{48 \textcolor{comment}{// \#define XB\_UNBALANCED\_QUOTES -\/102}} \DoxyCodeLine{49 } \DoxyCodeLine{50 } \DoxyCodeLine{51 \textcolor{keyword}{namespace }\mbox{\hyperlink{namespacexb}{xb}}\{} \DoxyCodeLine{52 } \DoxyCodeLine{54 \textcolor{keyword}{struct }XBDLLEXPORT xbExpToken \{} \DoxyCodeLine{55 xbString sExpression; \textcolor{comment}{// in -\/ expression to pull next token from}} \DoxyCodeLine{56 \textcolor{comment}{// out -\/ remainder of the expression after token removed}} \DoxyCodeLine{57 xbString sToken; \textcolor{comment}{// next token pulled from the expression}} \DoxyCodeLine{58 \textcolor{keywordtype}{char} cNodeType; \textcolor{comment}{// one of XB\_EXP\_CONSTANT, XB\_EXP\_FUNCTION, XB\_EXP\_FIELD, XB\_EXP\_OPERATOR, XB\_EXP\_NOTROOT}} \DoxyCodeLine{59 \textcolor{keywordtype}{char} cReturnType; \textcolor{comment}{// one of XB\_EXP\_CHAR, XB\_EXP\_DATE, XB\_EXP\_LOGICAL, XB\_EXP\_NUMERIC, XB\_EXP\_UNKNOWN}} \DoxyCodeLine{60 xbInt16 iSts; \textcolor{comment}{// return status after retrieving or attempting next token from expression}} \DoxyCodeLine{61 \textcolor{comment}{// 0 = no error}} \DoxyCodeLine{62 \textcolor{comment}{// XB\_END\_OF\_EXPRESSION}} \DoxyCodeLine{63 \textcolor{comment}{// XB\_UNBALANCED\_PARENS}} \DoxyCodeLine{64 \textcolor{comment}{// XB\_UNBALANCED\_QUOTES}} \DoxyCodeLine{65 \textcolor{keywordtype}{char} cPrevNodeType; \textcolor{comment}{// previous node type}} \DoxyCodeLine{66 \textcolor{keywordtype}{char} cPrevReturnType; \textcolor{comment}{// previous return type}} \DoxyCodeLine{67 } \DoxyCodeLine{68 \textcolor{comment}{// constructor}} \DoxyCodeLine{69 xbExpToken() \{ cNodeType = 0; cReturnType = 0; iSts = 0; cPrevNodeType = 0; cPrevReturnType = 0; \}} \DoxyCodeLine{70 \};} \DoxyCodeLine{72 } \DoxyCodeLine{73 } \DoxyCodeLine{74 \textcolor{comment}{/************************************************************************/}} \DoxyCodeLine{75 } \DoxyCodeLine{77 } \DoxyCodeLine{132 \textcolor{keyword}{class }XBDLLEXPORT xbExp\{} \DoxyCodeLine{133 } \DoxyCodeLine{134 \textcolor{keyword}{public}:} \DoxyCodeLine{135 xbExp( \mbox{\hyperlink{namespacexb_a97858ddeb1c4b0100f3edc1a46d3a8b0}{xbXBase}} * );} \DoxyCodeLine{136 xbExp( \mbox{\hyperlink{namespacexb_a97858ddeb1c4b0100f3edc1a46d3a8b0}{xbXBase}} *, \mbox{\hyperlink{namespacexb_ab2eae4b4732466698a7fdd89d77ba53b}{xbDbf}} * );} \DoxyCodeLine{137 \textcolor{keyword}{virtual} \string~xbExp();} \DoxyCodeLine{138 \textcolor{keywordtype}{void} ClearTreeHandle();} \DoxyCodeLine{139 } \DoxyCodeLine{140 } \DoxyCodeLine{141 \textcolor{preprocessor}{ \#ifdef XB\_DEBUG\_SUPPORT}} \DoxyCodeLine{142 \textcolor{keywordtype}{void} DumpTree( xbInt16 iOption );} \DoxyCodeLine{143 \textcolor{keywordtype}{void} DumpToken( xbExpToken \&t, xbInt16 iOption = 0 );} \DoxyCodeLine{144 \textcolor{preprocessor}{ \#endif}} \DoxyCodeLine{145 } \DoxyCodeLine{146 xbInt16 GetResultLen() \textcolor{keyword}{const};} \DoxyCodeLine{147 \textcolor{keywordtype}{char} GetReturnType() \textcolor{keyword}{const};} \DoxyCodeLine{148 xbInt16 GetBoolResult( \mbox{\hyperlink{namespacexb_ab1a750481dd487f0d384aa1d200dff0f}{xbBool}} \&bResult );} \DoxyCodeLine{149 xbInt16 GetDateResult( xbDate \&dtResult );} \DoxyCodeLine{150 xbInt16 GetNumericResult( \mbox{\hyperlink{namespacexb_a25f47b226ce924a5c78f97989b0744a2}{xbDouble}} \&dResult );} \DoxyCodeLine{151 xbInt16 GetStringResult( xbString \&sResult );} \DoxyCodeLine{152 xbInt16 GetStringResult( \textcolor{keywordtype}{char} * vpResult, xbUInt32 ulLen );} \DoxyCodeLine{153 xbExpNode *GetTreeHandle();} \DoxyCodeLine{154 xbInt16 ParseExpression( \textcolor{keyword}{const} xbString \&sExpression );} \DoxyCodeLine{155 xbInt16 ParseExpression( \mbox{\hyperlink{namespacexb_ab2eae4b4732466698a7fdd89d77ba53b}{xbDbf}} *dbf, \textcolor{keyword}{const} xbString \&sExpression );} \DoxyCodeLine{156 xbInt16 ProcessExpression();} \DoxyCodeLine{157 xbInt16 ProcessExpression( xbInt16 iRecBufSw );} \DoxyCodeLine{158 } \DoxyCodeLine{159 } \DoxyCodeLine{160 \textcolor{keyword}{protected}:} \DoxyCodeLine{161 xbInt16 GetNextToken( xbExpToken \&t );} \DoxyCodeLine{162 xbInt16 OperatorWeight( \textcolor{keyword}{const} xbString \&sOperator );} \DoxyCodeLine{163 xbExpNode *GetNextNode( xbExpNode * n ) \textcolor{keyword}{const}; \textcolor{comment}{// traverses the tree from bottom left node, right, then up}} \DoxyCodeLine{164 } \DoxyCodeLine{165 \textcolor{keyword}{private}: \textcolor{comment}{// methods}} \DoxyCodeLine{166 } \DoxyCodeLine{167 \textcolor{comment}{// xbInt16 CalcExpressionResultLen();}} \DoxyCodeLine{168 xbInt16 CalcFunctionResultLen( xbExpNode *n ) \textcolor{keyword}{const};} \DoxyCodeLine{169 xbInt16 CalcCharNodeLen( xbExpNode *n );} \DoxyCodeLine{170 xbInt16 CheckParensAndQuotes( \textcolor{keyword}{const} xbString \&sExpression );} \DoxyCodeLine{171 xbInt16 GetExpressionResultLen() \textcolor{keyword}{const};} \DoxyCodeLine{172 } \DoxyCodeLine{173 xbInt16 GetTokenCharConstant ( xbExpToken \&t );} \DoxyCodeLine{174 xbInt16 GetTokenDatabaseField ( xbExpToken \&t );} \DoxyCodeLine{175 xbInt16 GetTokenDateConstant ( xbExpToken \&t );} \DoxyCodeLine{176 xbInt16 GetTokenFunction ( xbExpToken \&t );} \DoxyCodeLine{177 xbInt16 GetTokenLogicalConstant( xbExpToken \&t );} \DoxyCodeLine{178 xbInt16 GetTokenNumericConstant( xbExpToken \&t );} \DoxyCodeLine{179 xbInt16 GetTokenOperator ( xbExpToken \&t );} \DoxyCodeLine{180 xbInt16 GetTokenParen ( xbExpToken \&t );} \DoxyCodeLine{181 } \DoxyCodeLine{182 \mbox{\hyperlink{namespacexb_ab1a750481dd487f0d384aa1d200dff0f}{xbBool}} IsFunction ( \textcolor{keyword}{const} xbString \&sExp, \textcolor{keywordtype}{char} \&cReturnType );} \DoxyCodeLine{183 \mbox{\hyperlink{namespacexb_ab1a750481dd487f0d384aa1d200dff0f}{xbBool}} IsLogicalConstant ( \textcolor{keyword}{const} xbString \&sExp );} \DoxyCodeLine{184 \mbox{\hyperlink{namespacexb_ab1a750481dd487f0d384aa1d200dff0f}{xbBool}} IsNumericConstant ( \textcolor{keyword}{const} xbString \&sExp, \textcolor{keywordtype}{char} cPrevNodeType );} \DoxyCodeLine{185 \mbox{\hyperlink{namespacexb_ab1a750481dd487f0d384aa1d200dff0f}{xbBool}} IsOperator ( \textcolor{keyword}{const} xbString \&sExp );} \DoxyCodeLine{186 \textcolor{keywordtype}{char} IsTokenSeparator ( \textcolor{keywordtype}{char} c );} \DoxyCodeLine{187 \mbox{\hyperlink{namespacexb_ab1a750481dd487f0d384aa1d200dff0f}{xbBool}} IsWhiteSpace ( \textcolor{keywordtype}{char} c );} \DoxyCodeLine{188 } \DoxyCodeLine{189 xbInt16 ParseExpression ( \textcolor{keyword}{const} xbString \&sExpression, xbInt16 iWeight );} \DoxyCodeLine{190 xbInt16 ParseExpressionConstant( xbExpToken \&t, xbExpNode *n );} \DoxyCodeLine{191 xbInt16 ParseExpressionFunction( xbExpToken \&t, xbExpNode *n, xbInt16 iWeight );} \DoxyCodeLine{192 xbInt16 ParseExpressionFunctionParms( \textcolor{keyword}{const} xbString \&sParms, xbLinkList \&llParms );} \DoxyCodeLine{193 xbInt16 ParseExpressionField ( xbExpToken \&t, xbExpNode *n );} \DoxyCodeLine{194 xbInt16 ParseExpressionOperator( xbExpToken \&t, xbExpNode *n, xbInt16 iWeight );} \DoxyCodeLine{195 } \DoxyCodeLine{196 xbInt16 ProcessExpressionFunction( xbExpNode *n, xbInt16 iRecBufSw = 0 );} \DoxyCodeLine{197 xbInt16 ProcessExpressionOperator( xbExpNode *n );} \DoxyCodeLine{198 } \DoxyCodeLine{199 \textcolor{keyword}{private}: \textcolor{comment}{// fields}} \DoxyCodeLine{200 \mbox{\hyperlink{namespacexb_a97858ddeb1c4b0100f3edc1a46d3a8b0}{xbXBase}} *xbase;} \DoxyCodeLine{201 \mbox{\hyperlink{namespacexb_ab2eae4b4732466698a7fdd89d77ba53b}{xbDbf}} *dbf;} \DoxyCodeLine{202 xbExpNode *nTree; \textcolor{comment}{// pointer to tree of expNodes}} \DoxyCodeLine{203 \textcolor{comment}{// xbInt16 iExpLen; // size of expression result}} \DoxyCodeLine{204 } \DoxyCodeLine{205 } \DoxyCodeLine{206 \};} \DoxyCodeLine{207 } \DoxyCodeLine{208 \textcolor{comment}{/* Expression handler */}} \DoxyCodeLine{209 } \DoxyCodeLine{210 } \DoxyCodeLine{211 \};} \DoxyCodeLine{212 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// XB\_EXPRESSION\_SUPPORT}} \DoxyCodeLine{213 \textcolor{preprocessor}{\#endif }\textcolor{comment}{// \_\_XB\_EXP\_H\_\_}} \DoxyCodeLine{214 } \DoxyCodeLine{215 } \end{DoxyCode}