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, totally_ordered< value_t, commodity_t, addable< value_t, commodity_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 , COMMODITY ,
  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 bool & as_boolean () const
bool & as_boolean_lval ()
const commodity_tas_commodity () const
const date_tas_date () const
date_tas_date_lval ()
const datetime_tas_datetime () const
datetime_tas_datetime_lval ()
const long & as_long () const
long & as_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_commodity () const
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_commodity (const commodity_t &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.
const commodity_tto_commodity () const
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 commodity_t &val)
 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 75 of file value.h.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 94 of file value.h.

◆ difference_type

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

Definition at line 95 of file value.h.

◆ iterator

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

Definition at line 93 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 92 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 
COMMODITY 
STRING 
MASK 
SEQUENCE 
SCOPE 
ANY 

Definition at line 102 of file value.h.

Constructor & Destructor Documentation

◆ value_t() [1/16]

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 278 of file value.h.

References TRACE_CTOR, and value_t().

Referenced by abs(), annotation(), casted(), ceilinged(), exchange_commodities(), floored(), is_equal_to(), is_greater_than(), is_less_than(), negated(), number(), operator*=(), operator+=(), operator-(), operator-=(), operator/=(), operator=(), operator[](), operator[](), push_back(), push_front(), reduced(), rounded(), roundto(), simplified(), strip_annotations(), truncated(), unreduced(), unrounded(), value(), value_t(), value_t(), value_t(), value_t(), value_t(), value_t(), value_t(), value_t(), value_t(), value_t(), value_t(), value_t(), 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:

◆ value_t() [2/16]

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

Definition at line 282 of file value.h.

