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


C++ JSONWriter::writeString方法代码示例

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


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

示例1: switch

void
dumpBoolean(JSONWriter &json, GLboolean value)
{
    switch (value) {
    case GL_FALSE:
        json.writeString("GL_FALSE");
        break;
    case GL_TRUE:
        json.writeString("GL_TRUE");
        break;
    default:
        json.writeInt(static_cast<GLint>(value));
        break;
    }
}
开发者ID:galek,项目名称:apitrace,代码行数:15,代码来源:glstate.cpp

示例2: malloc

inline void
dumpShader(JSONWriter &json, const char *name, T *pShader) {
    if (!pShader) {
        return;
    }

    HRESULT hr;

    UINT SizeOfData = 0;

    hr = pShader->GetFunction(NULL, &SizeOfData);
    if (SUCCEEDED(hr)) {
        void *pData;
        pData = malloc(SizeOfData);
        if (pData) {
            hr = pShader->GetFunction(pData, &SizeOfData);
            if (SUCCEEDED(hr)) {
                com_ptr<IDisassemblyBuffer> pDisassembly;
                hr = DisassembleShader((const DWORD *)pData, &pDisassembly);
                if (SUCCEEDED(hr)) {
                    json.beginMember(name);
                    json.writeString((const char *)pDisassembly->GetBufferPointer() /*, pDisassembly->GetBufferSize() */);
                    json.endMember();
                }

            }
            free(pData);
        }
    }
}
开发者ID:Acidburn0zzz,项目名称:apitrace,代码行数:30,代码来源:d3d9state.cpp

示例3: getPrivateData

inline void
dumpShader(JSONWriter &json, const char *name, T *pShader) {
    if (!pShader) {
        return;
    }

    /*
     * There is no method to get the shader byte code, so the creator is supposed to
     * attach it via the SetPrivateData method.
     */


    std::vector<BYTE> ShaderBytecode = getPrivateData(pShader, GUID_D3DSTATE);
    if (ShaderBytecode.empty()) {
        return;
    }

    com_ptr<IDisassemblyBuffer> pDisassembly;
    HRESULT hr;
    hr = DisassembleShader(&ShaderBytecode[0], ShaderBytecode.size(), &pDisassembly);
    if (SUCCEEDED(hr)) {
        json.beginMember(name);
        json.writeString((const char *)pDisassembly->GetBufferPointer() /*, pDisassembly->GetBufferSize() */);
        json.endMember();
    }
}
开发者ID:galek,项目名称:apitrace,代码行数:26,代码来源:d3d10state.hpp

示例4: glGetShaderiv

static void
dumpShader(JSONWriter &json, GLuint shader)
{
    if (!shader) {
        return;
    }

    GLint shader_type = 0;
    glGetShaderiv(shader, GL_SHADER_TYPE, &shader_type);
    if (!shader_type) {
        return;
    }

    GLint source_length = 0;
    glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &source_length);
    if (!source_length) {
        return;
    }

    GLchar *source = new GLchar[source_length];
    GLsizei length = 0;
    source[0] = 0;
    glGetShaderSource(shader, source_length, &length, source);

    json.beginMember(enumToString(shader_type));
    json.writeString(source);
    json.endMember();

    delete [] source;
}
开发者ID:pzick,项目名称:apitrace,代码行数:30,代码来源:glstate.cpp

示例5: glGetObjectParameterivARB

static void
dumpShaderObj(JSONWriter &json, GLhandleARB shaderObj)
{
    if (!shaderObj) {
        return;
    }

    GLint shader_type = 0;
    glGetObjectParameterivARB(shaderObj, GL_OBJECT_TYPE_ARB, &shader_type);
    if (!shader_type) {
        return;
    }

    GLint source_length = 0;
    glGetObjectParameterivARB(shaderObj, GL_OBJECT_SHADER_SOURCE_LENGTH_ARB, &source_length);
    if (!source_length) {
        return;
    }

    GLcharARB *source = new GLcharARB[source_length];
    GLsizei length = 0;
    source[0] = 0;
    glGetShaderSource(shaderObj, source_length, &length, source);

    json.beginMember(enumToString(shader_type));
    json.writeString(source);
    json.endMember();

    delete [] source;
}
开发者ID:pzick,项目名称:apitrace,代码行数:30,代码来源:glstate.cpp

示例6: glGetProgramiv

static inline void
dumpProgram(JSONWriter &json, GLint program)
{
    GLint attached_shaders = 0;
    glGetProgramiv(program, GL_ATTACHED_SHADERS, &attached_shaders);
    if (!attached_shaders) {
        return;
    }

    ShaderMap shaderMap;

    GLuint *shaders = new GLuint[attached_shaders];
    GLsizei count = 0;
    glGetAttachedShaders(program, attached_shaders, &count, shaders);
    std::sort(shaders, shaders + count);
    for (GLsizei i = 0; i < count; ++ i) {
        getShaderSource(shaderMap, shaders[i]);
    }
    delete [] shaders;

    for (ShaderMap::const_iterator it = shaderMap.begin(); it != shaderMap.end(); ++it) {
        json.beginMember(it->first);
        json.writeString(it->second);
        json.endMember();
    }
}
开发者ID:zhangjitao,项目名称:apitrace,代码行数:26,代码来源:glstate_shaders.cpp

示例7: enumToString

void
dumpEnum(JSONWriter &json, GLenum pname)
{
    const char *s = enumToString(pname);
    if (s) {
        json.writeString(s);
    } else {
        json.writeInt(pname);
    }
}
开发者ID:galek,项目名称:apitrace,代码行数:10,代码来源:glstate.cpp

示例8: glGetProgramivARB

static inline void
dumpArbProgram(JSONWriter &json, GLenum target)
{
    if (!glIsEnabled(target)) {
        return;
    }

    GLint program_length = 0;
    glGetProgramivARB(target, GL_PROGRAM_LENGTH_ARB, &program_length);
    if (!program_length) {
        return;
    }

    GLchar *source = new GLchar[program_length + 1];
    source[0] = 0;
    glGetProgramStringARB(target, GL_PROGRAM_STRING_ARB, source);
    source[program_length] = 0;

    json.beginMember(enumToString(target));
    json.writeString(source);
    json.endMember();

    delete [] source;
}
开发者ID:pzick,项目名称:apitrace,代码行数:24,代码来源:glstate.cpp


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