diff options
author | John Wiegley <johnw@newartisans.com> | 2012-02-27 00:40:22 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-02-27 02:31:08 -0600 |
commit | 0efdc0cf6f47278184eecdf47137b6253043e027 (patch) | |
tree | 1d67a02b3b7a3c202f505b420747c1aa2e7f48e7 /src/item.cc | |
parent | bb0c5344145cd79fa54a92f236628eebbe6f2f68 (diff) | |
download | fork-ledger-0efdc0cf6f47278184eecdf47137b6253043e027.tar.gz fork-ledger-0efdc0cf6f47278184eecdf47137b6253043e027.tar.bz2 fork-ledger-0efdc0cf6f47278184eecdf47137b6253043e027.zip |
The "id" of an item now maps to its UUID
Diffstat (limited to 'src/item.cc')
-rw-r--r-- | src/item.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/item.cc b/src/item.cc index 7184c0ef..97411512 100644 --- a/src/item.cc +++ b/src/item.cc @@ -340,6 +340,12 @@ namespace { value_t get_seq(item_t& item) { return item.pos ? long(item.pos->sequence) : 0L; } + value_t get_id(item_t& item) { + if (optional<value_t> ref = item.get_tag(_("UUID"))) + return *ref; + else + return item.pos ? long(item.pos->sequence) : 0L; + } value_t get_addr(item_t& item) { return long(&item); @@ -447,6 +453,8 @@ expr_t::ptr_op_t item_t::lookup(const symbol_t::kind_t kind, case 'i': if (name == "is_account") return WRAP_FUNCTOR(get_wrapper<&ignore>); + else if (name == "id") + return WRAP_FUNCTOR(get_wrapper<&get_id>); break; case 'm': @@ -481,6 +489,8 @@ expr_t::ptr_op_t item_t::lookup(const symbol_t::kind_t kind, case 'u': if (name == "uncleared") return WRAP_FUNCTOR(get_wrapper<&get_uncleared>); + else if (name == "uuid") + return WRAP_FUNCTOR(get_wrapper<&get_id>); break; case 'v': |