Codestyle.

This commit is contained in:
Relintai 2023-10-23 19:24:53 +02:00
parent 0a7e5d0f4a
commit 990db21277
45 changed files with 115 additions and 238 deletions

View File

@ -30,13 +30,11 @@
#include "array.h"
#include "pandemonium_global.h"
#include "variant.h"
#include "ustring.h"
#include "variant.h"
#include <cstdlib>
class Object;
Array::Array() {
@ -223,5 +221,3 @@ void Array::shuffle() {
Array::~Array() {
Pandemonium::api->pandemonium_array_destroy(&_pandemonium_array);
}

View File

@ -1,3 +1,8 @@
#ifndef ARRAY_H
#define ARRAY_H
#include <gdn/array.h>
/*************************************************************************/
/* array.h */
/*************************************************************************/
@ -28,13 +33,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef ARRAY_H
#define ARRAY_H
#include <gdn/array.h>
class String;
namespace helpers {
@ -186,6 +184,4 @@ public:
~Array();
};
#endif // ARRAY_H

View File

@ -1,3 +1,6 @@
#ifndef BASIS_H
#define BASIS_H
/*************************************************************************/
/* basis.h */
/*************************************************************************/
@ -28,17 +31,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef BASIS_H
#define BASIS_H
#include <gdn/basis.h>
#include "defs.h"
#include "vector3.h"
class Quaternion;
class Basis {
@ -453,6 +451,4 @@ public:
operator Quaternion() const;
};
#endif // BASIS_H

View File

@ -1,3 +1,6 @@
#ifndef COLOR_H
#define COLOR_H
/*************************************************************************/
/* color.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef COLOR_H
#define COLOR_H
#include <gdn/color.h>
#include <cmath>
@ -38,8 +38,6 @@
#include "defs.h"
#include "ustring.h"
struct Color {
private:
// static float _parse_col(const String& p_str, int p_ofs);
@ -166,6 +164,4 @@ public:
}
};
#endif // COLOR_H

View File

@ -1,3 +1,6 @@
#ifndef CORETYPES_H
#define CORETYPES_H
/*************************************************************************/
/* core_types.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef CORETYPES_H
#define CORETYPES_H
#include "defs.h"
#include "aabb.h"
@ -41,15 +41,15 @@
#include "node_path.h"
#include "plane.h"
#include "pool_arrays.h"
#include "projection.h"
#include "quaternion.h"
#include "rid.h"
#include "rect2.h"
#include "rect2i.h"
#include "ustring.h"
#include "rid.h"
#include "string_name.h"
#include "transform.h"
#include "transform_2d.h"
#include "projection.h"
#include "ustring.h"
#include "variant.h"
#include "vector2.h"
#include "vector2i.h"

View File

@ -33,8 +33,6 @@
#include "pandemonium_global.h"
#include "variant.h"
Dictionary::Dictionary() {
Pandemonium::api->pandemonium_dictionary_new(&_pandemonium_dictionary);
}
@ -106,5 +104,3 @@ Array Dictionary::values() const {
Dictionary::~Dictionary() {
Pandemonium::api->pandemonium_dictionary_destroy(&_pandemonium_dictionary);
}

View File

@ -1,3 +1,6 @@
#ifndef DICTIONARY_H
#define DICTIONARY_H
/*************************************************************************/
/* dictionary.h */
/*************************************************************************/
@ -28,16 +31,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef DICTIONARY_H
#define DICTIONARY_H
#include "array.h"
#include "variant.h"
#include <gdn/dictionary.h>
class Variant;
class Dictionary {
@ -85,6 +83,4 @@ public:
~Dictionary();
};
#endif // DICTIONARY_H

View File

@ -1,3 +1,6 @@
#ifndef PANDEMONIUM_MATH_H
#define PANDEMONIUM_MATH_H
/*************************************************************************/
/* Math.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PANDEMONIUM_MATH_H
#define PANDEMONIUM_MATH_H
#include "defs.h"
#include <float.h>

View File

@ -1,3 +1,6 @@
#ifndef PANDEMONIUM_H
#define PANDEMONIUM_H
/*************************************************************************/
/* Pandemonium.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PANDEMONIUM_H
#define PANDEMONIUM_H
#include <cstdlib>
#include <cstring>

View File

@ -30,8 +30,8 @@
#include "pandemonium_global.h"
#include "ustring.h"
#include "array.h"
#include "ustring.h"
#include "wrapped.h"
@ -51,8 +51,6 @@ static GDCALLINGCONV void wrapper_destroy(void *data, void *wrapper) {
Pandemonium::api->pandemonium_free(wrapper);
}
void *_RegisterState::nativescript_handle;
int _RegisterState::language_index;
@ -203,5 +201,3 @@ void Pandemonium::nativescript_init(void *handle) {
void Pandemonium::nativescript_terminate(void *handle) {
Pandemonium::nativescript_api->pandemonium_nativescript_unregister_instance_binding_data_functions(_RegisterState::language_index);
}

View File

@ -1,3 +1,6 @@
#ifndef PANDEMONIUM_GLOBAL_H
#define PANDEMONIUM_GLOBAL_H
/*************************************************************************/
/* pandemonium_global.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PANDEMONIUM_GLOBAL_H
#define PANDEMONIUM_GLOBAL_H
#include <gdnative_api_struct.gen.h>
#include "array.h"

View File

@ -5,8 +5,6 @@
#include <cstdio>
FunctionProfiling::FunctionProfiling(const char *p_function, const int p_line) {
snprintf(signature, 1024, "::%d::%s", p_line, p_function);
ticks = OS::get_singleton()->get_ticks_usec();
@ -18,4 +16,3 @@ FunctionProfiling::~FunctionProfiling() {
Pandemonium::gdnative_profiling_add_data(signature, t);
}
}

View File

@ -1,3 +1,6 @@
#ifndef PANDEMONIUM_PROFILING_H
#define PANDEMONIUM_PROFILING_H
/*************************************************************************/
/* pandemonium_profiling.h */
/*************************************************************************/
@ -28,13 +31,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PANDEMONIUM_PROFILING_H
#define PANDEMONIUM_PROFILING_H
#include "defs.h"
class FunctionProfiling {
char signature[1024];
uint64_t ticks;
@ -44,8 +42,6 @@ public:
~FunctionProfiling();
};
#ifdef DEBUG_ENABLED
#define PANDEMONIUM_PROFILING_FUNCTION FunctionProfiling __function_profiling(__FUNCTION__, __LINE__);
#else

View File

@ -34,8 +34,6 @@
#include <cmath>
void Plane::set_normal(const Vector3 &p_normal) {
this->normal = p_normal;
}
@ -200,5 +198,3 @@ bool Plane::operator==(const Plane &p_plane) const {
bool Plane::operator!=(const Plane &p_plane) const {
return normal != p_plane.normal || d != p_plane.d;
}

View File

@ -1,3 +1,6 @@
#ifndef PLANE_H
#define PLANE_H
/*************************************************************************/
/* Plane.h */
/*************************************************************************/
@ -28,15 +31,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PLANE_H
#define PLANE_H
#include "vector3.h"
#include <cmath>
enum ClockDirection {
CLOCKWISE,
@ -93,6 +91,4 @@ public:
Plane(const Vector3 &p_point1, const Vector3 &p_point2, const Vector3 &p_point3, ClockDirection p_dir = CLOCKWISE);
};
#endif // PLANE_H

View File

@ -39,8 +39,6 @@
#include <gdn/pool_arrays.h>
PoolByteArray::PoolByteArray() {
Pandemonium::api->pandemonium_pool_byte_array_new(&_pandemonium_array);
}
@ -644,5 +642,3 @@ int PoolColorArray::size() const {
PoolColorArray::~PoolColorArray() {
Pandemonium::api->pandemonium_pool_color_array_destroy(&_pandemonium_array);
}

View File

@ -1,3 +1,6 @@
#ifndef POOLARRAYS_H
#define POOLARRAYS_H
/*************************************************************************/
/* PoolArrays.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef POOLARRAYS_H
#define POOLARRAYS_H
#include "defs.h"
#include "color.h"
@ -42,8 +42,6 @@
#include <gdn/pool_arrays.h>
class Array;
class PoolByteArray {
@ -864,6 +862,4 @@ public:
~PoolColorArray();
};
#endif // POOLARRAYS_H

View File

@ -1,3 +1,6 @@
#ifndef PROJECTION_H
#define PROJECTION_H
/*************************************************************************/
/* Projection.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef CAMERA_MATRIX_H
#define CAMERA_MATRIX_H
#include "defs.h"
#include "math_funcs.h"
#include "plane.h"

View File

@ -35,8 +35,6 @@
#include <cmath>
const Quaternion Quaternion::IDENTITY = Quaternion();
// set_euler_xyz expects a vector containing the Euler angles in the format
@ -348,5 +346,3 @@ bool Quaternion::operator==(const Quaternion &p_quaternion) const {
bool Quaternion::operator!=(const Quaternion &p_quaternion) const {
return x != p_quaternion.x || y != p_quaternion.y || z != p_quaternion.z || w != p_quaternion.w;
}

View File

@ -1,3 +1,6 @@
#ifndef QUATERNION_H
#define QUATERNION_H
/*************************************************************************/
/* Quaternion.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef QUATERNION_H
#define QUATERNION_H
#include <cmath>
#include "vector3.h"

View File

@ -29,14 +29,12 @@
/*************************************************************************/
#include "rect2.h"
#include "ustring.h"
#include "transform_2d.h"
#include "ustring.h"
#include "vector2.h"
#include <cmath>
#ifndef MAX
#define MAX(a, b) (a > b ? a : b)
#endif
@ -319,5 +317,3 @@ next4:
return true;
}

View File

@ -1,3 +1,6 @@
#ifndef RECT2_H
#define RECT2_H
/*************************************************************************/
/* Rect2.h */
/*************************************************************************/
@ -28,17 +31,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef RECT2_H
#define RECT2_H
#include "vector2.h"
#include <cmath>
#include <cstdlib>
class String;
typedef Vector2 Size2;
@ -155,6 +153,4 @@ struct Rect2 {
}
};
#endif // RECT2_H

View File

@ -32,10 +32,6 @@
#include "ustring.h"
#include "vector2i.h"
Rect2i::operator String() const {
return String(position) + ", " + String(size);
}

View File

@ -1,3 +1,6 @@
#ifndef REF_H
#define REF_H
/*************************************************************************/
/* Ref.h */
/*************************************************************************/
@ -28,15 +31,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef REF_H
#define REF_H
#include "pandemonium_global.h"
#include "reference.h"
#include "variant.h"
// Replicates Pandemonium's Ref<T> behavior
// Rewritten from f5234e70be7dec4930c2d5a0e829ff480d044b1d.
template <class T>
@ -211,6 +209,4 @@ public:
}
};
#endif

