コード例 #1
0
ファイル: fbs_json.cpp プロジェクト: dyu/fbs-nginx-module
char *
fbs_schema_parse(ngx_pool_t *pool, ngx_str_t schema)
{
    u_char last_char;
    u_char* last;
    
    last = schema.data + schema.len;
    last_char = *last;
    *last = '\0';
    
    // clear structs
    parser.structs_.vec.clear();
    parser.structs_.dict.clear();
    // clear enums
    parser.enums_.vec.clear();
    parser.enums_.dict.clear();
    
    if (!parser.Parse((char*)schema.data, "schema/"))
    {
        *last = last_char;
        //ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, jsongen.c_str());
        return (char*)parser.error_.c_str();
    }
    
    *last = last_char;
    
    return NGX_CONF_OK;
}
コード例 #2
0
ファイル: flatc.cpp プロジェクト: EFLql/flatbuffers
static void ParseFile(flatbuffers::Parser &parser, const std::string &filename,
                      const std::string &contents,
                      std::vector<const char *> &include_directories) {
  auto local_include_directory = flatbuffers::StripFileName(filename);
  include_directories.push_back(local_include_directory.c_str());
  include_directories.push_back(nullptr);
  if (!parser.Parse(contents.c_str(), &include_directories[0],
                     filename.c_str()))
    Error(parser.error_, false, false);
  include_directories.pop_back();
  include_directories.pop_back();
}