General utility facilities used by Ledger. More...
Go to the source code of this file.
Namespaces | |
namespace | ledger |
Macros | |
#define | READ_INTO(str, targ, size, var, cond) |
#define | READ_INTO_(str, targ, size, var, idx, cond) |
#define | TIMERS_ON 1 |
Assertions | |
#define | assert(x) |
Verification (i.e., heavy asserts) | |
#define | DO_VERIFY() false |
#define | IF_VERIFY() if (DO_VERIFY()) |
#define | TRACE_CTOR(cls, args) |
#define | TRACE_DTOR(cls) |
#define | VERIFY(x) |
Tracing and logging | |
#define | CRITICAL(msg) |
#define | DEBUG(cat, msg) |
#define | DEBUG_(msg) |
#define | ERROR(msg) |
#define | FATAL(msg) |
#define | IF_CRITICAL() if (SHOW_CRITICAL()) |
#define | IF_DEBUG(cat) if (SHOW_DEBUG(cat)) |
#define | IF_DEBUG_() if (SHOW_DEBUG_()) |
#define | IF_ERROR() if (SHOW_ERROR()) |
#define | IF_FATAL() if (SHOW_FATAL()) |
#define | IF_INFO() if (SHOW_INFO()) |
#define | IF_TRACE(lvl) if (SHOW_TRACE(lvl)) |
#define | IF_WARN() if (SHOW_WARN()) |
#define | INFO(msg) |
#define | LOGGER(cat) |
#define | SHOW_CRITICAL() false |
#define | SHOW_DEBUG(cat) false |
#define | SHOW_DEBUG_() false |
#define | SHOW_ERROR() false |
#define | SHOW_FATAL() false |
#define | SHOW_INFO() false |
#define | SHOW_TRACE(lvl) false |
#define | SHOW_WARN() false |
#define | TRACE(lvl, msg) |
#define | WARN(msg) |
General utility functions | |
#define | foreach BOOST_FOREACH |
Typedefs | |
typedef gregorian::date | ledger::date |
typedef gregorian::date_duration | ledger::date_duration |
typedef boost::filesystem::filesystem_error | ledger::filesystem_error |
typedef boost::filesystem::ifstream | ledger::ifstream |
typedef boost::filesystem::ofstream | ledger::ofstream |
typedef boost::filesystem::path | ledger::path |
typedef posix_time::ptime | ledger::ptime |
typedef posix_time::seconds | ledger::seconds |
typedef std::string | ledger::string |
typedef std::list< string > | ledger::strings_list |
typedef ptime::time_duration_type | ledger::time_duration |
Enumerations | |
enum | ledger::hash_type_t { ledger::NO_HASHES = 0 , ledger::HASH_SHA512 = 1 , ledger::HASH_SHA512_Half = 2 } |
Functions | |
void | ledger::debug_assert (const string &reason, const string &func, const string &file, std::size_t line) |
string | ledger::digest_to_hex (const boost::uuids::detail::sha1::digest_type &message_digest, size_t len=sizeof(boost::uuids::detail::sha1::digest_type) *2) |
template<typename T , typename U > | |
T & | ledger::downcast (U &object) |
const string & | ledger::either_or (const string &first, const string &second) |
string | ledger::lowered (const string &str) |
char * | ledger::next_element (char *buf, bool variable=false) |
string | ledger::operator+ (const char *left, const string &right) |
int | ledger::peek_next_nonws (std::istream &in) |
path | ledger::resolve_path (const path &pathname) |
string | ledger::sha1sum (const string &str, size_t len=sizeof(boost::uuids::detail::sha1::digest_type) *2) |
char * | ledger::skip_ws (char *ptr) |
strings_list | ledger::split_arguments (const char *line) |
string | ledger::to_string (long num) |
string | ledger::to_string (std::size_t num) |
char * | ledger::trim_ws (char *ptr) |
Variables | |
string | ledger::empty_string |
const string | ledger::version |
Timers | |
This allows log xacts to specify cumulative time spent. | |
caught_signal_t | caught_signal |
enum | caught_signal_t { NONE_CAUGHT , INTERRUPTED , PIPE_CLOSED } |
void | check_for_signal () |
#define | DEBUG_FINISH(name) |
#define | DEBUG_START(name, msg) |
#define | DEBUG_START_(name, cat, msg) |
#define | DEBUG_STOP(name) |
#define | INFO_FINISH(name) |
#define | INFO_START(name, msg) |
#define | INFO_STOP(name) |
void | sigint_handler (int sig) |
void | sigpipe_handler (int sig) |
#define | TRACE_FINISH(name, lvl) |
#define | TRACE_START(lvl, msg, name) |
#define | TRACE_STOP(name, lvl) |
General utility facilities used by Ledger.
Definition in file utils.h.
#define assert | ( | x | ) |
Definition at line 92 of file utils.h.
Referenced by ledger::amount_t::amount_t(), ledger::amount_t::amount_t(), ledger::expr_t::op_t::as_function_lval(), ledger::expr_t::op_t::as_ident_lval(), ledger::expr_t::op_t::as_op_lval(), ledger::expr_t::op_t::as_scope_lval(), ledger::expr_t::op_t::as_value_lval(), ledger::expr_base_t< ResultType >::calc(), ledger::call_scope_t::context(), ledger::item_t::date(), ledger::symbol_scope_t::description(), ledger::unistring::extract(), ledger::unistring::extract_by_width(), ledger::parse_context_stack_t::get_current(), ledger::expr_t::op_t::is_ident(), ledger::amount_t::is_null(), ledger::expr_t::op_t::is_value(), ledger::expr_t::op_t::left(), ledger::expr_t::op_t::left(), ledger::query_t::lexer_t::lexer_t(), ledger::compare_items< T >::operator()(), ledger::amount_t::operator=(), ledger::expr_t::token_t::operator=(), ledger::value_t::operator[](), ledger::value_t::operator[](), ledger::parse_context_stack_t::pop(), ledger::global_scope_t::pop_report(), ledger::item_t::primary_date(), ledger::query_t::lexer_t::push_token(), ledger::draft_t::real_calc(), ledger::post_t::reported_account(), ledger::expr_t::op_t::right(), ledger::expr_t::op_t::right(), ledger::expr_t::op_t::set_left(), ledger::expr_t::op_t::set_right(), ledger::mask_t::str(), ledger::option_t< T >::str(), ledger::query_t::lexer_t::token_t::symbol(), ledger::query_t::parser_t::tokens_remaining(), ledger::unistring::unistring(), ledger::annotation_t::valid(), ledger::account_t::xdata(), and ledger::expr_t::op_t::~op_t().
#define DEBUG | ( | cat, | |
msg ) |
Definition at line 327 of file utils.h.
Referenced by ledger::bind_scope_t::bind_scope_t(), ledger::expr_base_t< ResultType >::calc(), ledger::mask_t::match(), ledger::option_t< T >::option_t(), ledger::search_scope(), ledger::balance_t::valid(), and ledger::mask_t::valid().
#define IF_CRITICAL | ( | ) | if (SHOW_CRITICAL()) |
#define IF_DEBUG | ( | cat | ) | if (SHOW_DEBUG(cat)) |
#define IF_DEBUG_ | ( | ) | if (SHOW_DEBUG_()) |
#define IF_ERROR | ( | ) | if (SHOW_ERROR()) |
#define IF_FATAL | ( | ) | if (SHOW_FATAL()) |
#define IF_TRACE | ( | lvl | ) | if (SHOW_TRACE(lvl)) |
#define READ_INTO | ( | str, | |
targ, | |||
size, | |||
var, | |||
cond ) |
#define READ_INTO_ | ( | str, | |
targ, | |||
size, | |||
var, | |||
idx, | |||
cond ) |
#define SHOW_DEBUG | ( | cat | ) | false |
Definition at line 318 of file utils.h.
Referenced by ledger::expr_base_t< ResultType >::calc().
#define TRACE_CTOR | ( | cls, | |
args ) |
Definition at line 143 of file utils.h.
Referenced by ledger::account_t::account_t(), ledger::account_t::account_t(), ledger::subtotal_posts::acct_value_t::acct_value_t(), ledger::subtotal_posts::acct_value_t::acct_value_t(), ledger::subtotal_posts::acct_value_t::acct_value_t(), ledger::amount_t::amount_t(), ledger::amount_t::amount_t(), ledger::amount_t::amount_t(), ledger::amount_t::amount_t(), ledger::amount_t::amount_t(), ledger::annotated_commodity_t::annotated_commodity_t(), ledger::annotation_t::annotation_t(), ledger::annotation_t::annotation_t(), ledger::anonymize_posts::anonymize_posts(), ledger::auto_xact_t::auto_xact_t(), ledger::auto_xact_t::auto_xact_t(), ledger::auto_xact_t::auto_xact_t(), ledger::balance_t::balance_t(), ledger::balance_t::balance_t(), ledger::balance_t::balance_t(), ledger::balance_t::balance_t(), ledger::balance_t::balance_t(), ledger::commodity_t::base_t::base_t(), ledger::basic_accounts_iterator::basic_accounts_iterator(), ledger::basic_accounts_iterator::basic_accounts_iterator(), ledger::basic_accounts_iterator::basic_accounts_iterator(), ledger::flags::basic_t< T, U >::basic_t(), ledger::flags::basic_t< T, U >::basic_t(), ledger::flags::basic_t< T, U >::basic_t(), ledger::flags::basic_t< T, U >::basic_t(), ledger::bind_scope_t::bind_scope_t(), ledger::budget_posts::budget_posts(), ledger::by_payee_posts::by_payee_posts(), ledger::calc_posts::calc_posts(), ledger::call_scope_t::call_scope_t(), ledger::child_scope_t::child_scope_t(), ledger::child_scope_t::child_scope_t(), ledger::collapse_posts::collapse_posts(), ledger::collect_posts::collect_posts(), ledger::commodity_t::commodity_t(), ledger::compare_items< T >::compare_items(), ledger::compare_items< T >::compare_items(), ledger::context_scope_t::context_scope_t(), ledger::csv_reader::csv_reader(), ledger::date_duration_t::date_duration_t(), ledger::date_duration_t::date_duration_t(), ledger::date_duration_t::date_duration_t(), ledger::date_interval_t::date_interval_t(), ledger::date_interval_t::date_interval_t(), ledger::date_interval_t::date_interval_t(), ledger::date_range_t::date_range_t(), ledger::date_range_t::date_range_t(), ledger::date_specifier_or_range_t::date_specifier_or_range_t(), ledger::date_specifier_or_range_t::date_specifier_or_range_t(), ledger::date_specifier_or_range_t::date_specifier_or_range_t(), ledger::date_specifier_or_range_t::date_specifier_or_range_t(), ledger::date_specifier_t::date_specifier_t(), ledger::date_specifier_t::date_specifier_t(), ledger::date_specifier_t::date_specifier_t(), ledger::date_traits_t::date_traits_t(), ledger::date_traits_t::date_traits_t(), ledger::day_of_week_posts::day_of_week_posts(), ledger::flags::delegates_flags< T >::delegates_flags(), ledger::flags::delegates_flags< T >::delegates_flags(), ledger::account_t::xdata_t::details_t::details_t(), ledger::account_t::xdata_t::details_t::details_t(), ledger::draft_t::draft_t(), ledger::empty_scope_t::empty_scope_t(), ledger::expr_base_t< ResultType >::expr_base_t(), ledger::expr_base_t< ResultType >::expr_base_t(), ledger::journal_t::fileinfo_t::fileinfo_t(), ledger::journal_t::fileinfo_t::fileinfo_t(), ledger::journal_t::fileinfo_t::fileinfo_t(), ledger::filter_posts::filter_posts(), ledger::forecast_posts::forecast_posts(), ledger::format_emacs_posts::format_emacs_posts(), ledger::format_ptree::format_ptree(), ledger::format_t::format_t(), ledger::format_t::format_t(), ledger::generate_posts::generate_posts(), ledger::interval_posts::interval_posts(), ledger::item_handler< T >::item_handler(), ledger::item_handler< T >::item_handler(), ledger::item_t::item_t(), ledger::item_t::item_t(), ledger::iterator_facade_base< Derived, Value, CategoryOrTraversal >::iterator_facade_base(), ledger::iterator_facade_base< Derived, Value, CategoryOrTraversal >::iterator_facade_base(), ledger::journal_posts_iterator::journal_posts_iterator(), ledger::journal_posts_iterator::journal_posts_iterator(), ledger::journal_posts_iterator::journal_posts_iterator(), ledger::keep_details_t::keep_details_t(), ledger::keep_details_t::keep_details_t(), ledger::query_t::lexer_t::lexer_t(), ledger::query_t::lexer_t::lexer_t(), ledger::mask_t::mask_t(), ledger::mask_t::mask_t(), ledger::merged_expr_t::merged_expr_t(), ledger::expr_t::op_t::op_t(), ledger::expr_t::op_t::op_t(), ledger::option_t< T >::option_t(), ledger::option_t< T >::option_t(), ledger::output_stream_t::output_stream_t(), ledger::output_stream_t::output_stream_t(), ledger::expr_t::parser_t::parser_t(), ledger::query_t::parser_t::parser_t(), ledger::query_t::parser_t::parser_t(), ledger::pass_down_accounts< Iterator >::pass_down_accounts(), ledger::pass_down_posts< Iterator >::pass_down_posts(), ledger::period_xact_t::period_xact_t(), ledger::period_xact_t::period_xact_t(), ledger::period_xact_t::period_xact_t(), ledger::position_t::position_t(), ledger::position_t::position_t(), ledger::post_splitter::post_splitter(), ledger::post_t::post_t(), ledger::post_t::post_t(), ledger::post_t::post_t(), ledger::draft_t::xact_template_t::post_template_t::post_template_t(), ledger::posts_as_equity::posts_as_equity(), ledger::posts_commodities_iterator::posts_commodities_iterator(), ledger::posts_commodities_iterator::posts_commodities_iterator(), ledger::posts_commodities_iterator::posts_commodities_iterator(), ledger::predicate_t::predicate_t(), ledger::predicate_t::predicate_t(), ledger::predicate_t::predicate_t(), ledger::predicate_t::predicate_t(), ledger::predicate_t::predicate_t(), ledger::print_xacts::print_xacts(), ledger::push_to_posts_list::push_to_posts_list(), ledger::query_t::query_t(), ledger::query_t::query_t(), ledger::query_t::query_t(), ledger::query_t::query_t(), ledger::related_posts::related_posts(), ledger::report_accounts::report_accounts(), ledger::report_commodities::report_commodities(), ledger::report_payees::report_payees(), ledger::report_t::report_t(), ledger::report_t::report_t(), ledger::report_tags::report_tags(), ledger::reporter< Type, handler_ptr, report_method >::reporter(), ledger::reporter< Type, handler_ptr, report_method >::reporter(), ledger::scope_t::scope_t(), ledger::sort_posts::sort_posts(), ledger::sort_posts::sort_posts(), ledger::sort_xacts::sort_xacts(), ledger::sort_xacts::sort_xacts(), ledger::sorted_accounts_iterator::sorted_accounts_iterator(), ledger::sorted_accounts_iterator::sorted_accounts_iterator(), ledger::subtotal_posts::subtotal_posts(), ledger::flags::supports_flags< T, U >::supports_flags(), ledger::flags::supports_flags< T, U >::supports_flags(), ledger::flags::supports_flags< T, U >::supports_flags(), ledger::symbol_scope_t::symbol_scope_t(), ledger::symbol_scope_t::symbol_scope_t(), ledger::symbol_t::symbol_t(), ledger::symbol_t::symbol_t(), ledger::symbol_t::symbol_t(), ledger::temporaries_t::temporaries_t(), ledger::time_log_t::time_log_t(), ledger::time_xact_t::time_xact_t(), ledger::time_xact_t::time_xact_t(), ledger::time_xact_t::time_xact_t(), ledger::expr_t::token_t::token_t(), ledger::query_t::lexer_t::token_t::token_t(), ledger::query_t::lexer_t::token_t::token_t(), ledger::transfer_details::transfer_details(), ledger::truncate_xacts::truncate_xacts(), ledger::unistring::unistring(), ledger::unistring::unistring(), ledger::value_scope_t::value_scope_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::value_t::value_t(), ledger::xact_base_t::xact_base_t(), ledger::xact_posts_iterator::xact_posts_iterator(), ledger::xact_posts_iterator::xact_posts_iterator(), ledger::xact_posts_iterator::xact_posts_iterator(), ledger::xact_t::xact_t(), ledger::xacts_iterator::xacts_iterator(), ledger::xacts_iterator::xacts_iterator(), ledger::xacts_iterator::xacts_iterator(), ledger::xacts_iterator::xacts_iterator(), ledger::account_t::xdata_t::xdata_t(), ledger::post_t::xdata_t::xdata_t(), ledger::account_t::xdata_t::xdata_t(), and ledger::post_t::xdata_t::xdata_t().
#define TRACE_DTOR | ( | cls | ) |
Definition at line 144 of file utils.h.
Referenced by ledger::subtotal_posts::acct_value_t::~acct_value_t(), ledger::amount_t::~amount_t(), ledger::annotated_commodity_t::~annotated_commodity_t(), ledger::annotation_t::~annotation_t(), ledger::anonymize_posts::~anonymize_posts(), ledger::auto_xact_t::~auto_xact_t(), ledger::balance_t::~balance_t(), ledger::commodity_t::base_t::~base_t(), ledger::basic_accounts_iterator::~basic_accounts_iterator(), ledger::flags::basic_t< T, U >::~basic_t(), ledger::bind_scope_t::~bind_scope_t(), ledger::budget_posts::~budget_posts(), ledger::by_payee_posts::~by_payee_posts(), ledger::calc_posts::~calc_posts(), ledger::call_scope_t::~call_scope_t(), ledger::changed_value_posts::~changed_value_posts(), ledger::child_scope_t::~child_scope_t(), ledger::collapse_posts::~collapse_posts(), ledger::collect_posts::~collect_posts(), ledger::commodity_pool_t::~commodity_pool_t(), ledger::commodity_t::~commodity_t(), ledger::compare_items< T >::~compare_items(), ledger::context_scope_t::~context_scope_t(), ledger::csv_reader::~csv_reader(), ledger::date_duration_t::~date_duration_t(), ledger::date_interval_t::~date_interval_t(), ledger::date_range_t::~date_range_t(), ledger::date_specifier_or_range_t::~date_specifier_or_range_t(), ledger::date_specifier_t::~date_specifier_t(), ledger::date_traits_t::~date_traits_t(), ledger::day_of_week_posts::~day_of_week_posts(), ledger::flags::delegates_flags< T >::~delegates_flags(), ledger::account_t::xdata_t::details_t::~details_t(), ledger::display_filter_posts::~display_filter_posts(), ledger::draft_t::~draft_t(), ledger::empty_scope_t::~empty_scope_t(), ledger::expr_base_t< ResultType >::~expr_base_t(), ledger::journal_t::fileinfo_t::~fileinfo_t(), ledger::filter_posts::~filter_posts(), ledger::forecast_posts::~forecast_posts(), ledger::format_accounts::~format_accounts(), ledger::format_emacs_posts::~format_emacs_posts(), ledger::format_posts::~format_posts(), ledger::format_ptree::~format_ptree(), ledger::format_t::~format_t(), ledger::generate_posts::~generate_posts(), ledger::generate_posts_iterator::~generate_posts_iterator(), ledger::inject_posts::~inject_posts(), ledger::interval_posts::~interval_posts(), ledger::item_handler< T >::~item_handler(), ledger::item_t::~item_t(), ledger::iterator_facade_base< Derived, Value, CategoryOrTraversal >::~iterator_facade_base(), ledger::journal_posts_iterator::~journal_posts_iterator(), ledger::keep_details_t::~keep_details_t(), ledger::query_t::lexer_t::~lexer_t(), ledger::mask_t::~mask_t(), ledger::merged_expr_t::~merged_expr_t(), ledger::expr_t::op_t::~op_t(), ledger::option_t< T >::~option_t(), ledger::output_stream_t::~output_stream_t(), ledger::expr_t::parser_t::~parser_t(), ledger::query_t::parser_t::~parser_t(), ledger::pass_down_accounts< Iterator >::~pass_down_accounts(), ledger::pass_down_posts< Iterator >::~pass_down_posts(), ledger::period_xact_t::~period_xact_t(), ledger::position_t::~position_t(), ledger::post_splitter::~post_splitter(), ledger::post_t::~post_t(), ledger::draft_t::xact_template_t::post_template_t::~post_template_t(), ledger::posts_as_equity::~posts_as_equity(), ledger::posts_commodities_iterator::~posts_commodities_iterator(), ledger::predicate_t::~predicate_t(), ledger::print_xacts::~print_xacts(), ledger::push_to_posts_list::~push_to_posts_list(), ledger::query_t::~query_t(), ledger::related_posts::~related_posts(), ledger::report_accounts::~report_accounts(), ledger::report_commodities::~report_commodities(), ledger::report_payees::~report_payees(), ledger::report_t::~report_t(), ledger::report_tags::~report_tags(), ledger::reporter< Type, handler_ptr, report_method >::~reporter(), ledger::scope_t::~scope_t(), ledger::session_t::~session_t(), ledger::sort_posts::~sort_posts(), ledger::sort_xacts::~sort_xacts(), ledger::sorted_accounts_iterator::~sorted_accounts_iterator(), ledger::value_t::storage_t::~storage_t(), ledger::subtotal_posts::~subtotal_posts(), ledger::flags::supports_flags< T, U >::~supports_flags(), ledger::symbol_scope_t::~symbol_scope_t(), ledger::symbol_t::~symbol_t(), ledger::temporaries_t::~temporaries_t(), ledger::time_log_t::~time_log_t(), ledger::time_xact_t::~time_xact_t(), ledger::query_t::lexer_t::token_t::~token_t(), ledger::expr_t::token_t::~token_t(), ledger::transfer_details::~transfer_details(), ledger::truncate_xacts::~truncate_xacts(), ledger::unistring::~unistring(), ledger::value_scope_t::~value_scope_t(), ledger::value_t::~value_t(), ledger::xact_posts_iterator::~xact_posts_iterator(), ledger::xact_t::~xact_t(), ledger::xacts_iterator::~xacts_iterator(), ledger::account_t::xdata_t::~xdata_t(), and ledger::post_t::xdata_t::~xdata_t().
#define VERIFY | ( | x | ) |
Definition at line 141 of file utils.h.
Referenced by ledger::value_t::as_amount(), ledger::value_t::as_amount_lval(), ledger::value_t::as_any(), ledger::value_t::as_any_lval(), ledger::value_t::as_balance(), ledger::value_t::as_balance_lval(), ledger::value_t::as_boolean(), ledger::value_t::as_boolean_lval(), ledger::value_t::as_date(), ledger::value_t::as_date_lval(), ledger::value_t::as_datetime(), ledger::value_t::as_datetime_lval(), ledger::value_t::as_long(), ledger::value_t::as_long_lval(), ledger::value_t::as_mask(), ledger::value_t::as_mask_lval(), ledger::value_t::as_scope(), ledger::value_t::as_sequence(), ledger::value_t::as_sequence_lval(), ledger::value_t::as_string(), ledger::value_t::as_string_lval(), ledger::expr_t::op_t::as_value_lval(), ledger::value_t::begin(), ledger::value_t::begin(), ledger::value_t::end(), ledger::value_t::end(), ledger::value_t::is_null(), ledger::value_t::operator[](), ledger::value_t::operator[](), ledger::value_t::pop_back(), ledger::value_t::set_amount(), ledger::value_t::set_balance(), ledger::value_t::set_string(), ledger::value_t::set_string(), ledger::expr_t::op_t::set_value(), ledger::unistring::unistring(), and ledger::value_t::storage_t::~storage_t().
enum caught_signal_t |
|
inline |
Definition at line 446 of file utils.h.
References caught_signal, INTERRUPTED, NONE_CAUGHT, and PIPE_CLOSED.
Referenced by ledger::item_handler< T >::operator()().
void sigint_handler | ( | int | sig | ) |
void sigpipe_handler | ( | int | sig | ) |
|
extern |
Referenced by check_for_signal().