View File

@ -34,8 +34,6 @@
#include "pandemonium_global.h"
RID::RID() {
Pandemonium::api->pandemonium_rid_new(&_pandemonium_rid);
}
@ -75,5 +73,3 @@ bool RID::operator<=(const RID &p_other) const {
bool RID::operator>=(const RID &p_other) const {
return !(*this < p_other);
}

View File

@ -1,3 +1,6 @@
#ifndef STRING_NAME_H
#define STRING_NAME_H
/*************************************************************************/
/* string.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef STRING_NAME_H
#define STRING_NAME_H
#include <gdn/string_name.h>
class String;

View File

@ -1,3 +1,6 @@
#ifndef TAGDB_H
#define TAGDB_H
/*************************************************************************/
/* TagDB.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef TAGDB_H
#define TAGDB_H
#include <stddef.h>
namespace _TagDB {

View File

@ -37,8 +37,6 @@
#include "quaternion.h"
const Transform Transform::IDENTITY = Transform();
const Transform Transform::FLIP_X = Transform(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0);
const Transform Transform::FLIP_Y = Transform(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0);
@ -301,5 +299,3 @@ Transform::Transform(const Basis &p_basis, const Vector3 &p_origin) {
basis = p_basis;
origin = p_origin;
}

View File

@ -1,3 +1,6 @@
#ifndef TRANSFORM_H
#define TRANSFORM_H
/*************************************************************************/
/* Transform.h */
/*************************************************************************/
@ -28,16 +31,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef TRANSFORM_H
#define TRANSFORM_H
#include "basis.h"
#include "aabb.h"
#include "plane.h"
class Transform {
public:
static const Transform IDENTITY;
@ -116,6 +114,4 @@ public:
inline Transform() {}
};
#endif // TRANSFORM_H

View File

@ -1,3 +1,6 @@
#ifndef TRANSFORM2D_H
#define TRANSFORM2D_H
/*************************************************************************/
/* Transform2D.h */
/*************************************************************************/
@ -28,13 +31,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef TRANSFORM2D_H
#define TRANSFORM2D_H
#include "vector2.h"
typedef Vector2 Size2;
struct Rect2;
@ -131,6 +129,4 @@ struct Transform2D {
}
};
#endif // TRANSFORM2D_H

