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

#include <commodity.h>

+ Inheritance diagram for ledger::commodity_t:
+ Collaboration diagram for ledger::commodity_t:

Classes

class  base_t
 
struct  compare_by_commodity
 

Public Types

typedef uint_least16_t flags_t
 

Public Member Functions

void add_flags (const flags_t arg)
 
void add_price (const datetime_t &date, const amount_t &price, const bool reflexive=true)
 
string base_symbol () const
 
optional< price_point_tcheck_for_updated_price (const optional< price_point_t > &point, const datetime_t &moment, const commodity_t *in_terms_of)
 
void clear_flags ()
 
void drop_flags (const flags_t arg)
 
virtual optional< price_point_tfind_price (const commodity_t *commodity=NULL, const datetime_t &moment=datetime_t(), const datetime_t &oldest=datetime_t()) const
 
optional< price_point_tfind_price_from_expr (expr_t &expr, const commodity_t *commodity, const datetime_t &moment) const
 
flags_t flags () const
 
optional< std::size_t > graph_index () const
 
bool has_annotation () const
 
bool has_flags (const flags_t arg) const
 
optional< amount_tlarger () const
 
void map_prices (function< void(datetime_t, const amount_t &)> fn, const datetime_t &moment=datetime_t(), const datetime_t &_oldest=datetime_t(), bool bidirectionally=false)
 
commodity_tnail_down (const expr_t &expr)
 
optional< stringname () const
 
optional< stringnote () const
 
 operator bool () const
 
virtual bool operator== (const commodity_t &comm) const
 
bool operator== (const string &name) const
 
commodity_pool_tpool () const
 
amount_t::precision_t precision () const
 
virtual void print (std::ostream &out, bool elide_quotes=false, bool print_annotations=false) const
 
virtual commodity_treferent ()
 
virtual const commodity_treferent () const
 
void remove_price (const datetime_t &date, commodity_t &commodity)
 
void set_flags (const flags_t arg)
 
void set_graph_index (const optional< std::size_t > &arg=none)
 
void set_larger (const optional< amount_t > &arg=none)
 
void set_name (const optional< string > &arg=none)
 
void set_note (const optional< string > &arg=none)
 
void set_precision (amount_t::precision_t arg)
 
void set_smaller (const optional< amount_t > &arg=none)
 
void set_value_expr (const optional< expr_t > &expr=none)
 
optional< amount_tsmaller () const
 
virtual commodity_tstrip_annotations (const keep_details_t &)
 
string symbol () const
 
bool valid () const
 
virtual optional< expr_tvalue_expr () const
 
virtual void write_annotations (std::ostream &, bool) const
 
virtual ~commodity_t ()
 

Static Public Member Functions

static void parse_symbol (char *&p, string &symbol)
 
static string parse_symbol (std::istream &in)
 
static void parse_symbol (std::istream &in, string &symbol)
 
static bool symbol_needs_quotes (const string &symbol)
 

Static Public Attributes

static bool decimal_comma_by_default
 
static bool time_colon_by_default
 

Protected Member Functions

 commodity_t (commodity_pool_t *_parent, const shared_ptr< base_t > &_base)
 

Protected Attributes

supports_flags< uint_least16_t > & _flags
 
bool annotated
 
shared_ptr< base_tbase
 
commodity_pool_tparent_
 
optional< stringqualified_symbol
 

Friends

class annotated_commodity_t
 
class commodity_pool_t
 

Detailed Description

Definition at line 72 of file commodity.h.

Member Typedef Documentation

◆ flags_t

Definition at line 150 of file flags.h.

Constructor & Destructor Documentation

◆ commodity_t()

ledger::commodity_t::commodity_t ( commodity_pool_t * _parent,
const shared_ptr< base_t > & _base )
inlineexplicitprotected

Definition at line 136 of file commodity.h.

References TRACE_CTOR.

◆ ~commodity_t()

virtual ledger::commodity_t::~commodity_t ( )
inlinevirtual

Definition at line 147 of file commodity.h.

References TRACE_DTOR.

Member Function Documentation

◆ add_flags()

void ledger::flags::delegates_flags< uint_least16_t >::add_flags ( const flags_t arg)
inlineinherited

Definition at line 179 of file flags.h.

◆ add_price()

void ledger::commodity_t::add_price ( const datetime_t & date,
const amount_t & price,
const bool reflexive = true )

◆ base_symbol()

string ledger::commodity_t::base_symbol ( ) const
inline

Definition at line 184 of file commodity.h.

References base.

