当前位置: 首页>>代码示例>>C++>>正文


C++ CL_String类代码示例

本文整理汇总了C++中CL_String的典型用法代码示例。如果您正苦于以下问题:C++ CL_String类的具体用法?C++ CL_String怎么用?C++ CL_String使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CL_String类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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)");
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:32,代码来源:collada_triangles.cpp

示例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)");
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:34,代码来源:collada_triangles.cpp

示例3: get_directory_listing

CL_VirtualDirectoryListing CL_VirtualFileSystem::get_directory_listing(const CL_String &path_rel)
{
	CL_String path = CL_PathHelp::make_absolute(
		"/",
		path_rel,
		CL_PathHelp::path_type_virtual);

	// First see if its a mount point:
	int index, size;
	size = (int) impl->mounts.size();
	for (index = 0; index < size; index++)
	{
		if (impl->mounts[index].first == path.substr(0, impl->mounts[index].first.length()))
		{
			return impl->mounts[index].second.get_directory_listing( path.substr(impl->mounts[index].first.length(), path.length()));
		}
	}

	// Try open locally, if we got a file provider attached
	if (impl->provider)
	{
		return CL_VirtualDirectoryListing(
			impl->provider,
			CL_PathHelp::make_relative(
				"/",
				path,
				CL_PathHelp::path_type_virtual));		
	}
	else
		throw CL_Exception(cl_format("Unable to list directory: %1", path));

}
开发者ID:Zenol,项目名称:clanlib-2.4,代码行数:32,代码来源:virtual_file_system.cpp

示例4: CL_String

