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


C++ Document::ParseStream方法代码示例

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


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

示例1: loadShaderCache

void loadShaderCache()
{
  FILE* fp = fopen(_shaderCacheFilePath.c_str(), "rb");

  if (fp == nullptr)
  {
    _INTR_LOG_WARNING("Shader cache not available...");
    return;
  }

  char* readBuffer = (char*)Memory::Tlsf::MainAllocator::allocate(65536u);
  {
    rapidjson::FileReadStream is(fp, readBuffer, 65536u);
    _shaderCache.ParseStream(is);
    fclose(fp);
  }
  Memory::Tlsf::MainAllocator::free(readBuffer);
}
开发者ID:zvoronz,项目名称:Intrinsic,代码行数:18,代码来源:IntrinsicRendererResourcesGpuProgram.cpp

示例2: LoadConfig

		void LoadConfig(rapidjson::Document& d, const std::string& fileName, const std::string& defaultFileName) {
			FILE* f = fopen(fileName.c_str(), "rb");

			if (!f) {
				s_CopyFile(defaultFileName.c_str(), fileName.c_str());
				f = fopen(fileName.c_str(), "rb");
			}

			if (!f)
				throw std::runtime_error((std::string) "can't open config file " + fileName);

			char buffer[4096];
			rapidjson::FileReadStream stream(f, buffer, sizeof(buffer));
			d.ParseStream(stream);

			fclose(f);

			if (d.GetParseError() != rapidjson::kParseErrorNone)
				throw std::runtime_error((std::string) "syntax error in config file " + fileName);
		}
开发者ID:minexew,项目名称:agdg-server,代码行数:20,代码来源:config.cpp

示例3: loadJSON

int SettingRegistry::loadJSON(std::string filename, rapidjson::Document& json_document)
{
    FILE* f = fopen(filename.c_str(), "rb");
    if (!f)
    {
        cura::logError("Couldn't open JSON file.\n");
        return 1;
    }
    char read_buffer[4096];
    rapidjson::FileReadStream reader_stream(f, read_buffer, sizeof(read_buffer));
    json_document.ParseStream(reader_stream);
    fclose(f);
    if (json_document.HasParseError())
    {
        cura::logError("Error parsing JSON(offset %u): %s\n", (unsigned)json_document.GetErrorOffset(), GetParseError_En(json_document.GetParseError()));
        return 2;
    }
    
    return 0;
}
开发者ID:nicanor-romero,项目名称:CuraEngine,代码行数:20,代码来源:settingRegistry.cpp


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