[C++] Code style modifications

This commit is contained in:
Alexey Geraskin
2019-07-19 13:41:41 +03:00
parent 16c45e28b4
commit b8281b2dd0
8 changed files with 33 additions and 43 deletions

5
BUILD
View File

@@ -136,9 +136,8 @@ cc_test(
"src/util.cpp",
"tests/namespace_test/namespace_test1_generated.h",
"tests/namespace_test/namespace_test2_generated.h",
"tests/vector3d.h",
"tests/vector3d_pack.h",
"tests/vector3d_pack.cpp",
"tests/native_type_test_impl.h",
"tests/native_type_test_impl.cpp",
"tests/test.cpp",
"tests/test_assert.cpp",
"tests/test_assert.h",

View File

@@ -117,9 +117,8 @@ set(FlatBuffers_Tests_SRCS
tests/test_assert.cpp
tests/test_builder.h
tests/test_builder.cpp
tests/vector3d.h
tests/vector3d_pack.h
tests/vector3d_pack.cpp
tests/native_type_test_impl.h
tests/native_type_test_impl.cpp
# file generate by running compiler on tests/monster_test.fbs
${CMAKE_CURRENT_BINARY_DIR}/tests/monster_test_generated.h
# file generate by running compiler on tests/arrays_test.fbs

View File

@@ -1,5 +1,4 @@
native_include "vector3d.h";
native_include "vector3d_pack.h";
native_include "native_type_test_impl.h";
namespace Geometry;

View File

@@ -6,8 +6,7 @@
#include "flatbuffers/flatbuffers.h"
#include "vector3d.h"
#include "vector3d_pack.h"
#include "native_type_test_impl.h"
namespace Geometry {

View File

@@ -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
// From stackoverflow (https://stackoverflow.com/questions/8456236/how-is-a-vectors-data-aligned):
@@ -13,11 +13,11 @@
#include "native_type_test_generated.h"
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);
}
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());
}
}

View 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

View File

@@ -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

View File

@@ -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