mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-02 04:07:42 +08:00
add null drawable support
This commit is contained in:
parent
250fded617
commit
888092eb5b
@ -350,7 +350,7 @@ Drawable* Assets::getDrawable(const std::string&fullresid) {
|
||||
Drawable* d = nullptr;
|
||||
std::string resname,package;
|
||||
ZIPArchive* pak = getResource(fullresid,&resname,&package);
|
||||
if(fullresid.empty()) {
|
||||
if(fullresid.empty()||(fullresid.compare("null")==0)) {
|
||||
return d;
|
||||
} else {
|
||||
auto it = mDrawables.find(fullresid);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <string.h>
|
||||
#include <textutils.h>
|
||||
#include <core/attributeset.h>
|
||||
#include <core/iostreams.h>
|
||||
|
||||
namespace cdroid{
|
||||
|
||||
@ -58,9 +59,16 @@ void Preferences::load(const std::string&fname){
|
||||
if(fin.good()){
|
||||
mFileName=fname;
|
||||
load(fin);
|
||||
}else{
|
||||
load(fname.c_str(),fname.length());
|
||||
}
|
||||
}
|
||||
|
||||
void Preferences::load(const char*buf,size_t len){
|
||||
MemoryInputStream stream(buf,len);
|
||||
load(stream);
|
||||
}
|
||||
|
||||
void Preferences::load(std::istream&istream){
|
||||
XML_Parser parser=XML_ParserCreate(nullptr);
|
||||
std::string curKey;
|
||||
@ -73,7 +81,7 @@ void Preferences::load(std::istream&istream){
|
||||
XML_SetCharacterDataHandler(parser,CharacterHandler);
|
||||
do {
|
||||
std::string str;
|
||||
std::getline(istream,str);//fin.read(buf,sizeof(buf));
|
||||
std::getline(istream,str);
|
||||
len=str.length();
|
||||
if (XML_Parse(parser, str.c_str(),len,len==0) == XML_STATUS_ERROR) {
|
||||
const char*es=XML_ErrorString(XML_GetErrorCode(parser));
|
||||
|
@ -18,6 +18,7 @@ public:
|
||||
void save(const std::string&fname);
|
||||
void load(std::istream&istream);
|
||||
void save(std::ostream&ostream);
|
||||
void load(const char*,size_t);
|
||||
int getSectionCount()const;
|
||||
int getSections(std::vector<std::string>&mbs);
|
||||
int getUpdates()const;
|
||||
|
Loading…
Reference in New Issue
Block a user