Update rpiConfigServer formatting

This commit is contained in:
Peter Johnson 2018-12-14 16:36:56 -08:00
parent bea3ad80b1
commit 7b78c412b0
No known key found for this signature in database
GPG Key ID: D39DD4DA7D41E329
12 changed files with 168 additions and 62 deletions

1
deps/tools/.clang vendored Normal file
View File

@ -0,0 +1 @@
-std=c++11 -I../allwpilib/src/main/native/include

107
deps/tools/.clang-format vendored Normal file
View File

@ -0,0 +1,107 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: 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
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...

View File

@ -5,8 +5,8 @@
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef WPIUTIL_DATAHISTORY_H_
#define WPIUTIL_DATAHISTORY_H_
#ifndef RPICONFIGSERVER_DATAHISTORY_H_
#define RPICONFIGSERVER_DATAHISTORY_H_
#include <stdint.h>
@ -53,4 +53,4 @@ class DataHistory {
size_t m_qty = 0;
};
#endif // WPIUTIL_DATAHISTORY_H_
#endif // RPICONFIGSERVER_DATAHISTORY_H_

View File

@ -7,9 +7,10 @@
#include "MyHttpConnection.h"
#include <wpi/UrlParser.h>
#include <wpi/raw_ostream.h>
#include "WebSocketHandlers.h"
#include "wpi/UrlParser.h"
#include "wpi/raw_ostream.h"
// static resources
namespace wpi {

View File

@ -5,14 +5,14 @@
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef WPIUTIL_MYHTTPCONNECTION_H_
#define WPIUTIL_MYHTTPCONNECTION_H_
#ifndef RPICONFIGSERVER_MYHTTPCONNECTION_H_
#define RPICONFIGSERVER_MYHTTPCONNECTION_H_
#include <memory>
#include "wpi/HttpServerConnection.h"
#include "wpi/WebSocketServer.h"
#include "wpi/uv/Stream.h"
#include <wpi/HttpServerConnection.h>
#include <wpi/WebSocketServer.h>
#include <wpi/uv/Stream.h>
class MyHttpConnection : public wpi::HttpServerConnection,
public std::enable_shared_from_this<MyHttpConnection> {
@ -25,4 +25,4 @@ class MyHttpConnection : public wpi::HttpServerConnection,
wpi::WebSocketServerHelper m_websocketHelper;
};
#endif // WPIUTIL_MYHTTPCONNECTION_H_
#endif // RPICONFIGSERVER_MYHTTPCONNECTION_H_

View File

@ -7,12 +7,12 @@
#include "SystemStatus.h"
#include "wpi/SmallString.h"
#include "wpi/SmallVector.h"
#include "wpi/StringRef.h"
#include "wpi/json.h"
#include "wpi/raw_istream.h"
#include "wpi/raw_ostream.h"
#include <wpi/SmallString.h>
#include <wpi/SmallVector.h>
#include <wpi/StringRef.h>
#include <wpi/json.h>
#include <wpi/raw_istream.h>
#include <wpi/raw_ostream.h>
std::shared_ptr<SystemStatus> SystemStatus::GetInstance() {
static auto sysStatus = std::make_shared<SystemStatus>(private_init{});

View File

@ -5,13 +5,14 @@
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef WPIUTIL_SYSTEMSTATUS_H_
#define WPIUTIL_SYSTEMSTATUS_H_
#ifndef RPICONFIGSERVER_SYSTEMSTATUS_H_
#define RPICONFIGSERVER_SYSTEMSTATUS_H_
#include <memory>
#include <wpi/Signal.h>
#include "DataHistory.h"
#include "wpi/Signal.h"
namespace wpi {
class json;
@ -57,4 +58,4 @@ class SystemStatus {
DataHistory<NetworkData, 6> m_network;
};
#endif // WPIUTIL_SYSTEMSTATUS_H_
#endif // RPICONFIGSERVER_SYSTEMSTATUS_H_

View File

@ -7,24 +7,22 @@
#include "VisionStatus.h"
#ifndef _WIN32
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#endif
#include <cstring>
#include "wpi/SmallString.h"
#include "wpi/StringRef.h"
#include "wpi/json.h"
#include "wpi/raw_ostream.h"
#include "wpi/uv/Buffer.h"
#include "wpi/uv/Pipe.h"
#include "wpi/uv/Process.h"
#include "wpi/uv/Work.h"
#include <wpi/SmallString.h>
#include <wpi/StringRef.h>
#include <wpi/json.h>
#include <wpi/raw_ostream.h>
#include <wpi/uv/Buffer.h>
#include <wpi/uv/Pipe.h>
#include <wpi/uv/Process.h>
#include <wpi/uv/Work.h>
namespace uv = wpi::uv;
@ -37,7 +35,6 @@ std::shared_ptr<VisionStatus> VisionStatus::GetInstance() {
void VisionStatus::RunSvc(const char* cmd,
std::function<void(wpi::StringRef)> onFail) {
#ifndef _WIN32
struct SvcWorkReq : public uv::WorkReq {
SvcWorkReq(const char* cmd_, std::function<void(wpi::StringRef)> onFail_)
: cmd(cmd_), onFail(onFail_) {}
@ -69,7 +66,6 @@ void VisionStatus::RunSvc(const char* cmd,
});
uv::QueueWork(m_loop, workReq);
#endif
}
void VisionStatus::Up(std::function<void(wpi::StringRef)> onFail) {
@ -93,7 +89,6 @@ void VisionStatus::Kill(std::function<void(wpi::StringRef)> onFail) {
}
void VisionStatus::UpdateStatus() {
#ifndef _WIN32
struct StatusWorkReq : public uv::WorkReq {
bool enabled = false;
wpi::SmallString<128> status;
@ -178,7 +173,6 @@ void VisionStatus::UpdateStatus() {
});
uv::QueueWork(m_loop, workReq);
#endif
}
void VisionStatus::ConsoleLog(uv::Buffer& buf, size_t len) {

View File

@ -5,14 +5,14 @@
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef WPIUTIL_VISIONSTATUS_H_
#define WPIUTIL_VISIONSTATUS_H_
#ifndef RPICONFIGSERVER_VISIONSTATUS_H_
#define RPICONFIGSERVER_VISIONSTATUS_H_
#include <functional>
#include <memory>
#include "wpi/Signal.h"
#include "wpi/StringRef.h"
#include <wpi/Signal.h>
#include <wpi/StringRef.h>
namespace wpi {
class json;
@ -54,4 +54,4 @@ class VisionStatus {
std::shared_ptr<wpi::uv::Loop> m_loop;
};
#endif // WPIUTIL_VISIONSTATUS_H_
#endif // RPICONFIGSERVER_VISIONSTATUS_H_

View File

@ -9,16 +9,17 @@
#include <memory>
#include <wpi/SmallVector.h>
#include <wpi/WebSocket.h>
#include <wpi/json.h>
#include <wpi/raw_ostream.h>
#include <wpi/raw_uv_ostream.h>
#include <wpi/uv/Loop.h>
#include <wpi/uv/Pipe.h>
#include <wpi/uv/Process.h>
#include "SystemStatus.h"
#include "VisionStatus.h"
#include "wpi/SmallVector.h"
#include "wpi/WebSocket.h"
#include "wpi/json.h"
#include "wpi/raw_ostream.h"
#include "wpi/raw_uv_ostream.h"
#include "wpi/uv/Loop.h"
#include "wpi/uv/Pipe.h"
#include "wpi/uv/Process.h"
namespace uv = wpi::uv;

View File

@ -5,10 +5,10 @@
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef WPIUTIL_WEBSOCKETHANDLERS_H_
#define WPIUTIL_WEBSOCKETHANDLERS_H_
#ifndef RPICONFIGSERVER_WEBSOCKETHANDLERS_H_
#define RPICONFIGSERVER_WEBSOCKETHANDLERS_H_
#include "wpi/StringRef.h"
#include <wpi/StringRef.h>
namespace wpi {
class WebSocket;
@ -17,4 +17,4 @@ class WebSocket;
void InitWs(wpi::WebSocket& ws);
void ProcessWsText(wpi::WebSocket& ws, wpi::StringRef msg);
#endif // WPIUTIL_WEBSOCKETHANDLERS_H_
#endif // RPICONFIGSERVER_WEBSOCKETHANDLERS_H_

View File

@ -8,19 +8,20 @@
#include <chrono>
#include <thread>
#include <wpi/ArrayRef.h>
#include <wpi/StringRef.h>
#include <wpi/raw_ostream.h>
#include <wpi/raw_uv_ostream.h>
#include <wpi/timestamp.h>
#include <wpi/uv/Loop.h>
#include <wpi/uv/Process.h>
#include <wpi/uv/Tcp.h>
#include <wpi/uv/Timer.h>
#include <wpi/uv/Udp.h>
#include "MyHttpConnection.h"
#include "SystemStatus.h"
#include "VisionStatus.h"
#include "wpi/ArrayRef.h"
#include "wpi/StringRef.h"
#include "wpi/raw_ostream.h"
#include "wpi/raw_uv_ostream.h"
#include "wpi/timestamp.h"
#include "wpi/uv/Loop.h"
#include "wpi/uv/Process.h"
#include "wpi/uv/Tcp.h"
#include "wpi/uv/Timer.h"
#include "wpi/uv/Udp.h"
namespace uv = wpi::uv;