Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applied google's clang format #3

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 258 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...
96 changes: 50 additions & 46 deletions include/DMDUtil/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,60 @@
#define DMDUTILCALLBACK
#endif

#include <string>
#include <cstdarg>
#include <string>

typedef void(DMDUTILCALLBACK *DMDUtil_LogCallback)(const char *format, va_list args);
typedef void(DMDUTILCALLBACK* DMDUtil_LogCallback)(const char* format,
va_list args);

namespace DMDUtil {

class DMDUTILAPI Config
{
public:
static Config* GetInstance();
bool IsAltColor() const { return m_altColor; }
void SetAltColor(bool altColor) { m_altColor = altColor; }
void SetAltColorPath(const char* path) { m_altColorPath = path; }
bool IsZeDMD() const { return m_zedmd; }
void SetZeDMD(bool zedmd) { m_zedmd = zedmd; }
const char* GetZeDMDDevice() const { return m_zedmdDevice.c_str(); }
void SetZeDMDDevice(const char* port) { m_zedmdDevice = port; }
bool IsZeDMDDebug() const { return m_zedmdDebug; }
void SetZeDMDDebug(bool debug) { m_zedmdDebug = debug; }
int GetZeDMDRGBOrder() const { return m_zedmdRgbOrder; }
void SetZeDMDRGBOrder(int rgbOrder) { m_zedmdRgbOrder = rgbOrder; }
int GetZeDMDBrightness() const { return m_zedmdBrightness; }
void SetZeDMDBrightness(int brightness) { m_zedmdBrightness = brightness; }
bool IsZeDMDSaveSettings() const { return m_zedmdSaveSettings; }
void SetZeDMDSaveSettings(bool saveSettings) { m_zedmdSaveSettings = saveSettings; }
bool IsPixelcade() const { return m_pixelcade; }
void SetPixelcade(bool pixelcade) { m_pixelcade = pixelcade; }
void SetPixelcadeDevice(const char* port) { m_pixelcadeDevice = port; }
const char* GetPixelcadeDevice() const { return m_pixelcadeDevice.c_str(); }
const DMDUtil_LogCallback GetLogCallback() const { return m_logCallback; }
void SetLogCallback(DMDUtil_LogCallback callback) { m_logCallback = callback; }
const char* GetAltColorPath() const { return m_altColorPath.c_str(); }

private:
Config();
~Config() {}

static Config* m_pInstance;
bool m_altColor;
std::string m_altColorPath;
bool m_zedmd;
std::string m_zedmdDevice;
bool m_zedmdDebug;
int m_zedmdRgbOrder;
int m_zedmdBrightness;
bool m_zedmdSaveSettings;
bool m_pixelcade;
std::string m_pixelcadeDevice;
DMDUtil_LogCallback m_logCallback;
class DMDUTILAPI Config {
public:
static Config* GetInstance();
bool IsAltColor() const { return m_altColor; }
void SetAltColor(bool altColor) { m_altColor = altColor; }
void SetAltColorPath(const char* path) { m_altColorPath = path; }
bool IsZeDMD() const { return m_zedmd; }
void SetZeDMD(bool zedmd) { m_zedmd = zedmd; }
const char* GetZeDMDDevice() const { return m_zedmdDevice.c_str(); }
void SetZeDMDDevice(const char* port) { m_zedmdDevice = port; }
bool IsZeDMDDebug() const { return m_zedmdDebug; }
void SetZeDMDDebug(bool debug) { m_zedmdDebug = debug; }
int GetZeDMDRGBOrder() const { return m_zedmdRgbOrder; }
void SetZeDMDRGBOrder(int rgbOrder) { m_zedmdRgbOrder = rgbOrder; }
int GetZeDMDBrightness() const { return m_zedmdBrightness; }
void SetZeDMDBrightness(int brightness) { m_zedmdBrightness = brightness; }
bool IsZeDMDSaveSettings() const { return m_zedmdSaveSettings; }
void SetZeDMDSaveSettings(bool saveSettings) {
m_zedmdSaveSettings = saveSettings;
}
bool IsPixelcade() const { return m_pixelcade; }
void SetPixelcade(bool pixelcade) { m_pixelcade = pixelcade; }
void SetPixelcadeDevice(const char* port) { m_pixelcadeDevice = port; }
const char* GetPixelcadeDevice() const { return m_pixelcadeDevice.c_str(); }
const DMDUtil_LogCallback GetLogCallback() const { return m_logCallback; }
void SetLogCallback(DMDUtil_LogCallback callback) {
m_logCallback = callback;
}
const char* GetAltColorPath() const { return m_altColorPath.c_str(); }

private:
Config();
~Config() {}

static Config* m_pInstance;
bool m_altColor;
std::string m_altColorPath;
bool m_zedmd;
std::string m_zedmdDevice;
bool m_zedmdDebug;
int m_zedmdRgbOrder;
int m_zedmdBrightness;
bool m_zedmdSaveSettings;
bool m_pixelcade;
std::string m_pixelcadeDevice;
DMDUtil_LogCallback m_logCallback;
};

}
} // namespace DMDUtil
Loading