Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
Runs clang-format on ntcore (#150)
Browse files Browse the repository at this point in the history
Also updates .clang-format to match allwpilib

WPIUtil was skipped
  • Loading branch information
ThadHouse authored and PeterJohnson committed Nov 4, 2016
1 parent cf0ec7b commit 05ca76e
Show file tree
Hide file tree
Showing 32 changed files with 713 additions and 755 deletions.
80 changes: 52 additions & 28 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,65 +1,89 @@
---
Language: Cpp
# BasedOnStyle: Google
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: true
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
BinPackArguments: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
DerivePointerAlignment: true
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
Cpp11BracedListStyle: true
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
IndentWidth: 2
TabWidth: 8
UseTab: Never
BreakBeforeBraces: Attach
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
...

54 changes: 28 additions & 26 deletions include/networktables/NetworkTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,15 @@ class NetworkTable : public ITable {
* @return False if the table key already exists with a different type
*/
bool PutNumber(llvm::StringRef key, double value) override;
/**

/**
* Gets the current value in the table, setting it if it does not exist.
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
virtual bool SetDefaultNumber(llvm::StringRef key, double defaultValue) override;
virtual bool SetDefaultNumber(llvm::StringRef key,
double defaultValue) override;

/**
* Gets the number associated with the given name.
Expand Down Expand Up @@ -310,14 +311,14 @@ class NetworkTable : public ITable {
* @return False if the table key already exists with a different type
*/
virtual bool PutString(llvm::StringRef key, llvm::StringRef value) override;
/**

/**
* Gets the current value in the table, setting it if it does not exist.
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
virtual bool SetDefaultString(llvm::StringRef key,
virtual bool SetDefaultString(llvm::StringRef key,
llvm::StringRef defaultValue) override;

/**
Expand Down Expand Up @@ -355,14 +356,15 @@ class NetworkTable : public ITable {
* @return False if the table key already exists with a different type
*/
virtual bool PutBoolean(llvm::StringRef key, bool value) override;
/**

/**
* Gets the current value in the table, setting it if it does not exist.
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
virtual bool SetDefaultBoolean(llvm::StringRef key, bool defaultValue) override;
virtual bool SetDefaultBoolean(llvm::StringRef key,
bool defaultValue) override;

/**
* Gets the boolean associated with the given name.
Expand Down Expand Up @@ -404,14 +406,14 @@ class NetworkTable : public ITable {
virtual bool PutBooleanArray(llvm::StringRef key,
llvm::ArrayRef<int> value) override;

/**
/**
* Gets the current value in the table, setting it if it does not exist.
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
virtual bool SetDefaultBooleanArray(llvm::StringRef key,
llvm::ArrayRef<int> defaultValue) override;
*/
virtual bool SetDefaultBooleanArray(
llvm::StringRef key, llvm::ArrayRef<int> defaultValue) override;

/**
* Returns the boolean array the key maps to. If the key does not exist or is
Expand Down Expand Up @@ -440,14 +442,14 @@ class NetworkTable : public ITable {
virtual bool PutNumberArray(llvm::StringRef key,
llvm::ArrayRef<double> value) override;

/**
/**
* Gets the current value in the table, setting it if it does not exist.
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
virtual bool SetDefaultNumberArray(llvm::StringRef key,
llvm::ArrayRef<double> defaultValue) override;
virtual bool SetDefaultNumberArray(
llvm::StringRef key, llvm::ArrayRef<double> defaultValue) override;

/**
* Returns the number array the key maps to. If the key does not exist or is
Expand All @@ -472,14 +474,14 @@ class NetworkTable : public ITable {
virtual bool PutStringArray(llvm::StringRef key,
llvm::ArrayRef<std::string> value) override;

/**
/**
* Gets the current value in the table, setting it if it does not exist.
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
virtual bool SetDefaultStringArray(llvm::StringRef key,
llvm::ArrayRef<std::string> defaultValue) override;
virtual bool SetDefaultStringArray(
llvm::StringRef key, llvm::ArrayRef<std::string> defaultValue) override;

/**
* Returns the string array the key maps to. If the key does not exist or is
Expand All @@ -503,14 +505,14 @@ class NetworkTable : public ITable {
* @return False if the table key already exists with a different type
*/
virtual bool PutRaw(llvm::StringRef key, llvm::StringRef value) override;
/**

/**
* Gets the current value in the table, setting it if it does not exist.
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
virtual bool SetDefaultRaw(llvm::StringRef key,
virtual bool SetDefaultRaw(llvm::StringRef key,
llvm::StringRef defaultValue) override;

/**
Expand All @@ -535,15 +537,15 @@ class NetworkTable : public ITable {
* @return False if the table key already exists with a different type
*/
bool PutValue(llvm::StringRef key, std::shared_ptr<nt::Value> value) override;
/**

/**
* Gets the current value in the table, setting it if it does not exist.
* @param key the key
* @param defaultValue the default value to set if key doesn't exist.
* @returns False if the table key exists with a different type
*/
virtual bool SetDefaultValue(llvm::StringRef key,
std::shared_ptr<nt::Value> defaultValue) override;
virtual bool SetDefaultValue(
llvm::StringRef key, std::shared_ptr<nt::Value> defaultValue) override;

/**
* Gets the value associated with a key as an object
Expand Down
6 changes: 4 additions & 2 deletions include/nt_Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ class Value {
return val;
}
#ifdef _MSC_VER
template <typename T, typename = std::enable_if_t<std::is_same<T, std::string>>>
template <typename T,
typename = std::enable_if_t<std::is_same<T, std::string>>>
#else
template <typename T,
typename std::enable_if<std::is_same<T, std::string>::value>::type>
Expand All @@ -125,7 +126,8 @@ class Value {
return val;
}
#ifdef _MSC_VER
template <typename T, typename = std::enable_if_t<std::is_same<T, std::string>>>
template <typename T,
typename = std::enable_if_t<std::is_same<T, std::string>>>
#else
template <typename T,
typename std::enable_if<std::is_same<T, std::string>::value>::type>
Expand Down
4 changes: 2 additions & 2 deletions include/ntcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
#ifdef __cplusplus
/* C++ API */
#include "ntcore_cpp.h"
#endif /* __cplusplus */
#endif /* __cplusplus */

#endif /* NTCORE_H_ */
#endif /* NTCORE_H_ */
Loading

0 comments on commit 05ca76e

Please sign in to comment.