Debugger: Add Number class for expression usage.

- This class abstracts out the underlying type of a value, and handles
  all the basic mathematical logical operators accordingly. Replaces
  the MAPM type previously used for these respective operations.
This commit is contained in:
Rene Gollent 2014-10-27 11:31:39 -04:00
parent 5d5ec05b1d
commit 1c6c5f3b57
3 changed files with 1065 additions and 0 deletions

View File

@ -219,6 +219,7 @@ Application Debugger :
# types
ArrayIndexPath.cpp
Number.cpp
TargetAddressRangeList.cpp
ValueLocation.cpp

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef NUMBER_H
#define NUMBER_H
#include <TypeConstants.h>
#include "Variant.h"
class BString;
class Number {
public:
Number();
virtual ~Number();
Number(type_code type, const BString& value);
Number(const BVariant& value);
Number(const Number& other);
void SetTo(type_code type, const BString& value,
int32 base = 10);
void SetTo(const BVariant& value);
Number& operator=(const Number& rhs);
Number& operator+=(const Number& rhs);
Number& operator-=(const Number& rhs);
Number& operator/=(const Number& rhs);
Number& operator*=(const Number& rhs);
Number& operator%=(const Number& rhs);
Number& operator&=(const Number& rhs);
Number& operator|=(const Number& rhs);
Number& operator^=(const Number& rhs);
Number operator-() const;
Number operator~() const;
int operator<(const Number& rhs) const;
int operator<=(const Number& rhs) const;
int operator>(const Number& rhs) const;
int operator>=(const Number& rhs) const;
int operator==(const Number& rhs) const;
int operator!=(const Number& rhs) const;
BVariant GetValue() const;
private:
BVariant fValue;
};
#endif // NUMBER_H