Referenced by operator==(), and symbol().

+ Here is the caller graph for this function:

◆ check_for_updated_price()

optional< price_point_t > ledger::commodity_t::check_for_updated_price ( const optional< price_point_t > & point,
const datetime_t & moment,
const commodity_t * in_terms_of )

◆ clear_flags()

void ledger::flags::delegates_flags< uint_least16_t >::clear_flags ( )
inlineinherited

Definition at line 176 of file flags.h.

◆ drop_flags()

void ledger::flags::delegates_flags< uint_least16_t >::drop_flags ( const flags_t arg)
inlineinherited

Definition at line 182 of file flags.h.

◆ find_price()

virtual optional< price_point_t > ledger::commodity_t::find_price ( const commodity_t * commodity = NULL,
const datetime_t & moment = datetime_t(),
const datetime_t & oldest = datetime_t() ) const
virtual

Reimplemented in ledger::annotated_commodity_t.

◆ find_price_from_expr()

optional< price_point_t > ledger::commodity_t::find_price_from_expr ( expr_t & expr,
const commodity_t * commodity,
const datetime_t & moment ) const

◆ flags()

flags_t ledger::flags::delegates_flags< uint_least16_t >::flags ( ) const
inlineinherited

Definition at line 166 of file flags.h.

◆ graph_index()

optional< std::size_t > ledger::commodity_t::graph_index ( ) const
inline

Definition at line 191 of file commodity.h.

References base.

◆ has_annotation()

bool ledger::commodity_t::has_annotation ( ) const
inline

Definition at line 171 of file commodity.h.

References annotated.

◆ has_flags()

bool ledger::flags::delegates_flags< uint_least16_t >::has_flags ( const flags_t arg) const
inlineinherited

Definition at line 169 of file flags.h.

◆ larger()

optional< amount_t > ledger::commodity_t::larger ( ) const
inline

Definition at line 226 of file commodity.h.

References base.

◆ map_prices()

void ledger::commodity_t::map_prices ( function< void(datetime_t, const amount_t &)> fn,
const datetime_t & moment = datetime_t(),
const datetime_t & _oldest = datetime_t(),
bool bidirectionally = false )

◆ nail_down()

commodity_t & ledger::commodity_t::nail_down ( const expr_t & expr)

◆ name()

optional< string > ledger::commodity_t::name ( ) const
inline

Definition at line 198 of file commodity.h.

References base.

Referenced by operator==().

+ Here is the caller graph for this function:

◆ note()

optional< string > ledger::commodity_t::note ( ) const
inline

Definition at line 205 of file commodity.h.

References base.

◆ operator bool()

ledger::commodity_t::operator bool ( ) const

◆ operator==() [1/2]

virtual bool ledger::commodity_t::operator== ( const commodity_t & comm) const
inlinevirtual

Reimplemented in ledger::annotated_commodity_t.

Definition at line 153 of file commodity.h.

References base, and ledger::downcast().

+ Here is the call graph for this function:

◆ operator==() [2/2]

bool ledger::commodity_t::operator== ( const string & name) const
inline

Definition at line 158 of file commodity.h.

References base_symbol(), and name().

+ Here is the call graph for this function:

◆ parse_symbol() [1/3]

static void ledger::commodity_t::parse_symbol ( char *& p,
string & symbol )
static

◆ parse_symbol() [2/3]

static string ledger::commodity_t::parse_symbol ( std::istream & in)
inlinestatic

Definition at line 270 of file commodity.h.

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

+ Here is the call graph for this function:

◆ parse_symbol() [3/3]

static void ledger::commodity_t::parse_symbol ( std::istream & in,
string & symbol )
static

Referenced by parse_symbol().

+ Here is the caller graph for this function:

◆ pool()

commodity_pool_t & ledger::commodity_t::pool ( ) const
inline

Definition at line 180 of file commodity.h.

References parent_.

◆ precision()

amount_t::precision_t ledger::commodity_t::precision ( ) const
inline

Definition at line 212 of file commodity.h.

References base.

◆ print()

virtual void ledger::commodity_t::print ( std::ostream & out,
bool elide_quotes = false,
bool print_annotations = false ) const
virtual

Reimplemented in ledger::annotated_commodity_t.

Referenced by ledger::annotated_commodity_t::print().

+ Here is the caller graph for this function:

◆ referent() [1/2]

virtual commodity_t & ledger::commodity_t::referent ( )
inlinevirtual

Reimplemented in ledger::annotated_commodity_t.

Definition at line 164 of file commodity.h.

