mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-14 08:26:59 +00:00
[C++] Code style modifications
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
native_include "vector3d.h";
|
||||
native_include "vector3d_pack.h";
|
||||
native_include "native_type_test_impl.h";
|
||||
|
||||
namespace Geometry;
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
#include "vector3d.h"
|
||||
#include "vector3d_pack.h"
|
||||
#include "native_type_test_impl.h"
|
||||
|
||||
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
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
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