--- parser3/src/classes/string.C 2015/11/16 18:27:15 1.223 +++ parser3/src/classes/string.C 2016/05/18 17:47:22 1.225 @@ -20,7 +20,7 @@ #include "pa_vregex.h" #include "pa_charsets.h" -volatile const char * IDENT_STRING_C="$Id: string.C,v 1.223 2015/11/16 18:27:15 moko Exp $"; +volatile const char * IDENT_STRING_C="$Id: string.C,v 1.225 2016/05/18 17:47:22 moko Exp $"; // class @@ -31,7 +31,7 @@ public: // global variable -DECLARE_CLASS_VAR(string, new MString, 0); +DECLARE_CLASS_VAR(string, new MString); // void class, inherited from string and thus should be inited afterwards @@ -42,7 +42,7 @@ public: // void global variable should be after string global variable -DECLARE_CLASS_VAR(void, new MVoid, 0); +DECLARE_CLASS_VAR(void, new MVoid); // defines for statics @@ -792,6 +792,13 @@ static void _unescape(Request& r, Method } } +static void _contains(Request& r, MethodParams& params) { + // empty or whitespace string is hash compatible + GET_SELF(r, VString).get_element(params.as_string(0, "key must be string")); + // ignoring result as it allways null + r.write_no_lang(VBool::get(false)); +} + // constructor MString::MString(): Methoded("string") { @@ -877,4 +884,7 @@ MString::MString(): Methoded("string") { // ^string:unescape[js|uri;escaped;$.charset[...]] add_native_method("unescape", Method::CT_STATIC, _unescape, 2, 3); + + // ^string.contains[key] for hash compatibility + add_native_method("contains", Method::CT_DYNAMIC, _contains, 1, 1); }