本文整理汇总了C++中CL_String::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_String::c_str方法的具体用法?C++ CL_String::c_str怎么用?C++ CL_String::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CL_String
的用法示例。
在下文中一共展示了CL_String::c_str方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decode
//конвертирование из CP-1251 в UTF-8
CL_String decode(const CL_String &str)
{
//строка символов в текущей локали преобразовать в UCS-2 через MultiByteToWideChar,
//а потом из UCS-2 в кланлибовский UTF-8 через CL_StringHelp::ucs2_to_text.
CL_String16 result;
int count = MultiByteToWideChar(1251, 0, str.c_str(), str.size(), NULL, 0);
result.resize(count);
MultiByteToWideChar(1251, 0, str.c_str(), str.size(), result.data(), count);
return CL_StringHelp::ucs2_to_text(result);
}
示例2: load_primitive
void CL_Collada_Triangles_Impl::load_primitive(CL_DomElement &primitive_element)
{
unsigned int count = stride * triangle_count * 3;
primitive.resize(count);
CL_String points = primitive_element.get_text();
const CL_String::char_type *primitive_text = points.c_str();
for (unsigned int cnt=0; cnt < count; cnt++)
{
if (!(*primitive_text))
throw CL_Exception("Primitive data count mismatch");
int value = atoi(primitive_text);
primitive[cnt] = value;
while(*primitive_text)
{
if (*(primitive_text++) <= ' ') // Find whitespace
break;
}
while(*primitive_text)
{
if ((*primitive_text) > ' ') // Find end of whitespace
break;
primitive_text++;
}
}
if (*primitive_text)
throw CL_Exception("Primitive data count mismatch (end)");
}
示例3: validate_vcount
void CL_Collada_Triangles_Impl::validate_vcount(CL_DomElement &vcount_element)
{
CL_String points = vcount_element.get_text();
const CL_String::char_type *vcount_text = points.c_str();
for (unsigned int cnt=0; cnt < triangle_count; cnt++)
{
if (!(*vcount_text))
throw CL_Exception("VCount data count mismatch");
int value = atoi(vcount_text);
if (value != 3)
throw CL_Exception("Only triangles are supported. Export your mesh as triangles please");
while(*vcount_text)
{
if (*(vcount_text++) <= ' ') // Find whitespace
break;
}
while(*vcount_text)
{
if ((*vcount_text) > ' ') // Find end of whitespace
break;
vcount_text++;
}
}
if (*vcount_text)
throw CL_Exception("VCount data count mismatch (end)");
}
示例4: set_current
bool CL_Directory::set_current(const CL_String &dir_name)
{
#ifdef WIN32
return SetCurrentDirectory(CL_StringHelp::utf8_to_ucs2(dir_name).c_str()) == TRUE;
#else
return chdir(dir_name.c_str()) == 0;
#endif
}