Skip to content

Commit ebc1d76

Browse files
committed
Added clang formar
1 parent 890dce6 commit ebc1d76

File tree

6 files changed

+273
-175
lines changed

6 files changed

+273
-175
lines changed

.clang-format

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
BasedOnStyle: Microsoft
3+
AccessModifierOffset: '-4'
4+
AlignAfterOpenBracket: AlwaysBreak
5+
AlignConsecutiveMacros: 'true'
6+
AlignConsecutiveAssignments: 'true'
7+
AlignConsecutiveDeclarations: 'true'
8+
AlignEscapedNewlines: Left
9+
AlignOperands: 'true'
10+
AlignTrailingComments: 'true'
11+
AllowAllArgumentsOnNextLine: 'false'
12+
AllowAllConstructorInitializersOnNextLine: 'true'
13+
AllowAllParametersOfDeclarationOnNextLine: 'false'
14+
AllowShortBlocksOnASingleLine: 'true'
15+
AllowShortCaseLabelsOnASingleLine: 'true'
16+
AllowShortFunctionsOnASingleLine: Empty
17+
AllowShortEnumsOnASingleLine: 'true'
18+
AllowShortIfStatementsOnASingleLine: Never
19+
AllowShortLambdasOnASingleLine: Empty
20+
AllowShortLoopsOnASingleLine: 'false'
21+
AlwaysBreakAfterReturnType: None
22+
AlwaysBreakBeforeMultilineStrings: 'false'
23+
AlwaysBreakTemplateDeclarations: 'Yes'
24+
BinPackArguments: 'false'
25+
BinPackParameters: 'false'
26+
BreakBeforeBinaryOperators: All
27+
BreakBeforeBraces: Allman
28+
BreakBeforeTernaryOperators: 'true'
29+
BreakConstructorInitializers: BeforeComma
30+
BreakInheritanceList: BeforeComma
31+
BreakStringLiterals: 'true'
32+
ColumnLimit: '180'
33+
CompactNamespaces: 'false'
34+
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
35+
Cpp11BracedListStyle: 'true'
36+
DisableFormat: 'false'
37+
FixNamespaceComments: 'true'
38+
IncludeBlocks: Regroup
39+
IndentPPDirectives: BeforeHash
40+
IndentWidth: '4'
41+
KeepEmptyLinesAtTheStartOfBlocks: 'false'
42+
Language: Cpp
43+
MaxEmptyLinesToKeep: '2'
44+
NamespaceIndentation: All
45+
PointerAlignment: Right
46+
ReflowComments: 'true'
47+
SortIncludes: 'false'
48+
SortUsingDeclarations: 'true'
49+
SpaceAfterCStyleCast: 'false'
50+
SpaceAfterLogicalNot: 'false'
51+
SpaceAfterTemplateKeyword: 'true'
52+
SpaceBeforeAssignmentOperators: 'true'
53+
SpaceBeforeCpp11BracedList: 'true'
54+
SpaceBeforeCtorInitializerColon: 'true'
55+
SpaceBeforeInheritanceColon: 'true'
56+
SpaceBeforeParens: ControlStatements
57+
SpaceBeforeRangeBasedForLoopColon: 'true'
58+
SpaceInEmptyParentheses: 'false'
59+
SpacesBeforeTrailingComments: '4'
60+
SpacesInAngles: 'false'
61+
SpacesInCStyleCastParentheses: 'false'
62+
SpacesInContainerLiterals: 'false'
63+
SpacesInParentheses: 'false'
64+
SpacesInSquareBrackets: 'false'
65+
Standard: Cpp11
66+
TabWidth: '4'
67+
UseTab: Never
68+
69+
...

NppJSONViewer/NppJsonViewer/AboutDlg.h

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44
class AboutDlg : public StaticDialog
55
{
66
public:
7-
AboutDlg(HINSTANCE hIntance, HWND hParent, int nCmdId);
8-
~AboutDlg() = default;
7+
AboutDlg(HINSTANCE hIntance, HWND hParent, int nCmdId);
8+
~AboutDlg() = default;
99

10-
bool ShowDlg(bool bShow);
10+
bool ShowDlg(bool bShow);
1111

1212
protected:
13-
virtual INT_PTR CALLBACK run_dlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
13+
virtual INT_PTR CALLBACK run_dlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
1414

15-
void SetVersion(HWND hWnd);
15+
void SetVersion(HWND hWnd);
1616

1717
private:
18-
int m_nCmdId = -1;
18+
int m_nCmdId = -1;
1919
};
20-

NppJSONViewer/NppJsonViewer/Define.h

+71-47
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,108 @@
22
#include "PluginInterface.h"
33