◆ referent() [2/2]

virtual const commodity_t & ledger::commodity_t::referent ( ) const
inlinevirtual

Reimplemented in ledger::annotated_commodity_t.

Definition at line 167 of file commodity.h.

◆ remove_price()

void ledger::commodity_t::remove_price ( const datetime_t & date,
commodity_t & commodity )

◆ set_flags()

void ledger::flags::delegates_flags< uint_least16_t >::set_flags ( const flags_t arg)
inlineinherited

Definition at line 173 of file flags.h.

◆ set_graph_index()

void ledger::commodity_t::set_graph_index ( const optional< std::size_t > & arg = none)
inline

Definition at line 194 of file commodity.h.

References base, and ledger::downcast().

+ Here is the call graph for this function:

◆ set_larger()

void ledger::commodity_t::set_larger ( const optional< amount_t > & arg = none)
inline

Definition at line 229 of file commodity.h.

References base, and ledger::downcast().

+ Here is the call graph for this function:

◆ set_name()

void ledger::commodity_t::set_name ( const optional< string > & arg = none)
inline

Definition at line 201 of file commodity.h.

References base, and ledger::downcast().

+ Here is the call graph for this function:

◆ set_note()

void ledger::commodity_t::set_note ( const optional< string > & arg = none)
inline

Definition at line 208 of file commodity.h.

References base, and ledger::downcast().

+ Here is the call graph for this function:

◆ set_precision()

void ledger::commodity_t::set_precision ( amount_t::precision_t arg)
inline

Definition at line 215 of file commodity.h.

References base, and ledger::downcast().

+ Here is the call graph for this function:

◆ set_smaller()

void ledger::commodity_t::set_smaller ( const optional< amount_t > & arg = none)
inline

Definition at line 222 of file commodity.h.

References base, and ledger::downcast().

+ Here is the call graph for this function:

◆ set_value_expr()

void ledger::commodity_t::set_value_expr ( const optional< expr_t > & expr = none)
inline

Definition at line 236 of file commodity.h.

References base.

◆ smaller()

optional< amount_t > ledger::commodity_t::smaller ( ) const
inline

Definition at line 219 of file commodity.h.

References base.

◆ strip_annotations()

virtual commodity_t & ledger::commodity_t::strip_annotations ( const keep_details_t & )
inlinevirtual

Reimplemented in ledger::annotated_commodity_t.

Definition at line 175 of file commodity.h.

◆ symbol()

string ledger::commodity_t::symbol ( ) const
inline

Definition at line 187 of file commodity.h.

References base_symbol(), and qualified_symbol.

+ Here is the call graph for this function:

◆ symbol_needs_quotes()

static bool ledger::commodity_t::symbol_needs_quotes ( const string & symbol)
static

◆ valid()

bool ledger::commodity_t::valid ( ) const

◆ value_expr()

virtual optional< expr_t > ledger::commodity_t::value_expr ( ) const
inlinevirtual

Reimplemented in ledger::annotated_commodity_t.

Definition at line 233 of file commodity.h.

References base.

Referenced by ledger::annotated_commodity_t::value_expr().

+ Here is the caller graph for this function:

◆ write_annotations()

virtual void ledger::commodity_t::write_annotations ( std::ostream & ,
bool  ) const
inlinevirtual

Reimplemented in ledger::annotated_commodity_t.

Definition at line 178 of file commodity.h.

Friends And Related Symbol Documentation

◆ annotated_commodity_t

Definition at line 78 of file commodity.h.

◆ commodity_pool_t

Definition at line 77 of file commodity.h.

Member Data Documentation

◆ _flags

supports_flags<uint_least16_t >& ledger::flags::delegates_flags< uint_least16_t >::_flags
protectedinherited

Definition at line 153 of file flags.h.

◆ annotated

bool ledger::commodity_t::annotated
protected

◆ base

◆ decimal_comma_by_default

bool ledger::commodity_t::decimal_comma_by_default
static

Definition at line 144 of file commodity.h.

◆ parent_

commodity_pool_t* ledger::commodity_t::parent_
protected

Definition at line 132 of file commodity.h.

Referenced by pool().

◆ qualified_symbol

optional<string> ledger::commodity_t::qualified_symbol
protected

Definition at line 133 of file commodity.h.

Referenced by ledger::annotated_commodity_t::annotated_commodity_t(), and symbol().

◆ time_colon_by_default

bool ledger::commodity_t::time_colon_by_default
static

Definition at line 145 of file commodity.h.


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