Datum.hpp

A single piece of data, either a value or a string.

DEVELOPER NOTES:

  • For now, using unions, but this creates complications with non-trivial constructor/destructor for strings, so could try shifting over.

Note

Status: ALPHA

Functions

std::ostream &operator<<(std::ostream &out, const Datum &d)
Datum operator%(double value1, Datum value2)
class Datum
#include <Datum.hpp>

Public Functions

inline Datum()
inline Datum(double in)
inline Datum(const std::string &in)
inline Datum(std::string &&in)
inline Datum(const char *in)
inline Datum(const Datum &in)
inline Datum(Datum &&in)
inline ~Datum()
inline bool IsDouble() const

Is this natively stored as a double?

inline bool IsString() const

Is this natively stored as a string?

inline double &NativeDouble()

If we know Datum is a Double, we can request its native form.

inline double NativeDouble() const
inline std::string &NativeString()

If we know Datum is a String, we can request its native form.

inline const std::string &NativeString() const
inline double AsDouble() const
inline std::string AsString() const
inline operator double() const
inline operator std::string() const
inline Datum &SetDouble(double in)
inline Datum &SetString(const std::string &in)
inline Datum &Set(const Datum &in)
inline Datum &operator=(double in)
inline Datum &operator=(const std::string &in)
inline Datum &operator=(const char *in)
inline Datum &operator=(const Datum &in)
inline Datum operator+() const
inline Datum operator-() const
inline Datum operator!() const
inline int CompareNumber(double rhs) const
inline int CompareString(const std::string &rhs) const
inline int Compare(double rhs) const
inline int Compare(const std::string &rhs) const
inline int Compare(const char *rhs) const
inline int Compare(const Datum &rhs) const
template<typename T>
inline bool operator==(const T &rhs) const
template<typename T>
inline bool operator!=(const T &rhs) const
template<typename T>
inline bool operator<(const T &rhs) const
template<typename T>
inline bool operator>=(const T &rhs) const
template<typename T>
inline bool operator>(const T &rhs) const
template<typename T>
inline bool operator<=(const T &rhs) const
inline Datum operator+(double in) const
inline Datum operator*(double in) const
inline Datum operator-(double in) const
inline Datum operator/(double in) const
inline Datum operator%(double in) const
inline Datum operator+(const Datum &in) const
inline Datum operator*(const Datum &in) const
inline Datum operator-(const Datum &in) const
inline Datum operator/(const Datum &in) const
inline Datum operator%(const Datum &in) const
template<typename T>
inline Datum operator+=(T &&in)
template<typename T>
inline Datum operator-=(T &&in)
template<typename T>
inline Datum operator*=(T &&in)
template<typename T>
inline Datum operator/=(T &&in)
template<typename T>
inline Datum operator%=(T &&in)

Public Members

double num
std::string str

Private Functions

inline void InitString()
template<typename T>
inline void InitString(T &&in)
inline void FreeString()

Private Members

union Datum::[anonymous] [anonymous]
bool is_num = true