diff --git a/.clang-format b/.clang-format index 65317ab1..d0c095e1 100644 --- a/.clang-format +++ b/.clang-format @@ -1,59 +1,56 @@ -IndentWidth: 2 -UseTab: Never - AccessModifierOffset: -2 AlignAfterOpenBracket: DontAlign AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlines: Left -AlignOperands: false +AlignOperands: true AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false -AllowShortFunctionsOnASingleLine: Inline +AllowShortFunctionsOnASingleLine: All AllowShortIfStatementsOnASingleLine: true -AllowShortLoopsOnASingleLine: false +AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: TopLevelDefinitions +AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: true -BinPackArguments: true -BinPackParameters: true +AlwaysBreakTemplateDeclarations: false +BinPackArguments: false +BinPackParameters: false BraceWrapping: - AfterClass: false + AfterClass: true AfterControlStatement: false AfterEnum: false AfterFunction: true AfterNamespace: false AfterObjCDeclaration: false - AfterStruct: false + AfterStruct: true AfterUnion: false BeforeCatch: false BeforeElse: false IndentBraces: false - SplitEmptyFunction: true + SplitEmptyFunction: false SplitEmptyNamespace: true SplitEmptyRecord: true -BreakAfterJavaFieldAnnotations: false -BreakBeforeBinaryOperators: All -BreakBeforeBraces: Allman +BreakAfterJavaFieldAnnotations: true +BreakBeforeBinaryOperators: NonAssignment +BreakBeforeBraces: Custom BreakBeforeInheritanceComma: true -BreakBeforeTernaryOperators: false -BreakConstructorInitializers: BeforeComma -BreakConstructorInitializersBeforeComma: true +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: BeforeColon +BreakConstructorInitializersBeforeComma: false BreakStringLiterals: true ColumnLimit: 0 CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: true +CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 5 +ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 2 Cpp11BracedListStyle: false DerivePointerAlignment: true DisableFormat: false ExperimentalAutoDetectBinPacking: true -FixNamespaceComments: false +FixNamespaceComments: true ForEachMacros: - foreach - Q_FOREACH @@ -67,38 +64,32 @@ IncludeCategories: Regex: .* IncludeIsMainRegex: (Test)?$ IndentCaseLabels: false -IndentWrappedFunctionNames: false -JavaScriptQuotes: Single -JavaScriptWrapImports: false +IndentWidth: 2 +IndentWrappedFunctionNames: true +JavaScriptQuotes: Leave +JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: true Language: Cpp MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 2 NamespaceIndentation: Inner -ObjCBlockIndentWidth: 4 +ObjCBlockIndentWidth: 7 ObjCSpaceAfterProperty: true ObjCSpaceBeforeProtocolList: false -PenaltyBreakAssignment: 2 -PenaltyBreakBeforeFirstCallParameter: 23 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 104 -PenaltyBreakString: 916 -PenaltyExcessCharacter: 1000000 -PenaltyReturnTypeOnItsOwnLine: 80 -PointerAlignment: Left +PointerAlignment: Right ReflowComments: true SortIncludes: false SortUsingDeclarations: false -SpaceAfterCStyleCast: true +SpaceAfterCStyleCast: false SpaceAfterTemplateKeyword: false SpaceBeforeAssignmentOperators: true SpaceBeforeParens: ControlStatements SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 +SpacesBeforeTrailingComments: 0 SpacesInAngles: false SpacesInCStyleCastParentheses: false -SpacesInContainerLiterals: false +SpacesInContainerLiterals: true SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Cpp11 diff --git a/cheatsheet.md b/cheatsheet.md index 28debbca..266ddc71 100644 --- a/cheatsheet.md +++ b/cheatsheet.md @@ -5,7 +5,7 @@ ChaiScript tries to follow the [Semantic Versioning](http://semver.org/) scheme. * Major Version Number: API changes / breaking changes * Minor Version Number: New Features * Patch Version Number: Minor changes / enhancements - + # Initializing ChaiScript @@ -37,7 +37,7 @@ chai.add(chaiscript::fun(&Class::method_name, Class_instance_ptr), "method_name" chai.add(chaiscript::fun(&Class::member_name, Class_instance_ptr), "member_name"); ``` -### With Overloads +### With Overloads #### Preferred @@ -69,9 +69,9 @@ chai.add(chaiscript::fun(static_cast(&Derived::data)), "data"); ``` chai.add( chaiscript::fun( - [](bool type) { - if (type) { return "x"; } - else { return "y"; } + [](bool type) { + if (type) { return "x"; } + else { return "y"; } }), "function_name"); ``` @@ -168,7 +168,7 @@ chai.set_global(chaiscript::var(somevar), "somevar"); // global non-const, overw ## Adding Namespaces -Namespaces will not be populated until `import` is called. +Namespaces will not be populated until `import` is called. This saves memory and computing costs if a namespace is not imported into every ChaiScript instance. ``` chai.register_namespace([](chaiscript::Namespace& math) {