rename from BaseString to String
This commit is contained in:
parent
51f22f0ed3
commit
7927586bd1
@ -2,7 +2,7 @@
|
||||
#define HGL_CODE_PAGE_INCLUDE
|
||||
|
||||
#include<hgl/platform/Platform.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
namespace hgl
|
||||
{
|
||||
struct CodePageAndCharSet
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef HGL_FILE_SYSTEM_INCLUDE
|
||||
#define HGL_FILE_SYSTEM_INCLUDE
|
||||
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/type/List.h>
|
||||
namespace hgl
|
||||
{
|
||||
@ -13,9 +13,9 @@ namespace hgl
|
||||
namespace filesystem
|
||||
{
|
||||
template<typename T>
|
||||
inline BaseString<T> MergeFilename(const BaseString<T> &pathname,const BaseString<T> &filename,const T directory_separator_char,const T *directory_separator_str)
|
||||
inline String<T> MergeFilename(const String<T> &pathname,const String<T> &filename,const T directory_separator_char,const T *directory_separator_str)
|
||||
{
|
||||
BaseString<T> fullname;
|
||||
String<T> fullname;
|
||||
|
||||
if(pathname.GetEndChar()==directory_separator_char) //结尾有分隔符
|
||||
{
|
||||
@ -47,17 +47,17 @@ namespace hgl
|
||||
* @param fullname 完整路径文件名
|
||||
*/
|
||||
template<typename T>
|
||||
inline BaseString<T> ClipFilename(const BaseString<T> &fullname)
|
||||
inline String<T> ClipFilename(const String<T> &fullname)
|
||||
{
|
||||
if(fullname.Length()<=1)
|
||||
return(BaseString<T>());
|
||||
return(String<T>());
|
||||
|
||||
const T spear_char[] = { '/','\\' };
|
||||
|
||||
const int pos=fullname.FindRightChar(spear_char);
|
||||
|
||||
if(pos==-1)
|
||||
return BaseString<T>(fullname);
|
||||
return String<T>(fullname);
|
||||
|
||||
return fullname.SubString(pos+1);
|
||||
}
|
||||
@ -68,15 +68,15 @@ namespace hgl
|
||||
* @param split_char 扩展名分隔符,一般为'.'
|
||||
*/
|
||||
template<typename T>
|
||||
inline BaseString<T> ClipFileMainname(const BaseString<T> &filename,const T split_char='.')
|
||||
inline String<T> ClipFileMainname(const String<T> &filename,const T split_char='.')
|
||||
{
|
||||
if(filename.Length()<=1)
|
||||
return(BaseString<T>());
|
||||
return(String<T>());
|
||||
|
||||
const int pos=filename.FindRightChar(split_char);
|
||||
|
||||
if(pos==-1)
|
||||
return BaseString<T>(filename);
|
||||
return String<T>(filename);
|
||||
|
||||
return filename.SubString(0,pos);
|
||||
}
|
||||
@ -87,7 +87,7 @@ namespace hgl
|
||||
* @param include_dot 是否包括点
|
||||
*/
|
||||
template<typename T>
|
||||
inline BaseString<T> ClipFileExtName(const BaseString<T> &fullname,bool include_dot=true)
|
||||
inline String<T> ClipFileExtName(const String<T> &fullname,bool include_dot=true)
|
||||
{
|
||||
int end=fullname.FindChar(T('?')); //url的文件名,以?为结束
|
||||
|
||||
@ -97,7 +97,7 @@ namespace hgl
|
||||
int pos=fullname.FindRightChar(fullname.Length()-end,T('.'));
|
||||
|
||||
if(pos==-1)
|
||||
return BaseString<T>();
|
||||
return String<T>();
|
||||
|
||||
return include_dot? fullname.SubString(pos, end- pos ):
|
||||
fullname.SubString(pos+1, end-(pos+1));
|
||||
@ -107,10 +107,10 @@ namespace hgl
|
||||
* 截取路径最后一个名字
|
||||
*/
|
||||
template<typename T>
|
||||
inline BaseString<T> ClipLastPathname(const BaseString<T> &fullname)
|
||||
inline String<T> ClipLastPathname(const String<T> &fullname)
|
||||
{
|
||||
if(fullname.Length()<=1)
|
||||
return(BaseString<T>());
|
||||
return(String<T>());
|
||||
|
||||
const T gap_char[2]={'\\','/'};
|
||||
|
||||
@ -136,14 +136,14 @@ namespace hgl
|
||||
{
|
||||
if(*e==gap_char[0]||*e==gap_char[1])
|
||||
{
|
||||
return BaseString<T>(e+1,p-e);
|
||||
return String<T>(e+1,p-e);
|
||||
}
|
||||
|
||||
--e;
|
||||
}
|
||||
}
|
||||
|
||||
return(BaseString<T>());
|
||||
return(String<T>());
|
||||
}
|
||||
|
||||
inline UTF8String MergeFilename(const UTF8String &pathname,const UTF8String &filename) ///<组合路径名与文件名
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define HGL_IO_DATA_INPUT_STREAM_INCLUDE
|
||||
|
||||
#include<hgl/io/InputStream.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/math/Vector.h>
|
||||
namespace hgl
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define HGL_IO_DATA_OUTPUT_STREAM_INCLUDE
|
||||
|
||||
#include<hgl/io/OutputStream.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/CodePage.h>
|
||||
#include<hgl/math/Vector.h>
|
||||
namespace hgl
|
||||
@ -136,9 +136,9 @@ namespace hgl
|
||||
template<typename T> bool WriteUTF16LEChars (const T *str,uint count); ///<按utf16-le格式写入字符阵列
|
||||
template<typename T> bool WriteUTF16BEChars (const T *str,uint count); ///<按utf16-be格式写入字符阵列
|
||||
|
||||
template<typename T> bool WriteUTF8Chars (const BaseString<T> &str){return WriteUTF8Chars (str.c_str(),str.Length());}
|
||||
template<typename T> bool WriteUTF16LEChars (const BaseString<T> &str){return WriteUTF16LEChars (str.c_str(),str.Length());}
|
||||
template<typename T> bool WriteUTF16BEChars (const BaseString<T> &str){return WriteUTF16BEChars (str.c_str(),str.Length());}
|
||||
template<typename T> bool WriteUTF8Chars (const String<T> &str){return WriteUTF8Chars (str.c_str(),str.Length());}
|
||||
template<typename T> bool WriteUTF16LEChars (const String<T> &str){return WriteUTF16LEChars (str.c_str(),str.Length());}
|
||||
template<typename T> bool WriteUTF16BEChars (const String<T> &str){return WriteUTF16BEChars (str.c_str(),str.Length());}
|
||||
|
||||
template<typename T> bool WriteUTF8StringWithLength (const u8char *str,const uint length);
|
||||
template<typename T> bool WriteUTF8StringWithLength (const UTF16String &str);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef HGL_IO_FILE_ACCESS_INCLUDE
|
||||
#define HGL_IO_FILE_ACCESS_INCLUDE
|
||||
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/io/SeekAccess.h>
|
||||
#include<sys/stat.h>
|
||||
namespace hgl
|
||||
|
@ -59,7 +59,7 @@ namespace hgl
|
||||
virtual bool WriteChars(const u16char *,int64)=0; ///<写入一个字符串
|
||||
|
||||
template<typename N>
|
||||
bool WriteString(const BaseString<N> &str) ///<写入一个字符串
|
||||
bool WriteString(const String<N> &str) ///<写入一个字符串
|
||||
{
|
||||
return WriteChars(str.c_str(),str.Length());
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace hgl
|
||||
}
|
||||
|
||||
template<typename N>
|
||||
bool WriteLine(const BaseString<N> &str)
|
||||
bool WriteLine(const String<N> &str)
|
||||
{
|
||||
return WriteLine(str.c_str(),str.Length());
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef HGL_LOGGER_INCLUDE
|
||||
#define HGL_LOGGER_INCLUDE
|
||||
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace logger
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef HGL_PLUGIN_INCLUDE
|
||||
#define HGL_PLUGIN_INCLUDE
|
||||
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
namespace hgl
|
||||
{
|
||||
/**
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include<hgl/type/DataType.h>
|
||||
#include<hgl/type/Set.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/thread/ThreadMutex.h>
|
||||
#include<hgl/log/LogInfo.h>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include<string>
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/CodePage.h>
|
||||
|
||||
#if HGL_OS == HGL_OS_Windows
|
||||
|
@ -9,13 +9,13 @@
|
||||
namespace hgl
|
||||
{
|
||||
/**
|
||||
* 字符串基类
|
||||
* 字符串类
|
||||
*/
|
||||
template<typename T> class BaseString ///字符串基类
|
||||
template<typename T> class String ///字符串基类
|
||||
{
|
||||
protected:
|
||||
|
||||
using SelfClass =BaseString<T>;
|
||||
using SelfClass =String<T>;
|
||||
using InstClass =StringInstance<T>;
|
||||
using SharedClass =SharedPtr<InstClass>;
|
||||
|
||||
@ -23,9 +23,9 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
BaseString()=default;
|
||||
String()=default;
|
||||
|
||||
BaseString(InstClass *ic)
|
||||
String(InstClass *ic)
|
||||
{
|
||||
data=ic;
|
||||
}
|
||||
@ -34,7 +34,7 @@ namespace hgl
|
||||
* 根据一个C指针风格字符串设置当前字符串内容
|
||||
* @param str 字符串内容,需以0为结尾
|
||||
*/
|
||||
BaseString(const T *str)
|
||||
String(const T *str)
|
||||
{
|
||||
SetString(str);
|
||||
}
|
||||
@ -44,21 +44,21 @@ namespace hgl
|
||||
* @param str 字符串内容,在len<0的情况下,需以0为结尾
|
||||
* @param len 字符串长度,如果str以0为结尾,可以为负值,将启用自动计算长度
|
||||
*/
|
||||
BaseString(const T *str,int len)
|
||||
String(const T *str,int len)
|
||||
{
|
||||
SetString(str,len);
|
||||
}
|
||||
|
||||
static BaseString<T> newOf(T *str,const uint len)
|
||||
static String<T> newOf(T *str,const uint len)
|
||||
{
|
||||
StringInstance<T> *si=new StringInstance<T>();
|
||||
|
||||
si->InitFromInstance(str,len);
|
||||
|
||||
return BaseString<T>(si);
|
||||
return String<T>(si);
|
||||
}
|
||||
|
||||
BaseString(io::InputStream *is,int len=0)
|
||||
String(io::InputStream *is,int len=0)
|
||||
{
|
||||
if(len<=0)
|
||||
len=is->Available();
|
||||
@ -76,26 +76,26 @@ namespace hgl
|
||||
SetInstance(str,len);
|
||||
}
|
||||
|
||||
BaseString(const char)=delete;
|
||||
String(const char)=delete;
|
||||
|
||||
static BaseString<T> charOf(const T &ch)
|
||||
static String<T> charOf(const T &ch)
|
||||
{
|
||||
T *str=new T[2];
|
||||
|
||||
str[0]=ch;
|
||||
str[1]=0;
|
||||
|
||||
return BaseString<T>::newOf(str,1);
|
||||
return String<T>::newOf(str,1);
|
||||
}
|
||||
|
||||
BaseString(const InstClass &si)
|
||||
String(const InstClass &si)
|
||||
{
|
||||
if((&si)==nullptr)return;
|
||||
|
||||
data=si;
|
||||
}
|
||||
|
||||
BaseString(const SelfClass &bs)
|
||||
String(const SelfClass &bs)
|
||||
{
|
||||
if((&bs)==nullptr)return;
|
||||
|
||||
@ -103,8 +103,8 @@ namespace hgl
|
||||
}
|
||||
|
||||
#define BASE_STRING_NUMBER_CONSTRUCT(type,func) \
|
||||
BaseString(const type num)=delete; \
|
||||
static BaseString<T> valueOf(const type value) \
|
||||
String(const type num)=delete; \
|
||||
static String<T> valueOf(const type value) \
|
||||
{ \
|
||||
StringInstance<T> *si=new StringInstance<T>(); \
|
||||
\
|
||||
@ -115,7 +115,7 @@ namespace hgl
|
||||
func(tmp_str,len,value); \
|
||||
si->InitFromInstance(tmp_str,hgl::strlen(tmp_str)); \
|
||||
\
|
||||
return BaseString<T>(si); \
|
||||
return String<T>(si); \
|
||||
}
|
||||
|
||||
BASE_STRING_NUMBER_CONSTRUCT(int, itos);
|
||||
@ -128,9 +128,9 @@ namespace hgl
|
||||
|
||||
#undef BASE_STRING_NUMBER_CONSTRUCT
|
||||
|
||||
BaseString(const int *value,int N)=delete;
|
||||
String(const int *value,int N)=delete;
|
||||
|
||||
static BaseString<T> valueOf(const int *value,int N)
|
||||
static String<T> valueOf(const int *value,int N)
|
||||
{
|
||||
const int size=N*sizeof(int)*8;
|
||||
int len;
|
||||
@ -148,12 +148,12 @@ namespace hgl
|
||||
++value;
|
||||
}
|
||||
|
||||
return BaseString<T>(tmp_str);
|
||||
return String<T>(tmp_str);
|
||||
}
|
||||
|
||||
BaseString(const float *value,int N)=delete;
|
||||
String(const float *value,int N)=delete;
|
||||
|
||||
static BaseString<T> valueOf(const float *value,int N)
|
||||
static String<T> valueOf(const float *value,int N)
|
||||
{
|
||||
const int size=N*sizeof(float)*16;
|
||||
int len;
|
||||
@ -171,10 +171,10 @@ namespace hgl
|
||||
++value;
|
||||
}
|
||||
|
||||
return BaseString<T>(tmp_str);
|
||||
return String<T>(tmp_str);
|
||||
}
|
||||
|
||||
virtual ~BaseString()=default;
|
||||
virtual ~String()=default;
|
||||
|
||||
const T GetBeginChar()const ///<取得当前字符串第一个字符
|
||||
{
|
||||
@ -352,7 +352,7 @@ namespace hgl
|
||||
}
|
||||
|
||||
/**
|
||||
* 断开与其它BaseString共用的情况,创建一个独有的实例
|
||||
* 断开与其它String共用的情况,创建一个独有的实例
|
||||
*/
|
||||
bool Unlink()
|
||||
{
|
||||
@ -971,7 +971,7 @@ namespace hgl
|
||||
* @param pos 起始查找位置
|
||||
* @param ch 要查找的字符,可以是多个,找到任意一个就算
|
||||
*/
|
||||
int FindChar(uint pos,const BaseString<T> &ch)const ///<返回当前字符串中指定字符(多个任选一)的索引(从左至右)
|
||||
int FindChar(uint pos,const String<T> &ch)const ///<返回当前字符串中指定字符(多个任选一)的索引(从左至右)
|
||||
{
|
||||
if(!data.valid())
|
||||
return(-1);
|
||||
@ -984,7 +984,7 @@ namespace hgl
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int FindChar(const BaseString<T> &ch)const{return FindChar(0,ch);} ///<返回当前字符串中指定字符(多个任选一)的索引(从左至右)
|
||||
int FindChar(const String<T> &ch)const{return FindChar(0,ch);} ///<返回当前字符串中指定字符(多个任选一)的索引(从左至右)
|
||||
|
||||
int FindRightChar(const T ch)const ///<返回当前字符串中指定字符开始的索引(从右至左)
|
||||
{
|
||||
@ -999,7 +999,7 @@ namespace hgl
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int FindRightChar(const BaseString<T> &ch)const ///<返回当前字符串中指定字符(多个任选一)开始的索引(从右至左)
|
||||
int FindRightChar(const String<T> &ch)const ///<返回当前字符串中指定字符(多个任选一)开始的索引(从右至左)
|
||||
{
|
||||
if(!data.valid())
|
||||
return(-1);
|
||||
@ -1035,7 +1035,7 @@ namespace hgl
|
||||
* @param off 从右至左跳过不查的字符个数
|
||||
* @param ch 要查找的字符
|
||||
*/
|
||||
int FindRightChar(const int off,const BaseString<T> &ch)const
|
||||
int FindRightChar(const int off,const String<T> &ch)const
|
||||
{
|
||||
if(!data.valid())
|
||||
return(-1);
|
||||
@ -1073,7 +1073,7 @@ namespace hgl
|
||||
* @param pos 起始查找位置
|
||||
* @param ch 要排除的字符
|
||||
*/
|
||||
int FindExcludeChar(const uint pos,const BaseString<T> &ch)const
|
||||
int FindExcludeChar(const uint pos,const String<T> &ch)const
|
||||
{
|
||||
if(!data.valid())
|
||||
return(-1);
|
||||
@ -1086,7 +1086,7 @@ namespace hgl
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int FindExcludeChar(const BaseString &ch)const{return FindExcludeChar(0,ch);}
|
||||
int FindExcludeChar(const String &ch)const{return FindExcludeChar(0,ch);}
|
||||
|
||||
/**
|
||||
* 在整个字符串内,查找指定字符串
|
||||
@ -1228,7 +1228,7 @@ namespace hgl
|
||||
|
||||
ms[new_len]=0;
|
||||
|
||||
return BaseString::newOf(ms,new_len);
|
||||
return String::newOf(ms,new_len);
|
||||
}
|
||||
|
||||
SelfClass operator + (const SelfClass &str) const
|
||||
@ -1277,35 +1277,35 @@ namespace hgl
|
||||
|
||||
CompOperator(const T *,Comp);
|
||||
CompOperator(const SelfClass &,Comp);
|
||||
};//template<typename T> class BaseString
|
||||
};//template<typename T> class String
|
||||
|
||||
//这种重载用于value+str的情况
|
||||
//而类中的的重载用于str+value的情况
|
||||
|
||||
template<typename V,typename T> BaseString<T> operator + (const V &value,const BaseString<T> &str)
|
||||
template<typename V,typename T> String<T> operator + (const V &value,const String<T> &str)
|
||||
{
|
||||
if(str.Length()<=0)
|
||||
return BaseString<T>(value);
|
||||
return String<T>(value);
|
||||
|
||||
return BaseString<T>(value)+str;
|
||||
return String<T>(value)+str;
|
||||
}
|
||||
|
||||
using AnsiString =BaseString<char>;
|
||||
using UTF8String =BaseString<u8char>;
|
||||
using UTF16String =BaseString<u16char>;
|
||||
using UTF32String =BaseString<char32_t>;
|
||||
using OSString =BaseString<os_char>;
|
||||
using WideString =BaseString<wchar_t>;
|
||||
using AnsiString =String<char>;
|
||||
using UTF8String =String<u8char>;
|
||||
using UTF16String =String<u16char>;
|
||||
using UTF32String =String<char32_t>;
|
||||
using OSString =String<os_char>;
|
||||
using WideString =String<wchar_t>;
|
||||
|
||||
template<typename C> bool ToNumber(const BaseString<C> &str,int &value){return str.ToInt(value);}
|
||||
template<typename C> bool ToNumber(const BaseString<C> &str,uint &value){return str.ToUint(value);}
|
||||
template<typename C> bool ToNumber(const BaseString<C> &str,float &value){return str.ToFloat(value);}
|
||||
template<typename C> bool ToNumber(const BaseString<C> &str,double &value){return str.ToFloat(value);}
|
||||
template<typename C> bool ToNumber(const String<C> &str,int &value){return str.ToInt(value);}
|
||||
template<typename C> bool ToNumber(const String<C> &str,uint &value){return str.ToUint(value);}
|
||||
template<typename C> bool ToNumber(const String<C> &str,float &value){return str.ToFloat(value);}
|
||||
template<typename C> bool ToNumber(const String<C> &str,double &value){return str.ToFloat(value);}
|
||||
|
||||
/**
|
||||
* 以累加的方式为一个字符串计算出一个hash码
|
||||
*/
|
||||
template<typename T,int HASH_MAX> uint StringFastHash(const BaseString<T> &str)
|
||||
template<typename T,int HASH_MAX> uint StringFastHash(const String<T> &str)
|
||||
{
|
||||
const T *p=str.c_str();
|
||||
int c=str.Length();
|
||||
@ -1324,13 +1324,13 @@ namespace hgl
|
||||
* @return 转换好的字符串
|
||||
* @see HexToString
|
||||
*/
|
||||
template<typename T,typename I> BaseString<T> ToHexString(const I &value)
|
||||
template<typename T,typename I> String<T> ToHexString(const I &value)
|
||||
{
|
||||
T str[(sizeof(I)<<1)+1];
|
||||
|
||||
ToUpperHexStr(str,value);
|
||||
|
||||
return BaseString<T>(str);
|
||||
return String<T>(str);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1339,46 +1339,46 @@ namespace hgl
|
||||
* @param value 要转换的数值
|
||||
* @see ToHexString
|
||||
*/
|
||||
template<typename T,typename I> BaseString<T> HexToString(const I &value)
|
||||
template<typename T,typename I> String<T> HexToString(const I &value)
|
||||
{
|
||||
T str[(sizeof(I)<<1)+1];
|
||||
|
||||
htos(str,sizeof(I)<<1,value);
|
||||
|
||||
return BaseString<T>(str);
|
||||
return String<T>(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将一个指针转换成一个16进制字符串
|
||||
*/
|
||||
template<typename T> BaseString<T> PointerToHexString(const void *ptr)
|
||||
template<typename T> String<T> PointerToHexString(const void *ptr)
|
||||
{
|
||||
return HexToString<T,HGL_POINTER_UINT>(reinterpret_cast<const HGL_POINTER_UINT>(ptr));
|
||||
}
|
||||
|
||||
inline BaseString<os_char> PointerToHexOSString(const void *value)
|
||||
inline String<os_char> PointerToHexOSString(const void *value)
|
||||
{
|
||||
return PointerToHexString<os_char>(value);
|
||||
}
|
||||
|
||||
inline BaseString<char> PointerToHexUTF8String(const void *value)
|
||||
inline String<char> PointerToHexUTF8String(const void *value)
|
||||
{
|
||||
return PointerToHexString<char>(value);
|
||||
}
|
||||
|
||||
inline BaseString<u16char> PointerToHexUTF16String(const void *value)
|
||||
inline String<u16char> PointerToHexUTF16String(const void *value)
|
||||
{
|
||||
return PointerToHexString<u16char>(value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void strcpy(T *dst,int max_count,const BaseString<T> &src)
|
||||
inline void strcpy(T *dst,int max_count,const String<T> &src)
|
||||
{
|
||||
hgl::strcpy(dst,max_count,src.c_str(),src.Length());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline void strcat(T *dst,int max_count,const BaseString<T> &src)
|
||||
inline void strcat(T *dst,int max_count,const String<T> &src)
|
||||
{
|
||||
hgl::strcat(dst,max_count,src.c_str(),src.Length());
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include<hgl/type/List.h>
|
||||
#include<hgl/filesystem/FileSystem.h>
|
||||
#include<hgl/type/BaseString.h>
|
||||
#include<hgl/type/String.h>
|
||||
#include<hgl/io/DataInputStream.h>
|
||||
#include<hgl/io/DataOutputStream.h>
|
||||
|
||||
@ -222,7 +222,7 @@ namespace hgl
|
||||
* @param size 字符串长度
|
||||
* @return 字符串行数
|
||||
*/
|
||||
template<typename T> int SplitToStringListBySpace(StringList<BaseString<T> > &sl,const T *str,int size)
|
||||
template<typename T> int SplitToStringListBySpace(StringList<String<T> > &sl,const T *str,int size)
|
||||
{
|
||||
if(!str||size<=0)return(-1);
|
||||
|
||||
@ -237,7 +237,7 @@ namespace hgl
|
||||
{
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ namespace hgl
|
||||
{
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -262,7 +262,7 @@ namespace hgl
|
||||
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ namespace hgl
|
||||
* @param split_char 分隔字符
|
||||
* @return 字符串行数
|
||||
*/
|
||||
template<typename T> int SplitToStringList(StringList<BaseString<T> > &sl,const T *str,int size,const T &split_char)
|
||||
template<typename T> int SplitToStringList(StringList<String<T> > &sl,const T *str,int size,const T &split_char)
|
||||
{
|
||||
if(!str||size<=0)return(-1);
|
||||
|
||||
@ -292,7 +292,7 @@ namespace hgl
|
||||
{
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ namespace hgl
|
||||
{
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -317,14 +317,14 @@ namespace hgl
|
||||
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}//int SplitToStringList
|
||||
|
||||
template<typename T> int SplitToStringListFromString(StringList<BaseString<T> > &sl,const BaseString<T> &str,const T &split_char)
|
||||
template<typename T> int SplitToStringListFromString(StringList<String<T> > &sl,const String<T> &str,const T &split_char)
|
||||
{
|
||||
return SplitToStringList<T>(sl,str.c_str(),str.Length(),split_char);
|
||||
}
|
||||
@ -338,7 +338,7 @@ namespace hgl
|
||||
* @param maxSize 最多执行次数
|
||||
* @return 字符串行数
|
||||
*/
|
||||
template<typename T> int SplitToStringList(StringList<BaseString<T> > &sl,const T *str,int size,const T &split_char,int maxSize)
|
||||
template<typename T> int SplitToStringList(StringList<String<T> > &sl,const T *str,int size,const T &split_char,int maxSize)
|
||||
{
|
||||
if(!str||size<=0)return(-1);
|
||||
|
||||
@ -353,7 +353,7 @@ namespace hgl
|
||||
{
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ namespace hgl
|
||||
{
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -376,7 +376,7 @@ namespace hgl
|
||||
--size;
|
||||
if(size > 0)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,size));
|
||||
sl.Add(String<T>(sp,size));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -390,14 +390,14 @@ namespace hgl
|
||||
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}//int SplitToStringList
|
||||
|
||||
template<typename T> int SplitToStringList(StringList<BaseString<T> > &sl,const BaseString<T> &str,const T &split_char,int maxSize)
|
||||
template<typename T> int SplitToStringList(StringList<String<T> > &sl,const String<T> &str,const T &split_char,int maxSize)
|
||||
{
|
||||
return SplitToStringList<T>(sl,str.c_str(),str.Length(),split_char,maxSize);
|
||||
}
|
||||
@ -409,7 +409,7 @@ namespace hgl
|
||||
* @param size 字符串长度
|
||||
* @return 字符串行数
|
||||
*/
|
||||
template<typename T> int SplitToStringListByEnter(StringList<BaseString<T> > &sl,const T *str,int size)
|
||||
template<typename T> int SplitToStringListByEnter(StringList<String<T> > &sl,const T *str,int size)
|
||||
{
|
||||
if(!str||size<=0)return(-1);
|
||||
|
||||
@ -424,7 +424,7 @@ namespace hgl
|
||||
{
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
@ -434,7 +434,7 @@ namespace hgl
|
||||
|
||||
if(*p==0x0D) // \r
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
|
||||
++p;
|
||||
@ -451,7 +451,7 @@ namespace hgl
|
||||
else
|
||||
if(*p==0x0A) // \n
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
|
||||
++p;
|
||||
@ -468,19 +468,19 @@ namespace hgl
|
||||
|
||||
if(p>sp)
|
||||
{
|
||||
sl.Add(BaseString<T>(sp,p-sp));
|
||||
sl.Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}//int SplitToStringList
|
||||
|
||||
template<typename T> int SplitToStringListByEnter(StringList<BaseString<T> > &sl,const BaseString<T> &str)
|
||||
template<typename T> int SplitToStringListByEnter(StringList<String<T> > &sl,const String<T> &str)
|
||||
{
|
||||
return SplitToStringListByEnter<T>(sl,str.c_str(),str.Length());
|
||||
}
|
||||
|
||||
template<typename T> int SplitToStringList(StringList<BaseString<T> > &sl,const BaseString<T> &str)
|
||||
template<typename T> int SplitToStringList(StringList<String<T> > &sl,const String<T> &str)
|
||||
{
|
||||
return SplitToStringList<T>(sl,str.c_str(),str.Length());
|
||||
}
|
||||
@ -493,7 +493,7 @@ namespace hgl
|
||||
* @param size 字符串长度
|
||||
* @return 字符串行数
|
||||
*/
|
||||
template<typename T> int SplitToMultiStringList(StringList<BaseString<T> > **sl,int slc,const T *str,int size)
|
||||
template<typename T> int SplitToMultiStringList(StringList<String<T> > **sl,int slc,const T *str,int size)
|
||||
{
|
||||
if(!str||size<=0)return(-1);
|
||||
if(slc<=0)return(-1);
|
||||
@ -510,7 +510,7 @@ namespace hgl
|
||||
{
|
||||
if(p>sp)
|
||||
{
|
||||
sl[index]->Add(BaseString<T>(sp,p-sp));
|
||||
sl[index]->Add(String<T>(sp,p-sp));
|
||||
if(++index==slc)index=0;
|
||||
++count;
|
||||
}
|
||||
@ -521,7 +521,7 @@ namespace hgl
|
||||
|
||||
if(*p==0x0D) // \r
|
||||
{
|
||||
sl[index]->Add(BaseString<T>(sp,p-sp));
|
||||
sl[index]->Add(String<T>(sp,p-sp));
|
||||
if(++index==slc)index=0;
|
||||
|
||||
++count;
|
||||
@ -540,7 +540,7 @@ namespace hgl
|
||||
else
|
||||
if(*p==0x0A) // \n
|
||||
{
|
||||
sl[index]->Add(BaseString<T>(sp,p-sp));
|
||||
sl[index]->Add(String<T>(sp,p-sp));
|
||||
if(++index==slc)index=0;
|
||||
|
||||
++count;
|
||||
@ -559,14 +559,14 @@ namespace hgl
|
||||
|
||||
if(p>sp)
|
||||
{
|
||||
sl[index]->Add(BaseString<T>(sp,p-sp));
|
||||
sl[index]->Add(String<T>(sp,p-sp));
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}//int SplitToStringList
|
||||
|
||||
template<typename T> int SplitToMultiStringList(StringList<BaseString<T> > **sl,int slc,const BaseString<T> &str)
|
||||
template<typename T> int SplitToMultiStringList(StringList<String<T> > **sl,int slc,const String<T> &str)
|
||||
{
|
||||
if(!sl||slc<=0)return(false);
|
||||
|
||||
@ -618,7 +618,7 @@ namespace hgl
|
||||
* @param dis 数据输入流
|
||||
* @return 字符串行数
|
||||
*/
|
||||
template<typename T,ByteOrderMask bom> int LoadStringList(StringList<BaseString<T> > &sl,io::DataInputStream *dis)
|
||||
template<typename T,ByteOrderMask bom> int LoadStringList(StringList<String<T> > &sl,io::DataInputStream *dis)
|
||||
{
|
||||
if(!dis)return(-1);
|
||||
|
||||
@ -628,9 +628,9 @@ namespace hgl
|
||||
if(!dis->ReadInt32(count))
|
||||
return(-2);
|
||||
|
||||
ReadStringFromDIS<BaseString<T>,bom> rsfd;
|
||||
ReadStringFromDIS<String<T>,bom> rsfd;
|
||||
|
||||
BaseString<T> str;
|
||||
String<T> str;
|
||||
|
||||
for(int i=0;i<count;i++)
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ SOURCE_GROUP("Datatype\\Color\\Header Files" FILES ${COLOR_HEADER_FILES})
|
||||
SOURCE_GROUP("Datatype\\Color\\Source Files" FILES ${COLOR_SOURCE_FILES})
|
||||
|
||||
##Text--------------------------------------------------------
|
||||
SET(STRING_HEADER_FILES ${TYPE_INCLUDE_PATH}/BaseString.h
|
||||
SET(STRING_HEADER_FILES ${TYPE_INCLUDE_PATH}/String.h
|
||||
${TYPE_INCLUDE_PATH}/StringInstance.h
|
||||
${TYPE_INCLUDE_PATH}/StringList.h
|
||||
${TYPE_INCLUDE_PATH}/StdString.h)
|
||||
|
Loading…
x
Reference in New Issue
Block a user