diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-12-11 03:51:03 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-12-11 03:51:03 +0000 |
commit | ae0b7c0063db6236be2d7cf01ddbf2159f77c98c (patch) | |
tree | 2f64d65d018634b8728623e2ca99514541fab8aa /sca-cpp/trunk/modules/scdl/scdl.hpp | |
parent | 1f3796522a078dda5906395ba471d151ad694b6b (diff) |
Port kernel to C++11 and refactor some of the core modules. Convert functors to lambdas, and add C++ const, noexcept and inline annotations to get more efficient generated code.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1419985 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/scdl/scdl.hpp')
-rw-r--r-- | sca-cpp/trunk/modules/scdl/scdl.hpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/sca-cpp/trunk/modules/scdl/scdl.hpp b/sca-cpp/trunk/modules/scdl/scdl.hpp index 7cf43e3b14..35a717d478 100644 --- a/sca-cpp/trunk/modules/scdl/scdl.hpp +++ b/sca-cpp/trunk/modules/scdl/scdl.hpp @@ -30,7 +30,7 @@ #include "list.hpp" #include "value.hpp" #include "monad.hpp" -#include "xml.hpp" +#include "../modules/xml/xml.hpp" namespace tuscany { namespace scdl { @@ -82,33 +82,26 @@ const list<value> nameToElementAssoc(const list<value>& l) { /** * Returns the scdl declaration with the given name. */ -struct filterName { - const value n; - filterName(const value& n) : n(n) { - } - const bool operator()(const value& v) const { +const value named(const value& n, const value& l) { + const vblambda filterName = [n](const value& v) -> const bool { return name(v) == n; - } -}; - -const value named(const value& name, const value& l) { - const list<value> c = filter<value>(filterName(name), l); + }; + const list<value> c = filter<value>(filterName, l); if (isNil(c)) - return value(); + return nilValue; return car(c); } /** * Returns the implementation of a component. */ -const bool filterImplementation(const value& v) { - return isElement(v) && contains(string(cadr<value>(v)), "implementation."); -} - const value implementation(const value& l) { + const vblambda filterImplementation = [](const value& v) -> const bool { + return isElement(v) && contains(string(cadr<value>(v)), "implementation."); + }; const list<value> n = filter<value>(filterImplementation, l); if (isNil(n)) - return value(); + return nilValue; return car(n); } @@ -156,7 +149,7 @@ const list<value> bindings(const value& l) { */ const value bindingsTarget(const list<value>& l) { if (isNil(l)) - return value(); + return nilValue; const value u = uri(car(l)); if (!isNil(u)) return u; |