From 0efdc0cf6f47278184eecdf47137b6253043e027 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 27 Feb 2012 00:40:22 -0600 Subject: The "id" of an item now maps to its UUID --- src/item.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/item.cc') 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 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': -- cgit v1.2.3