chore(format): tweak brace and type macro styles

This commit is contained in:
fallenoak 2020-11-14 17:12:00 -06:00
parent b38b98bb7c
commit f631bdac3b
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
4 changed files with 20 additions and 26 deletions

View file

@ -6,19 +6,12 @@ AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: Never AllowShortIfStatementsOnASingleLine: Never
AlwaysBreakTemplateDeclarations: Yes AlwaysBreakTemplateDeclarations: Yes
BraceWrapping: BreakBeforeBraces: Attach
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterStruct: false
AfterUnion: false
BeforeElse: false
BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma BreakConstructorInitializers: BeforeComma
ColumnLimit: 0 ColumnLimit: 0
ContinuationIndentWidth: 4 ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: false DeriveLineEnding: false
DerivePointerAlignment: false DerivePointerAlignment: false
IncludeBlocks: Merge IncludeBlocks: Merge
@ -50,5 +43,6 @@ SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false SpacesInConditionalStatement: false
Standard: c++11 Standard: c++11
TabWidth: 4 TabWidth: 4
TypenameMacros: ['STORM_EXPLICIT_LIST', 'STORM_LIST']
UseCRLF: false UseCRLF: false
UseTab: Never UseTab: Never

View file

@ -3,7 +3,7 @@
#include <cstdint> #include <cstdint>
template<class T> template <class T>
class TSBaseArray { class TSBaseArray {
public: public:
uint32_t m_alloc = 0; uint32_t m_alloc = 0;
@ -15,17 +15,17 @@ class TSBaseArray {
void Clear(void); void Clear(void);
}; };
template<class T> template <class T>
T& TSBaseArray<T>::operator[](uint32_t i) { T& TSBaseArray<T>::operator[](uint32_t i) {
return this->m_data[i]; return this->m_data[i];
} }
template<class T> template <class T>
uint32_t TSBaseArray<T>::Count() { uint32_t TSBaseArray<T>::Count() {
return this->m_count; return this->m_count;
} }
template<class T> template <class T>
void TSBaseArray<T>::Clear() { void TSBaseArray<T>::Clear() {
delete[] this->m_data; delete[] this->m_data;
TSBaseArray<T>(); TSBaseArray<T>();

View file

@ -1,18 +1,18 @@
#ifndef STORM_ARRAY_TS_FIXED_ARRAY_HPP #ifndef STORM_ARRAY_TS_FIXED_ARRAY_HPP
#define STORM_ARRAY_TS_FIXED_ARRAY_HPP #define STORM_ARRAY_TS_FIXED_ARRAY_HPP
#include "storm/array/TSBaseArray.hpp"
#include "storm/Memory.hpp" #include "storm/Memory.hpp"
#include "storm/array/TSBaseArray.hpp"
#include <cstdint> #include <cstdint>
template<class T> template <class T>
class TSFixedArray : public TSBaseArray<T> { class TSFixedArray : public TSBaseArray<T> {
public: public:
void ReallocData(uint32_t count); void ReallocData(uint32_t count);
void SetCount(uint32_t count); void SetCount(uint32_t count);
}; };
template<class T> template <class T>
void TSFixedArray<T>::ReallocData(uint32_t count) { void TSFixedArray<T>::ReallocData(uint32_t count) {
T* oldData = this->m_data; T* oldData = this->m_data;
@ -47,7 +47,7 @@ void TSFixedArray<T>::ReallocData(uint32_t count) {
} }
} }
template<class T> template <class T>
void TSFixedArray<T>::SetCount(uint32_t count) { void TSFixedArray<T>::SetCount(uint32_t count) {
if (count != this->m_count) { if (count != this->m_count) {
if (count) { if (count) {

View file

@ -7,7 +7,7 @@
#include <cstring> #include <cstring>
#include <new> #include <new>
template<class T> template <class T>
class TSGrowableArray : public TSFixedArray<T> { class TSGrowableArray : public TSFixedArray<T> {
public: public:
uint32_t m_chunk = 0; uint32_t m_chunk = 0;
@ -22,7 +22,7 @@ class TSGrowableArray : public TSFixedArray<T> {
void SetCount(uint32_t count); void SetCount(uint32_t count);
}; };
template<class T> template <class T>
uint32_t TSGrowableArray<T>::Add(uint32_t count, const T* data) { uint32_t TSGrowableArray<T>::Add(uint32_t count, const T* data) {
this->Reserve(count, 1); this->Reserve(count, 1);
@ -35,7 +35,7 @@ uint32_t TSGrowableArray<T>::Add(uint32_t count, const T* data) {
return this->m_count - count; return this->m_count - count;
} }
template<class T> template <class T>
uint32_t TSGrowableArray<T>::Add(uint32_t count, uint32_t incr, const T* data) { uint32_t TSGrowableArray<T>::Add(uint32_t count, uint32_t incr, const T* data) {
this->Reserve(count, 1); this->Reserve(count, 1);
@ -51,7 +51,7 @@ uint32_t TSGrowableArray<T>::Add(uint32_t count, uint32_t incr, const T* data) {
return this->m_count - count; return this->m_count - count;
} }
template<class T> template <class T>
uint32_t TSGrowableArray<T>::CalcChunkSize(uint32_t count) { uint32_t TSGrowableArray<T>::CalcChunkSize(uint32_t count) {
uint32_t maxChunk = std::max(static_cast<int32_t>(256 / sizeof(T)), 8); uint32_t maxChunk = std::max(static_cast<int32_t>(256 / sizeof(T)), 8);
@ -73,7 +73,7 @@ uint32_t TSGrowableArray<T>::CalcChunkSize(uint32_t count) {
return result; return result;
} }
template<class T> template <class T>
void TSGrowableArray<T>::GrowToFit(uint32_t index, int32_t zero) { void TSGrowableArray<T>::GrowToFit(uint32_t index, int32_t zero) {
uint32_t count = this->m_count; uint32_t count = this->m_count;
@ -88,14 +88,14 @@ void TSGrowableArray<T>::GrowToFit(uint32_t index, int32_t zero) {
} }
} }
template<class T> template <class T>
T* TSGrowableArray<T>::New() { T* TSGrowableArray<T>::New() {
this->Reserve(1, 1); this->Reserve(1, 1);
void* element = &this->m_data[this->m_count++]; void* element = &this->m_data[this->m_count++];
return new (element) T(); return new (element) T();
} }
template<class T> template <class T>
void TSGrowableArray<T>::Reserve(uint32_t count, int32_t round) { void TSGrowableArray<T>::Reserve(uint32_t count, int32_t round) {
if (count + this->m_count > this->m_alloc) { if (count + this->m_count > this->m_alloc) {
if (round) { if (round) {
@ -112,7 +112,7 @@ void TSGrowableArray<T>::Reserve(uint32_t count, int32_t round) {
} }
} }
template<class T> template <class T>
uint32_t TSGrowableArray<T>::RoundToChunk(uint32_t count, uint32_t chunk) { uint32_t TSGrowableArray<T>::RoundToChunk(uint32_t count, uint32_t chunk) {
if (count % chunk) { if (count % chunk) {
return chunk - count % chunk + count; return chunk - count % chunk + count;
@ -121,7 +121,7 @@ uint32_t TSGrowableArray<T>::RoundToChunk(uint32_t count, uint32_t chunk) {
} }
} }
template<class T> template <class T>
void TSGrowableArray<T>::SetCount(uint32_t count) { void TSGrowableArray<T>::SetCount(uint32_t count) {
if (count > this->m_count) { if (count > this->m_count) {
// Expand size // Expand size