Skip to content

Commit b35db4c

Browse files
authored
Merge pull request #100 from edisonhello/upgrade/bump-1.5
Bump version to 1.5.0
2 parents b5518f4 + 3fcf6fa commit b35db4c

16 files changed

+177
-315
lines changed

.clang-format

Lines changed: 1 addition & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,4 @@
11
---
22
Language: Cpp
3-
# BasedOnStyle: LLVM
4-
AccessModifierOffset: -2
5-
AlignAfterOpenBracket: Align
6-
AlignConsecutiveAssignments: false
7-
AlignConsecutiveDeclarations: false
8-
AlignEscapedNewlines: Right
9-
AlignOperands: true
10-
AlignTrailingComments: true
11-
AllowAllParametersOfDeclarationOnNextLine: true
12-
AllowShortBlocksOnASingleLine: false
13-
AllowShortCaseLabelsOnASingleLine: false
14-
AllowShortFunctionsOnASingleLine: All
15-
AllowShortIfStatementsOnASingleLine: false
16-
AllowShortLoopsOnASingleLine: false
17-
AlwaysBreakAfterDefinitionReturnType: None
18-
AlwaysBreakAfterReturnType: None
19-
AlwaysBreakBeforeMultilineStrings: false
20-
AlwaysBreakTemplateDeclarations: false
21-
BinPackArguments: true
22-
BinPackParameters: true
23-
BraceWrapping:
24-
AfterClass: false
25-
AfterControlStatement: false
26-
AfterEnum: false
27-
AfterFunction: false
28-
AfterNamespace: false
29-
AfterObjCDeclaration: false
30-
AfterStruct: false
31-
AfterUnion: false
32-
AfterExternBlock: false
33-
BeforeCatch: false
34-
BeforeElse: false
35-
IndentBraces: false
36-
SplitEmptyFunction: true
37-
SplitEmptyRecord: true
38-
SplitEmptyNamespace: true
39-
BreakBeforeBinaryOperators: None
40-
BreakBeforeBraces: Attach
41-
BreakBeforeInheritanceComma: false
42-
BreakBeforeTernaryOperators: true
43-
BreakConstructorInitializersBeforeComma: false
44-
BreakConstructorInitializers: BeforeColon
45-
BreakAfterJavaFieldAnnotations: false
46-
BreakStringLiterals: true
47-
ColumnLimit: 80
48-
CommentPragmas: '^ IWYU pragma:'
49-
CompactNamespaces: false
50-
ConstructorInitializerAllOnOneLineOrOnePerLine: false
51-
ConstructorInitializerIndentWidth: 4
52-
ContinuationIndentWidth: 4
53-
Cpp11BracedListStyle: true
54-
DerivePointerAlignment: false
55-
DisableFormat: false
56-
ExperimentalAutoDetectBinPacking: false
57-
FixNamespaceComments: true
58-
ForEachMacros:
59-
- foreach
60-
- Q_FOREACH
61-
- BOOST_FOREACH
62-
IncludeBlocks: Preserve
63-
IncludeCategories:
64-
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
65-
Priority: 2
66-
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
67-
Priority: 3
68-
- Regex: '.*'
69-
Priority: 1
70-
IncludeIsMainRegex: '(Test)?$'
71-
IndentCaseLabels: false
72-
IndentPPDirectives: None
73-
IndentWidth: 2
74-
IndentWrappedFunctionNames: false
75-
JavaScriptQuotes: Leave
76-
JavaScriptWrapImports: true
77-
KeepEmptyLinesAtTheStartOfBlocks: true
78-
MacroBlockBegin: ''
79-
MacroBlockEnd: ''
80-
MaxEmptyLinesToKeep: 1
81-
NamespaceIndentation: None
82-
ObjCBlockIndentWidth: 2
83-
ObjCSpaceAfterProperty: false
84-
ObjCSpaceBeforeProtocolList: true
85-
PenaltyBreakAssignment: 2
86-
PenaltyBreakBeforeFirstCallParameter: 19
87-
PenaltyBreakComment: 300
88-
PenaltyBreakFirstLessLess: 120
89-
PenaltyBreakString: 1000
90-
PenaltyExcessCharacter: 1000000
91-
PenaltyReturnTypeOnItsOwnLine: 60
92-
PointerAlignment: Right
93-
RawStringFormats:
94-
- Language: TextProto
95-
Delimiters:
96-
- 'pb'
97-
- 'proto'
98-
BasedOnStyle: google
99-
ReflowComments: true
100-
SortIncludes: true
101-
SortUsingDeclarations: true
102-
SpaceAfterCStyleCast: false
103-
SpaceAfterTemplateKeyword: true
104-
SpaceBeforeAssignmentOperators: true
105-
SpaceBeforeParens: ControlStatements
106-
SpaceInEmptyParentheses: false
107-
SpacesBeforeTrailingComments: 1
108-
SpacesInAngles: false
109-
SpacesInContainerLiterals: true
110-
SpacesInCStyleCastParentheses: false
111-
SpacesInParentheses: false
112-
SpacesInSquareBrackets: false
113-
Standard: Cpp11
114-
TabWidth: 8
115-
UseTab: Never
3+
ColumnLimit: 100
1164
...
117-

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.8)
2-
project(tabulate VERSION 1.4.0 LANGUAGES CXX)
2+
project(tabulate VERSION 1.5.0 LANGUAGES CXX)
33
option(tabulate_BUILD_TESTS OFF)
44
option(SAMPLES "Build Samples" OFF)
55

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<a href="https://github.com/p-ranav/tabulate/blob/master/LICENSE">
1313
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="license"/>
1414
</a>
15-
<img src="https://img.shields.io/badge/version-1.4-blue.svg?cacheSeconds=2592000" alt="version"/>
15+
<img src="https://img.shields.io/badge/version-1.5-blue.svg?cacheSeconds=2592000" alt="version"/>
1616
</p>
1717

