mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: XmlNode size optimized (40% less average), removed 64bit warning in InVector
git-svn-id: svn://ultimatepp.org/upp/trunk@6151 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
d01bffeebd
commit
4fd7e653ed
3 changed files with 29 additions and 15 deletions
|
|
@ -39,7 +39,7 @@ private:
|
|||
uint16 slave;
|
||||
|
||||
InVectorSlave__ *Slave() { return (InVectorSlave__ *)((byte *)this + slave); }
|
||||
void SetSlave(InVectorSlave__ *s) { slave = (byte *)s - (byte *)this; }
|
||||
void SetSlave(InVectorSlave__ *s) { slave = (uint16)((byte *)s - (byte *)this); }
|
||||
|
||||
void SetCache(int blki, int offset) const;
|
||||
void ClearCache() const;
|
||||
|
|
|
|||
|
|
@ -739,17 +739,31 @@ int XmlNode::AttrInt(const char *id, int def) const
|
|||
return p.IsInt() ? p.ReadInt() : def;
|
||||
}
|
||||
|
||||
XmlNode& XmlNode::SetAttr(const char *id, const String& text)
|
||||
{
|
||||
if(!attr)
|
||||
attr.Create();
|
||||
attr->GetAdd(id) = text;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void XmlNode::SetAttrsPick(pick_ VectorMap<String, String>& a)
|
||||
{
|
||||
if(a.GetCount() == 0)
|
||||
attr.Clear();
|
||||
else {
|
||||
if(!attr)
|
||||
attr.Create();
|
||||
*attr = a;
|
||||
}
|
||||
}
|
||||
|
||||
XmlNode& XmlNode::SetAttr(const char *id, int i)
|
||||
{
|
||||
SetAttr(id, AsString(i));
|
||||
return *this;
|
||||
}
|
||||
|
||||
XmlNode& XmlNode::SetAttr(const char *id, const String& text)
|
||||
{
|
||||
attr.GetAdd(id) = text;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Ignore(XmlParser& p, dword style)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -134,10 +134,10 @@ public:
|
|||
};
|
||||
|
||||
class XmlNode {
|
||||
int type;
|
||||
String text;
|
||||
VectorMap<String, String> attr;
|
||||
Array<XmlNode> node;
|
||||
int type;
|
||||
String text;
|
||||
Array<XmlNode> node;
|
||||
One< VectorMap<String, String> > attr;
|
||||
|
||||
public:
|
||||
static const XmlNode& Void();
|
||||
|
|
@ -176,15 +176,15 @@ public:
|
|||
String GatherText() const;
|
||||
String operator~() const { return GatherText(); }
|
||||
|
||||
int GetAttrCount() const { return attr.GetCount(); }
|
||||
String AttrId(int i) const { return attr.GetKey(i); }
|
||||
String Attr(int i) const { return attr[i]; }
|
||||
String Attr(const char *id) const { return attr.Get(id, Null); }
|
||||
int GetAttrCount() const { return attr ? attr->GetCount() : 0; }
|
||||
String AttrId(int i) const { return attr->GetKey(i); }
|
||||
String Attr(int i) const { return (*attr)[i]; }
|
||||
String Attr(const char *id) const { return attr ? attr->Get(id, Null) : String(); }
|
||||
XmlNode& SetAttr(const char *id, const String& val);
|
||||
int AttrInt(const char *id, int def = Null) const;
|
||||
XmlNode& SetAttr(const char *id, int val);
|
||||
|
||||
void SetAttrsPick(pick_ VectorMap<String, String>& a) { attr = a; }
|
||||
void SetAttrsPick(pick_ VectorMap<String, String>& a);
|
||||
|
||||
XmlNode() { type = XML_DOC; }
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue