Skip to content

Commit

Permalink
Add and apply new clang-format config
Browse files Browse the repository at this point in the history
  • Loading branch information
Zer0-One committed Mar 13, 2024
1 parent d82007b commit 918ec6c
Show file tree
Hide file tree
Showing 13 changed files with 900 additions and 690 deletions.
160 changes: 125 additions & 35 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,71 +1,161 @@
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
#AlignArrayOfStructures: Right
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignEscapedNewlinesLeft: false
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: DontAlign
AlignOperands: DontAlign
AlignTrailingComments: false
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both
BreakBeforeBinaryOperators: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: AfterColon
#BreakInheritanceList: AfterComma
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 150
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DerivePointerBinding: false
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
IndentCaseBlocks: true
IndentCaseLabels: true
IndentGotoLabels: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
StatementAttributeLikeMacros:
- Q_EMIT
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: ".*"
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
IndentCaseLabels: True
IndentCaseBlocks: False
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
MaxEmptyLinesToKeep: 2
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
#ReferenceAlignment: Pointer
#SortIncludes: CaseInsensitive
QualifierAlignment: Left
ReflowComments: true
SortIncludes: true
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeParens: Never
SpaceBeforeRangeBasedForLoopColon: false
SpaceBeforeSquareBrackets: false
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
#SpacesInAngles: Never
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
...
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
24 changes: 11 additions & 13 deletions include/tmj.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef struct Property {
char* propertytype;
char* type;

union{
union {
char* value_string;
int value_int;
double value_float;
Expand All @@ -49,7 +49,7 @@ typedef struct Chunk {
bool data_is_str;
size_t data_count;

union{
union {
char* data_str;
unsigned int* data_uint;
};
Expand All @@ -58,15 +58,15 @@ typedef struct Chunk {
/**
* https://doc.mapeditor.org/en/stable/reference/json-map-format/#point
*/
typedef struct Point{
typedef struct Point {
double x;
double y;
} Point;

/**
* https://doc.mapeditor.org/en/stable/reference/json-map-format/#text
*/
typedef struct Text{
typedef struct Text {
bool bold;
bool italic;
bool kerning;
Expand Down Expand Up @@ -106,11 +106,11 @@ typedef struct Object {

bool is_polygon;

union{
union {
size_t polygon_point_count;
size_t polyline_point_count;
};
union{
union {
Point* polygon;
Point* polyline;
};
Expand Down Expand Up @@ -142,16 +142,16 @@ typedef struct Layer {

bool data_is_str;
size_t data_count;
union{
union {
unsigned int* data_uint;
char* data_str;
}; //tilelayer only
}; // tilelayer only

int height; // tilelayer only
int id;
int startx;
int starty;
int width; //tilelayer only
int width; // tilelayer only
int x;
int y;

Expand Down Expand Up @@ -404,7 +404,6 @@ typedef struct ObjectTemplate {
Object* object;
} ObjectTemplate;


/**
* @defgroup tmj TMJ
*
Expand Down Expand Up @@ -494,7 +493,7 @@ void tmj_tileset_free(Tileset* tileset);
/**
* @ingroup tmj
*/
typedef enum TMJ_LOG_PRIORITY{
typedef enum TMJ_LOG_PRIORITY {
TMJ_LOG_DEBUG,
TMJ_LOG_INFO,
TMJ_LOG_WARNING,
Expand All @@ -513,7 +512,6 @@ typedef enum TMJ_LOG_PRIORITY{
*/
void tmj_log_regcb(bool debug, void (*callback)(tmj_log_priority, const char*));


///**
// * @defgroup util Util
// *
Expand Down Expand Up @@ -569,7 +567,7 @@ extern const char* const TMJ_VERSION;
* https://doc.mapeditor.org/en/stable/reference/global-tile-ids/ for more
* information. On failure, returns NULL.
*/
uint32_t* tmj_decode_layer(const char* data, const char* encoding, const char* compression, size_t* size);
uint32_t* tmj_decode_layer(const char* data, const char* encoding, const char* compression, size_t* size);

#ifdef __cplusplus
}
Expand Down
Loading

0 comments on commit 918ec6c

Please sign in to comment.