Skip to content

Commit 7c74763

Browse files
committed
fix: clean-up the includes in C++ files
1 parent 4369f64 commit 7c74763

32 files changed

+138
-90
lines changed

.clang-format

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,27 @@ SpaceBeforeAssignmentOperators: true
5656
SpaceBeforeParens: ControlStatements
5757
SpaceInEmptyParentheses: false
5858
SpacesBeforeTrailingComments: 2
59-
SpacesInAngles: false
59+
SpacesInAngles: "Never"
6060
SpacesInContainerLiterals: true
6161
SpacesInCStyleCastParentheses: false
6262
SpacesInParentheses: false
6363
SpacesInSquareBrackets: false
6464
Standard: Auto
6565
TabWidth: 4
6666
UseTab: Never
67-
---
6867

68+
IncludeBlocks: Regroup
69+
IncludeCategories:
70+
# # Specific external headers in <> to put first
71+
- Regex: "<(catch2|gtest).*>"
72+
Priority: 1
73+
# External headers in <> with extension or /
74+
- Regex: '<[-\w\/-_]+[\.\/][-\w\/-_]+>'
75+
Priority: 2
76+
# Standard headers in <>
77+
- Regex: '<[-\w\/-_]+>'
78+
Priority: 3
79+
# Local headers in ""
80+
- Regex: '"[-\w\/-_]*"'
81+
Priority: 4
82+
SortUsingDeclarations: true

.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"v5-compat.d.ts",
1414
"draft.d.ts",
1515
"script/*.js",
16-
"script/*.d.ts"
16+
"script/*.d.ts",
17+
"docs/",
18+
"docs-raw/"
1719
]
1820
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/prebuilds
55
/node_modules
66
pnpm-lock.yaml
7+
/build

src/closable.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#pragma once
2+
3+
/* A thing that can be closed. Simple interface to allow us to correctly clean
4+
up ZMQ resources at agent exit. */
5+
namespace zmq {
6+
struct Closable {
7+
virtual void Close() = 0;
8+
};
9+
}

src/context.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
/* Copyright (c) 2017-2019 Rolf Timmermans */
2-
#include "context.h"
3-
#include "module.h"
4-
#include "socket.h"
2+
#include "./context.h"
53

6-
#include "util/uvwork.h"
4+
#include "./module.h"
5+
#include "./socket.h"
6+
#include "util/arguments.h"
7+
#include "util/error.h"
8+
#include "util/object.h"
79

810
namespace zmq {
911
Context::Context(const Napi::CallbackInfo& info)

src/context.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/* Copyright (c) 2017-2019 Rolf Timmermans */
22
#pragma once
33

4-
#include "prefix.h"
4+
#include <napi.h>
5+
6+
#include "closable.h"
57

68
namespace zmq {
79
class Module;

src/incoming_msg.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* Copyright (c) 2017-2019 Rolf Timmermans */
2-
#include "incoming_msg.h"
2+
#include "./incoming_msg.h"
3+
4+
#include <cassert>
35

46
#include "util/electron_helper.h"
57
#include "util/error.h"

src/incoming_msg.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/* Copyright (c) 2017-2019 Rolf Timmermans */
22
#pragma once
33

4-
#include "prefix.h"
4+
#include <napi.h>
5+
6+
#include "./zmq_inc.h"
57

68
namespace zmq {
79
class IncomingMsg {

src/inline.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#pragma once
2+
3+
#ifdef _MSC_VER
4+
#define force_inline inline __forceinline
5+
#else
6+
#define force_inline inline __attribute__((always_inline))
7+
#endif

src/module.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
/* Copyright (c) 2017-2019 Rolf Timmermans */
2-
#include "module.h"
3-
#include "context.h"
4-
#include "observer.h"
5-
#include "outgoing_msg.h"
6-
#include "proxy.h"
7-
#include "socket.h"
2+
#include "./module.h"
3+
4+
#include "./context.h"
5+
#include "./observer.h"
6+
#include "./outgoing_msg.h"
7+
#include "./proxy.h"
8+
#include "./socket.h"
9+
#include "util/error.h"
10+
#include "util/to_string.h"
811

912
namespace zmq {
1013
static inline Napi::String Version(const Napi::Env& env) {

0 commit comments

Comments
 (0)