void CL_StringFormat::set_arg(int index, long unsigned int value, int min_length)
{
	CL_String t = CL_StringHelp::ull_to_text(value);
	if ((int) t.length() < min_length)
		t = CL_String(min_length-t.length(), '0') + t;
	set_arg(index, t);
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:7,代码来源:string_format.cpp

示例5: FromStream

void CL_TimeOfDay::FromStream (istream& s)
{
    CL_String rep;
    char c;
    long count = 0;
    char fill_char = s.fill ();
    
    while (s.get (c) && c == fill_char);
    if (!s.good() || s.eof()) {
        _numSecs = 0;
        return;
    }
    do {
        if (isalnum (c) || c == ':') {
            rep.Append (c);
            count++;
        }
        else
            break;
    } while (s.get (c));

    long n = ParseAndConvert (rep);
    if (n > 0) {
        if (!s.eof())
            s.putback (c);
        _numSecs = n;
    }
    else {
        s.seekg (s.tellg() - count, istream::cur);
        _numSecs = 0;
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:32,代码来源:timeofda.cpp

示例6: CL_Exception

void CL_Collada_Material_Impl::load_material(CL_DomElement &material_element, std::vector<CL_Collada_Effect> &effects)
{
	id = material_element.get_attribute("id");

	CL_DomElement instance_effect_element = material_element.named_item("instance_effect").to_element();
	if (instance_effect_element.is_null())
		throw CL_Exception("Only instance_effect materials are supported");

	CL_String url = instance_effect_element.get_attribute("url");
	url = url.substr(1);	// Remove the initial '#' symbol

	std::vector<CL_Collada_Effect>::size_type size, cnt;
	size = effects.size();
	for (cnt=0; cnt< size; cnt++)
	{
		if (effects[cnt].get_id() == url)
		{
			effect = effects[cnt];
			break;
		}
	}

	if (effect.is_null())
		throw CL_Exception("Unable to find effect");

}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:26,代码来源:collada_material.cpp

示例7: is_absolute

bool CL_PathHelp::is_absolute(const CL_String &path, PathType path_type)
{
	if (path_type == path_type_file)
	{
#ifdef WIN32
		if (path.length() < 3)
			return false;
		if (path[1] == ':' && (path[2] == '\\' || path[2] == '/'))
			return true;
		if (path[0] == '\\' && path[1] == '\\')
			return true;
		return false;
#else
		if (path.length() < 1)
			return false;
		if (path[0] == '/')
			return true;
		if (path[0] == '\\')
			return true;
		return false;
#endif
	}
	else
	{
		if (path.length() < 1)
			return false;
		if (path[0] == '/')
			return true;
		return false;
	}
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:31,代码来源:path_help.cpp

示例8: file

CL_String CL_File::read_text(const CL_String &filename)
{
    CL_File file(filename);
    CL_String str;
    str.resize(file.get_size());
    file.read(str.data(), str.length());
    file.close();
    return str;
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:9,代码来源:file.cpp

示例9: remove_trailing_slash

CL_String CL_PathHelp::remove_trailing_slash(const CL_String &path)
{
	if (path.empty())
		return path;

	if (path[path.length()-1] == '/' || path[path.length()-1] == '\\')
		return path.substr(0, path.length()-1);

	return path;
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:10,代码来源:path_help.cpp

示例10: 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);
}
开发者ID:ermachkov,项目名称:bmgui,代码行数:12,代码来源:main.cpp

示例11: index_file

void ReferenceIndex::save(const CL_StringRef &filename)
{
	CL_File index_file(filename, CL_File::create_always, CL_File::access_write);
	CL_String html =
		"<!-- clanlib header begin -->"
		"<HTML>"
		"<HEAD>"
		"<TITLE>Index - ClanLib Game SDK</TITLE>"
		"<STYLE TYPE=\"text/css\"><!--"
		"HTML BODY"
		"{"
		"        font-family: verdana, helvetica, sans-serif;"
		"        font-size: 12px;"
		"}"
		"H1 { font-size: 22px; }"
		"H2 { font-size: 18px; }"
		"H3 { font-size: 16px; }"
		"H4 { font-size: 14px; }"
		"P { font-size: 12px; }"
		"LI { font-size: 12px; }"
		".reflink:link { text-decoration: none; font-weight: bold; color: black; }"
		".reflink:visited { text-decoration: none; font-weight: bold; color: black; }"
		".reflink:active { text-decoration: none; font-weight: bold; color: black; }"
		".reflink:hover { text-decoration: underline; font-weight: bold; color: black; }"
		"--></STYLE>"
		"</HEAD>"
		"<body bgcolor=white text=black link=blue vlink=#800080>"
		"<center>"
		"<img src=\"http://clanlib.org/gfx/clanlib.png\">"
		"</center>"
		"<!-- clanlib header end -->"
		"<center>"
		"<p>"
//		"<a href=\"http://clanlib.org/docs.html\">Home</a> |"
		"<a href=\"classes.html\">All Classes</a> |"
		"<a href=\"modules.html\">Grouped Classes</a> |"
		"<a href=\"index.html\">Index</a>"
//		"<a href=\"search.html\">Search</a>"
		"</p>"
		"</center>"
		"<h1>Index</h1>";
	index_file.write(html.data(), html.length());

	html =
		"<!-- clanlib footer begin -->"
//		"<center><br><br><font color=\"#a0a0a0\">"
//		"Questions or comments, write to the <a href=\"http://clanlib.org/contact.html\">ClanLib mailing list</a>."
//		"</font></center>"
		"<!-- clanlib footer end -->"
		"</body>"
		"</html>";
	index_file.write(html.data(), html.length());
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:53,代码来源:reference_index.cpp

示例12: get_fullname

CL_String CL_PathHelp::get_fullname(
	const CL_String &fullpath,
	const CL_String &filename,
	const CL_String &extension,
	PathType path_type)
{
	if (!extension.empty() && extension[0] == '.')
		return add_trailing_slash(fullpath, path_type) + filename + extension;
	else if (!extension.empty())
		return add_trailing_slash(fullpath, path_type) + filename + "." + extension;
	else
		return add_trailing_slash(fullpath, path_type) + filename;
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:13,代码来源:path_help.cpp

示例13: save

void CL_ImageProviderFactory::save(
	CL_PixelBuffer buffer,
	const CL_String &filename,
	CL_VirtualDirectory &directory,
	const CL_String &type_
	)
{
	CL_String type = type_;

	if (type.empty())
		type = CL_PathHelp::get_extension(filename, CL_PathHelp::path_type_virtual);
	
	if (types.find(type) == types.end()) throw CL_Exception("Unknown image provider type " + type);
	
	CL_ImageProviderType *factory = types[type];
	factory->save(buffer, filename, directory);
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:17,代码来源:provider_factory.cpp

示例14: get_text

CL_String CL_DomElement::get_text() const
{
	CL_String str;
	if (has_child_nodes() == false)
		return str;

	CL_DomNode cur = get_first_child();
	while (!cur.is_null())
	{
		if (cur.is_text() || cur.is_cdata_section())
			str.append(cur.get_node_value());
		if (cur.is_element())
			str.append(cur.to_element().get_text());
		cur = cur.get_next_sibling();
	}
	return str;
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:17,代码来源:dom_element.cpp

示例15: SetCurrentDirectory

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
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:8,代码来源:directory.cpp


注:本文中的CL_String类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。