References set_boolean(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [3/16]

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

Definition at line 287 of file value.h.

References set_datetime(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [4/16]

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

Definition at line 291 of file value.h.

References set_date(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [5/16]

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

Definition at line 296 of file value.h.

References set_long(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [6/16]

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

Definition at line 300 of file value.h.

References set_amount(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [7/16]

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

Definition at line 304 of file value.h.

References set_amount(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [8/16]

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

Definition at line 308 of file value.h.

References set_amount(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [9/16]

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

Definition at line 312 of file value.h.

References set_balance(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [10/16]

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

Definition at line 316 of file value.h.

References set_commodity(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [11/16]

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

Definition at line 320 of file value.h.

References set_mask(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [12/16]

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

Definition at line 325 of file value.h.

References set_amount(), set_string(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [13/16]

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

Definition at line 333 of file value.h.

References set_amount(), set_string(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [14/16]

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

Definition at line 342 of file value.h.

References set_sequence(), TRACE_CTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [15/16]

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

Definition at line 347 of file value.h.

References set_scope(), TRACE_CTOR, and value_t().

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 364 of file value.h.

References TRACE_DTOR, and value_t().

Here is the call graph for this function:

◆ value_t() [16/16]

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 373 of file value.h.

References TRACE_CTOR, and value_t().

Here is the call graph for this function:

Member Function Documentation

◆ abs()

value_t ledger::value_t::abs ( ) const

References value_t().

Here is the call graph for this function:

◆ annotate()

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

Annotated commodity methods.

◆ annotation() [1/2]

annotation_t & ledger::value_t::annotation ( )

◆ annotation() [2/2]

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

Definition at line 847 of file value.h.

References value_t().

Here is the call graph for this function:

◆ as_amount()

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

Definition at line 634 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 629 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 772 of file value.h.

References is_any(), and VERIFY.

Referenced by as_any(), and ledger::is_expr().

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 777 of file value.h.

References as_any().

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 763 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 769 of file value.h.

References as_any_lval().

Here is the call graph for this function:

◆ as_balance()

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

Definition at line 652 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 647 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 566 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 561 of file value.h.

References is_boolean(), and VERIFY.

Here is the call graph for this function:

◆ as_commodity()

const commodity_t & ledger::value_t::as_commodity ( ) const
inline

Definition at line 665 of file value.h.

References is_commodity(), 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 600 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 595 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 583 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 578 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 617 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 612 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 703 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 697 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 740 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 725 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 720 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 679 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 674 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 914 of file value.h.

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

Here is the call graph for this function:

◆ begin() [2/2]

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

Definition at line 923 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 824 of file value.h.

References in_place_cast(), and value_t().

Here is the call graph for this function:

◆ ceilinged()

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

Definition at line 461 of file value.h.

References in_place_ceiling(), and value_t().

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 941 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 918 of file value.h.

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

Here is the call graph for this function:

◆ end() [2/2]

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

Definition at line 927 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() )

References value_t().

Here is the call graph for this function:

◆ floored()

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

Definition at line 454 of file value.h.

References in_place_floor(), and value_t().

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 casted(), push_back(), and push_front().

Here is the caller graph for this function:

◆ in_place_ceiling()

void ledger::value_t::in_place_ceiling ( )

Referenced by ceilinged().

Here is the caller graph for this function:

◆ in_place_floor()

void ledger::value_t::in_place_floor ( )

Referenced by floored().

Here is the caller graph for this function:

◆ 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 ( )

Referenced by reduced().

Here is the caller graph for this function:

◆ in_place_round()

void ledger::value_t::in_place_round ( )

Referenced by rounded().

Here is the caller graph for this function:

◆ in_place_roundto()

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

Referenced by roundto().

Here is the caller graph for this function:

◆ 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 ( )

Referenced by truncated().

Here is the caller graph for this function:

◆ in_place_unreduce()

void ledger::value_t::in_place_unreduce ( )

Referenced by unreduced().

Here is the caller graph for this function:

◆ in_place_unround()

void ledger::value_t::in_place_unround ( )

Referenced by unrounded().

Here is the caller graph for this function:

◆ initialize()

void ledger::value_t::initialize ( )
static

◆ is_amount()

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

Definition at line 626 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 755 of file value.h.

References ANY, and is_type().

Referenced by as_any(), as_any_lval(), and ledger::is_expr().

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 759 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 644 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 558 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_commodity()

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

Definition at line 662 of file value.h.

References COMMODITY, and is_type().

Referenced by as_commodity().

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 592 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 575 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

References value_t().

Referenced by operator==().

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

◆ is_greater_than()

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

References value_t().

Referenced by operator>().

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

◆ is_less_than()

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

References value_t().

Referenced by operator<().

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

◆ is_long()

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

Definition at line 609 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 694 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 502 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 508 of file value.h.

References is_type(), VERIFY, and VOID.

Referenced by ledger::add_or_set_value(), 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 737 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 717 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 671 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 521 of file value.h.

References type().

Referenced by is_amount(), is_any(), is_balance(), is_boolean(), is_commodity(), 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 419 of file value.h.

References in_place_negate(), and value_t().

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

References value_t().

Here is the call graph for this function:

◆ operator bool()

ledger::value_t::operator bool ( ) const

Truth tests.

◆ operator*=()

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

References value_t().

Here is the call graph for this function:

◆ 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.

References value_t().

Here is the call graph for this function:

◆ operator-()

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

Definition at line 427 of file value.h.

References negated(), and value_t().

Here is the call graph for this function:

◆ operator-=()

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

References value_t().

Here is the call graph for this function:

◆ operator/=()

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

References value_t().

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 395 of file value.h.

References 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 377 of file value.h.

References value_t().

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 391 of file value.h.

References 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 399 of file value.h.

References 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 856 of file value.h.

References as_sequence_lval(), assert, is_null(), is_sequence(), value_t(), 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 867 of file value.h.

References as_sequence(), assert, is_null(), is_sequence(), value_t(), and VERIFY.

Here is the call graph for this function:

◆ pop_back()

void ledger::value_t::pop_back ( )
inline

Definition at line 895 of file value.h.

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

Here is the call 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.

References AMOUNT_PRINT_NO_FLAGS.

Referenced by ledger::operator<<(), and ledger::value_context().

Here is the caller graph for this function:

◆ push_back()

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

Definition at line 887 of file value.h.

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

Here is the call graph for this function:

◆ push_front()

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

Definition at line 879 of file value.h.

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

Here is the call graph for this function:

◆ reduced()

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

Definition at line 475 of file value.h.

References in_place_reduce(), and value_t().

Here is the call graph for this function:

◆ rounded()

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

Definition at line 433 of file value.h.

References in_place_round(), and value_t().

Here is the call graph for this function:

◆ roundto()

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

Definition at line 440 of file value.h.

References in_place_roundto(), and value_t().

Here is the call graph for this function:

◆ set_amount()

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

Definition at line 638 of file value.h.

References AMOUNT, ledger::amount_t::valid(), 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 780 of file value.h.

References ANY.

◆ set_any() [2/2]

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

Definition at line 785 of file value.h.

References ANY.

◆ set_balance()

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

Definition at line 656 of file value.h.

References BALANCE, ledger::balance_t::valid(), 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 570 of file value.h.

References BOOLEAN.

Referenced by value_t().

Here is the caller graph for this function:

◆ set_commodity()

void ledger::value_t::set_commodity ( const commodity_t & val)

Referenced by value_t().

Here is the caller graph for this function:

◆ set_date()

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

Definition at line 604 of file value.h.

References DATE.

Referenced by value_t().

Here is the caller graph for this function:

◆ set_datetime()

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

Definition at line 587 of file value.h.

References DATETIME.

Referenced by value_t().

Here is the caller graph for this function:

◆ set_long()

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

Definition at line 621 of file value.h.

References INTEGER.

Referenced by value_t().

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 712 of file value.h.

References MASK.

◆ set_mask() [2/2]

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

Definition at line 708 of file value.h.

References MASK.

Referenced by value_t().

Here is the caller graph for this function:

◆ set_scope()

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

Definition at line 744 of file value.h.

References SCOPE.

Referenced by value_t().

Here is the caller graph for this function:

◆ set_sequence()

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

Definition at line 729 of file value.h.

References SEQUENCE.

Referenced by value_t().

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 688 of file value.h.

References STRING, and VERIFY.

◆ set_string() [2/2]

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

Definition at line 683 of file value.h.

References STRING, and VERIFY.

Referenced by value_t(), and value_t().

Here is the caller graph for this function:

◆ shutdown()

void ledger::value_t::shutdown ( )
static

◆ simplified()

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

Definition at line 831 of file value.h.

References in_place_simplify(), and value_t().

Here is the call graph for this function:

◆ size()

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

Definition at line 932 of file value.h.

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

Referenced by empty().

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

References value_t().

Here is the call graph for this function:

◆ 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_commodity()

const commodity_t & ledger::value_t::to_commodity ( ) const

◆ 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

Referenced by ledger::query_t::query_t().

Here is the caller graph for this function:

◆ to_size_t()

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

Definition at line 798 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 447 of file value.h.

References in_place_truncate(), and value_t().

Here is the call graph for this function:

◆ type()

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

Definition at line 518 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 482 of file value.h.

References in_place_unreduce(), and value_t().

Here is the call graph for this function:

◆ unrounded()

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

Definition at line 468 of file value.h.

References in_place_unround(), and value_t().

Here is the call graph for this function:

◆ valid()

bool ledger::value_t::valid ( ) const

Debugging methods.

Referenced by ledger::expr_t::op_t::as_value_lval(), and ledger::expr_t::op_t::set_value().

Here is the caller graph for this function:

◆ value()

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

References value_t().

Here is the call graph for this function:

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