本文整理汇总了C++中pstring::get方法的典型用法代码示例。如果您正苦于以下问题:C++ pstring::get方法的具体用法?C++ pstring::get怎么用?C++ pstring::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pstring
的用法示例。
在下文中一共展示了pstring::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: append_sheet
void orcus_xml::append_sheet(const pstring& name)
{
if (name.empty())
return;
mp_impl->mp_import_factory->append_sheet(name.get(), name.size());
}
示例2: characters
void xls_xml_context::characters(const pstring& str, bool transient)
{
if (str.empty())
return;
const xml_token_pair_t& elem = get_current_element();
if (elem.first == NS_xls_xml_ss && elem.second == XML_Data)
{
switch (m_cur_cell_type)
{
case ct_string:
{
if (transient)
m_cur_cell_string.push_back(m_pool.intern(str).first);
else
m_cur_cell_string.push_back(str);
}
break;
case ct_number:
{
const char* p = str.get();
m_cur_cell_value = to_double(p, p + str.size());
}
break;
default:
;
}
}
}
示例3: to_length
length_t to_length(const pstring& str)
{
length_t ret;
if (str.empty())
return ret;
const char* p = str.get();
const char* p_start = p;
const char* p_end = p_start + str.size();
ret.value = parse_numeric(p, p_end);
// TODO: See if this part can be optimized.
pstring tail(p, p_end-p);
if (tail == "in")
ret.unit = length_unit_inch;
else if (tail == "cm")
ret.unit = length_unit_centimeter;
else if (tail == "pt")
ret.unit = length_unit_point;
return ret;
}
示例4: to_date_time
date_time_t to_date_time(const pstring& str)
{
date_time_t ret;
int dash_count = 0, t_count = 0, colon_count = 0;
const char* p = str.get();
const char* p_end = p + str.size();
const char* digit = p;
size_t digit_len = 0;
bool valid = true;
for (; p != p_end && valid; ++p)
{
switch (*p)
{
case '-':
{
if (t_count || colon_count || !digit)
{
// Invalid date-time value. All dashes must occur before
// any of 'T' and ':' occur.
valid = false;
break;
}
switch (dash_count)
{
case 0:
// Flush year.
flush_int(ret.year, digit, digit_len);
break;
case 1:
// Flush month.
flush_int(ret.month, digit, digit_len);
break;
default:
valid = false;
}
++dash_count;
}
break;
case 'T':
{
if (t_count || dash_count != 2 || !digit)
{
// Invalid date-time value.
valid = false;
break;
}
// Flush day.
ret.day = strtol(digit, NULL, 10);
digit = NULL;
digit_len = 0;
++t_count;
}
break;
case ':':
{
if (!t_count || !digit)
{
// Invalid date-time value.
valid = false;
break;
}
switch (colon_count)
{
case 0:
// Flush hour.
flush_int(ret.hour, digit, digit_len);
break;
case 1:
// Flush minute.
flush_int(ret.minute, digit, digit_len);
break;
default:
valid = false;
}
++colon_count;
}
break;
default:
{
if (t_count)
{
// Time element.
switch (colon_count)
{
case 0:
// Hour
process_char(p, digit, digit_len);
break;
case 1:
// Minute
process_char(p, digit, digit_len);
break;
case 2:
//.........这里部分代码省略.........
示例5: type
parse_token::parse_token(const pstring& _characters) :
type(parse_token_t::characters)
{
characters.p = _characters.get();
characters.n = _characters.size();
}