Loading...
Searching...
No Matches
ledger::value_t Class Reference

Dynamic type representing various numeric types. More...

#include <value.h>

Inherits ordered_field_operators< value_t, equality_comparable< value_t, balance_t, additive< value_t, balance_t, multiplicative< value_t, balance_t, ordered_field_operators< value_t, amount_t, ordered_field_operators< value_t, double, ordered_field_operators< value_t, unsigned long, ordered_field_operators< value_t, long > > > > > > > >.

Classes

class  storage_t
 

Public Types

typedef sequence_t::const_iterator const_iterator
 
typedef sequence_t::difference_type difference_type
 
typedef sequence_t::iterator iterator
 
typedef ptr_deque< value_tsequence_t
 The sequence_t member type abstracts the type used to represent a resizable "array" of value_t objects.
 
enum  type_t {
  VOID , BOOLEAN , DATETIME , DATE ,
  INTEGER , AMOUNT , BALANCE , STRING ,
  MASK , SEQUENCE , SCOPE , ANY
}
 type_t gives the type of the data contained or referenced by a value_t object. More...
 

Public Member Functions

value_t abs () const
 
void annotate (const annotation_t &details)
 Annotated commodity methods.
 
annotation_tannotation ()
 
const annotation_tannotation () const
 
const amount_tas_amount () const
 
amount_tas_amount_lval ()
 
const boost::any & as_any () const
 
template<typename T >
const T & as_any () const
 
boost::any & as_any_lval ()
 
template<typename T >
T & as_any_lval ()
 
const balance_tas_balance () const
 
balance_tas_balance_lval ()
 
const boolas_boolean () const
 
boolas_boolean_lval ()
 
const date_tas_date () const
 
date_tas_date_lval ()
 
const datetime_tas_datetime () const
 
datetime_tas_datetime_lval ()
 
const longas_long () const
 
longas_long_lval ()
 
const mask_tas_mask () const
 
mask_tas_mask_lval ()
 
scope_tas_scope () const
 
const sequence_tas_sequence () const
 
sequence_tas_sequence_lval ()
 
const stringas_string () const
 
stringas_string_lval ()
 
sequence_t::iterator begin ()
 
sequence_t::const_iterator begin () const
 
value_t casted (type_t cast_type) const
 Dynamic typing conversion methods.
 
value_t ceilinged () const
 
void dump (std::ostream &out, const bool relaxed=true) const
 
bool empty () const
 
sequence_t::iterator end ()
 
sequence_t::const_iterator end () const
 
value_t exchange_commodities (const std::string &commodities, const bool add_prices=false, const datetime_t &moment=datetime_t())
 
value_t floored () const
 
bool has_annotation () const
 
void in_place_cast (type_t cast_type)
 
void in_place_ceiling ()
 
void in_place_floor ()
 
void in_place_negate ()
 
void in_place_not ()
 
void in_place_reduce ()
 
void in_place_round ()
 
void in_place_roundto (int places)
 
void in_place_simplify ()
 
void in_place_truncate ()
 
void in_place_unreduce ()
 
void in_place_unround ()
 
bool is_amount () const
 
bool is_any () const
 Dealing with any type at all is bit involved because we actually deal with typed object.
 
template<typename T >
bool is_any () const
 
bool is_balance () const
 
bool is_boolean () const
 Data manipulation methods.
 
bool is_date () const
 
bool is_datetime () const
 
bool is_equal_to (const value_t &val) const
 Comparison operators.
 
bool is_greater_than (const value_t &val) const
 
bool is_less_than (const value_t &val) const
 
bool is_long () const
 
bool is_mask () const
 
bool is_nonzero () const
 
bool is_null () const
 
bool is_realzero () const
 
bool is_scope () const
 Dealing with scope pointers.
 
bool is_sequence () const
 
bool is_string () const
 
bool is_type (type_t _type) const
 
bool is_zero () const
 
string label (optional< type_t > the_type=none) const
 Informational methods.
 
value_t negated () const
 Unary arithmetic operators.
 
value_t number () const
 
 operator bool () const
 Truth tests.
 
value_toperator*= (const value_t &val)
 
value_toperator+= (const value_t &val)
 Binary arithmetic operators.
 
value_t operator- () const
 
value_toperator-= (const value_t &val)
 
value_toperator/= (const value_t &val)
 
template<typename T >
bool operator< (const T &amt) const
 
