Optimize compact mode: xml_text
This commit is contained in:
parent
fad2d5e4ef
commit
2fa9158b4f
@ -6567,65 +6567,74 @@ namespace pugi
|
|||||||
PUGI__FN const char_t* xml_text::get() const
|
PUGI__FN const char_t* xml_text::get() const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return PUGIXML_TEXT("");
|
||||||
return (d && d->value) ? d->value + 0 : PUGIXML_TEXT("");
|
const char_t* value = d->value;
|
||||||
|
return value ? value : PUGIXML_TEXT("");
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN const char_t* xml_text::as_string(const char_t* def) const
|
PUGI__FN const char_t* xml_text::as_string(const char_t* def) const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return def;
|
||||||
return (d && d->value) ? d->value + 0 : def;
|
const char_t* value = d->value;
|
||||||
|
return value ? value : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN int xml_text::as_int(int def) const
|
PUGI__FN int xml_text::as_int(int def) const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return def;
|
||||||
return (d && d->value) ? impl::get_value_int(d->value) : def;
|
const char_t* value = d->value;
|
||||||
|
return value ? impl::get_value_int(value) : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN unsigned int xml_text::as_uint(unsigned int def) const
|
PUGI__FN unsigned int xml_text::as_uint(unsigned int def) const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return def;
|
||||||
return (d && d->value) ? impl::get_value_uint(d->value) : def;
|
const char_t* value = d->value;
|
||||||
|
return value ? impl::get_value_uint(value) : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN double xml_text::as_double(double def) const
|
PUGI__FN double xml_text::as_double(double def) const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return def;
|
||||||
return (d && d->value) ? impl::get_value_double(d->value) : def;
|
const char_t* value = d->value;
|
||||||
|
return value ? impl::get_value_double(value) : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN float xml_text::as_float(float def) const
|
PUGI__FN float xml_text::as_float(float def) const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return def;
|
||||||
return (d && d->value) ? impl::get_value_float(d->value) : def;
|
const char_t* value = d->value;
|
||||||
|
return value ? impl::get_value_float(value) : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN bool xml_text::as_bool(bool def) const
|
PUGI__FN bool xml_text::as_bool(bool def) const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return def;
|
||||||
return (d && d->value) ? impl::get_value_bool(d->value) : def;
|
const char_t* value = d->value;
|
||||||
|
return value ? impl::get_value_bool(value) : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PUGIXML_HAS_LONG_LONG
|
#ifdef PUGIXML_HAS_LONG_LONG
|
||||||
PUGI__FN long long xml_text::as_llong(long long def) const
|
PUGI__FN long long xml_text::as_llong(long long def) const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return def;
|
||||||
return (d && d->value) ? impl::get_value_llong(d->value) : def;
|
const char_t* value = d->value;
|
||||||
|
return value ? impl::get_value_llong(value) : def;
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN unsigned long long xml_text::as_ullong(unsigned long long def) const
|
PUGI__FN unsigned long long xml_text::as_ullong(unsigned long long def) const
|
||||||
{
|
{
|
||||||
xml_node_struct* d = _data();
|
xml_node_struct* d = _data();
|
||||||
|
if (!d) return def;
|
||||||
return (d && d->value) ? impl::get_value_ullong(d->value) : def;
|
const char_t* value = d->value;
|
||||||
|
return value ? impl::get_value_ullong(value) : def;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user