1 /* 2 __________ ____ ___ 3 _____ __ _\______ \_____ _______ ______ __________\ \/ / 4 / \| | \ ___/\__ \\_ __ \/ ___// __ \_ __ \ / 5 | Y Y \ | / | / __ \| | \/\___ \\ ___/| | \/ \ 6 |__|_| /____/|____| (____ /__| /____ >\___ >__| /___/\ \ 7 \/ \/ \/ \/ \_/ 8 Copyright (C) 2016 Ingo Berg 9 All rights reserved. 10 11 muParserX - A C++ math parser library with array and string support 12 Copyright (c) 2016, Ingo Berg 13 All rights reserved. 14 15 Redistribution and use in source and binary forms, with or without 16 modification, are permitted provided that the following conditions are met: 17 18 * Redistributions of source code must retain the above copyright notice, 19 this list of conditions and the following disclaimer. 20 * Redistributions in binary form must reproduce the above copyright notice, 21 this list of conditions and the following disclaimer in the documentation 22 and/or other materials provided with the distribution. 23 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 25 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 29 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 31 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 POSSIBILITY OF SUCH DAMAGE. 34 */ 35 #ifndef MUP_FUNC_COMMON_H 36 #define MUP_FUNC_COMMON_H 37 38 #include "mpICallback.h" 39 40 41 MUP_NAMESPACE_START 42 43 //------------------------------------------------------------------------------ 44 /** \brief Parser function callback for determining the size of an array. 45 \ingroup functions 46 */ 47 class FunParserID : public ICallback 48 { 49 public: 50 FunParserID (); 51 virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc) override; 52 virtual const char_type* GetDesc() const override; 53 virtual IToken* Clone() const override; 54 }; // class FunParserID 55 56 //------------------------------------------------------------------------------ 57 /** \brief Determine maximal value from the parameter list. 58 \ingroup functions 59 */ 60 class FunMax : public ICallback 61 { 62 public: 63 FunMax(); 64 virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc) override; 65 virtual const char_type* GetDesc() const override; 66 virtual IToken* Clone() const override; 67 }; // class FunMax 68 69 //------------------------------------------------------------------------------ 70 /** \brief Determine minimal value from the parameter list. 71 \ingroup functions 72 */ 73 class FunMin : public ICallback 74 { 75 public: 76 FunMin(); 77 virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc) override; 78 virtual const char_type* GetDesc() const override; 79 virtual IToken* Clone() const override; 80 }; // class FunMin 81 82 //------------------------------------------------------------------------------ 83 /** \brief Parser callback for summing up all function arguments. 84 \ingroup functions 85 */ 86 class FunSum : public ICallback 87 { 88 public: 89 FunSum(); 90 virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc) override; 91 virtual const char_type* GetDesc() const override; 92 virtual IToken* Clone() const override; 93 }; // class FunSum 94 95 //------------------------------------------------------------------------------ 96 /** \brief Parser function callback for determining the size of an array. 97 \ingroup functions 98 */ 99 class FunSizeOf : public ICallback 100 { 101 public: 102 FunSizeOf(); 103 virtual ~FunSizeOf(); 104 virtual void Eval(ptr_val_type &ret, const ptr_val_type *a_pArg, int a_iArgc) override; 105 virtual const char_type* GetDesc() const override; 106 virtual IToken* Clone() const override; 107 }; // class FunSizeOf 108 109 MUP_NAMESPACE_END 110 111 #endif 112