Skip to content

Commit

Permalink
Update formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadden committed Sep 4, 2020
1 parent 9d8305d commit 5050f65
Show file tree
Hide file tree
Showing 51 changed files with 729 additions and 602 deletions.
110 changes: 85 additions & 25 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,76 +1,136 @@
---
Language: Cpp
Language: Cpp
AccessModifierOffset: -3
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: All
AlwaysBreakAfterReturnType: All
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterEnum: true
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
BreakBeforeBinaryOperators: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
ColumnLimit: 80
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 79
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentWidth: 4
IndentGotoLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
SpaceBeforeSquareBrackets: false
Standard: Latest
StatementMacros:
- ALIA_END
- alia_end
TabWidth: 8
UseCRLF: false
UseTab: Never
...

3 changes: 2 additions & 1 deletion examples/asm-dom/demo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

using namespace alia;

extern std::map<std::string, std::function<void(std::string dom_id)>> the_demos;
extern std::map<std::string, std::function<void(std::string dom_id)>>
the_demos;

struct demo : noncopyable
{
Expand Down
3 changes: 2 additions & 1 deletion examples/asm-dom/demos/features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ sqrt_flashcard(dom::context ctx, readable<int> n)
// Get the local state we need for this component.
auto answer_revealed = alia::get_state(ctx, false);

// If the answer is revealed, show it. Otherwise show a button to reveal it.
// If the answer is revealed, show it. Otherwise show a button to reveal
// it.
alia_if(answer_revealed)
{
dom::text(ctx, alia::printf(ctx, "The square root is %d.", n));
Expand Down
3 changes: 2 additions & 1 deletion examples/asm-dom/demos/fetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ handle_fetch_result(emscripten_fetch_t* fetch, fetch_result result)
{
// Recover our callback from the Emscripten fetch object.
auto* result_callback
= reinterpret_cast<std::function<void(fetch_result)>*>(fetch->userData);
= reinterpret_cast<std::function<void(fetch_result)>*>(
fetch->userData);

// Report the result.
(*result_callback)(result);
Expand Down
5 changes: 4 additions & 1 deletion examples/asm-dom/demos/greeting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ widget(dom::context ctx, std::string name)
dom::text(
ctx,
alia::printf(
ctx, "Hi, I'm widget %s. I live at %p.", value(name), value(data)));
ctx,
"Hi, I'm widget %s. I live at %p.",
value(name),
value(data)));
}

void
Expand Down
9 changes: 5 additions & 4 deletions examples/asm-dom/demos/tracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,11 @@ init_demo(std::string dom_id)
static alia::system the_system;
static dom::system the_dom;

static std::vector<my_record> the_records = {{"abc", "ABC", 2, 4},
{"def", "DEF", 5, 1},
{"ghi", "GHI", 1, 0},
{"jkl", "JKL", -1, 3}};
static std::vector<my_record> the_records
= {{"abc", "ABC", 2, 4},
{"def", "DEF", 5, 1},
{"ghi", "GHI", 1, 0},
{"jkl", "JKL", -1, 3}};

initialize(the_dom, the_system, dom_id, [&](dom::context ctx) {
records_ui(ctx, the_records);
Expand Down
16 changes: 11 additions & 5 deletions examples/asm-dom/dom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace dom {
void
callback_proxy(std::uintptr_t callback, emscripten::val event)
{
(*reinterpret_cast<std::function<void(emscripten::val)>*>(callback))(event);
(*reinterpret_cast<std::function<void(emscripten::val)>*>(callback))(
event);
};

EMSCRIPTEN_BINDINGS(callback_proxy)
Expand Down Expand Up @@ -47,8 +48,8 @@ install_element_callback(
+ " µs");
};
element.addEventListener(type, handler);
// Add the handler to asm-dom's event list so that it knows to clear
// it out before recycling this DOM node.
// Add the handler to asm-dom's event list so that it knows to
// clear it out before recycling this DOM node.
if (!element.hasOwnProperty('asmDomEvents'))
element['asmDomEvents'] = {};
element['asmDomEvents'][type] = handler;
Expand Down Expand Up @@ -115,7 +116,9 @@ do_element_attribute(
},
[&]() {
EM_ASM_(
{ Module.removeAttribute($0, Module['UTF8ToString']($1)); },
{
Module.removeAttribute($0, Module['UTF8ToString']($1));
},
object.js_id,
name);
});
Expand All @@ -124,7 +127,10 @@ do_element_attribute(

void
do_element_attribute(
context ctx, element_object& object, char const* name, readable<bool> value)
context ctx,
element_object& object,
char const* name,
readable<bool> value)
{
auto& stored_id = get_cached_data<captured_id>(ctx);
on_refresh(ctx, [&](auto ctx) {
Expand Down
3 changes: 2 additions & 1 deletion examples/asm-dom/dom.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ struct element_object
{
assert(this->js_id == 0);
this->js_id = EM_ASM_INT(
{ return Module.createElement(Module['UTF8ToString']($0)); }, type);
{ return Module.createElement(Module['UTF8ToString']($0)); },
type);
}

void
Expand Down
5 changes: 3 additions & 2 deletions examples/asm-dom/sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ init_sandbox(std::string dom_id)
static alia::system the_system;
static dom::system the_dom;

initialize(
the_dom, the_system, dom_id, [](dom::context ctx) { sandbox_ui(ctx); });
initialize(the_dom, the_system, dom_id, [](dom::context ctx) {
sandbox_ui(ctx);
});
}

static demo the_sandbox_demo("sandbox", init_sandbox);
3 changes: 2 additions & 1 deletion examples/qt/adaptor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ struct qt_traversal;

ALIA_DEFINE_TAGGED_TYPE(qt_traversal_tag, qt_traversal&)

typedef alia::extend_context_type_t<alia::context, qt_traversal_tag> qt_context;
typedef alia::extend_context_type_t<alia::context, qt_traversal_tag>
qt_context;

typedef alia::remove_context_tag_t<qt_context, alia::data_traversal_tag>
dataless_qt_context;
Expand Down
16 changes: 10 additions & 6 deletions src/alia/context/interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ ALIA_DEFINE_TAGGED_TYPE(system_tag, system&)
struct timing_subsystem;
ALIA_DEFINE_TAGGED_TYPE(timing_tag, timing_subsystem&)

// the structure we use to store context objects - It provides direct storage of
// the commonly-used objects in the core of alia.
// the structure we use to store context objects - It provides direct storage
// of the commonly-used objects in the core of alia.

struct context_storage
{
Expand Down Expand Up @@ -225,23 +225,27 @@ struct optional_context
return has_value();
}

Context const operator*() const
Context const
operator*() const
{
assert(has_value());
return ctx_;
}
Context operator*()
Context
operator*()
{
assert(has_value());
return ctx_;
}

Context const* operator->() const
Context const*
operator->() const
{
assert(has_value());
return &ctx_;
}
Context* operator->()
Context*
operator->()
{
assert(has_value());
return &ctx_;
Expand Down

0 comments on commit 5050f65

Please sign in to comment.