diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-08-10 06:08:18 +0000 |
commit | 72aaee9802d447ee21340b011856b9b355a58f1a (patch) | |
tree | f97a68e4f75e6c25c8492e03fdfe6983fb0aa199 /src/modules/str | |
parent | 5d03948cd3558c613fae1fad109635f860babcbb (diff) | |
download | kvirc-72aaee9802d447ee21340b011856b9b355a58f1a.tar.gz kvirc-72aaee9802d447ee21340b011856b9b355a58f1a.zip |
rename the following methods:
tqfind find
tqreplace replace
tqcontains contains
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/str')
-rw-r--r-- | src/modules/str/libkvistr.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/src/modules/str/libkvistr.cpp b/src/modules/str/libkvistr.cpp index 0403bbc1..de2236c1 100644 --- a/src/modules/str/libkvistr.cpp +++ b/src/modules/str/libkvistr.cpp @@ -377,15 +377,15 @@ static bool str_kvs_fnc_isempty(KviKvsModuleFunctionCall * c) } /* - @doc: str.tqcontains + @doc: str.contains @type: function @title: - $str.tqcontains + $str.contains @short: Returns 1 if the first parameter contains the second @syntax: - <bool> $str.tqcontains(<container:string>,<totqfind:string>) + <bool> $str.contains(<container:string>,<tofind:string>) @description: Returns 1 if the first string parameter contains the second string parameter. This function is case sensitive. @@ -394,15 +394,15 @@ static bool str_kvs_fnc_isempty(KviKvsModuleFunctionCall * c) */ -static bool str_kvs_fnc_tqcontains(KviKvsModuleFunctionCall * c) +static bool str_kvs_fnc_contains(KviKvsModuleFunctionCall * c) { TQString szString,szSubString; bool bIs; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("container",KVS_PT_STRING,0,szString) - KVSM_PARAMETER("totqfind",KVS_PT_STRING,0,szSubString) + KVSM_PARAMETER("tofind",KVS_PT_STRING,0,szSubString) KVSM_PARAMETERS_END(c) - bIs = szString.tqfind(szSubString) != -1; + bIs = szString.find(szSubString) != -1; c->returnValue()->setBoolean(bIs); return true; } @@ -416,12 +416,12 @@ static bool str_kvs_fnc_tqcontains(KviKvsModuleFunctionCall * c) @short: Returns 1 if the first parameter contains the second, case insensitive @syntax: - <bool> $str.containsnocase(<container:string>,<totqfind:string>) + <bool> $str.containsnocase(<container:string>,<tofind:string>) @description: Returns 1 if the first string parameter contains the second string parameter whithout taking in consideration the case of the characters in the string. @seealso: - [fnc]$str.tqcontains[/fnc] + [fnc]$str.contains[/fnc] */ static bool str_kvs_fnc_containsnocase(KviKvsModuleFunctionCall * c) @@ -430,9 +430,9 @@ static bool str_kvs_fnc_containsnocase(KviKvsModuleFunctionCall * c) bool bIs; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("container",KVS_PT_STRING,0,szString) - KVSM_PARAMETER("totqfind",KVS_PT_STRING,0,szSubString) + KVSM_PARAMETER("tofind",KVS_PT_STRING,0,szSubString) KVSM_PARAMETERS_END(c) - bIs = szString.tqfind(szSubString,0,false) != -1; + bIs = szString.find(szSubString,0,false) != -1; c->returnValue()->setBoolean(bIs); return true; } @@ -557,15 +557,15 @@ static bool str_kvs_fnc_cmpnocase(KviKvsModuleFunctionCall * c) } /* - @doc: str.tqfind + @doc: str.find @type: function @title: - $str.tqfind + $str.find @short: Find the index of the nth ocurrence of a substring in a string @syntax: - <int> $str.tqfind(<findIn:string>,<totqfind:string>[,ocurrence:int]) + <int> $str.find(<findIn:string>,<tofind:string>[,ocurrence:int]) @description: This function search in the string given as the first parameter for the string given as his second parameter, and will return the index where the nth ocurrence @@ -576,13 +576,13 @@ static bool str_kvs_fnc_cmpnocase(KviKvsModuleFunctionCall * c) FIXME: The semantics of this function are totally broken :( */ -static bool str_kvs_fnc_tqfind(KviKvsModuleFunctionCall * c) +static bool str_kvs_fnc_find(KviKvsModuleFunctionCall * c) { TQString szFindIn, szToFind; kvs_int_t iOcurence; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("findIn",KVS_PT_STRING,0,szFindIn) - KVSM_PARAMETER("totqfind",KVS_PT_STRING,0,szToFind) + KVSM_PARAMETER("tofind",KVS_PT_STRING,0,szToFind) KVSM_PARAMETER("ocurrence",KVS_PT_INTEGER,KVS_PF_OPTIONAL,iOcurence) KVSM_PARAMETERS_END(c) int pos = 1; @@ -609,7 +609,7 @@ static bool str_kvs_fnc_tqfind(KviKvsModuleFunctionCall * c) while (cnt<=pos) { - idx = szFindIn.right(szFindIn.length() - totalIdx).tqfind(szToFind); + idx = szFindIn.right(szFindIn.length() - totalIdx).find(szToFind); if(idx == -1) { c->returnValue()->setInteger(-1); @@ -646,7 +646,7 @@ static bool str_kvs_fnc_findfirst(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("findIn",KVS_PT_STRING,0,szString) KVSM_PARAMETER("toFind",KVS_PT_STRING,0,szString2) KVSM_PARAMETERS_END(c) - c->returnValue()->setInteger(szString.tqfind(szString2)); + c->returnValue()->setInteger(szString.find(szString2)); return true; } /* @@ -672,7 +672,7 @@ static bool str_kvs_fnc_findfirstnocase(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("findIn",KVS_PT_STRING,0,szString) KVSM_PARAMETER("toFind",KVS_PT_STRING,0,szString2) KVSM_PARAMETERS_END(c) - c->returnValue()->setInteger(szString.tqfind(szString2,0,false)); + c->returnValue()->setInteger(szString.find(szString2,0,false)); return true; } /* @@ -698,7 +698,7 @@ static bool str_kvs_fnc_findlast(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("findIn",KVS_PT_STRING,0,szString) KVSM_PARAMETER("toFind",KVS_PT_STRING,0,szString2) KVSM_PARAMETERS_END(c) - c->returnValue()->setInteger(szString.tqfindRev(szString2)); + c->returnValue()->setInteger(szString.findRev(szString2)); return true; } /* @@ -724,7 +724,7 @@ static bool str_kvs_fnc_findlastnocase(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("findIn",KVS_PT_STRING,0,szString) KVSM_PARAMETER("toFind",KVS_PT_STRING,0,szString2) KVSM_PARAMETERS_END(c) - c->returnValue()->setInteger(szString.tqfindRev(szString2,-1,false)); + c->returnValue()->setInteger(szString.findRev(szString2,-1,false)); return true; } /* @@ -994,37 +994,37 @@ static bool str_kvs_fnc_stripcolors(KviKvsModuleFunctionCall * c) } /* - @doc: str.tqreplace + @doc: str.replace @type: function @title: - $str.tqreplace + $str.replace @short: Replace substrings in a string @syntax: - <string> $str.tqreplace(<string:string>,<replacewith:string>,<totqreplace:string>) + <string> $str.replace(<string:string>,<replacewith:string>,<toreplace:string>) @description: This function returns a string created replacing all ocurrences of the third parameter - ('totqreplace') in the string given as the first parameter ('string') with the string + ('toreplace') in the string given as the first parameter ('string') with the string given as the second parameter ('replacewith'). The string replacement is case sensitive!. FIXME: The order of the parameters in this function is illogical (and probably incompatible with any other scripting language) :D @examples: [example] - echo $str.tqreplace("I like big networks","neural","big") + echo $str.replace("I like big networks","neural","big") [/example] */ -static bool str_kvs_fnc_tqreplace(KviKvsModuleFunctionCall * c) +static bool str_kvs_fnc_replace(KviKvsModuleFunctionCall * c) { - TQString szString,szNewstr,szTotqreplace; + TQString szString,szNewstr,szToreplace; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("string",KVS_PT_STRING,0,szString) KVSM_PARAMETER("newstr",KVS_PT_STRING,0,szNewstr) - KVSM_PARAMETER("totqreplace",KVS_PT_STRING,0,szTotqreplace) + KVSM_PARAMETER("toreplace",KVS_PT_STRING,0,szToreplace) KVSM_PARAMETERS_END(c) - szString.tqreplace(szTotqreplace,szNewstr); + szString.replace(szToreplace,szNewstr); c->returnValue()->setString(szString); return true; } @@ -1038,10 +1038,10 @@ static bool str_kvs_fnc_tqreplace(KviKvsModuleFunctionCall * c) @short: Replace substrings in a string ignoring case @syntax: - <string> $str.replacenocase(<string:string>,<newstr:string>,<totqreplace:string>) + <string> $str.replacenocase(<string:string>,<newstr:string>,<toreplace:string>) @description: This function returns a string created replacing all ocurrences of the third parameter - ('totqreplace') in the string given as the first parameter ('string') with the string + ('toreplace') in the string given as the first parameter ('string') with the string given as the second parameter ('newstr').[br] The replacement is case insensitive.[br] FIXME: The order of the parameters in this function is illogical (and probably incompatible @@ -1050,13 +1050,13 @@ static bool str_kvs_fnc_tqreplace(KviKvsModuleFunctionCall * c) static bool str_kvs_fnc_replacenocase(KviKvsModuleFunctionCall * c) { - TQString szString,szNewstr,szTotqreplace; + TQString szString,szNewstr,szToreplace; KVSM_PARAMETERS_BEGIN(c) KVSM_PARAMETER("string",KVS_PT_STRING,0,szString) KVSM_PARAMETER("newstr",KVS_PT_STRING,0,szNewstr) - KVSM_PARAMETER("totqreplace",KVS_PT_STRING,0,szTotqreplace) + KVSM_PARAMETER("toreplace",KVS_PT_STRING,0,szToreplace) KVSM_PARAMETERS_END(c) - szString.tqreplace(szTotqreplace,szNewstr,false); + szString.replace(szToreplace,szNewstr,false); c->returnValue()->setString(szString); return true; } @@ -1090,12 +1090,12 @@ static bool str_kvs_fnc_urlencode(KviKvsModuleFunctionCall * c) /* for(int idx=0,idx<22,idx++) - szNewstr=szString.tqreplace(toReplace[idx],newStr[idx],false); + szNewstr=szString.replace(toReplace[idx],newStr[idx],false); */ int idx=0; while(idx<20){ - szNewstr=szString.tqreplace(toReplace[idx],newStr[idx],false); + szNewstr=szString.replace(toReplace[idx],newStr[idx],false); idx++; } @@ -1129,7 +1129,7 @@ static bool str_kvs_fnc_lefttofirst(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("string",KVS_PT_STRING,0,szString) KVSM_PARAMETER("substring",KVS_PT_STRING,0,szNewstr) KVSM_PARAMETERS_END(c) - where = szString.tqfind(szNewstr,false); + where = szString.find(szNewstr,false); if(where != -1) c->returnValue()->setString(szString.left(where)); else c->returnValue()->setString(szString); return true; @@ -1159,7 +1159,7 @@ static bool str_kvs_fnc_lefttolast(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("string",KVS_PT_STRING,0,szString) KVSM_PARAMETER("substring",KVS_PT_STRING,0,szNewstr) KVSM_PARAMETERS_END(c) - int where = szString.tqfindRev(szNewstr,-1,false); + int where = szString.findRev(szNewstr,-1,false); if(where != -1) c->returnValue()->setString(szString.left(where)); else c->returnValue()->setString(szString); return true; @@ -1189,7 +1189,7 @@ static bool str_kvs_fnc_rightfromfirst(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("string",KVS_PT_STRING,0,szString) KVSM_PARAMETER("substring",KVS_PT_STRING,0,szNewstr) KVSM_PARAMETERS_END(c) - int idx = szString.tqfind(szNewstr,false); + int idx = szString.find(szNewstr,false); if(idx != -1) c->returnValue()->setString(szString.right(szString.length()-(idx+szNewstr.length()))); else c->returnValue()->setString(""); return true; @@ -1220,7 +1220,7 @@ static bool str_kvs_fnc_rightfromlast(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("string",KVS_PT_STRING,0,szString) KVSM_PARAMETER("substring",KVS_PT_STRING,0,szNewstr) KVSM_PARAMETERS_END(c) - int idx = szString.tqfindRev(szNewstr,-1,false); + int idx = szString.findRev(szNewstr,-1,false); if(idx != -1) c->returnValue()->setString(szString.right(szString.length()-(idx+szNewstr.length()))); else c->returnValue()->setString(""); return true; @@ -1265,8 +1265,8 @@ static bool str_kvs_fnc_match(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("string",KVS_PT_STRING,0,szString) KVSM_PARAMETER("flags",KVS_PT_STRING,KVS_PF_OPTIONAL,szFlags) KVSM_PARAMETERS_END(c) - bool bRegExp = (szFlags.tqfind(TQChar('r')) != -1) || (szFlags.tqfind(TQChar('R')) != -1); - bool bExact = (szFlags.tqfind(TQChar('e')) != -1) || (szFlags.tqfind(TQChar('E')) != -1); + bool bRegExp = (szFlags.find(TQChar('r')) != -1) || (szFlags.find(TQChar('R')) != -1); + bool bExact = (szFlags.find(TQChar('e')) != -1) || (szFlags.find(TQChar('E')) != -1); c->returnValue()->setBoolean(KviTQString::matchStringCS(szWildcard,szString,bRegExp,bExact)); return true; } @@ -1311,8 +1311,8 @@ static bool str_kvs_fnc_matchnocase(KviKvsModuleFunctionCall * c) KVSM_PARAMETER("string",KVS_PT_STRING,0,szString) KVSM_PARAMETER("flags",KVS_PT_STRING,KVS_PF_OPTIONAL,szFlags) KVSM_PARAMETERS_END(c) - bool bRegExp = (szFlags.tqfind(TQChar('r')) != -1) || (szFlags.tqfind(TQChar('R')) != -1); - bool bExact = (szFlags.tqfind(TQChar('e')) != -1) || (szFlags.tqfind(TQChar('E')) != -1); + bool bRegExp = (szFlags.find(TQChar('r')) != -1) || (szFlags.find(TQChar('R')) != -1); + bool bExact = (szFlags.find(TQChar('e')) != -1) || (szFlags.find(TQChar('E')) != -1); c->returnValue()->setBoolean(KviTQString::matchStringCI(szWildcard,szString,bRegExp,bExact)); return true; } @@ -1435,13 +1435,13 @@ static bool str_kvs_fnc_token(KviKvsModuleFunctionCall * c) { TQChar szTmp = szString[idx].tqunicode(); // while (szTmp==sep) - while (sep.tqcontains(szTmp)) + while (sep.contains(szTmp)) { idx++; szTmp = szString[idx].tqunicode(); } begin = idx; - while (idx<len && !sep.tqcontains(szTmp)) + while (idx<len && !sep.contains(szTmp)) { idx++; szTmp = szString[idx].tqunicode(); @@ -1600,7 +1600,7 @@ static bool str_kvs_fnc_join(KviKvsModuleFunctionCall * c) KVSM_PARAMETERS_END(c) TQString szRet; - bool bSkipEmpty = szFlags.tqfind('n',0,false) != -1; + bool bSkipEmpty = szFlags.find('n',0,false) != -1; bool bFirst = true; @@ -1693,9 +1693,9 @@ static bool str_kvs_fnc_grep(KviKvsModuleFunctionCall * c) KviKvsArray * a = ac.array(); - bool bCaseSensitive = szFlags.tqfind('s',0,false) != -1; - bool bRegexp = szFlags.tqfind('r',0,false) != -1; - bool bWild = szFlags.tqfind('w',0,false) != -1; + bool bCaseSensitive = szFlags.find('s',0,false) != -1; + bool bRegexp = szFlags.find('r',0,false) != -1; + bool bWild = szFlags.find('w',0,false) != -1; int idx = 0; int cnt = a->size(); @@ -1726,7 +1726,7 @@ static bool str_kvs_fnc_grep(KviKvsModuleFunctionCall * c) { TQString sz; v->asString(sz); - if(sz.tqfind(szMatch,0,bCaseSensitive) != -1) + if(sz.find(szMatch,0,bCaseSensitive) != -1) { n->set(i,new KviKvsVariant(sz)); i++; @@ -1812,10 +1812,10 @@ static bool str_kvs_fnc_split(KviKvsModuleFunctionCall * c) if(iMaxItems == 0)return true; - bool bWild = szFla.tqfind('w',0,false) != -1; - bool bContainsR = szFla.tqfind('r',0,false) != -1; - bool bCaseSensitive = szFla.tqfind('s',0,false) != -1; - bool bNoEmpty = szFla.tqfind('n',0,false) != -1; + bool bWild = szFla.find('w',0,false) != -1; + bool bContainsR = szFla.find('r',0,false) != -1; + bool bCaseSensitive = szFla.find('s',0,false) != -1; + bool bNoEmpty = szFla.find('n',0,false) != -1; int id = 0; @@ -1855,7 +1855,7 @@ static bool str_kvs_fnc_split(KviKvsModuleFunctionCall * c) } else { while((iMatch != -1) && (iMatch < iStrLen) && ((id < (iMaxItems-1)) || (iMaxItems < 0))) { - iMatch = szStr.tqfind(szSep,iBegin,bCaseSensitive); + iMatch = szStr.find(szSep,iBegin,bCaseSensitive); if(iMatch != -1) { TQString tmp = szStr.mid(iBegin,iMatch - iBegin); @@ -2270,13 +2270,13 @@ static bool str_module_init(KviModule * m) KVSM_REGISTER_FUNCTION(m,"localelowcase",str_kvs_fnc_localelowcase); KVSM_REGISTER_FUNCTION(m,"isnumber",str_kvs_fnc_isnumber); KVSM_REGISTER_FUNCTION(m,"isunsignednumber",str_kvs_fnc_isunsignednumber); - KVSM_REGISTER_FUNCTION(m,"tqcontains",str_kvs_fnc_tqcontains); + KVSM_REGISTER_FUNCTION(m,"contains",str_kvs_fnc_contains); KVSM_REGISTER_FUNCTION(m,"containsnocase",str_kvs_fnc_containsnocase); KVSM_REGISTER_FUNCTION(m,"equal",str_kvs_fnc_equal); KVSM_REGISTER_FUNCTION(m,"equalnocase",str_kvs_fnc_equalnocase); KVSM_REGISTER_FUNCTION(m,"cmp",str_kvs_fnc_cmp); KVSM_REGISTER_FUNCTION(m,"cmpnocase",str_kvs_fnc_cmpnocase); - KVSM_REGISTER_FUNCTION(m,"tqfind",str_kvs_fnc_tqfind); + KVSM_REGISTER_FUNCTION(m,"find",str_kvs_fnc_find); KVSM_REGISTER_FUNCTION(m,"findfirst",str_kvs_fnc_findfirst); KVSM_REGISTER_FUNCTION(m,"findfirstnocase",str_kvs_fnc_findfirstnocase); KVSM_REGISTER_FUNCTION(m,"findlast",str_kvs_fnc_findlast); @@ -2291,7 +2291,7 @@ static bool str_module_init(KviModule * m) KVSM_REGISTER_FUNCTION(m,"stripright",str_kvs_fnc_stripright); KVSM_REGISTER_FUNCTION(m,"stripleft",str_kvs_fnc_stripleft); KVSM_REGISTER_FUNCTION(m,"stripcolors",str_kvs_fnc_stripcolors); - KVSM_REGISTER_FUNCTION(m,"tqreplace",str_kvs_fnc_tqreplace); + KVSM_REGISTER_FUNCTION(m,"replace",str_kvs_fnc_replace); KVSM_REGISTER_FUNCTION(m,"replacenocase",str_kvs_fnc_replacenocase); KVSM_REGISTER_FUNCTION(m,"urlencode",str_kvs_fnc_urlencode); KVSM_REGISTER_FUNCTION(m,"lefttolast",str_kvs_fnc_lefttolast); |