add new Construct function of BaseString from InputStream
This commit is contained in:
parent
2ba8757dec
commit
f895b3c3b0
@ -2,6 +2,7 @@
|
|||||||
#define HGL_TYPE_BASE_STRING_INCLUDE
|
#define HGL_TYPE_BASE_STRING_INCLUDE
|
||||||
|
|
||||||
#include<hgl/type/StringInstance.h>
|
#include<hgl/type/StringInstance.h>
|
||||||
|
#include<hgl/io/InputStream.h>
|
||||||
#include<hgl/CompOperator.h>
|
#include<hgl/CompOperator.h>
|
||||||
#include<hgl/type/Smart.h>
|
#include<hgl/type/Smart.h>
|
||||||
|
|
||||||
@ -29,6 +30,24 @@ namespace hgl
|
|||||||
Set(str);
|
Set(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseString(io::InputStream *is,int len=0)
|
||||||
|
{
|
||||||
|
if(len<=0)
|
||||||
|
len=is->Available();
|
||||||
|
|
||||||
|
if(len<=0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
len/=sizeof(T);
|
||||||
|
|
||||||
|
T *str=new T[len+1];
|
||||||
|
|
||||||
|
len=is->Read(str,len*sizeof(T));
|
||||||
|
|
||||||
|
str[len]=0;
|
||||||
|
Set(str,len,true);
|
||||||
|
}
|
||||||
|
|
||||||
explicit BaseString(const T);
|
explicit BaseString(const T);
|
||||||
|
|
||||||
static BaseString<T> charOf(const T &ch)
|
static BaseString<T> charOf(const T &ch)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user