107 const string& name) = 0;
157 const string& name) {
174 DEBUG(
"scope.symbols",
193 const string& name) {
205 if (T *
sought =
dynamic_cast<T *
>(ptr))
210 scope->parent : &scope->grandchild))
213 &scope->grandchild : scope->parent);
229 throw_(std::runtime_error,
_(
"Could not find scope"));
230 return reinterpret_cast<T&
>(scope);
239 throw_(std::runtime_error,
_(
"Could not find scope"));
240 return reinterpret_cast<T&
>(scope);
245 typedef std::map<symbol_t, expr_t::ptr_op_t> symbol_map;
299 return value_type_context;
314 const bool required =
false);
337 for (std::size_t index = 0; index <
args.
size(); index++)
351 bool has(std::size_t index) {
352 return index <
args.
size() && ! (*this)[index].is_null();
354 template <
typename T>
355 bool has(std::size_t index);
356 template <
typename T>
357 T
get(std::size_t index,
bool convert =
true);
359 template <
typename T>
364 return *
static_cast<T *
>(
ptr);
379 value_t::sequence_t::iterator
begin() {
382 value_t::sequence_t::iterator
end() {
388 value_t::sequence_t::const_iterator
begin()
const {
391 value_t::sequence_t::const_iterator
end()
const {
404inline bool call_scope_t::has<bool>(std::size_t index) {
412inline bool call_scope_t::has<int>(std::size_t index) {
420inline bool call_scope_t::has<long>(std::size_t index) {
428inline bool call_scope_t::has<amount_t>(std::size_t index) {
436inline bool call_scope_t::has<balance_t>(std::size_t index) {
444inline bool call_scope_t::has<string>(std::size_t index) {
452inline bool call_scope_t::has<date_t>(std::size_t index) {
460inline bool call_scope_t::has<datetime_t>(std::size_t index) {
468inline bool call_scope_t::has<scope_t *>(std::size_t index) {
476inline bool call_scope_t::has<expr_t::ptr_op_t>(std::size_t index) {
477 if (index < args.size()) {
479 return ! args[index].is_null();
485inline bool call_scope_t::get<bool>(std::size_t index,
bool convert) {
492inline int call_scope_t::get<int>(std::size_t index,
bool) {
496inline long call_scope_t::get<long>(std::size_t index,
bool convert) {
503inline amount_t call_scope_t::get<amount_t>(std::size_t index,
bool convert) {
510inline balance_t call_scope_t::get<balance_t>(std::size_t index,
bool convert) {
517inline string call_scope_t::get<string>(std::size_t index,
bool convert) {
524inline mask_t call_scope_t::get<mask_t>(std::size_t index,
bool convert) {
531inline date_t call_scope_t::get<date_t>(std::size_t index,
bool convert) {
538inline datetime_t call_scope_t::get<datetime_t>(std::size_t index,
bool convert) {
548call_scope_t::get<value_t::sequence_t&>(std::size_t index,
bool) {
553call_scope_t::get<const value_t::sequence_t&>(std::size_t index,
bool) {
559inline scope_t * call_scope_t::get<scope_t *>(std::size_t index,
bool) {
564call_scope_t::get<expr_t::ptr_op_t>(std::size_t index,
bool) {
569 std::ostringstream buf;
572 for (std::size_t
i = 0;
i < args.
size();
i++) {
#define TRACE_CTOR(cls, args)
boost::gregorian::date date_t
string join_args(call_scope_t &args)
T & find_scope(child_scope_t &scope, bool skip_this=true, bool prefer_direct_parents=false)
T * search_scope(scope_t *ptr, bool prefer_direct_parents=false)
boost::posix_time::ptime datetime_t
Encapsulate infinite-precision commoditized amounts.
A wrapper around amount_t allowing addition of multiple commodities.
intrusive_ptr< op_t > ptr_op_t
expr_t::ptr_op_t definition
bool operator==(const symbol_t &sym) const
symbol_t(kind_t _kind, string _name, expr_t::ptr_op_t _definition=NULL)
symbol_t(const symbol_t &sym)
bool operator<(const symbol_t &sym) const
static empty_scope_t * empty_scope
virtual string description()=0
virtual void define(const symbol_t::kind_t, const string &, expr_t::ptr_op_t)
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind, const string &name)=0
static scope_t * default_scope
virtual value_t::type_t type_context() const
virtual bool type_required() const
virtual string description()
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t, const string &)
child_scope_t(scope_t &_parent)
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind, const string &name)
virtual void define(const symbol_t::kind_t kind, const string &name, expr_t::ptr_op_t def)
virtual void define(const symbol_t::kind_t kind, const string &name, expr_t::ptr_op_t def)
virtual string description()
bind_scope_t(scope_t &_parent, scope_t &_grandchild)
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind, const string &name)
virtual ~symbol_scope_t()
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind, const string &name)
symbol_scope_t(scope_t &_parent)
virtual string description()
virtual void define(const symbol_t::kind_t kind, const string &name, expr_t::ptr_op_t def)
virtual string description()
context_scope_t(scope_t &_parent, value_t::type_t _type_context=value_t::VOID, const bool _required=true)
virtual ~context_scope_t()
virtual value_t::type_t type_context() const
virtual bool type_required() const
T get(std::size_t index, bool convert=true)
value_t::sequence_t::iterator iterator
value_t::sequence_t::const_iterator const_iterator
void push_back(const value_t &val)
value_t & resolve(const std::size_t index, value_t::type_t context=value_t::VOID, const bool required=false)
value_t::sequence_t::const_iterator end() const
value_t & operator[](const std::size_t index)
value_t::sequence_t::const_iterator begin() const
bool has(std::size_t index)
bool has(std::size_t index)
void set_args(const value_t &_args)
value_t::sequence_t::iterator begin()
call_scope_t(scope_t &_parent, expr_t::ptr_op_t *_locus=NULL, const int _depth=0)
value_t::sequence_t::iterator end()
void push_front(const value_t &val)
virtual string description()
value_scope_t(scope_t &_parent, const value_t &_value)
virtual expr_t::ptr_op_t lookup(const symbol_t::kind_t kind, const string &name)
Dynamic type representing various numeric types.
const datetime_t & as_datetime() const
const date_t & as_date() const
sequence_t::iterator end()
scope_t * as_scope() const
const long & as_long() const
const balance_t & as_balance() const
const mask_t & as_mask() const
void push_back(const value_t &val)
const string & as_string() const
type_t
type_t gives the type of the data contained or referenced by a value_t object.
datetime_t to_datetime() const
const amount_t & as_amount() const
sequence_t::iterator begin()
balance_t to_balance() const
amount_t to_amount() const
void push_front(const value_t &val)
const bool & as_boolean() const
ptr_deque< value_t > sequence_t
The sequence_t member type abstracts the type used to represent a resizable "array" of value_t object...
bool to_boolean() const
Data conversion methods.