[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

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