diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-16 06:00:12 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-16 06:00:12 +0000 |
commit | ec5f59dac8d5eca3504ec5fe205dcb7d8fd382a6 (patch) | |
tree | 41edf192475639ca342a84efc3e1d94bf0a65672 /cpp/sca/modules/atom/atom.hpp | |
parent | 24842067f999efb5e62f1dd3cde017df1381c0a3 (diff) |
Fixed support for nested elements and lists. Improved failure/error reporting monad. Minor code cleanup.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@880598 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | cpp/sca/modules/atom/atom.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/cpp/sca/modules/atom/atom.hpp b/cpp/sca/modules/atom/atom.hpp index 2077081320..5054c635a0 100644 --- a/cpp/sca/modules/atom/atom.hpp +++ b/cpp/sca/modules/atom/atom.hpp @@ -52,7 +52,7 @@ const list<value> entryValue(const list<value>& e) { */ const list<value> entriesValues(const list<value>& e) { if (isNil(e)) - return list<value>(); + return e; return cons<value>(entryValue(car(e)), entriesValues(cdr(e))); } @@ -62,7 +62,7 @@ const list<value> entriesValues(const list<value>& e) { const failable<list<value>, std::string> readEntry(const list<std::string>& ilist) { const list<value> e = readXML(ilist); if (isNil(e)) - return std::string("Empty entry"); + return mkfailure<list<value>, std::string>("Empty entry"); return entryValue(car(e)); } @@ -72,7 +72,7 @@ const failable<list<value>, std::string> readEntry(const list<std::string>& ilis const failable<list<value>, std::string> readFeed(const list<std::string>& ilist) { const list<value> f = readXML(ilist); if (isNil(f)) - return std::string("Empty feed"); + return mkfailure<list<value>, std::string>("Empty feed"); const list<value> t = filter<value>(selector(mklist<value>(element, "title")), car(f)); const list<value> i = filter<value>(selector(mklist<value>(element, "id")), car(f)); const list<value> e = filter<value>(selector(mklist<value>(element, "entry")), car(f)); @@ -99,7 +99,7 @@ const list<value> entryElement(const list<value>& l) { */ const list<value> entriesElements(const list<value>& l) { if (isNil(l)) - return list<value>(); + return l; return cons<value>(entryElement(car(l)), entriesElements(cdr(l))); } @@ -156,7 +156,7 @@ const list<value> entryValuesToElements(const list<value> val) { */ const list<value> feedValuesToElementsLoop(const list<value> val) { if (isNil(val)) - return list<value>(); + return val; return cons<value>(entryValuesToElements(car(val)), feedValuesToElementsLoop(cdr(val))); } |