diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-01 06:04:35 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-01 06:04:35 +0000 |
commit | ac8bb2ddecac09d60760ef83319b627548d0fd77 (patch) | |
tree | b15d73262f02989d8dfe554e127e82e70b5aebe4 /sca-cpp/trunk/kernel | |
parent | 54561e00c9714c9230dc1ed39f3bb548a59adeed (diff) |
Minimal support for implementation.widget, using simplified (and generic) JSONRPC and ATOMPub Javascript proxies. Minor changes to the server runtime to serve reference requests from widgets. Adjust and simplified samples using the widget support.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@959521 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/kernel')
-rw-r--r-- | sca-cpp/trunk/kernel/string.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sca-cpp/trunk/kernel/string.hpp b/sca-cpp/trunk/kernel/string.hpp index 931417e430..1daec2aac7 100644 --- a/sca-cpp/trunk/kernel/string.hpp +++ b/sca-cpp/trunk/kernel/string.hpp @@ -241,6 +241,9 @@ const int find(const string& s1, const char* s2) { return find(s1, s2, 0); } +/** + * Return true if string s1 contains s2. + */ const bool contains(const string& s1, const char* s2) { return find(s1, s2) != length(s1); } @@ -253,6 +256,17 @@ const int find_first_of(const string& s1, const string& s2) { } /** + * Find the first occurence of a character in a string. + */ +const int find(const string& s, const char c) { + const char* cs = c_str(s); + const char* f = strchr(cs, c); + if (f == NULL) + return length(s); + return f - cs; +} + +/** * Find the last occurence of a character in a string. */ const int find_last(const string& s, const char c) { |