value_toperator= (const value_t &val)
 
template<typename T >
bool operator== (const T &amt) const
 
template<typename T >
bool operator> (const T &amt) const
 
value_toperator[] (const std::size_t index)
 Collection-style access methods for SEQUENCE values.
 
const value_toperator[] (const std::size_t index) const
 
void pop_back ()
 
void print (std::ostream &out, const int first_width=-1, const int latter_width=-1, const uint_least8_t flags=0x00) const
 Printing methods.
 
void push_back (const value_t &val)
 
void push_front (const value_t &val)
 
value_t reduced () const
 
value_t rounded () const
 
value_t roundto (int places) const
 
void set_amount (const amount_t &val)
 
void set_any (const boost::any &val)
 
template<typename T >
void set_any (T &val)
 
void set_balance (const balance_t &val)
 
void set_boolean (const bool val)
 
void set_date (const date_t &val)
 
void set_datetime (const datetime_t &val)
 
void set_long (const long val)
 
void set_mask (const mask_t &val)
 
void set_mask (const string &val)
 
void set_scope (scope_t *val)
 
void set_sequence (const sequence_t &val)
 
void set_string (const char *val="")
 
void set_string (const string &val="")
 
value_t simplified () const
 
std::size_t size () const
 
value_t strip_annotations (const keep_details_t &what_to_keep) const
 
amount_t to_amount () const
 
balance_t to_balance () const
 
bool to_boolean () const
 Data conversion methods.
 
date_t to_date () const
 
datetime_t to_datetime () const
 
int to_int () const
 
long to_long () const
 
mask_t to_mask () const
 
sequence_t to_sequence () const
 
std::size_t to_size_t () const
 
string to_string () const
 
value_t truncated () const
 
type_t type () const
 
value_t unreduced () const
 
value_t unrounded () const
 
bool valid () const
 Debugging methods.
 
value_t value (const datetime_t &moment=datetime_t(), const commodity_t *in_terms_of=NULL) const
 
 value_t ()
 Constructors.
 
 value_t (const amount_t &val)
 
 value_t (const balance_t &val)
 
 value_t (const bool val)
 
 value_t (const char *val, bool literal=false)
 
 value_t (const date_t &val)
 
 value_t (const datetime_t &val)
 
 value_t (const double val)
 
 value_t (const long val)
 
 value_t (const mask_t &val)
 
 value_t (const sequence_t &val)
 
 value_t (const string &val, bool literal=false)
 
 value_t (const unsigned long val)
 
 value_t (const value_t &val)
 Assignment and copy operators.
 
 value_t (scope_t *item)
 
 ~value_t ()
 Destructor.
 

Static Public Member Functions

static void initialize ()
 
static void shutdown ()
 

Detailed Description

Dynamic type representing various numeric types.

The following type is a polymorphous value type used solely for performance reasons. The alternative is to compute value expressions (valexpr.cc) in terms of the largest data type, balance_t. This was found to be prohibitively expensive, especially when large logic chains were involved, since many temporary allocations would occur for every operator. With value_t, and the fact that logic chains only need boolean values to continue, no memory allocations need to take place at all.

Definition at line 74 of file value.h.

Member Typedef Documentation

◆ const_iterator

typedef sequence_t::const_iterator ledger::value_t::const_iterator

Definition at line 91 of file value.h.

◆ difference_type

typedef sequence_t::difference_type ledger::value_t::difference_type

Definition at line 92 of file value.h.

◆ iterator

typedef sequence_t::iterator ledger::value_t::iterator

Definition at line 90 of file value.h.

◆ sequence_t

The sequence_t member type abstracts the type used to represent a resizable "array" of value_t objects.

Definition at line 89 of file value.h.

Member Enumeration Documentation

◆ type_t

type_t gives the type of the data contained or referenced by a value_t object.

Use the type() method to get a value of type type_t.

Enumerator
VOID 
BOOLEAN 
DATETIME 
DATE 
INTEGER 
AMOUNT 
BALANCE 
STRING 
MASK 
SEQUENCE 
SCOPE 
ANY 

Definition at line 99 of file value.h.

Constructor & Destructor Documentation

◆ value_t() [1/15]

ledger::value_t::value_t ( )
inline

Constructors.

value_t objects may be constructed from almost any value type that they can contain, including variations on those types (such as long, unsigned long, etc). The ordering of the methods here reflects the ordering of the constants in type_t above.