1818
<p align="center">

clang-format.bash

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#!/usr/bin/env bash
2-
find ./include ./samples -type f \( -iname \*.cpp -o -iname \*.hpp \) | xargs clang-format -style="{ColumnLimit : 100}" -i
2+
find ./include ./samples -type f \
3+
\( -iname \*.cpp -o \
4+
\( -iname \*.hpp -a ! -name optional_lite.hpp -a ! -name variant_lite.hpp -a ! -name string_view_lite.hpp \) \) \
5+
| xargs clang-format -style=file -i

generate-single-include.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
python3 utils/amalgamate/amalgamate.py -c single_include.json -s .

include/tabulate/format.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,15 +405,16 @@ class Format {
405405
current_line_length = 0;
406406
}
407407

408-
// If the current word is too long to fit on a line even on it's own then
409-
// split the word up.
408+
// If the current word is too long to fit on a line even on it's own
409+
// then split the word up.
410410
while (get_sequence_length(word, locale, is_multi_byte_character_support_enabled) > width) {
411411
result += word.substr(0, width - 1) + "-";
412412
word = word.substr(width - 1);
413413
result += '\n';
414414
}
415415

416-
// Remove leading whitespace from the word so the new line starts flush to the left.
416+
// Remove leading whitespace from the word so the new line starts flush
417+
// to the left.
417418
word = trim_left(word);
418419
}
419420
result += word;
@@ -772,7 +773,8 @@ class Format {
772773

773774
std::string word = input.substr(start_index, index - start_index);
774775
char next_character = input.substr(index, 1)[0];
775-
// Unlike whitespace, dashes and the like should stick to the word occurring before it.
776+
// Unlike whitespace, dashes and the like should stick to the word
777+
// occurring before it.
776778
if (isspace(next_character)) {
777779
result.push_back(word);
778780
result.push_back(std::string(1, next_character));

include/tabulate/printer.hpp

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,19 @@ class Printer {
4646

4747
static void print_table(std::ostream &stream, TableInternal &table);
4848

49-
static void
50-
print_row_in_cell(std::ostream &stream, TableInternal &table,
51-
const std::pair<size_t, size_t> &index,
52-
const std::pair<size_t, size_t> &dimension,
53-
size_t num_columns, size_t row_index,
54-
const std::vector<std::string> &splitted_cell_text);
49+
static void print_row_in_cell(std::ostream &stream, TableInternal &table,
50+
const std::pair<size_t, size_t> &index,
51+
const std::pair<size_t, size_t> &dimension, size_t num_columns,
52+
size_t row_index,
53+
const std::vector<std::string> &splitted_cell_text);
5554

5655
static bool print_cell_border_top(std::ostream &stream, TableInternal &table,
5756
const std::pair<size_t, size_t> &index,
58-
const std::pair<size_t, size_t> &dimension,
59-
size_t num_columns);
60-
static bool
61-
print_cell_border_bottom(std::ostream &stream, TableInternal &table,
62-
const std::pair<size_t, size_t> &index,
63-
const std::pair<size_t, size_t> &dimension,
64-
size_t num_columns);
57+
const std::pair<size_t, size_t> &dimension, size_t num_columns);
58+
static bool print_cell_border_bottom(std::ostream &stream, TableInternal &table,
59+
const std::pair<size_t, size_t> &index,
60+
const std::pair<size_t, size_t> &dimension,
61+
size_t num_columns);
6562

6663
static void apply_element_style(std::ostream &stream, Color foreground_color,
6764
Color background_color,
@@ -72,26 +69,21 @@ class Printer {
7269
apply_font_style(stream, style);
7370
}
7471

75-
static void reset_element_style(std::ostream &stream) {
76-
stream << termcolor::reset;
77-
}
72+
static void reset_element_style(std::ostream &stream) { stream << termcolor::reset; }
7873

7974
private:
80-
static void print_content_left_aligned(std::ostream &stream,
81-
const std::string &cell_content,
82-
const Format &format,
83-
size_t text_with_padding_size,
75+
static void print_content_left_aligned(std::ostream &stream, const std::string &cell_content,
76+
const Format &format, size_t text_with_padding_size,
8477
size_t column_width) {
8578

8679
// Apply font style
87-
apply_element_style(stream, *format.font_color_,
88-
*format.font_background_color_, *format.font_style_);
80+
apply_element_style(stream, *format.font_color_, *format.font_background_color_,
81+
*format.font_style_);
8982
stream << cell_content;
9083
// Only apply font_style to the font
9184
// Not the padding. So calling apply_element_style with font_style = {}
9285
reset_element_style(stream);
93-
apply_element_style(stream, *format.font_color_,
94-
*format.font_background_color_, {});
86+
apply_element_style(stream, *format.font_color_, *format.font_background_color_, {});
9587

9688
if (text_with_padding_size < column_width) {
9789
for (size_t j = 0; j < (column_width - text_with_padding_size); ++j) {
@@ -100,10 +92,8 @@ class Printer {
10092
}
10193
}
10294

103-
static void print_content_center_aligned(std::ostream &stream,
104-
const std::string &cell_content,
105-
const Format &format,
106-
size_t text_with_padding_size,
95+
static void print_content_center_aligned(std::ostream &stream, const std::string &cell_content,
96+
const Format &format, size_t text_with_padding_size,
10797
size_t column_width) {
10898
auto num_spaces = column_width - text_with_padding_size;
10999
if (num_spaces % 2 == 0) {
@@ -112,14 +102,13 @@ class Printer {
112102
stream << " ";
113103

114104
// Apply font style
115-
apply_element_style(stream, *format.font_color_,
116-
*format.font_background_color_, *format.font_style_);
105+
apply_element_style(stream, *format.font_color_, *format.font_background_color_,
106+
*format.font_style_);
117107
stream << cell_content;
118108
// Only apply font_style to the font
119109
// Not the padding. So calling apply_element_style with font_style = {}
120110
reset_element_style(stream);
121-
apply_element_style(stream, *format.font_color_,
122-
*format.font_background_color_, {});
111+
apply_element_style(stream, *format.font_color_, *format.font_background_color_, {});
123112

124113
for (size_t j = 0; j < num_spaces / 2; ++j)
125114
stream << " ";
@@ -129,24 +118,21 @@ class Printer {
129118
stream << " ";
130119

131120
// Apply font style
132-
apply_element_style(stream, *format.font_color_,
133-
*format.font_background_color_, *format.font_style_);
121+
apply_element_style(stream, *format.font_color_, *format.font_background_color_,
122+
*format.font_style_);
134123
stream << cell_content;
135124
// Only apply font_style to the font
136125
// Not the padding. So calling apply_element_style with font_style = {}
137126
reset_element_style(stream);
138-
apply_element_style(stream, *format.font_color_,
139-
*format.font_background_color_, {});
127+
apply_element_style(stream, *format.font_color_, *format.font_background_color_, {});
140128

141129
for (size_t j = 0; j < num_spaces - num_spaces_before; ++j)
142130
stream << " ";
143131
}
144132
}
145133

146-
static void print_content_right_aligned(std::ostream &stream,
147-
const std::string &cell_content,
148-
const Format &format,
149-
size_t text_with_padding_size,
134+
static void print_content_right_aligned(std::ostream &stream, const std::string &cell_content,
135+
const Format &format, size_t text_with_padding_size,
150136
size_t column_width) {
151137
if (text_with_padding_size < column_width) {
152138
for (size_t j = 0; j < (column_width - text_with_padding_size); ++j) {
@@ -155,14 +141,13 @@ class Printer {
155141
}
156142

157143
// Apply font style
158-
apply_element_style(stream, *format.font_color_,
159-
*format.font_background_color_, *format.font_style_);
144+
apply_element_style(stream, *format.font_color_, *format.font_background_color_,
145+
*format.font_style_);
160146
stream << cell_content;
161147
// Only apply font_style to the font
162148
// Not the padding. So calling apply_element_style with font_style = {}
163149
reset_element_style(stream);
164-
apply_element_style(stream, *format.font_color_,
165-
*format.font_background_color_, {});
150+
apply_element_style(stream, *format.font_color_, *format.font_background_color_, {});
166151
}
167152

168153
static void apply_font_style(std::ostream &stream, FontStyle style) {
@@ -196,8 +181,7 @@ class Printer {
196181
}
197182
}
198183

199-
static void apply_foreground_color(std::ostream &stream,
200-
Color foreground_color) {
184+
static void apply_foreground_color(std::ostream &stream, Color foreground_color) {
201185
switch (foreground_color) {
202186
case Color::grey:
203187
stream << termcolor::grey;
@@ -229,8 +213,7 @@ class Printer {
229213
}
230214
}
231215

232-
static void apply_background_color(std::ostream &stream,
233-
Color background_color) {
216+
static void apply_background_color(std::ostream &stream, Color background_color) {
234217
switch (background_color) {
235218
case Color::grey:
236219
stream << termcolor::on_grey;

include/tabulate/table.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ class Table {
6060
public:
6161
Table() : table_(TableInternal::create()) {}
6262

63-
using Row_t =
64-
std::vector<variant<std::string, const char *, string_view, Table>>;
63+
using Row_t = std::vector<variant<std::string, const char *, string_view, Table>>;
6564

6665
Table &add_row(const Row_t &cells) {
6766

@@ -123,8 +122,7 @@ class Table {
123122

124123
class RowIterator {
125124
public:
126-
explicit RowIterator(std::vector<std::shared_ptr<Row>>::iterator ptr)
127-
: ptr(ptr) {}
125+
explicit RowIterator(std::vector<std::shared_ptr<Row>>::iterator ptr) : ptr(ptr) {}
128126

129127
RowIterator operator++() {
130128
++ptr;

0 commit comments

Comments
 (0)