Commit 5ea2b49f authored by 吴凡's avatar 吴凡

Fix some error

parent 70deb70b
......@@ -105,14 +105,6 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
"${CMAKE_CXX_FLAGS} -std=c++0x")
endif(CYGWIN)
set(CMAKE_CXX_FLAGS
<<<<<<< HEAD
"${CMAKE_CXX_FLAGS} -std=c++0x -Wall -pedantic -Werror -Wextra -Werror=shadow")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++0x -stdlib=libc++ -Wall -pedantic -Werror -Wextra")
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -lc++abi")
=======
"${CMAKE_CXX_FLAGS} -Wall -pedantic -Werror -Wextra -Werror=shadow")
if (GCC_VERSION VERSION_GREATER 4.4)
set(CMAKE_CXX_FLAGS
......@@ -137,7 +129,6 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -fsigned-char")
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
endif()
if(FLATBUFFERS_CODE_COVERAGE)
......
<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>FlatBuffers: Using the schema compiler</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,400italic,500,500italic,700,700italic|Roboto+Mono:400,700" rel="stylesheet">
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea" style="height: 110px;">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="commonprojectlogo">
<img alt="Logo" src="fpl_logo_small.png"/>
</td>
<td style="padding-left: 0.5em;">
<div id="projectname">FlatBuffers
</div>
<div style="font-size:12px;">
An open source project by <a href="https://developers.google.com/games/#Tools">FPL</a>.
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('md__compiler.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">Using the schema compiler </div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Usage: </p><pre class="fragment">flatc [ GENERATOR OPTIONS ] [ -o PATH ] [ -I PATH ] [ -S ] FILES...
[ -- FILES...]
</pre><p>The files are read and parsed in order, and can contain either schemas or data (see below). Data files are processed according to the definitions of the most recent schema specified.</p>
<p><code>--</code> indicates that the following files are binary files in FlatBuffer format conforming to the schema indicated before it.</p>
<p>Depending on the flags passed, additional files may be generated for each file processed:</p>
<p>For any schema input files, one or more generators can be specified:</p>
<ul>
<li><code>--cpp</code>, <code>-c</code> : Generate a C++ header for all definitions in this file (as <code>filename_generated.h</code>).</li>
<li><code>--java</code>, <code>-j</code> : Generate Java code.</li>
<li><code>--csharp</code>, <code>-n</code> : Generate C# code.</li>
<li><code>--go</code>, <code>-g</code> : Generate Go code.</li>
<li><code>--python</code>, <code>-p</code>: Generate Python code.</li>
<li><code>--javascript</code>, <code>-s</code>: Generate JavaScript code.</li>
<li><code>--php</code>: Generate PHP code.</li>
</ul>
<p>For any data input files:</p>
<ul>
<li><code>--binary</code>, <code>-b</code> : If data is contained in this file, generate a <code>filename.bin</code> containing the binary flatbuffer (or a different extension if one is specified in the schema).</li>
<li><code>--json</code>, <code>-t</code> : If data is contained in this file, generate a <code>filename.json</code> representing the data in the flatbuffer.</li>
</ul>
<p>Additional options:</p>
<ul>
<li><code>-o PATH</code> : Output all generated files to PATH (either absolute, or relative to the current directory). If omitted, PATH will be the current directory. PATH should end in your systems path separator, e.g. <code>/</code> or <code>\</code>.</li>
<li><code>-I PATH</code> : when encountering <code>include</code> statements, attempt to load the files from this path. Paths will be tried in the order given, and if all fail (or none are specified) it will try to load relative to the path of the schema file being parsed.</li>
<li><code>-M</code> : Print make rules for generated files.</li>
<li><code>--strict-json</code> : Require &amp; generate strict JSON (field names are enclosed in quotes, no trailing commas in tables/vectors). By default, no quotes are required/generated, and trailing commas are allowed.</li>
<li><code>--defaults-json</code> : Output fields whose value is equal to the default value when writing JSON text.</li>
<li><code>--no-prefix</code> : Don't prefix enum values in generated C++ by their enum type.</li>
<li><code>--scoped-enums</code> : Use C++11 style scoped and strongly typed enums in generated C++. This also implies <code>--no-prefix</code>.</li>
<li><code>--gen-includes</code> : (deprecated), this is the default behavior. If the original behavior is required (no include statements) use <code>--no-includes.</code></li>
<li><code>--no-includes</code> : Don't generate include statements for included schemas the generated file depends on (C++).</li>
<li><code>--gen-mutable</code> : Generate additional non-const accessors for mutating FlatBuffers in-place.</li>
<li><code>--gen-onefile</code> : Generate single output file (useful for C#)</li>
<li><code>--raw-binary</code> : Allow binaries without a file_indentifier to be read. This may crash flatc given a mismatched schema.</li>
<li><code>--proto</code>: Expect input files to be .proto files (protocol buffers). Output the corresponding .fbs file. Currently supports: <code>package</code>, <code>message</code>, <code>enum</code>, nested declarations, <code>import</code> (use <code>-I</code> for paths), <code>extend</code>, <code>oneof</code>, <code>group</code>. Does not support, but will skip without error: <code>option</code>, <code>service</code>, <code>extensions</code>, and most everything else.</li>
<li><code>--schema</code>: Serialize schemas instead of JSON (use with -b). This will output a binary version of the specified schema that itself corresponds to the reflection/reflection.fbs schema. Loading this binary file is the basis for reflection functionality.</li>
</ul>
<p>NOTE: short-form options for generators are deprecated, use the long form whenever possible. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-49880327-7', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
......@@ -33,11 +33,8 @@ For any schema input files, one or more generators can be specified:
- `--php`: Generate PHP code.
<<<<<<< HEAD
=======
- `--grpc`: Generate RPC stub code for GRPC.
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
For any data input files:
- `--binary`, `-b` : If data is contained in this file, generate a
......
......@@ -550,18 +550,7 @@ private:
IDLOptions opts;
private:
<<<<<<< HEAD
const char *source_, *cursor_;
int line_; // the current line being parsed
int token_;
std::string files_being_parsed_;
bool proto_mode_;
bool strict_json_;
std::string attribute_;
std::vector<std::string> doc_comment_;
=======
const char *source_;
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
std::string file_being_parsed_;
......
......@@ -36,21 +36,6 @@ import java.nio.charset.Charset;
* "Use in Java/C#" in the main FlatBuffers documentation.
*/
public class FlatBufferBuilder {
<<<<<<< HEAD
ByteBuffer bb; // Where we construct the FlatBuffer.
int space; // Remaining space in the ByteBuffer.
static final Charset utf8charset = Charset.forName("UTF-8");
int minalign = 1; // Minimum alignment encountered so far.
int[] vtable = null; // The vtable for the current table.
int vtable_in_use = 0; // The amount of fields we're actually using.
boolean nested = false; // Whether we are currently serializing a table.
boolean finished = false; // Whether the buffer is finished.
int object_start; // Starting offset of the current struct/table.
int[] vtables = new int[16]; // List of offsets of all vtables.
int num_vtables = 0; // Number of entries in `vtables` in use.
int vector_num_elems = 0; // For the current vector being built.
boolean force_defaults = false; // False omits default values from the serialized data
=======
/// @cond FLATBUFFERS_INTERNAL
ByteBuffer bb; // Where we construct the FlatBuffer.
int space; // Remaining space in the ByteBuffer.
......@@ -68,7 +53,6 @@ public class FlatBufferBuilder {
CharsetEncoder encoder = utf8charset.newEncoder();
ByteBuffer dst;
/// @endcond
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
/**
* Start with a buffer of size `initial_size`, then grow as required.
......@@ -440,16 +424,6 @@ public class FlatBufferBuilder {
" finished by FlatBufferBuilder.finish().");
}
/**
* Should not be accessing the final buffer before it is finished.
*/
public void finished() {
if (!finished)
throw new AssertionError(
"FlatBuffers: you can only access the serialized buffer after it has been" +
" finished by FlatBufferBuilder.finish().");
}
/**
* Should not be creating any other object, string or vector
* while an object is being constructed.
......@@ -751,11 +725,6 @@ public class FlatBufferBuilder {
return this;
}
<<<<<<< HEAD
// Get the ByteBuffer representing the FlatBuffer. Only call this after you've
// called finish(). The actual data starts at the ByteBuffer's current position,
// not necessarily at 0.
=======
/**
* Get the ByteBuffer representing the FlatBuffer. Only call this after you've
* called `finish()`. The actual data starts at the ByteBuffer's current position,
......@@ -763,7 +732,6 @@ public class FlatBufferBuilder {
*
* @return The {@link ByteBuffer} representing the FlatBuffer
*/
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
public ByteBuffer dataBuffer() {
finished();
return bb;
......
......@@ -72,12 +72,9 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VT_NAME = 10,
VT_INVENTORY = 14,
VT_COLOR = 16,
<<<<<<< HEAD
=======
VT_WEAPONS = 18,
VT_EQUIPPED_TYPE = 20,
VT_EQUIPPED = 22
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
};
const Vec3 *pos() const { return GetStruct<const Vec3 *>(VT_POS); }
Vec3 *mutable_pos() { return GetStruct<Vec3 *>(VT_POS); }
......@@ -91,15 +88,12 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
flatbuffers::Vector<uint8_t> *mutable_inventory() { return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_INVENTORY); }
Color color() const { return static_cast<Color>(GetField<int8_t>(VT_COLOR, 2)); }
bool mutate_color(Color _color) { return SetField(VT_COLOR, static_cast<int8_t>(_color)); }
<<<<<<< HEAD
=======
const flatbuffers::Vector<flatbuffers::Offset<Weapon>> *weapons() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<Weapon>> *>(VT_WEAPONS); }
flatbuffers::Vector<flatbuffers::Offset<Weapon>> *mutable_weapons() { return GetPointer<flatbuffers::Vector<flatbuffers::Offset<Weapon>> *>(VT_WEAPONS); }
Equipment equipped_type() const { return static_cast<Equipment>(GetField<uint8_t>(VT_EQUIPPED_TYPE, 0)); }
bool mutate_equipped_type(Equipment _equipped_type) { return SetField(VT_EQUIPPED_TYPE, static_cast<uint8_t>(_equipped_type)); }
const void *equipped() const { return GetPointer<const void *>(VT_EQUIPPED); }
void *mutable_equipped() { return GetPointer<void *>(VT_EQUIPPED); }
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<Vec3>(verifier, VT_POS) &&
......@@ -110,15 +104,12 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VerifyField<flatbuffers::uoffset_t>(verifier, VT_INVENTORY) &&
verifier.Verify(inventory()) &&
VerifyField<int8_t>(verifier, VT_COLOR) &&
<<<<<<< HEAD
=======
VerifyField<flatbuffers::uoffset_t>(verifier, VT_WEAPONS) &&
verifier.Verify(weapons()) &&
verifier.VerifyVectorOfTables(weapons()) &&
VerifyField<uint8_t>(verifier, VT_EQUIPPED_TYPE) &&
VerifyField<flatbuffers::uoffset_t>(verifier, VT_EQUIPPED) &&
VerifyEquipment(verifier, equipped(), equipped_type()) &&
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
verifier.EndTable();
}
};
......@@ -132,12 +123,9 @@ struct MonsterBuilder {
void add_name(flatbuffers::Offset<flatbuffers::String> name) { fbb_.AddOffset(Monster::VT_NAME, name); }
void add_inventory(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> inventory) { fbb_.AddOffset(Monster::VT_INVENTORY, inventory); }
void add_color(Color color) { fbb_.AddElement<int8_t>(Monster::VT_COLOR, static_cast<int8_t>(color), 2); }
<<<<<<< HEAD
=======
void add_weapons(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<Weapon>>> weapons) { fbb_.AddOffset(Monster::VT_WEAPONS, weapons); }
void add_equipped_type(Equipment equipped_type) { fbb_.AddElement<uint8_t>(Monster::VT_EQUIPPED_TYPE, static_cast<uint8_t>(equipped_type), 0); }
void add_equipped(flatbuffers::Offset<void> equipped) { fbb_.AddOffset(Monster::VT_EQUIPPED, equipped); }
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
MonsterBuilder &operator=(const MonsterBuilder &);
flatbuffers::Offset<Monster> Finish() {
......
......@@ -29,12 +29,7 @@ static void Error(const std::string &err, bool usage = false,
struct Generator {
bool (*generate)(const flatbuffers::Parser &parser,
const std::string &path,
<<<<<<< HEAD
const std::string &file_name,
const flatbuffers::GeneratorOptions &opts);
=======
const std::string &file_name);
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
const char *generator_opt_short;
const char *generator_opt_long;
const char *lang_name;
......@@ -48,41 +43,6 @@ struct Generator {
const Generator generators[] = {
{ flatbuffers::GenerateBinary, "-b", "--binary", "binary",
<<<<<<< HEAD
flatbuffers::GeneratorOptions::kMAX,
"Generate wire format binaries for any data definitions",
flatbuffers::BinaryMakeRule },
{ flatbuffers::GenerateTextFile, "-t", "--json", "text",
flatbuffers::GeneratorOptions::kMAX,
"Generate text output for any data definitions",
flatbuffers::TextMakeRule },
{ flatbuffers::GenerateCPP, "-c", "--cpp", "C++",
flatbuffers::GeneratorOptions::kMAX,
"Generate C++ headers for tables/structs",
flatbuffers::CPPMakeRule },
{ flatbuffers::GenerateGo, "-g", "--go", "Go",
flatbuffers::GeneratorOptions::kGo,
"Generate Go files for tables/structs",
flatbuffers::GeneralMakeRule },
{ flatbuffers::GenerateGeneral, "-j", "--java", "Java",
flatbuffers::GeneratorOptions::kJava,
"Generate Java classes for tables/structs",
flatbuffers::GeneralMakeRule },
{ flatbuffers::GenerateJS, "-s", "--js", "JavaScript",
flatbuffers::GeneratorOptions::kMAX,
"Generate JavaScript code for tables/structs",
flatbuffers::JSMakeRule },
{ flatbuffers::GenerateGeneral, "-n", "--csharp", "C#",
flatbuffers::GeneratorOptions::kCSharp,
"Generate C# classes for tables/structs",
flatbuffers::GeneralMakeRule },
{ flatbuffers::GeneratePython, "-p", "--python", "Python",
flatbuffers::GeneratorOptions::kMAX,
"Generate Python files for tables/structs",
flatbuffers::GeneralMakeRule },
{ flatbuffers::GeneratePhp, nullptr, "--php", "PHP",
flatbuffers::GeneratorOptions::kMAX,
=======
flatbuffers::IDLOptions::kMAX,
"Generate wire format binaries for any data definitions",
flatbuffers::BinaryMakeRule },
......@@ -116,7 +76,6 @@ const Generator generators[] = {
flatbuffers::GeneralMakeRule },
{ flatbuffers::GeneratePhp, nullptr, "--php", "PHP",
flatbuffers::IDLOptions::kMAX,
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
"Generate PHP files for tables/structs",
flatbuffers::GeneralMakeRule },
{ flatbuffers::GenerateGRPC, nullptr, "--grpc", "GRPC",
......@@ -270,11 +229,7 @@ int main(int argc, const char *argv[]) {
}
// Now process the files:
<<<<<<< HEAD
parser = new flatbuffers::Parser(opts.strict_json, proto_mode);
=======
parser = new flatbuffers::Parser(opts);
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
for (auto file_it = filenames.begin();
file_it != filenames.end();
++file_it) {
......@@ -310,23 +265,16 @@ int main(int argc, const char *argv[]) {
}
}
} else {
<<<<<<< HEAD
=======
// Check if file contains 0 bytes.
if (contents.length() != strlen(contents.c_str())) {
Error("input file appears to be binary: " + *file_it, true);
}
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
if (flatbuffers::GetExtension(*file_it) == "fbs") {
// If we're processing multiple schemas, make sure to start each
// one from scratch. If it depends on previous schemas it must do
// so explicitly using an include.
delete parser;
<<<<<<< HEAD
parser = new flatbuffers::Parser(opts.strict_json, proto_mode);
=======
parser = new flatbuffers::Parser(opts);
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
}
auto local_include_directory = flatbuffers::StripFileName(*file_it);
include_directories.push_back(local_include_directory.c_str());
......@@ -350,11 +298,7 @@ int main(int argc, const char *argv[]) {
if (generator_enabled[i]) {
if (!print_make_rules) {
flatbuffers::EnsureDirExists(output_path);
<<<<<<< HEAD
if (!generators[i].generate(*parser, output_path, filebase, opts)) {
=======
if (!generators[i].generate(*parser, output_path, filebase)) {
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
Error(std::string("Unable to generate ") +
generators[i].lang_name +
" for " +
......@@ -362,11 +306,7 @@ int main(int argc, const char *argv[]) {
}
} else {
std::string make_rule = generators[i].make_rule(
<<<<<<< HEAD
*parser, output_path, *file_it, opts);
=======
*parser, output_path, *file_it);
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
if (!make_rule.empty())
printf("%s\n", flatbuffers::WordWrap(
make_rule, 80, " ", " \\").c_str());
......@@ -374,15 +314,11 @@ int main(int argc, const char *argv[]) {
}
}
<<<<<<< HEAD
if (proto_mode) GenerateFBS(*parser, output_path, filebase, opts);
=======
if (opts.proto_mode) GenerateFBS(*parser, output_path, filebase);
// We do not want to generate code for the definitions in this file
// in any files coming up next.
parser->MarkGenerated();
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
}
delete parser;
......
This diff is collapsed.
......@@ -112,7 +112,7 @@ class FlatBufPrinter : public grpc_cpp_generator::Printer {
// Current indentation.
str_->insert(str_->end(), indent_ * 2, ' ');
// See if this contains more than one line.
auto lf = strchr(s, '\n');
const char * lf = strchr(s, '\n');
if (lf) {
(*str_) += std::string(s, lf + 1);
s = lf + 1;
......
......@@ -1167,11 +1167,7 @@ CheckedError Parser::ParseEnum(bool is_union, EnumDef **dest) {
EXPECT(kTokenIdentifier);
auto &enum_def = *new EnumDef();
enum_def.name = enum_name;
<<<<<<< HEAD
enum_def.file = files_being_parsed_;
=======
enum_def.file = file_being_parsed_;
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
enum_def.doc_comment = enum_comment;
enum_def.is_union = is_union;
enum_def.defined_namespace = namespaces_.back();
......@@ -1268,11 +1264,7 @@ CheckedError Parser::StartStruct(const std::string &name, StructDef **dest) {
if (!struct_def.predecl) return Error("datatype already exists: " + name);
struct_def.predecl = false;
struct_def.name = name;
<<<<<<< HEAD
struct_def.file = files_being_parsed_;
=======
struct_def.file = file_being_parsed_;
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
// Move this struct to the back of the vector just in case it was predeclared,
// to preserve declaration order.
*remove(structs_.vec.begin(), structs_.vec.end(), &struct_def) = &struct_def;
......@@ -1787,16 +1779,12 @@ CheckedError Parser::SkipJsonString() {
bool Parser::Parse(const char *source, const char **include_paths,
const char *source_filename) {
<<<<<<< HEAD
files_being_parsed_ = source_filename ? source_filename : "";
=======
return !DoParse(source, include_paths, source_filename).Check();
}
CheckedError Parser::DoParse(const char *source, const char **include_paths,
const char *source_filename) {
file_being_parsed_ = source_filename ? source_filename : "";
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
if (source_filename &&
included_files_.find(source_filename) == included_files_.end()) {
included_files_[source_filename] = true;
......@@ -1937,23 +1925,8 @@ CheckedError Parser::DoParse(const char *source, const char **include_paths,
return Error("only tables can be union elements: " + val.name);
}
}
<<<<<<< HEAD
} catch (const std::string &msg) {
error_ = source_filename ? AbsolutePath(source_filename) : "";
#ifdef _WIN32
error_ += "(" + NumToString(line_) + ")"; // MSVC alike
#else
if (source_filename) error_ += ":";
error_ += NumToString(line_) + ":0"; // gcc alike
#endif
error_ += ": error: " + msg;
return false;
}
return true;
=======
}
return NoError();
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
}
std::set<std::string> Parser::GetIncludedFilesRecursive(
......
<<<<<<< HEAD
../flatc --cpp --java --csharp --go --binary --python --js --php --gen-mutable --no-includes monster_test.fbs monsterdata_test.json
../flatc --binary --schema monster_test.fbs
=======
#!/bin/bash
#
# Copyright 2015 Google Inc. All rights reserved.
......@@ -22,4 +18,3 @@
../flatc --cpp --java --csharp --go --binary --python --js --php --gen-mutable -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs
../flatc --binary --schema monster_test.fbs
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
No preview for this file type
......@@ -138,11 +138,7 @@ namespace Example {
struct TestSimpleTableWithEnum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
enum {
<<<<<<< HEAD
VT_COLOR = 4,
=======
VT_COLOR = 4
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
};
Color color() const { return static_cast<Color>(GetField<int8_t>(VT_COLOR, 2)); }
bool mutate_color(Color _color) { return SetField(VT_COLOR, static_cast<int8_t>(_color)); }
......@@ -176,11 +172,7 @@ struct Stat FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
enum {
VT_ID = 4,
VT_VAL = 6,
<<<<<<< HEAD
VT_COUNT = 8,
=======
VT_COUNT = 8
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
};
const flatbuffers::String *id() const { return GetPointer<const flatbuffers::String *>(VT_ID); }
flatbuffers::String *mutable_id() { return GetPointer<flatbuffers::String *>(VT_ID); }
......@@ -250,13 +242,10 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
VT_TESTHASHS64_FNV1A = 48,
VT_TESTHASHU64_FNV1A = 50,
VT_TESTARRAYOFBOOLS = 52,
<<<<<<< HEAD
=======
VT_TESTF = 54,
VT_TESTF2 = 56,
VT_TESTF3 = 58,
VT_TESTARRAYOFSTRING2 = 60
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
};
const Vec3 *pos() const { return GetStruct<const Vec3 *>(VT_POS); }
Vec3 *mutable_pos() { return GetStruct<Vec3 *>(VT_POS); }
......@@ -291,11 +280,7 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const MyGame::Example::Monster *testnestedflatbuffer_nested_root() const { return flatbuffers::GetRoot<MyGame::Example::Monster>(testnestedflatbuffer()->Data()); }
const Stat *testempty() const { return GetPointer<const Stat *>(VT_TESTEMPTY); }
Stat *mutable_testempty() { return GetPointer<Stat *>(VT_TESTEMPTY); }
<<<<<<< HEAD
bool testbool() const { return static_cast<bool>(GetField<uint8_t>(VT_TESTBOOL, 0)); }
=======
bool testbool() const { return GetField<uint8_t>(VT_TESTBOOL, 0) != 0; }
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
bool mutate_testbool(bool _testbool) { return SetField(VT_TESTBOOL, static_cast<uint8_t>(_testbool)); }
int32_t testhashs32_fnv1() const { return GetField<int32_t>(VT_TESTHASHS32_FNV1, 0); }
bool mutate_testhashs32_fnv1(int32_t _testhashs32_fnv1) { return SetField(VT_TESTHASHS32_FNV1, _testhashs32_fnv1); }
......@@ -315,8 +300,6 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool mutate_testhashu64_fnv1a(uint64_t _testhashu64_fnv1a) { return SetField(VT_TESTHASHU64_FNV1A, _testhashu64_fnv1a); }
const flatbuffers::Vector<uint8_t> *testarrayofbools() const { return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS); }
flatbuffers::Vector<uint8_t> *mutable_testarrayofbools() { return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_TESTARRAYOFBOOLS); }
<<<<<<< HEAD
=======
float testf() const { return GetField<float>(VT_TESTF, 3.14159f); }
bool mutate_testf(float _testf) { return SetField(VT_TESTF, _testf); }
float testf2() const { return GetField<float>(VT_TESTF2, 3.0f); }
......@@ -325,7 +308,6 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
bool mutate_testf3(float _testf3) { return SetField(VT_TESTF3, _testf3); }
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *testarrayofstring2() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2); }
flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *mutable_testarrayofstring2() { return GetPointer<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_TESTARRAYOFSTRING2); }
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<Vec3>(verifier, VT_POS) &&
......@@ -401,12 +383,6 @@ struct MonsterBuilder {
void add_testhashs64_fnv1a(int64_t testhashs64_fnv1a) { fbb_.AddElement<int64_t>(Monster::VT_TESTHASHS64_FNV1A, testhashs64_fnv1a, 0); }
void add_testhashu64_fnv1a(uint64_t testhashu64_fnv1a) { fbb_.AddElement<uint64_t>(Monster::VT_TESTHASHU64_FNV1A, testhashu64_fnv1a, 0); }
void add_testarrayofbools(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> testarrayofbools) { fbb_.AddOffset(Monster::VT_TESTARRAYOFBOOLS, testarrayofbools); }
<<<<<<< HEAD
MonsterBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); }
MonsterBuilder &operator=(const MonsterBuilder &);
flatbuffers::Offset<Monster> Finish() {
auto o = flatbuffers::Offset<Monster>(fbb_.EndTable(start_, 25));
=======
void add_testf(float testf) { fbb_.AddElement<float>(Monster::VT_TESTF, testf, 3.14159f); }
void add_testf2(float testf2) { fbb_.AddElement<float>(Monster::VT_TESTF2, testf2, 3.0f); }
void add_testf3(float testf3) { fbb_.AddElement<float>(Monster::VT_TESTF3, testf3, 0.0f); }
......@@ -415,7 +391,6 @@ struct MonsterBuilder {
MonsterBuilder &operator=(const MonsterBuilder &);
flatbuffers::Offset<Monster> Finish() {
auto o = flatbuffers::Offset<Monster>(fbb_.EndTable(start_, 29));
>>>>>>> 48f37f9e0a04f2b60046dda7fef20a8b0ebc1a70
fbb_.Required(o, Monster::VT_NAME); // name
return o;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment