fixed the PList at current version of CMUtil.
This commit is contained in:
parent
4734a558a1
commit
40b047c7d4
@ -2,7 +2,7 @@
|
|||||||
#define HGL_PLIST_INCLUDE
|
#define HGL_PLIST_INCLUDE
|
||||||
|
|
||||||
#include<hgl/type/Map.h>
|
#include<hgl/type/Map.h>
|
||||||
#include<hgl/type/StringList.h>
|
#include<hgl/type/LoadStringList.h>
|
||||||
#include<hgl/io/FileOutputStream.h>
|
#include<hgl/io/FileOutputStream.h>
|
||||||
#include<hgl/io/TextOutputStream.h>
|
#include<hgl/io/TextOutputStream.h>
|
||||||
namespace hgl
|
namespace hgl
|
||||||
@ -12,12 +12,12 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 属性列表,类似INI的管理类
|
* 属性列表,类似INI的管理类
|
||||||
*/
|
*/
|
||||||
template<typename C> class PList:public Map<BaseString<C>,BaseString<C>> ///属性列表
|
template<typename C> class PList:public Map<String<C>,String<C>> ///属性列表
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
using PString=BaseString<C>;
|
using PString=String<C>;
|
||||||
using PStringList=StringList<PString>;
|
using PStringList=StringList<C>;
|
||||||
using PMap=Map<PString,PString>;
|
using PMap=Map<PString,PString>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -43,9 +43,9 @@ namespace hgl
|
|||||||
if(key.Length()<2)return(false);
|
if(key.Length()<2)return(false);
|
||||||
|
|
||||||
if(((off=key.FindChar(C('\t')))==-1)
|
if(((off=key.FindChar(C('\t')))==-1)
|
||||||
&&((off=key.FindChar(C(' '))) ==-1)
|
&&((off=key.FindChar(C(' ' )))==-1)
|
||||||
&&((off=key.FindChar(C('='))) ==-1)
|
&&((off=key.FindChar(C('=' )))==-1)
|
||||||
&&((off=key.FindChar(C(':'))) ==-1))
|
&&((off=key.FindChar(C(':' )))==-1))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
name.Strcpy(key,off);
|
name.Strcpy(key,off);
|
||||||
@ -79,11 +79,11 @@ namespace hgl
|
|||||||
/**
|
/**
|
||||||
* 从文本文件中加载
|
* 从文本文件中加载
|
||||||
*/
|
*/
|
||||||
virtual bool LoadFromTextFile(const OSString &filename) ///<从文件中加载列表
|
virtual bool LoadFromTextFile(const OSString &filename,const CharSet &cs=OSCharSet) ///<从文件中加载列表
|
||||||
{
|
{
|
||||||
PStringList sl;
|
PStringList sl;
|
||||||
|
|
||||||
if(LoadStringListFromTextFile(sl,filename)<=0)
|
if(LoadStringListFromTextFile(sl,filename,cs)<=0)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
ReadData(sl);
|
ReadData(sl);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user