mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-28 01:08:04 +00:00
[C++] Code style modifications
This commit is contained in:
5
BUILD
5
BUILD
@@ -136,9 +136,8 @@ cc_test(
|
|||||||
"src/util.cpp",
|
"src/util.cpp",
|
||||||
"tests/namespace_test/namespace_test1_generated.h",
|
"tests/namespace_test/namespace_test1_generated.h",
|
||||||
"tests/namespace_test/namespace_test2_generated.h",
|
"tests/namespace_test/namespace_test2_generated.h",
|
||||||
"tests/vector3d.h",
|
"tests/native_type_test_impl.h",
|
||||||
"tests/vector3d_pack.h",
|
"tests/native_type_test_impl.cpp",
|
||||||
"tests/vector3d_pack.cpp",
|
|
||||||
"tests/test.cpp",
|
"tests/test.cpp",
|
||||||
"tests/test_assert.cpp",
|
"tests/test_assert.cpp",
|
||||||
"tests/test_assert.h",
|
"tests/test_assert.h",
|
||||||
|
|||||||
@@ -117,9 +117,8 @@ set(FlatBuffers_Tests_SRCS
|
|||||||
tests/test_assert.cpp
|
tests/test_assert.cpp
|
||||||
tests/test_builder.h
|
tests/test_builder.h
|
||||||
tests/test_builder.cpp
|
tests/test_builder.cpp
|
||||||
tests/vector3d.h
|
tests/native_type_test_impl.h
|
||||||
tests/vector3d_pack.h
|
tests/native_type_test_impl.cpp
|
||||||
tests/vector3d_pack.cpp
|
|
||||||
# file generate by running compiler on tests/monster_test.fbs
|
# file generate by running compiler on tests/monster_test.fbs
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/tests/monster_test_generated.h
|
${CMAKE_CURRENT_BINARY_DIR}/tests/monster_test_generated.h
|
||||||
# file generate by running compiler on tests/arrays_test.fbs
|
# file generate by running compiler on tests/arrays_test.fbs
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
native_include "vector3d.h";
|
native_include "native_type_test_impl.h";
|
||||||
native_include "vector3d_pack.h";
|
|
||||||
|
|
||||||
namespace Geometry;
|
namespace Geometry;
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
#include "flatbuffers/flatbuffers.h"
|
#include "flatbuffers/flatbuffers.h"
|
||||||
|
|
||||||
#include "vector3d.h"
|
#include "native_type_test_impl.h"
|
||||||
#include "vector3d_pack.h"
|
|
||||||
|
|
||||||
namespace Geometry {
|
namespace Geometry {
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "vector3d_pack.h"
|
#include "native_type_test_impl.h"
|
||||||
|
|
||||||
// looks like VS10 does not support std::vector with explicit alignment
|
// looks like VS10 does not support std::vector with explicit alignment
|
||||||
// From stackoverflow (https://stackoverflow.com/questions/8456236/how-is-a-vectors-data-aligned):
|
// From stackoverflow (https://stackoverflow.com/questions/8456236/how-is-a-vectors-data-aligned):
|
||||||
@@ -13,11 +13,11 @@
|
|||||||
#include "native_type_test_generated.h"
|
#include "native_type_test_generated.h"
|
||||||
|
|
||||||
namespace flatbuffers {
|
namespace flatbuffers {
|
||||||
Geometry::Vector3D Pack(const Native::Vector3D& obj) {
|
Geometry::Vector3D Pack(const Native::Vector3D &obj) {
|
||||||
return Geometry::Vector3D(obj.x, obj.y, obj.z);
|
return Geometry::Vector3D(obj.x, obj.y, obj.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Native::Vector3D UnPack(const Geometry::Vector3D& obj) {
|
const Native::Vector3D UnPack(const Geometry::Vector3D &obj) {
|
||||||
return Native::Vector3D(obj.x(), obj.y(), obj.z());
|
return Native::Vector3D(obj.x(), obj.y(), obj.z());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
24
tests/native_type_test_impl.h
Normal file
24
tests/native_type_test_impl.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef NATIVE_TYPE_TEST_IMPL_H
|
||||||
|
#define NATIVE_TYPE_TEST_IMPL_H
|
||||||
|
|
||||||
|
namespace Native {
|
||||||
|
struct Vector3D {
|
||||||
|
double x;
|
||||||
|
double y;
|
||||||
|
double z;
|
||||||
|
|
||||||
|
Vector3D() { x = 0; y = 0; z = 0; };
|
||||||
|
Vector3D(double x, double y, double z) { this->x = x; this->y = y; this->z = z; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Geometry {
|
||||||
|
struct Vector3D;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace flatbuffers {
|
||||||
|
Geometry::Vector3D Pack(const Native::Vector3D &obj);
|
||||||
|
const Native::Vector3D UnPack(const Geometry::Vector3D &obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // VECTOR3D_PACK_H
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#ifndef VECTOR3D_H
|
|
||||||
#define VECTOR3D_H
|
|
||||||
|
|
||||||
namespace Native {
|
|
||||||
struct Vector3D {
|
|
||||||
double x;
|
|
||||||
double y;
|
|
||||||
double z;
|
|
||||||
|
|
||||||
Vector3D() { x = 0; y = 0; z = 0; };
|
|
||||||
Vector3D(double x, double y, double z) { this->x = x; this->y = y; this->z = z; }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // VECTOR3D_H
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#ifndef VECTOR3D_PACK_H
|
|
||||||
#define VECTOR3D_PACK_H
|
|
||||||
|
|
||||||
#include "vector3d.h"
|
|
||||||
|
|
||||||
namespace Geometry {
|
|
||||||
struct Vector3D;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace flatbuffers {
|
|
||||||
Geometry::Vector3D Pack(const Native::Vector3D& obj);
|
|
||||||
const Native::Vector3D UnPack(const Geometry::Vector3D& obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // VECTOR3D_PACK_H
|
|
||||||
Reference in New Issue
Block a user