diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-12-11 06:13:02 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-12-11 06:13:02 +0000 |
commit | 36adc76235fb0a38e7042bc751f988b71627e2a0 (patch) | |
tree | fc83b3f4e0afeb3932c8d200f5493f0a8d6c4619 /sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp | |
parent | 86b1de85536e93c59a25702a5a2d3e384202ffd2 (diff) |
Changes to get successful C++11 based build. Code cleanup, dependency upgrades, and const + inline optimizations in components, samples, and app hosting server.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1420007 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp')
-rw-r--r-- | sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp b/sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp index 9907650316..16f01cd85c 100644 --- a/sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp +++ b/sca-cpp/trunk/samples/store-cpp/fruits-catalog.cpp @@ -35,27 +35,19 @@ namespace store { /** * Returns the catalog. */ -struct convert { - const lambda<value(const list<value>&)> converter; - const string currency; - convert(const lambda<value(const list<value>&)>& converter, const string& currency) : converter(converter), currency(currency) { - } - const value operator()(const value& price) const { - return converter(mklist<value>("convert", string("USD"), currency, price)); - } -}; - const list<value> mkfruit(const string& name, const string& code, const string& symbol, const double price) { - return list<value>() + + return nilListValue + mklist<value>("name", name) + mklist<value>("currencyCode", code) + mklist<value>("currencySymbol", symbol) + mklist<value>("price", price); } -const failable<value> items(const lambda<value(const list<value>&)>& converter, const lambda<value(const list<value>&)>& currencyCode) { - const string currency(currencyCode(list<value>())); +const failable<value> items(const lvvlambda& converter, const lvvlambda& currencyCode) { + const string currency(currencyCode(nilListValue)); const string symbol(converter(mklist<value>("symbol", currency))); - const lambda<value(const value&)> conv(convert(converter, currency)); + const vvlambda conv = [converter, currency](const value& price) -> const value { + return converter(mklist<value>("convert", string("USD"), currency, price)); + }; - return value(list<value>() + + return value(nilListValue + mkfruit("Apple", currency, symbol, conv(2.99)) + mkfruit("Orange", currency, symbol, conv(3.55)) + mkfruit("Pear", currency, symbol, conv(1.55))); |