View File

@ -1,3 +1,6 @@
#ifndef STRING_H
#define STRING_H
/*************************************************************************/
/* String.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef STRING_H
#define STRING_H
#include <gdn/string.h>
class NodePath;

View File

@ -1,3 +1,6 @@
#ifndef VARIANT_H
#define VARIANT_H
/*************************************************************************/
/* Variant.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VARIANT_H
#define VARIANT_H
#include <gdn/variant.h>
#include "defs.h"

View File

@ -34,8 +34,6 @@
#include "ustring.h"
const Vector2 Vector2::ZERO = Vector2();
const Vector2 Vector2::ONE = Vector2(1, 1);
const Vector2 Vector2::INF = Vector2(INFINITY, INFINITY);
@ -96,5 +94,3 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
Vector2::operator String() const {
return String::num(x) + ", " + String::num(y);
}

View File

@ -1,3 +1,6 @@
#ifndef VECTOR2_H
#define VECTOR2_H
/*************************************************************************/
/* Vector2.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR2_H
#define VECTOR2_H
#include <gdn/vector2.h>
#include "defs.h"

View File

@ -34,10 +34,6 @@
#include "ustring.h"
Vector2i::operator String() const {
return String::num(x) + ", " + String::num(y);
}

View File

@ -1,3 +1,6 @@
#ifndef VECTOR2I_H
#define VECTOR2I_H
/*************************************************************************/
/* vector2.h */
/*************************************************************************/
@ -28,17 +31,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR2I_H
#define VECTOR2I_H
#include <gdn/vector2i.h>
#include "defs.h"
#include <math_funcs.h>
class String;
struct Vector2i {
@ -64,6 +62,4 @@ struct Vector2i {
operator String() const;
};
#endif // VECTOR2_H

View File

@ -36,8 +36,6 @@
#include "basis.h"
const Vector3 Vector3::ZERO = Vector3();
const Vector3 Vector3::ONE = Vector3(1, 1, 1);
const Vector3 Vector3::INF = Vector3(INFINITY, INFINITY, INFINITY);
@ -117,5 +115,3 @@ void Vector3::snap(real_t p_val) {
Vector3::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z);
}

