本文整理汇总了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);
}
示例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);
}
示例3: PushGroup
/// Pushes a debug group
static void PushGroup(
DebugSource source,
GLuint id,
StrCRef message
)
{
PushGroup(source, id, message.size(), message.c_str());
}
示例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);
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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()
);
}
示例12: Set
void Set(StrCRef str) {
Set(UTF8ToCodePoints(str.begin(), str.size()));
}
示例13: Set
void Set(StrCRef str)
{
Set(str.begin(), str.size());
}
示例14:
GLSLString(const StrCRef& str)
: _str(str.begin())
, _len(GLint(str.size()))
{ }
示例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);
}