Expressions

- Filter processing short-circuits if there is no filter.
- Variant code was not only incomplete, but very broken.  It should not have
  been used.  It still doesn't handle dates and durations.
- Converted all logical and relational Variant operators to return Boolean
  values.
- Stack size is now checked for every operator.
- All operators implemented (without any advanced special case handling) except
  %, ~ and !~.
- Added lazy DOM expansion at the last possible moment.
- Implemented Expression::create_variant to create appropriate Variant instances
  based on categorized and inferred type.
- Removed Variant math functions.  No point.
- Debug code left in place for now.
This commit is contained in:
Paul Beckingham
2011-06-19 09:49:43 -04:00
parent c57f880be7
commit db17536266
4 changed files with 363 additions and 270 deletions

View File

@@ -55,42 +55,36 @@ public:
Variant (const std::string&);
Variant (const Date&);
Variant (const Duration&);
Variant& operator= (const Variant&);
Variant& operator&& (const Variant& other);
Variant& operator|| (const Variant& other);
Variant& operator<= (const Variant& other);
Variant& operator>= (const Variant& other);
Variant& operator== (const Variant& other);
Variant& operator!= (const Variant& other);
Variant& operator^ (const Variant& other);
Variant& operator! ();
Variant& operator- (const Variant& other);
Variant& operator+ (const Variant& other);
Variant& operator* (const Variant& other);
Variant& operator/ (const Variant& other);
Variant& operator< (const Variant& other);
Variant& operator> (const Variant& other);
bool operator&& (Variant& other);
bool operator|| (Variant& other);
void sqrt ();
void sin ();
void cos ();
void tan ();
void asin ();
void acos ();
void atan ();
void log ();
void exp ();
void exp10 ();
void ln ();
void sign ();
void abs ();
bool operator<= (Variant& other);
bool operator>= (Variant& other);
bool operator== (Variant& other);
bool operator< (Variant& other);
bool operator> (Variant& other);
bool operator!= (Variant& other);
bool operator! ();
Variant& operator^ (Variant& other);
Variant& operator- (Variant& other);
Variant& operator+ (Variant& other);
Variant& operator* (Variant& other);
Variant& operator/ (Variant& other);
void input (const std::string&);
std::string format ();
void cast (const variant_type);
variant_type type ();
void raw (const std::string&);
std::string raw ();
void raw_type (const std::string&);
std::string raw_type ();
void promote (Variant&, Variant&);
bool boolean ();
std::string dump ();
private:
variant_type mType;
@@ -101,6 +95,9 @@ private:
std::string mString;
Date mDate;
Duration mDuration;
std::string mRaw;
std::string mRawType;
};
#endif