View File

@ -1,3 +1,6 @@
#ifndef VECTOR3_H
#define VECTOR3_H
/*************************************************************************/
/* vector3.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR3_H
#define VECTOR3_H
#include <gdn/vector3.h>
#include "defs.h"

View File

@ -34,10 +34,6 @@
#include "ustring.h"
Vector3i::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z);
}

View File

@ -1,3 +1,6 @@
#ifndef VECTOR3I_H
#define VECTOR3I_H
/*************************************************************************/
/* vector2.h */
/*************************************************************************/
@ -28,17 +31,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR3I_H
#define VECTOR3I_H
#include <gdn/vector3i.h>
#include "defs.h"
#include <math_funcs.h>
class String;
struct Vector3i {
@ -67,6 +65,4 @@ struct Vector3i {
operator String() const;
};
#endif // VECTOR2_H

View File

@ -34,10 +34,6 @@
#include "ustring.h"
Vector4::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
}

View File

@ -1,3 +1,6 @@
#ifndef VECTOR4_H
#define VECTOR4_H
/*************************************************************************/
/* vector2.h */
/*************************************************************************/
@ -28,17 +31,12 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR4_H
#define VECTOR4_H
#include <gdn/vector4.h>
#include "defs.h"
#include <math_funcs.h>
class String;
struct Vector4 {
@ -70,6 +68,4 @@ struct Vector4 {
operator String() const;
};
#endif // VECTOR2_H

View File

@ -34,10 +34,6 @@
#include "ustring.h"
Vector4i::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
}

View File

@ -1,3 +1,6 @@
#ifndef VECTOR4I_H
#define VECTOR4I_H
/*************************************************************************/
/* vector2.h */
/*************************************************************************/
@ -28,9 +31,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VECTOR4I_H
#define VECTOR4I_H
#include <gdn/vector4i.h>
#include "defs.h"