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:
parent
5d5ec05b1d
commit
1c6c5f3b57
@ -219,6 +219,7 @@ Application Debugger :
|
||||
|
||||
# types
|
||||
ArrayIndexPath.cpp
|
||||
Number.cpp
|
||||
TargetAddressRangeList.cpp
|
||||
ValueLocation.cpp
|
||||
|
||||
|
1008
src/apps/debugger/types/Number.cpp
Normal file
1008
src/apps/debugger/types/Number.cpp
Normal file
File diff suppressed because it is too large
Load Diff
56
src/apps/debugger/types/Number.h
Normal file
56
src/apps/debugger/types/Number.h
Normal 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
|
Loading…
x
Reference in New Issue
Block a user