44
// Define the number of plugin commands here
5-
enum class CallBackID :int { SHOW_DOC_PANEL = 0, FORMAT, COMPRESS, SEP_1, SETTING, ABOUT };
5+
enum class CallBackID : int
6+
{
7+
SHOW_DOC_PANEL = 0,
8+
FORMAT,
9+
COMPRESS,
10+
SEP_1,
11+
SETTING,
12+
ABOUT
13+
};
614
constexpr const int nTotalCommandCount = static_cast<int>(CallBackID::ABOUT) + 1;
715

816
// Define plugin name here
9-
const TCHAR PLUGIN_NAME[] = TEXT("JSON Viewer");
17+
const TCHAR PLUGIN_NAME[] = TEXT("JSON Viewer");
1018
const TCHAR PLUGIN_CONFIG[] = TEXT("JSONViewer.ini");
1119

1220
// Text which can be considered for localization
13-
const TCHAR TITLE_JSON_PANEL[] = TEXT("JSON Viewer Panel");
21+
const TCHAR TITLE_JSON_PANEL[] = TEXT("JSON Viewer Panel");
1422
const TCHAR MENU_SHOW_JSON_PANEL[] = TEXT("Show &JSON Viewer");
15-
const TCHAR MENU_FORMAT_JSON[] = TEXT("&Format JSON");
16-
const TCHAR MENU_COMPRESS_JSON[] = TEXT("&Compress JSON");
17-
const TCHAR MENU_SETTING[] = TEXT("&Setting");
18-
const TCHAR MENU_ABOUT[] = TEXT("&About");
19-
const TCHAR MENU_SEPERATOR[] = TEXT("-SEPARATOR-");
23+
const TCHAR MENU_FORMAT_JSON[] = TEXT("&Format JSON");
24+
const TCHAR MENU_COMPRESS_JSON[] = TEXT("&Compress JSON");
25+
const TCHAR MENU_SETTING[] = TEXT("&Setting");
26+
const TCHAR MENU_ABOUT[] = TEXT("&About");
27+
const TCHAR MENU_SEPERATOR[] = TEXT("-SEPARATOR-");
2028

21-
const TCHAR TOOLTIP_REFRESH[] = TEXT("Refresh JSON tree");
29+
const TCHAR TOOLTIP_REFRESH[] = TEXT("Refresh JSON tree");
2230
const TCHAR TOOLTIP_VALIDATE[] = TEXT("Validate JSON to detect any error");
23-
const TCHAR TOOLTIP_FORMAT[] = TEXT("Format JSON to beautify it");
24-
const TCHAR TOOLTIP_SEARCH[] = TEXT("Search in JSON");
31+
const TCHAR TOOLTIP_FORMAT[] = TEXT("Format JSON to beautify it");
32+
const TCHAR TOOLTIP_SEARCH[] = TEXT("Search in JSON");
2533

26-
const TCHAR URL_SOURCE_CODE[] = TEXT("https://github.com/kapilratnani/JSON-Viewer");
34+
const TCHAR URL_SOURCE_CODE[] = TEXT("https://github.com/kapilratnani/JSON-Viewer");
2735
const TCHAR URL_REPORT_ISSUE[] = TEXT("https://github.com/kapilratnani/JSON-Viewer/issues/new");
2836

29-
3037
const TCHAR JSON_ROOT[] = TEXT("JSON");
3138

32-
const TCHAR JSON_ERROR_TITLE[] = TEXT("JSON Viewer: Error");
39+
const TCHAR JSON_ERROR_TITLE[] = TEXT("JSON Viewer: Error");
3340
const TCHAR JSON_WARNING_TITLE[] = TEXT("JSON Viewer: Warning");
34-
const TCHAR JSON_INFO_TITLE[] = TEXT("JSON Viewer: Information");
41+
const TCHAR JSON_INFO_TITLE[] = TEXT("JSON Viewer: Information");
3542

36-
const TCHAR JSON_ERR_PARSE[] = TEXT("Cannot parse JSON. Please select a JSON String.");
37-
const TCHAR JSON_ERR_VALIDATE[] = TEXT("There was an error while parsing JSON. Refer the current selection for possible problematic area.");
43+
const TCHAR JSON_ERR_PARSE[] = TEXT("Cannot parse JSON. Please select a JSON String.");
44+
const TCHAR JSON_ERR_VALIDATE[] = TEXT("There was an error while parsing JSON. Refer the current selection for possible problematic area.");
3845
const TCHAR JSON_ERR_VALIDATE_SUCCESS[] = TEXT("JSON looks good. No error found while validating it.");
39-
const TCHAR JSON_ERR_SAVE_SETTING[] = TEXT("Failed to save the setting. Please try again.");
40-
41-
const TCHAR STR_VERSION[] = TEXT("Version: ");
42-
const TCHAR STR_COPY[] = TEXT("Copy");
43-
const TCHAR STR_COPYNAME[] = TEXT("Copy name");
44-
const TCHAR STR_COPYVALUE[] = TEXT("Copy value");
45-
const TCHAR STR_COPYPATH[] = TEXT("Copy path");
46-
const TCHAR STR_EXPANDALL[] = TEXT("Expand all");
46+
const TCHAR JSON_ERR_SAVE_SETTING[] = TEXT("Failed to save the setting. Please try again.");
47+
48+
const TCHAR STR_VERSION[] = TEXT("Version: ");
49+
const TCHAR STR_COPY[] = TEXT("Copy");
50+
const TCHAR STR_COPYNAME[] = TEXT("Copy name");
51+
const TCHAR STR_COPYVALUE[] = TEXT("Copy value");
52+
const TCHAR STR_COPYPATH[] = TEXT("Copy path");
53+
const TCHAR STR_EXPANDALL[] = TEXT("Expand all");
4754
const TCHAR STR_COLLAPSEALL[] = TEXT("Collapse all");
4855

