Ignore:
Timestamp:
03/12/15 04:21:46 (9 years ago)
Author:
Maciej Komosinski
Message:

New math operator semantics: extend mixed int/float to float, forbid number+notnumber

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/extvalue.h

    r333 r337  
    140140        enum CompareResult
    141141        {
    142          ResultLower=-1, ResultEqual=0, ResultHigher=1,
    143          ResultEqualUnordered,
    144          ResultUnequal_RelaxedEqual,
    145          ResultUnequal_RelaxedUnequal,
    146          ResultMismatch_RelaxedUnequal,
    147          ResultMismatch
     142                ResultLower = -1, ResultEqual = 0, ResultHigher = 1,
     143                ResultEqualUnordered,
     144                ResultUnequal_RelaxedEqual,
     145                ResultUnequal_RelaxedUnequal,
     146                ResultMismatch_RelaxedUnequal,
     147                ResultMismatch
    148148        };
    149149        // performs all script value comparisons.
     
    152152        CompareResult compare(const ExtValue& src) const;
    153153
    154         enum CmpOperator { CmpFIRST,CmpEQ=CmpFIRST,CmpNE,CmpGE,CmpLE,CmpGT,CmpLT,/*relaxed (not)equal*/CmpREQ,CmpRNE };
     154        enum CmpOperator { CmpFIRST, CmpEQ = CmpFIRST, CmpNE, CmpGE, CmpLE, CmpGT, CmpLT,/*relaxed (not)equal*/CmpREQ, CmpRNE };
    155155        static const char* cmp_op_names[];
    156         class CmpMessageHandler { public: virtual void cmpMessage(SString& text); };
    157         struct CmpContext { const ExtValue *v1,*v2; CmpMessageHandler *handler; };
    158         static CmpMessageHandler default_cmp_message;
    159         static CmpContext default_cmp_context;
     156        struct CmpContext { const ExtValue *v1, *v2; };
    160157        // interpret compare() result, optional context controls error messages
    161158        // @return 0=false, 1=true, -1=undefined (null in script)
    162         static int interpretCompare(CmpOperator op,CompareResult result,CmpContext *context=&default_cmp_context);
     159        static int interpretCompare(CmpOperator op, CompareResult result, CmpContext *context = NULL);
     160
     161        void divInt(paInt a);
     162        void divDouble(double a);
    163163
    164164        int operator==(const ExtValue& src) const;
     
    197197        bool isNull() const { return (type == TUnknown) || ((type == TObj) && odata().isEmpty()); }
    198198        SString typeDescription() const;//< @return human readable type name (used in error messages)
     199        SString typeAndValue() const;//< @return type and value (used in error messages)
    199200        const char* parseNumber(const char* in, ExtPType strict_type = TUnknown);
    200201        const char* deserialize(const char* in);//< @return first character after the succesfully parsed string or NULL if failed
Note: See TracChangeset for help on using the changeset viewer.