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


C++ StrCRef::size方法代码示例

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


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

示例1: MakeLayout

	Layout MakeLayout(const Font& font, StrCRef str)
	{
		CodePoints cps;
		UTF8ToCodePoints(str.begin(), str.size(), cps);

		Layout layout(MakeLayout(font, str.size()));
		layout.Set(cps.data(), cps.size());
		return std::move(layout);
	}
开发者ID:MaikKlein,项目名称:OglplusGen,代码行数:9,代码来源:pango_cairo.hpp

示例2: Set

	/// Store the @p value, of the specified @p type under @p name
	static void Set(
		NamedStringType type,
		const StrCRef& name,
		const StrCRef& value
	)
	{
		OGLPLUS_GLFUNC(NamedStringARB)(
			GLenum(type),
			GLint(name.size()),
			name.c_str(),
			GLint(value.size()),
			value.c_str()
		);
		OGLPLUS_CHECK_SIMPLE(NamedStringARB);
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:16,代码来源:named_string.hpp

示例3: PushGroup

	/// Pushes a debug group
	static void PushGroup(
		DebugSource source,
		GLuint id,
		StrCRef message
	)
	{
		PushGroup(source, id, message.size(), message.c_str());
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:9,代码来源:KHR_debug.hpp

示例4: Delete

	/// Deletes the value stored under @p name
	static void Delete(const StrCRef& name)
	{
		OGLPLUS_GLFUNC(DeleteNamedStringARB)(
			GLint(name.size()),
			name.c_str()
		);
		OGLPLUS_CHECK_SIMPLE(DeleteNamedStringARB);
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:9,代码来源:named_string.hpp

示例5: ObjectLabel

 static void ObjectLabel(const ObjectName<ObjTag>& object, StrCRef label) {
     OGLPLUS_GLFUNC(ObjectLabel)
     (GetGLName(object),
      ObjTypeOps<ObjTag>::ObjectType(),
      label.size(),
      label.c_str());
     OGLPLUS_VERIFY_SIMPLE(ObjectLabel);
 }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:8,代码来源:debug_output.hpp

示例6: IsA

	/// Checks if @p name is a stored string
	static bool IsA(const StrCRef& name)
	{
		GLboolean result = OGLPLUS_GLFUNC(IsNamedStringARB)(
			GLint(name.size()),
			name.c_str()
		);
		OGLPLUS_CHECK_SIMPLE(IsNamedStringARB);
		return result == GL_TRUE;
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:10,代码来源:named_string.hpp

示例7: Type

	/// Gets the type of the named string stored under @p name
	static NamedStringType Type(const StrCRef& name)
	{
		GLint result = 0;
		OGLPLUS_GLFUNC(GetNamedStringivARB)(
			GLint(name.size()),
			name.c_str(),
			GL_NAMED_STRING_TYPE_ARB,
			&result
		);
		OGLPLUS_CHECK_SIMPLE(GetNamedStringivARB);
		return NamedStringType(GLenum(result));
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:13,代码来源:named_string.hpp

示例8: Get

	/// Gets the value stored under @p name
	static String Get(const StrCRef& name)
	{
		GLint len = 0;
		OGLPLUS_GLFUNC(GetNamedStringivARB)(
			GLint(name.size()),
			name.c_str(),
			GL_NAMED_STRING_LENGTH_ARB,
			&len
		);
		OGLPLUS_CHECK_SIMPLE(GetNamedStringivARB);

		String result(len, '\0');
		OGLPLUS_GLFUNC(GetNamedStringARB)(
			GLint(name.size()),
			name.c_str(),
			len,
			&len,
			&result.front()
		);
		OGLPLUS_CHECK_SIMPLE(GetNamedStringARB);
		return std::move(result);

	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:24,代码来源:named_string.hpp

示例9:

		/**
		 *  @overload
		 *
		 *  @glsymbols
		 *  @glfunref{PushDebugGroup}
		 */
		Group(
			DebugOutputSource source,
			GLuint id,
			StrCRef message
		)
		{
			OGLPLUS_GLFUNC(PushDebugGroup)(
				GLenum(source),
				id,
				message.size(),
				message.begin()
			);
			OGLPLUS_VERIFY_SIMPLE(PushDebugGroup);
		}
开发者ID:r-lyeh-forks,项目名称:oglplus,代码行数:20,代码来源:debug_output.hpp

示例10: InsertMessage

 /// Inserts a new message into the debug output
 static void InsertMessage(
   DebugOutputARBSource source,
   DebugOutputARBType type,
   GLuint id,
   DebugOutputARBSeverity severity,
   StrCRef message) {
     OGLPLUS_GLFUNC(DebugMessageInsertARB)
     (GLenum(source),
      GLenum(type),
      id,
      GLenum(severity),
      GLsizei(message.size()),
      message.c_str());
     OGLPLUS_VERIFY_SIMPLE(DebugMessageInsertARB);
 }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:16,代码来源:ARB_debug_output.hpp

示例11: InsertMessage

	/// Inserts a new message into the debug output
	static void InsertMessage(
		DebugSource source,
		DebugType type,
		GLuint id,
		DebugSeverity severity,
		StrCRef message
	)
	{
		InsertMessage(
			source,
			type,
			id,
			severity,
			message.size(),
			message.c_str()
		);
	}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:18,代码来源:KHR_debug.hpp

示例12: Set

 void Set(StrCRef str) {
     Set(UTF8ToCodePoints(str.begin(), str.size()));
 }
开发者ID:matus-chochlik,项目名称:oglplus,代码行数:3,代码来源:layout.hpp

示例13: Set

	void Set(StrCRef str)
	{
		Set(str.begin(), str.size());
	}
开发者ID:Extrunder,项目名称:oglplus,代码行数:4,代码来源:layout.hpp

示例14:

	GLSLString(const StrCRef& str)
	 : _str(str.begin())
	 , _len(GLint(str.size()))
	{ }
开发者ID:Extrunder,项目名称:oglplus,代码行数:4,代码来源:glsl_string.hpp

示例15: BuildProgramWithXFB

oglplus::Program SpectraSharedObjects::BuildProgramWithXFB(
	const char* prog_name,
	const char** xfb_varyings,
	std::size_t xfb_var_count,
	bool separate_attribs
)
{
	using namespace oglplus;

	Program prog = Program(ObjectDesc(prog_name));

	std::ifstream prog_file;
	OpenResourceFile(prog_file, "glsl", prog_name, ".txt");

	const std::size_t linesize = 1024;
	char line[1024] = {'\0'};

	int line_no = 0;
	while(prog_file.getline(line, linesize).good())
	{
		std::size_t line_len = prog_file.gcount();
		++line_no;
		auto types = EnumValueRange<ShaderType>();
		ShaderType type = ShaderType::Fragment;
		std::size_t name_len = 0;
		while(!types.Empty())
		{
			type = types.Front();
			StrCRef name = EnumValueName(type);
			name_len = name.size();
			if(std::strncmp(line, name.c_str(), name.size()) == 0)
				break;
			types.Next();
		}
		if(types.Empty())
		{
			wxString message = wxString::Format(
				wxGetTranslation(wxT(
					"Invalid shader type in program '%s' "\
					"on line %d: '%s'"
				)),
				wxString(prog_name, wxConvUTF8).c_str(),
				line_no,
				wxString(line, wxConvUTF8).c_str()
			);
			throw std::runtime_error(
				(const char*)message.mb_str(wxConvUTF8)
			);
		}

		// rtrim the name
		for(std::size_t i = name_len+1; i!=line_len; ++i)
		{
			if(std::isspace(line[i]))
			{
				line[i] = '\0';
				break;
			}
		}

		std::ifstream shader_file;
		OpenResourceFile(shader_file, "glsl", line+name_len+1, ".glsl");

		Shader shader(type);
		shader.Source(GLSLSource::FromStream(shader_file));
		shader.Compile();

		prog.AttachShader(shader);
	}

	if(xfb_varyings && xfb_var_count)
	{
		prog.TransformFeedbackVaryings(
			xfb_var_count,
			xfb_varyings,
			separate_attribs
			?TransformFeedbackMode::SeparateAttribs
			:TransformFeedbackMode::InterleavedAttribs
		);
	}

	prog.Link().Use();
	return std::move(prog);
}
开发者ID:AdamSimpson,项目名称:oglplus,代码行数:84,代码来源:shared_objects.cpp


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