summaryrefslogtreecommitdiff
path: root/src/register.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-04-30 06:26:38 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:33 -0400
commitc8899addfd2deed3d84be2de234681db64987722 (patch)
tree07f9a5eb603ff4ec83fe18c83083575d2b7a439a /src/register.h
parentaa9cc125796711afcaa459898e95527fdae8e912 (diff)
downloadfork-ledger-c8899addfd2deed3d84be2de234681db64987722.tar.gz
fork-ledger-c8899addfd2deed3d84be2de234681db64987722.tar.bz2
fork-ledger-c8899addfd2deed3d84be2de234681db64987722.zip
Rearranged the sources a bit.
Diffstat (limited to 'src/register.h')
-rw-r--r--src/register.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/register.h b/src/register.h
new file mode 100644
index 00000000..ba2020ec
--- /dev/null
+++ b/src/register.h
@@ -0,0 +1,38 @@
+#ifndef _REGISTER_H
+#define _REGISTER_H
+
+#include "xpath.h"
+
+namespace ledger {
+
+class register_command : public xml::xpath_t::functor_t
+{
+ public:
+ register_command() : xml::xpath_t::functor_t("register") {}
+
+ virtual void operator()(value_t&, xml::xpath_t::scope_t * locals) {
+ std::ostream * out = get_ptr<std::ostream>(locals, 0);
+ xml::document_t * doc = get_ptr<xml::document_t>(locals, 1);
+
+ print_document(*out, doc);
+ }
+
+ virtual void print_document(std::ostream& out, xml::document_t * doc);
+};
+
+enum elision_style_t {
+ TRUNCATE_TRAILING,
+ TRUNCATE_MIDDLE,
+ TRUNCATE_LEADING,
+ ABBREVIATE
+};
+
+string abbreviate(const string& str,
+ unsigned int width,
+ elision_style_t elision_style = TRUNCATE_TRAILING,
+ const bool is_account = false,
+ int abbrev_length = 2);
+
+} // namespace ledger
+
+#endif // _REGISTER_H