One constructor of special note is that taking a string or character pointer as an argument. Because value_t("$100") is interpreted as a commoditized amount, the form value_t("$100", true) is required to represent the literal string "$100", and not the amount "one hundred dollars".

Definition at line 273 of file value.h.

References TRACE_CTOR.

Referenced by push_back(), and push_front().

+ Here is the caller graph for this function:

◆ value_t() [2/15]

ledger::value_t::value_t ( const bool val)
inline

Definition at line 277 of file value.h.

References ledger::downcast(), set_boolean(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [3/15]

ledger::value_t::value_t ( const datetime_t & val)
inline

Definition at line 282 of file value.h.

References ledger::downcast(), set_datetime(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [4/15]

ledger::value_t::value_t ( const date_t & val)
inline

Definition at line 286 of file value.h.

References ledger::downcast(), set_date(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [5/15]

ledger::value_t::value_t ( const long val)
inline

Definition at line 291 of file value.h.

References ledger::downcast(), set_long(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [6/15]

ledger::value_t::value_t ( const unsigned long val)
inline

Definition at line 295 of file value.h.

References ledger::downcast(), set_amount(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [7/15]

ledger::value_t::value_t ( const double val)
inline

Definition at line 299 of file value.h.

References ledger::downcast(), set_amount(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [8/15]

ledger::value_t::value_t ( const amount_t & val)
inline

Definition at line 303 of file value.h.

References ledger::downcast(), set_amount(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [9/15]

ledger::value_t::value_t ( const balance_t & val)
inline

Definition at line 307 of file value.h.

References ledger::downcast(), set_balance(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [10/15]

ledger::value_t::value_t ( const mask_t & val)
inline

Definition at line 311 of file value.h.

References ledger::downcast(), set_mask(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [11/15]

ledger::value_t::value_t ( const string & val,
bool literal = false )
inlineexplicit

Definition at line 316 of file value.h.

References ledger::downcast(), set_amount(), set_string(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [12/15]

ledger::value_t::value_t ( const char * val,
bool literal = false )
inlineexplicit

Definition at line 324 of file value.h.

References ledger::downcast(), set_amount(), set_string(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [13/15]

ledger::value_t::value_t ( const sequence_t & val)
inline

Definition at line 333 of file value.h.

References ledger::downcast(), set_sequence(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ value_t() [14/15]

ledger::value_t::value_t ( scope_t * item)
inlineexplicit

Definition at line 338 of file value.h.

References ledger::downcast(), set_scope(), and TRACE_CTOR.

+ Here is the call graph for this function:

◆ ~value_t()

ledger::value_t::~value_t ( )
inline

Destructor.

This does not do anything, because the intrusive_ptr that refers to our storage object will decrease its reference count itself upon destruction.

Definition at line 355 of file value.h.

References TRACE_DTOR.

◆ value_t() [15/15]

ledger::value_t::value_t ( const value_t & val)
inline

Assignment and copy operators.

Values are cheaply copied by simply creating another reference to the other value's storage object. A true copy is only ever made prior to modification.

Definition at line 364 of file value.h.

References ledger::downcast(), and TRACE_CTOR.

+ Here is the call graph for this function:

Member Function Documentation

◆ abs()

value_t ledger::value_t::abs ( ) const

◆ annotate()

void ledger::value_t::annotate ( const annotation_t & details)

Annotated commodity methods.

◆ annotation() [1/2]

annotation_t & ledger::value_t::annotation ( )

Referenced by annotation().

+ Here is the caller graph for this function:

◆ annotation() [2/2]

const annotation_t & ledger::value_t::annotation ( ) const
inline

Definition at line 828 of file value.h.

References annotation().

+ Here is the call graph for this function:

◆ as_amount()

const amount_t & ledger::value_t::as_amount ( ) const
inline

Definition at line 625 of file value.h.

References is_amount(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_amount_lval()

amount_t & ledger::value_t::as_amount_lval ( )
inline

Definition at line 620 of file value.h.

References is_amount(), and VERIFY.

+ Here is the call graph for this function:

◆ as_any() [1/2]

const boost::any & ledger::value_t::as_any ( ) const
inline

Definition at line 754 of file value.h.

References is_any(), and VERIFY.

Referenced by as_any().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_any() [2/2]

template<typename T >
const T & ledger::value_t::as_any ( ) const
inline

Definition at line 759 of file value.h.

References as_any(), and ledger::downcast().

+ Here is the call graph for this function:

◆ as_any_lval() [1/2]

boost::any & ledger::value_t::as_any_lval ( )
inline

Definition at line 745 of file value.h.

References is_any(), and VERIFY.

Referenced by as_any_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_any_lval() [2/2]

template<typename T >
T & ledger::value_t::as_any_lval ( )
inline

Definition at line 751 of file value.h.

References as_any_lval(), and ledger::downcast().

+ Here is the call graph for this function:

◆ as_balance()

const balance_t & ledger::value_t::as_balance ( ) const
inline

Definition at line 643 of file value.h.

References is_balance(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_balance_lval()

balance_t & ledger::value_t::as_balance_lval ( )
inline

Definition at line 638 of file value.h.

References is_balance(), and VERIFY.

+ Here is the call graph for this function:

◆ as_boolean()

const bool & ledger::value_t::as_boolean ( ) const
inline

Definition at line 557 of file value.h.

References is_boolean(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_boolean_lval()

bool & ledger::value_t::as_boolean_lval ( )
inline

Definition at line 552 of file value.h.

References is_boolean(), and VERIFY.

+ Here is the call graph for this function:

◆ as_date()

const date_t & ledger::value_t::as_date ( ) const
inline

Definition at line 591 of file value.h.

References is_date(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_date_lval()

date_t & ledger::value_t::as_date_lval ( )
inline

Definition at line 586 of file value.h.

References is_date(), and VERIFY.

+ Here is the call graph for this function:

◆ as_datetime()

const datetime_t & ledger::value_t::as_datetime ( ) const
inline

Definition at line 574 of file value.h.

References is_datetime(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_datetime_lval()

datetime_t & ledger::value_t::as_datetime_lval ( )
inline

Definition at line 569 of file value.h.

References is_datetime(), and VERIFY.

+ Here is the call graph for this function:

◆ as_long()

const long & ledger::value_t::as_long ( ) const
inline

Definition at line 608 of file value.h.

References is_long(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_long_lval()

long & ledger::value_t::as_long_lval ( )
inline

Definition at line 603 of file value.h.

References is_long(), and VERIFY.

+ Here is the call graph for this function:

◆ as_mask()

const mask_t & ledger::value_t::as_mask ( ) const
inline

Definition at line 685 of file value.h.

References is_mask(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_mask_lval()

mask_t & ledger::value_t::as_mask_lval ( )
inline

Definition at line 679 of file value.h.

References is_mask(), and VERIFY.

+ Here is the call graph for this function:

◆ as_scope()

scope_t * ledger::value_t::as_scope ( ) const
inline

Definition at line 722 of file value.h.

References is_scope(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_sequence()

const sequence_t & ledger::value_t::as_sequence ( ) const
inline

Definition at line 707 of file value.h.

References is_sequence(), and VERIFY.

Referenced by begin(), end(), operator[](), pop_back(), and size().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_sequence_lval()

sequence_t & ledger::value_t::as_sequence_lval ( )
inline

Definition at line 702 of file value.h.

References is_sequence(), and VERIFY.

Referenced by begin(), end(), operator[](), pop_back(), push_back(), and push_front().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_string()

const string & ledger::value_t::as_string ( ) const
inline

Definition at line 661 of file value.h.

References is_string(), and VERIFY.

Referenced by ledger::call_scope_t::get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_string_lval()

string & ledger::value_t::as_string_lval ( )
inline

Definition at line 656 of file value.h.

References is_string(), and VERIFY.

+ Here is the call graph for this function:

◆ begin() [1/2]

sequence_t::iterator ledger::value_t::begin ( )
inline

Definition at line 895 of file value.h.

References as_sequence_lval(), is_sequence(), and VERIFY.

Referenced by ledger::call_scope_t::begin(), and ledger::call_scope_t::begin().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ begin() [2/2]

sequence_t::const_iterator ledger::value_t::begin ( ) const
inline

Definition at line 904 of file value.h.

References as_sequence(), is_sequence(), and VERIFY.

+ Here is the call graph for this function:

◆ casted()

value_t ledger::value_t::casted ( type_t cast_type) const
inline

Dynamic typing conversion methods.

‘cast(type_t)’ returns a new value whose type has been cast to the given type, but whose value is based on the original value. For example, the uncommoditized AMOUNT "100.00" could be cast to an INTEGER value. If a cast would lose information or is not meaningful, an exception is thrown.

simplify()’ is an automatic cast to the simplest type that can still represent the original value.

There are also "in-place" versions of these two methods: in_place_cast in_place_simplify

Definition at line 805 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ ceilinged()

value_t ledger::value_t::ceilinged ( ) const
inline

Definition at line 452 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ dump()

void ledger::value_t::dump ( std::ostream & out,
const bool relaxed = true ) const

◆ empty()

bool ledger::value_t::empty ( ) const
inline

Definition at line 922 of file value.h.

References size().

Referenced by ledger::draft_t::draft_t(), and ledger::query_t::query_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end() [1/2]

sequence_t::iterator ledger::value_t::end ( )
inline

Definition at line 899 of file value.h.

References as_sequence_lval(), is_sequence(), and VERIFY.

Referenced by ledger::call_scope_t::end(), and ledger::call_scope_t::end().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ end() [2/2]

sequence_t::const_iterator ledger::value_t::end ( ) const
inline

Definition at line 908 of file value.h.

References as_sequence(), is_sequence(), and VERIFY.

+ Here is the call graph for this function:

◆ exchange_commodities()

value_t ledger::value_t::exchange_commodities ( const std::string & commodities,
const bool add_prices = false,
const datetime_t & moment = datetime_t() )

◆ floored()

value_t ledger::value_t::floored ( ) const
inline

Definition at line 445 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ has_annotation()

bool ledger::value_t::has_annotation ( ) const

◆ in_place_cast()

void ledger::value_t::in_place_cast ( type_t cast_type)

Referenced by push_back(), and push_front().

+ Here is the caller graph for this function:

◆ in_place_ceiling()

void ledger::value_t::in_place_ceiling ( )

◆ in_place_floor()

void ledger::value_t::in_place_floor ( )

◆ in_place_negate()

void ledger::value_t::in_place_negate ( )

Referenced by negated().

+ Here is the caller graph for this function:

◆ in_place_not()

void ledger::value_t::in_place_not ( )

◆ in_place_reduce()

void ledger::value_t::in_place_reduce ( )

◆ in_place_round()

void ledger::value_t::in_place_round ( )

◆ in_place_roundto()

void ledger::value_t::in_place_roundto ( int places)

◆ in_place_simplify()

void ledger::value_t::in_place_simplify ( )

Referenced by simplified().

+ Here is the caller graph for this function:

◆ in_place_truncate()

void ledger::value_t::in_place_truncate ( )

◆ in_place_unreduce()

void ledger::value_t::in_place_unreduce ( )

◆ in_place_unround()

void ledger::value_t::in_place_unround ( )

◆ initialize()

static void ledger::value_t::initialize ( )
static

◆ is_amount()

bool ledger::value_t::is_amount ( ) const
inline

Definition at line 617 of file value.h.

References AMOUNT, and is_type().

Referenced by as_amount(), and as_amount_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_any() [1/2]

bool ledger::value_t::is_any ( ) const
inline

Dealing with any type at all is bit involved because we actually deal with typed object.

For example, if you call as_any it returns a boost::any object, but if you use as_any<type_t>, then it returns a type_t by value.

Definition at line 737 of file value.h.

References ANY, and is_type().

Referenced by as_any(), and as_any_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_any() [2/2]

template<typename T >
bool ledger::value_t::is_any ( ) const
inline

Definition at line 741 of file value.h.

References ANY, and is_type().

+ Here is the call graph for this function:

◆ is_balance()

bool ledger::value_t::is_balance ( ) const
inline

Definition at line 635 of file value.h.

References BALANCE, and is_type().

Referenced by as_balance(), and as_balance_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_boolean()

bool ledger::value_t::is_boolean ( ) const
inline

Data manipulation methods.

A value object may be truth tested for the existence of every type it can contain:

is_boolean() is_long() is_datetime() is_date() is_amount() is_balance() is_string() is_mask() is_sequence() is_any()

There are corresponding as_*() methods that represent a value as a reference to its underlying type. For example, as_long() returns a reference to a "const long".

There are also as_*_lval() methods, which represent the underlying data as a reference to a non-const type. The difference here is that an _lval() call causes the underlying data to be fully copied before the resulting reference is returned.

Lastly, there are corresponding set_*(data) methods for directly assigning data of a particular type, rather than using the regular assignment operator (whose implementation simply calls the various set_ methods).

Definition at line 549 of file value.h.

References BOOLEAN, and is_type().

Referenced by as_boolean(), and as_boolean_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_date()

bool ledger::value_t::is_date ( ) const
inline

Definition at line 583 of file value.h.

References DATE, and is_type().

Referenced by as_date(), and as_date_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_datetime()

bool ledger::value_t::is_datetime ( ) const
inline

Definition at line 566 of file value.h.

References DATETIME, and is_type().

Referenced by as_datetime(), and as_datetime_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_equal_to()

bool ledger::value_t::is_equal_to ( const value_t & val) const

Comparison operators.

Values can be compared to other values

Referenced by operator==().

+ Here is the caller graph for this function:

◆ is_greater_than()

bool ledger::value_t::is_greater_than ( const value_t & val) const

Referenced by operator>().

+ Here is the caller graph for this function:

◆ is_less_than()

bool ledger::value_t::is_less_than ( const value_t & val) const

Referenced by operator<().

+ Here is the caller graph for this function:

◆ is_long()

bool ledger::value_t::is_long ( ) const
inline

Definition at line 600 of file value.h.

References INTEGER, and is_type().

Referenced by as_long(), and as_long_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_mask()

bool ledger::value_t::is_mask ( ) const
inline

Definition at line 676 of file value.h.

References is_type(), and MASK.

Referenced by as_mask(), and as_mask_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_nonzero()

bool ledger::value_t::is_nonzero ( ) const
inline

Definition at line 493 of file value.h.

References is_zero().

+ Here is the call graph for this function:

◆ is_null()

bool ledger::value_t::is_null ( ) const
inline

Definition at line 499 of file value.h.

References is_type(), VERIFY, and VOID.

Referenced by ledger::call_scope_t::has(), operator[](), operator[](), pop_back(), push_back(), push_front(), and size().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_realzero()

bool ledger::value_t::is_realzero ( ) const

◆ is_scope()

bool ledger::value_t::is_scope ( ) const
inline

Dealing with scope pointers.

Definition at line 719 of file value.h.

References is_type(), and SCOPE.

Referenced by as_scope().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_sequence()

bool ledger::value_t::is_sequence ( ) const
inline

Definition at line 699 of file value.h.

References is_type(), and SEQUENCE.

Referenced by as_sequence(), as_sequence_lval(), begin(), begin(), end(), end(), operator[](), operator[](), pop_back(), push_back(), push_front(), and size().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_string()

bool ledger::value_t::is_string ( ) const
inline

Definition at line 653 of file value.h.

References is_type(), and STRING.

Referenced by as_string(), and as_string_lval().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_type()

bool ledger::value_t::is_type ( type_t _type) const
inline

Definition at line 512 of file value.h.

References ledger::downcast(), and type().

Referenced by is_amount(), is_any(), is_balance(), is_boolean(), is_date(), is_datetime(), is_long(), is_mask(), is_null(), is_scope(), is_sequence(), and is_string().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_zero()

bool ledger::value_t::is_zero ( ) const

Referenced by is_nonzero().

+ Here is the caller graph for this function:

◆ label()

string ledger::value_t::label ( optional< type_t > the_type = none) const

Informational methods.

◆ negated()

value_t ledger::value_t::negated ( ) const
inline

Unary arithmetic operators.

Definition at line 410 of file value.h.

References ledger::downcast(), and in_place_negate().

Referenced by operator-().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ number()

value_t ledger::value_t::number ( ) const

◆ operator bool()

ledger::value_t::operator bool ( ) const

Truth tests.

◆ operator*=()

value_t & ledger::value_t::operator*= ( const value_t & val)

◆ operator+=()

value_t & ledger::value_t::operator+= ( const value_t & val)

Binary arithmetic operators.

add(amount_t, optional<amount_t>) allows for the possibility of adding both an amount and its cost in a single operation. Otherwise, there is no way to separately represent the "cost" part of an amount addition statement.

◆ operator-()

value_t ledger::value_t::operator- ( ) const
inline

Definition at line 418 of file value.h.

References negated().

+ Here is the call graph for this function:

◆ operator-=()

value_t & ledger::value_t::operator-= ( const value_t & val)

◆ operator/=()

value_t & ledger::value_t::operator/= ( const value_t & val)

◆ operator<()

template<typename T >
bool ledger::value_t::operator< ( const T & amt) const
inline

Definition at line 386 of file value.h.

References ledger::downcast(), and is_less_than().

+ Here is the call graph for this function:

◆ operator=()

value_t & ledger::value_t::operator= ( const value_t & val)
inline

Definition at line 368 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ operator==()

template<typename T >
bool ledger::value_t::operator== ( const T & amt) const
inline

Definition at line 382 of file value.h.

References ledger::downcast(), and is_equal_to().

+ Here is the call graph for this function:

◆ operator>()

template<typename T >
bool ledger::value_t::operator> ( const T & amt) const
inline

Definition at line 390 of file value.h.

References ledger::downcast(), and is_greater_than().

+ Here is the call graph for this function:

◆ operator[]() [1/2]

value_t & ledger::value_t::operator[] ( const std::size_t index)
inline

Collection-style access methods for SEQUENCE values.

Definition at line 837 of file value.h.

References as_sequence_lval(), assert, ledger::downcast(), is_null(), is_sequence(), and VERIFY.

+ Here is the call graph for this function:

◆ operator[]() [2/2]

const value_t & ledger::value_t::operator[] ( const std::size_t index) const
inline

Definition at line 848 of file value.h.

References as_sequence(), assert, ledger::downcast(), is_null(), is_sequence(), and VERIFY.

+ Here is the call graph for this function:

◆ pop_back()

void ledger::value_t::pop_back ( )
inline

Definition at line 876 of file value.h.

References as_sequence(), as_sequence_lval(), ledger::downcast(), is_null(), is_sequence(), and VERIFY.

Referenced by ledger::call_scope_t::pop_back().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print()

void ledger::value_t::print ( std::ostream & out,
const int first_width = -1,
const int latter_width = -1,
const uint_least8_t flags = 0x00 ) const

Printing methods.

◆ push_back()

void ledger::value_t::push_back ( const value_t & val)
inline

Definition at line 868 of file value.h.

References as_sequence_lval(), ledger::downcast(), in_place_cast(), is_null(), is_sequence(), SEQUENCE, and value_t().

Referenced by ledger::call_scope_t::push_back().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_front()

void ledger::value_t::push_front ( const value_t & val)
inline

Definition at line 860 of file value.h.

References as_sequence_lval(), ledger::downcast(), in_place_cast(), is_null(), is_sequence(), SEQUENCE, and value_t().

Referenced by ledger::call_scope_t::push_front().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reduced()

value_t ledger::value_t::reduced ( ) const
inline

Definition at line 466 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ rounded()

value_t ledger::value_t::rounded ( ) const
inline

Definition at line 424 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ roundto()

value_t ledger::value_t::roundto ( int places) const
inline

Definition at line 431 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ set_amount()

void ledger::value_t::set_amount ( const amount_t & val)
inline

Definition at line 629 of file value.h.

References AMOUNT, ledger::downcast(), and VERIFY.

Referenced by value_t(), value_t(), value_t(), value_t(), and value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_any() [1/2]

void ledger::value_t::set_any ( const boost::any & val)
inline

Definition at line 762 of file value.h.

References ANY, and ledger::downcast().

+ Here is the call graph for this function:

◆ set_any() [2/2]

template<typename T >
void ledger::value_t::set_any ( T & val)
inline

Definition at line 767 of file value.h.

References ANY, and ledger::downcast().

+ Here is the call graph for this function:

◆ set_balance()

void ledger::value_t::set_balance ( const balance_t & val)
inline

Definition at line 647 of file value.h.

References BALANCE, ledger::downcast(), and VERIFY.

Referenced by value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_boolean()

void ledger::value_t::set_boolean ( const bool val)
inline

Definition at line 561 of file value.h.

References BOOLEAN, and ledger::downcast().

Referenced by value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_date()

void ledger::value_t::set_date ( const date_t & val)
inline

Definition at line 595 of file value.h.

References DATE, and ledger::downcast().

Referenced by value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_datetime()

void ledger::value_t::set_datetime ( const datetime_t & val)
inline

Definition at line 578 of file value.h.

References DATETIME, and ledger::downcast().

Referenced by value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_long()

void ledger::value_t::set_long ( const long val)
inline

Definition at line 612 of file value.h.

References ledger::downcast(), and INTEGER.

Referenced by value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_mask() [1/2]

void ledger::value_t::set_mask ( const mask_t & val)
inline

Definition at line 694 of file value.h.

References ledger::downcast(), and MASK.

+ Here is the call graph for this function:

◆ set_mask() [2/2]

void ledger::value_t::set_mask ( const string & val)
inline

Definition at line 690 of file value.h.

References ledger::downcast(), and MASK.

Referenced by value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_scope()

void ledger::value_t::set_scope ( scope_t * val)
inline

Definition at line 726 of file value.h.

References ledger::downcast(), and SCOPE.

Referenced by value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_sequence()

void ledger::value_t::set_sequence ( const sequence_t & val)
inline

Definition at line 711 of file value.h.

References ledger::downcast(), and SEQUENCE.

Referenced by value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_string() [1/2]

void ledger::value_t::set_string ( const char * val = "")
inline

Definition at line 670 of file value.h.

References ledger::downcast(), STRING, and VERIFY.

+ Here is the call graph for this function:

◆ set_string() [2/2]

void ledger::value_t::set_string ( const string & val = "")
inline

Definition at line 665 of file value.h.

References ledger::downcast(), STRING, and VERIFY.

Referenced by value_t(), and value_t().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ shutdown()

static void ledger::value_t::shutdown ( )
static

◆ simplified()

value_t ledger::value_t::simplified ( ) const
inline

Definition at line 812 of file value.h.

References ledger::downcast(), and in_place_simplify().

+ Here is the call graph for this function:

◆ size()

std::size_t ledger::value_t::size ( ) const
inline

Definition at line 913 of file value.h.

References as_sequence(), is_null(), and is_sequence().

Referenced by ledger::call_scope_t::empty(), empty(), ledger::call_scope_t::has(), ledger::call_scope_t::size(), and ledger::call_scope_t::value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ strip_annotations()

value_t ledger::value_t::strip_annotations ( const keep_details_t & what_to_keep) const

◆ to_amount()

amount_t ledger::value_t::to_amount ( ) const

Referenced by ledger::call_scope_t::get().

+ Here is the caller graph for this function:

◆ to_balance()

balance_t ledger::value_t::to_balance ( ) const

Referenced by ledger::call_scope_t::get().

+ Here is the caller graph for this function:

◆ to_boolean()

bool ledger::value_t::to_boolean ( ) const

Data conversion methods.

These methods convert a value object to its underlying type, where possible. If not possible, an exception is thrown.

Referenced by ledger::call_scope_t::get().

+ Here is the caller graph for this function:

◆ to_date()

date_t ledger::value_t::to_date ( ) const

Referenced by ledger::call_scope_t::get().

+ Here is the caller graph for this function:

◆ to_datetime()

datetime_t ledger::value_t::to_datetime ( ) const

Referenced by ledger::call_scope_t::get().

+ Here is the caller graph for this function:

◆ to_int()

int ledger::value_t::to_int ( ) const

Referenced by ledger::call_scope_t::get().

+ Here is the caller graph for this function:

◆ to_long()

long ledger::value_t::to_long ( ) const

Referenced by ledger::call_scope_t::get(), and to_size_t().

+ Here is the caller graph for this function:

◆ to_mask()

mask_t ledger::value_t::to_mask ( ) const

Referenced by ledger::call_scope_t::get().

+ Here is the caller graph for this function:

◆ to_sequence()

sequence_t ledger::value_t::to_sequence ( ) const

◆ to_size_t()

std::size_t ledger::value_t::to_size_t ( ) const
inline

Definition at line 780 of file value.h.

References to_long().

+ Here is the call graph for this function:

◆ to_string()

string ledger::value_t::to_string ( ) const

Referenced by ledger::call_scope_t::get().

+ Here is the caller graph for this function:

◆ truncated()

value_t ledger::value_t::truncated ( ) const
inline

Definition at line 438 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ type()

type_t ledger::value_t::type ( ) const
inline

Definition at line 509 of file value.h.

References VOID.

Referenced by is_type().

+ Here is the caller graph for this function:

◆ unreduced()

value_t ledger::value_t::unreduced ( ) const
inline

Definition at line 473 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ unrounded()

value_t ledger::value_t::unrounded ( ) const
inline

Definition at line 459 of file value.h.

References ledger::downcast().

+ Here is the call graph for this function:

◆ valid()

bool ledger::value_t::valid ( ) const

Debugging methods.

◆ value()

value_t ledger::value_t::value ( const datetime_t & moment = datetime_t(),
const commodity_t * in_terms_of = NULL ) const

The documentation for this class was generated from the following file: