fixed: UGContainer<Type> used a std::vector<Type> and when a new item was inserted
then current iterators (and pointers) were invalidated now we are using std::vector<Type*> this caused some crashes when a new user was added by 'adduser' winix function added: plugin 'export' is able to upload files on a remote server now (not finished yet) changed: Thumb class is now called: Image and we are able to resize images too (some new options in the config and in mount points) added: some new plugin messages git-svn-id: svn://ttmath.org/publicrep/winix/trunk@764 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
42
core/misc.h
42
core/misc.h
@@ -258,7 +258,7 @@ const wchar_t * SkipWhite(const wchar_t * s);
|
||||
|
||||
|
||||
template<class StringType1, class StringType2>
|
||||
bool IsSubString(const StringType1 * short_str, const StringType2 * long_str)
|
||||
bool IsSubStringp(const StringType1 * short_str, const StringType2 * long_str)
|
||||
{
|
||||
while( *short_str && *long_str && wchar_t(*short_str) == wchar_t(*long_str) )
|
||||
{
|
||||
@@ -274,12 +274,18 @@ return false;
|
||||
|
||||
|
||||
template<class StringType1, class StringType2>
|
||||
bool IsSubString(const StringType1 & short_str, const StringType2 & long_str)
|
||||
bool IsSubString(const StringType1 * short_str, const StringType2 * long_str)
|
||||
{
|
||||
return IsSubString(short_str.c_str(), long_str.c_str());
|
||||
return IsSubStringp(short_str, long_str);
|
||||
}
|
||||
|
||||
|
||||
template<class StringType1, class StringType2>
|
||||
bool IsSubString(const StringType1 & short_str, const StringType2 & long_str)
|
||||
{
|
||||
return IsSubStringp(short_str.c_str(), long_str.c_str());
|
||||
}
|
||||
|
||||
|
||||
template<class StringType1, class StringType2>
|
||||
bool IsSubStringNoCase(const StringType1 * short_str, const StringType2 * long_str)
|
||||
@@ -353,6 +359,36 @@ bool EqualNoCase(const StringType1 & str1, const StringType2 & str2)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
looking for 'look_for' string in 'buf' and replacing it with 'replace'
|
||||
'replace' can be empty (so only 'look_for' will be deleted)
|
||||
*/
|
||||
template<class StringType>
|
||||
void ReplaceString(StringType & buf, const StringType & look_for, const StringType & replace)
|
||||
{
|
||||
size_t i = 0;
|
||||
|
||||
if( look_for.empty() )
|
||||
return;
|
||||
|
||||
while( i < buf.size() )
|
||||
{
|
||||
if( IsSubString(look_for.c_str(), buf.c_str() + i) )
|
||||
{
|
||||
buf.erase(i, look_for.size());
|
||||
buf.insert(i, replace);
|
||||
i += replace.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template<class StringType>
|
||||
void NoLastSlash(StringType & s)
|
||||
{
|
||||
|
Reference in New Issue
Block a user