summaryrefslogtreecommitdiff
path: root/src/interactive.cc
Commit message (Collapse)AuthorAgeFilesLines
* Updated copyrights to 2003-2010John Wiegley2010-03-051-1/+1
|
* Redesigned the expr_t, predicate_t, query_t classesJohn Wiegley2009-11-091-5/+4
|
* Change the value_t::POINTER type to value_t::SCOPEJohn Wiegley2009-10-301-3/+3
| | | | | scope_t pointers are the only kind that are ever stored in value objects, so there was no need to make it generic and use boost::any.
* Pushing null values into a sequence is legitimateJohn Wiegley2009-10-281-16/+20
|
* The --download option is now fully restoredJohn Wiegley2009-06-261-6/+7
|
* Enabled use of pre-compiled headers by defaultJohn Wiegley2009-03-101-0/+2
|
* Marked all strings needing internationalizationJohn Wiegley2009-02-251-15/+15
| | | | | | | | | | | | | | | | These strings are now collected automagically in the file po/ledger.pot. If you'd like to produce a translation, just run this command after building Ledger: msginit -l LOCALE -o LANG.po -i po/ledger.pot Where LOCALE is a string like de or en_GB, and LANG is a short descriptive word for your language. Then send me this .po file so I can commit it to the Ledger sources (alternatively, you could maintain the file in a fork on GitHub), and setup the build script to format and install your new message catalog during a "make install".
* If interactive_t wants S, also accept bare valuesJohn Wiegley2009-02-231-1/+5
|
* Fixed a bug with interactive_t's arg validationJohn Wiegley2009-02-211-1/+1
|
* Create a new interactive_t helper classJohn Wiegley2009-02-211-0/+184
The purpose of this class is much like Emacs' (interactive) form: it allows a value expression function to declare exactly how many arguments, and of what type, it intends to receive. It then offers type-safe access to theese arguments in a consistent manner. An example value expression function definition in C++: value_t fn_foo(call_scope_t& scope) { // We expect a string, an integer, and an optional date interactive_t args(scope, "sl&d"); std::cout << "String = " << args.get<string>(0) << "Integer = " << args.get<long>(1) << std::endl; if (args.has(2)) // was a date provided? std::cout << "Date = " << args.get<date_t>(2) << std::endl; return NULL_VALUE; } There is also an in_context_t<T> template, which finds the context type T in the current scope hierarchy. The in_context_t then also acts as a smart pointer to reference this context object, in addition to serving the same duty as interactive_t. This combination of intent is solely for the sake of brevity. value_t fn_bar(call_scope_t& scope) { in_context_t<account_t> env(scope, "sl&d"); std::cout << "Account name = " << env->fullname() << "String arg = " << env.get<string>(0) << std::endl; return NULL_VALUE; } As you can see here, 'env' acts as a smart pointer to the required context, and an object to extract the typed arguments.