Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

AddSubOp.h

Go to the documentation of this file.
00001 
00002 // MathCore = a WYSIWYG equation editor + a powerful math engine     //
00003 // Copyright (C) 2003 by Francesco Montorsi                          //
00004 //                                                                   //
00005 // This library is free software; you can redistribute it and/or     //
00006 // modify it under the terms of the GNU Lesser General Public        //
00007 // License as published by the Free Software Foundation; either      //
00008 // version 2.1 of the License, or (at your option) any later         //
00009 // version.                                                          //
00010 //                                                                   //
00011 // This library is distributed in the hope that it will be useful,   //
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of    //
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the      //
00014 // GNU Lesser General Public License for more details.               //
00015 //                                                                   //
00016 // You should have received a copy of the GNU Lesser General Public  //
00017 // License along with this program; if not, write to the Free        //
00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,   //
00019 // MA 02111-1307, USA.                                               //
00020 //                                                                   //
00021 // For any comment, suggestion or feature request, please contact    //
00022 // the administrator of the project at frm@users.sourceforge.net     //
00023 //                                                                   //
00031 
00032 
00033 
00034 #ifndef ADDSUBOP_H
00035 #define ADDSUBOP_H
00036 
00037 // optimization for GCC compiler
00038 #ifdef __GNUG__
00039 #pragma interface "AddSubOp.h"
00040 #endif
00041 
00042 // required includes
00043 #include "mc/Operator.h"
00044 
00045 
00046 // this will be defined later...
00047 mcDEFINE_HELPER_CLASSES(mcAddSubOp)
00048 
00049 
00050 
00051 
00052 
00053 class mcAddSubOpHelpers : public mcOperatorHelpers
00054 {
00055  mcDEFINE_REFERENCE_DATA(mcAddSubOp, mdata_nType);
00056 
00057 public:
00058  mcAddSubOpHelpers() { data_Init(); }
00059  virtual ~mcAddSubOpHelpers() {}
00060 
00061 
00062 #ifdef mcENABLE_DATA
00063 public:
00064  bool data_isAddOp() const  { return data_GetType() == mcET_ADDOP; }
00065  bool data_isSubOp() const  { return data_GetType() == mcET_SUBOP; }
00066 
00067 
00068 #ifdef __MCDEBUG__
00069  wxString data_Debug(long flags) const 
00070   { return wxString(wxT("mcAddSubOp    ")) + (data_isAddOp() ? wxT("+\n") : wxT("-\n")); }
00071 #endif
00072 #endif  // mcENABLE_DATA
00073 
00074 
00075 #ifdef mcENABLE_MATH
00076 public:
00077  bool math_CanBeApplied(const mcElement &, const mcElement &) const;
00078  mcRealValue math_Evaluate(mcRealValue v1, mcRealValue v2) const;
00079 
00080  mcBasicOpRes math_ApplySimple(mcElement &m1, const mcElement &m2) const;
00081  mcBasicOpRes math_Apply(mcElement &, const mcElement &, mcElement *) const;
00082 
00083 #endif  // mcENABLE_MATH
00084 };
00085 
00086 
00089 class mcAddSubOp : public mcOperator
00090 {
00091  mcDEFINE_MAIN_CLASS(AddSubOp, mcOperator);
00092 
00093 public:
00094 
00097  mcAddSubOp(mcElementType t);
00098  
00099 
00100  bool data_isValidContainerFor(mcElementType t) const
00101   { return t == mcET_ADDOP || t == mcET_SUBOP; }
00102 
00103  bool data_isAddOp() const   { return hlp()->data_isAddOp(); }
00104  bool data_isSubOp() const   { return hlp()->data_isSubOp(); }
00105 };
00106 
00107 #endif  // ADDSUBOP_H


Documentation generated with Doxygen on Sun Feb 6 17:10:45 2005
Visit MathStudio home page for more info

[ Top ]