mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 21:40:01 +00:00
Fixed VS2010 build
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LocalDebuggerWorkingDirectory>..\..\tests</LocalDebuggerWorkingDirectory>
|
<LocalDebuggerWorkingDirectory>..\..\tests</LocalDebuggerWorkingDirectory>
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
<LocalDebuggerCommandArguments>-j -c -n -g --php --no-includes --gen-mutable monster_test.fbs</LocalDebuggerCommandArguments>
|
<LocalDebuggerCommandArguments>-j -c -n -g --php --no-includes --gen-mutable --gen-object-api monster_test.fbs</LocalDebuggerCommandArguments>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
|
||||||
|
|||||||
@@ -966,7 +966,7 @@ class CppGenerator : public BaseGenerator {
|
|||||||
auto dest = deref + field.name;
|
auto dest = deref + field.name;
|
||||||
auto assign = prefix + dest + " = ";
|
auto assign = prefix + dest + " = ";
|
||||||
auto gen_unpack_val = [&](const Type &type, const std::string &val,
|
auto gen_unpack_val = [&](const Type &type, const std::string &val,
|
||||||
bool invector) {
|
bool invector) -> std::string {
|
||||||
switch (type.base_type) {
|
switch (type.base_type) {
|
||||||
case BASE_TYPE_STRING:
|
case BASE_TYPE_STRING:
|
||||||
return val + "->str()";
|
return val + "->str()";
|
||||||
@@ -987,14 +987,18 @@ class CppGenerator : public BaseGenerator {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
switch (field.value.type.base_type) {
|
switch (field.value.type.base_type) {
|
||||||
case BASE_TYPE_VECTOR:
|
case BASE_TYPE_VECTOR: {
|
||||||
code += prefix;
|
code += prefix;
|
||||||
code += "{ for (size_t _i = 0; _i < _e->size(); _i++) { ";
|
code += "{ for (size_t _i = 0; _i < _e->size(); _i++) { ";
|
||||||
code += dest + ".push_back(";
|
code += dest + ".push_back(";
|
||||||
|
std::string indexing = "_e->Get(_i)";
|
||||||
|
if (field.value.type.element == BASE_TYPE_BOOL)
|
||||||
|
indexing += "!=0";
|
||||||
code += gen_unpack_val(field.value.type.VectorType(),
|
code += gen_unpack_val(field.value.type.VectorType(),
|
||||||
"_e->Get(_i)", true);
|
indexing, true);
|
||||||
code += "); } }";
|
code += "); } }";
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case BASE_TYPE_UTYPE: {
|
case BASE_TYPE_UTYPE: {
|
||||||
auto &union_field = **(it + 1);
|
auto &union_field = **(it + 1);
|
||||||
assert(union_field.value.type.base_type == BASE_TYPE_UNION);
|
assert(union_field.value.type.base_type == BASE_TYPE_UNION);
|
||||||
|
|||||||
@@ -645,7 +645,7 @@ inline std::unique_ptr<MonsterT> Monster::UnPack() const {
|
|||||||
{ auto _e = testhashu32_fnv1a(); _o->testhashu32_fnv1a = _e; };
|
{ auto _e = testhashu32_fnv1a(); _o->testhashu32_fnv1a = _e; };
|
||||||
{ auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; };
|
{ auto _e = testhashs64_fnv1a(); _o->testhashs64_fnv1a = _e; };
|
||||||
{ auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; };
|
{ auto _e = testhashu64_fnv1a(); _o->testhashu64_fnv1a = _e; };
|
||||||
{ auto _e = testarrayofbools(); if (_e) { for (size_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools.push_back(_e->Get(_i)); } } };
|
{ auto _e = testarrayofbools(); if (_e) { for (size_t _i = 0; _i < _e->size(); _i++) { _o->testarrayofbools.push_back(_e->Get(_i)!=0); } } };
|
||||||
{ auto _e = testf(); _o->testf = _e; };
|
{ auto _e = testf(); _o->testf = _e; };
|
||||||
{ auto _e = testf2(); _o->testf2 = _e; };
|
{ auto _e = testf2(); _o->testf2 = _e; };
|
||||||
{ auto _e = testf3(); _o->testf3 = _e; };
|
{ auto _e = testf3(); _o->testf3 = _e; };
|
||||||
|
|||||||
Reference in New Issue
Block a user