49-
const TCHAR STR_INI_FORMATTING_SEC[] = TEXT("Formatting");
50-
const TCHAR STR_INI_FORMATTING_EOL[] = TEXT("EOL");
51-
const TCHAR STR_INI_FORMATTING_LINE[] = TEXT("LINE_FORMATTING");
52-
const TCHAR STR_INI_FORMATTING_INDENT[] = TEXT("INDENTATION");
56+
const TCHAR STR_INI_FORMATTING_SEC[] = TEXT("Formatting");
57+
const TCHAR STR_INI_FORMATTING_EOL[] = TEXT("EOL");
58+
const TCHAR STR_INI_FORMATTING_LINE[] = TEXT("LINE_FORMATTING");
59+
const TCHAR STR_INI_FORMATTING_INDENT[] = TEXT("INDENTATION");
5360
const TCHAR STR_INI_FORMATTING_INDENTCOUNT[] = TEXT("INDENTATION_COUNT");
5461

55-
const TCHAR STR_INI_OTHER_SEC[] = TEXT("Others");
56-
const TCHAR STR_INI_OTHER_FOLLOW_TAB[] = TEXT("FOLLOW_TAB");
57-
const TCHAR STR_INI_OTHER_AUTO_FORMAT[] = TEXT("AUTO_FORMAT");
62+
const TCHAR STR_INI_OTHER_SEC[] = TEXT("Others");
63+
const TCHAR STR_INI_OTHER_FOLLOW_TAB[] = TEXT("FOLLOW_TAB");
64+
const TCHAR STR_INI_OTHER_AUTO_FORMAT[] = TEXT("AUTO_FORMAT");
5865
const TCHAR STR_INI_OTHER_IGNORE_COMMENT[] = TEXT("IGNORE_COMMENT");
59-
const TCHAR STR_INI_OTHER_IGNORE_COMMA[] = TEXT("IGNORE_TRAILLING_COMMA");
66+
const TCHAR STR_INI_OTHER_IGNORE_COMMA[] = TEXT("IGNORE_TRAILLING_COMMA");
67+
68+
enum class LineEnding
69+
{
70+
AUTO,
71+
WINDOWS,
72+
UNIX,
73+
MAC
74+
};
75+
76+
enum class LineFormat
77+
{
78+
DEFAULT,
79+
SINGLELINE
80+
};
81+
82+
enum class IndentStyle
83+
{
84+
AUTO,
85+
TAB,
86+
SPACE
87+
};
6088

61-
enum class LineEnding { AUTO, WINDOWS, UNIX, MAC };
62-
enum class LineFormat { DEFAULT, SINGLELINE };
63-
enum class IndentStyle { AUTO, TAB, SPACE };
6489
struct Indent
6590
{
66-
unsigned len = 4;
67-
IndentStyle style = IndentStyle::AUTO;
91+
unsigned len = 4;
92+
IndentStyle style = IndentStyle::AUTO;
6893
};
6994

7095
struct ParseOptions
7196
{
72-
bool bIgnoreComment = true;
73-
bool bIgnoreTraillingComma = true;
97+
bool bIgnoreComment = true;
98+
bool bIgnoreTraillingComma = true;
7499
};
75100

76101
struct Setting
77102
{
78-
LineEnding lineEnding = LineEnding::AUTO;
79-
LineFormat lineFormat = LineFormat::DEFAULT;
80-
Indent indent{};
81-
bool bFollowCurrentTab = false;
82-
bool bAutoFormat = false;
83-
ParseOptions parseOptions{};
103+
LineEnding lineEnding = LineEnding::AUTO;
104+
LineFormat lineFormat = LineFormat::DEFAULT;
105+
Indent indent {};
106+
bool bFollowCurrentTab = false;
107+
bool bAutoFormat = false;
108+
ParseOptions parseOptions {};
84109
};
85-

0 commit comments

Comments
 (0)