From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/eval__num__expr_8h-source.html | 261 ++++++++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 docs/doxygen/nel/eval__num__expr_8h-source.html (limited to 'docs/doxygen/nel/eval__num__expr_8h-source.html') diff --git a/docs/doxygen/nel/eval__num__expr_8h-source.html b/docs/doxygen/nel/eval__num__expr_8h-source.html new file mode 100644 index 00000000..10c4b1c2 --- /dev/null +++ b/docs/doxygen/nel/eval__num__expr_8h-source.html @@ -0,0 +1,261 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

eval_num_expr.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000, 2001 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NeL Network Services.
+00010  * NEVRAX NeL Network Services is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NeL Network Services is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NeL Network Services; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #ifndef NL_EVAL_NUM_EXPR_H
+00027 #define NL_EVAL_NUM_EXPR_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 
+00031 namespace NLMISC
+00032 {
+00033 
+00037 class CEvalNumExpr
+00038 {
+00039 public:
+00040         virtual ~CEvalNumExpr() {}
+00042         enum TReturnState
+00043         {
+00044                 NoError,                        // No error
+00045                 UnkownValue,            // Unkown value has been parsed
+00046                 ValueError,                     // Error during user defined value evaluation
+00047                 UnkownFunction,         // Unkown function has been parsed
+00048                 FunctionError,          // Error during user defined function evaluation
+00049                 NumberSyntaxError,      // Syntax error in a number expression
+00050                 UnkownOperator,         // Unkown operator
+00051                 MustBeOpen,                     // Should be a open parentesis
+00052                 MustBeClose,            // Should be a close parentesis
+00053                 MustBeComa,                     // Should be a coma character
+00054                 MustBeExpression,       // Should be an expression
+00055                 NotUnaryOperator,       // Should not be an unary operator
+00056                 MustBeEnd,                      // Should be the end
+00057                 MustBeDoubleQuote,      // Should be a double quote
+00058                 ReturnValueCount
+00059         };
+00060 
+00167         TReturnState evalExpression (const char *expression, double &result, int *errorIndex, uint32 userData = 0);
+00168 
+00170         const char* getErrorString (TReturnState state) const;
+00171 
+00172 protected:
+00173 
+00175 
+00187         virtual TReturnState evalValue (const char *value, double &result, uint32 userData);
+00188 
+00203         virtual TReturnState evalFunction (const char *funcName, double arg0, double &result);
+00204         virtual TReturnState evalFunction (const char *funcName, double arg0, double arg1, double &result);
+00205 
+00206 private:
+00207 
+00209 
+00211         enum TToken
+00212         {
+00213                 Number,         // This is a number
+00214                 Function1,      // This is a function with one argu
+00215                 Function2,      // This is a function with two argu
+00216                 String,         // This is a user string
+00217                 Operator,       // This is an operator
+00218                 Open,           // (
+00219                 Close,          // )
+00220                 Coma,           // ,
+00221                 End,            // End of string
+00222         };
+00223 
+00224         // Operators
+00225         enum TOperator
+00226         {
+00227                 Not = 0,                // !
+00228                 Tilde,                  // ~
+00229                 Mul,                    // *
+00230                 Div,                    // /
+00231                 Remainder,              // %
+00232                 Plus,                   // +
+00233                 Minus,                  // -
+00234                 ULeftShift,             // <<
+00235                 URightShift,    // >>
+00236                 SLeftShift,             // <-
+00237                 SRightShift,    // ->
+00238                 Inferior,               // <
+00239                 InferiorEqual,  // <=
+00240                 Superior,               // >
+00241                 SuperiorEqual,  // >=
+00242                 Equal,                  // ==
+00243                 NotEqual,               // !=
+00244                 And,                    // &
+00245                 Or,                             // |
+00246                 Xor,                    // ^
+00247                 LogicalAnd,             // &&
+00248                 LogicalOr,              // ||
+00249                 LogicalXor,             // ^^
+00250                 OperatorCount,  // 
+00251                 NotOperator, // This is not an operator
+00252                 ExtOperator, // This is a 2 charcters operator
+00253         };
+00254 
+00255         // Functions
+00256         enum TReservedWord
+00257         {
+00258                 Abs = 0,
+00259                 Acos,
+00260                 Asin,
+00261                 Atan,
+00262                 Atan2,
+00263                 Ceil,
+00264                 Cos,
+00265                 Cosh,
+00266                 Exp,
+00267                 Exponent,
+00268                 Floor,
+00269                 Int,
+00270                 Log,
+00271                 Log10,
+00272                 Mantissa,
+00273                 Max,
+00274                 Min,
+00275                 Pow,
+00276                 Rand,
+00277                 Round,
+00278                 Sin,
+00279                 Sinh,
+00280                 Sq,
+00281                 Sqrt,
+00282                 Tan,
+00283                 Tanh,
+00284                 ReservedWordCount,
+00285         };
+00286 
+00287         // Some constant
+00288         enum 
+00289         {
+00290                 InternalStringLen = 32,
+00291                 InternalOperator = 4,
+00292         };
+00293 
+00295         TReturnState    _State;         // Current state
+00296         const char              *_ExprPtr;      // Current pointer on the expression
+00297 
+00299         TReturnState readDecimal (double &value);
+00300 
+00302         void readIntegerNumberDecimal (double &value);
+00303 
+00305 
+00307         TReturnState    getNextToken (TToken &token);
+00308 
+00310         TReturnState    evalExpression (double &result, TToken &nextToken, uint32 userData);
+00311 
+00313         TReservedWord   _ReservedWordFound;
+00314 
+00316         char                    _InternalString[InternalStringLen];
+00317         std::string             _InternalStlString;
+00318         const char              *_InternalStringPtr;
+00319 
+00321         double                  _Value;
+00322 
+00324         TOperator               _Op;
+00325 
+00327 
+00329         static const TToken             _ReservedWordToken[ReservedWordCount];
+00330         static const char               *_ReservedWord[ReservedWordCount];
+00331         static const TOperator  _OperatorArray[128];
+00332         static const bool               _StringChar[128];
+00333         static const char               *_ErrorString[ReturnValueCount];
+00334         static const int                _OperatorPrecedence[];
+00335 
+00336 public:
+00337 
+00338         bool internalCheck ();
+00339 };
+00340 
+00341 }
+00342 
+00343 #endif // NL_EVAL_NUM_EXPR_H
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1