Skip to content

Commit c687930

Browse files
committed
apply format, apply cpplint
1 parent 59998b8 commit c687930

21 files changed

Lines changed: 96 additions & 51 deletions

include/fifechan/widgets/activitybar.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
// Platform config include
88
#include "fifechan/platform.hpp"
99

10+
// Standard library includes
11+
#include <list>
12+
1013
// Project headers (subdirs before local)
1114
#include "fifechan/listeners/actionlistener.hpp"
1215
#include "fifechan/widgets/container.hpp"

include/fifechan/widgets/activitybaritem.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace fcn
3333
* @param icon The icon to display (can be image path or emoji).
3434
* @param tooltip The tooltip text.
3535
*/
36-
ActivityBarItem(std::string const & icon, std::string const & tooltip = "", Widget* panel = nullptr);
36+
explicit ActivityBarItem(std::string const & icon, std::string const & tooltip = "", Widget* panel = nullptr);
3737

3838
~ActivityBarItem() override;
3939

include/fifechan/widgets/menubar.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
// Platform config include
88
#include "fifechan/platform.hpp"
99

10+
// Standard library includes
11+
#include <string>
12+
1013
// Project headers (subdirs before local)
1114
#include "fifechan/listeners/actionlistener.hpp"
1215
#include "fifechan/listeners/keylistener.hpp"

include/fifechan/widgets/primarypanel.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
// Platform config include
88
#include "fifechan/platform.hpp"
99

10+
// Standard library includes
11+
#include <string>
12+
1013
// Project headers (subdirs before local)
1114
#include "fifechan/widgets/panel.hpp"
1215

include/fifechan/widgets/secondarypanel.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
// Platform config include
88
#include "fifechan/platform.hpp"
99

10+
// Standard library includes
11+
#include <string>
12+
1013
// Project headers (subdirs before local)
1114
#include "fifechan/widgets/panel.hpp"
1215

src/imagefont.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <algorithm>
1010
#include <iostream>
1111
#include <map>
12+
#include <numeric>
1213
#include <sstream>
1314
#include <string>
1415
#include <utility>
@@ -178,7 +179,8 @@ namespace fcn
178179
std::ostringstream os;
179180
os << "Image " << mFilename << " is corrupt or uses wrong separator.\n"
180181
<< "Expected: " << expected << " glyphs, Found: " << found.size() << "\n"
181-
<< "Detected separator: R:" << (int)sep.r << " G:" << (int)sep.g << " B:" << (int)sep.b << "\n"
182+
<< "Detected separator: R:" << static_cast<int>(sep.r) << " G:" << static_cast<int>(sep.g)
183+
<< " B:" << static_cast<int>(sep.b) << "\n"
182184
<< "Suggestion: Use ExplicitColor strategy with magenta (255,0,255)";
183185
throwException(os.str());
184186
}
@@ -189,19 +191,19 @@ namespace fcn
189191

190192
if (config.verbose) {
191193
std::cerr << "[ImageFont] Loaded '" << mFilename << "' ExpectedGlyphs=" << expected
192-
<< " Found=" << found.size() << " Separator=R:" << (int)sep.r << " G:" << (int)sep.g
193-
<< " B:" << (int)sep.b << "\n";
194+
<< " Found=" << found.size() << " Separator=R:" << static_cast<int>(sep.r)
195+
<< " G:" << static_cast<int>(sep.g) << " B:" << static_cast<int>(sep.b) << "\n";
194196
for (size_t i = 0; i < glyphs.size(); ++i) {
195197
unsigned char const c = static_cast<unsigned char>(glyphs[i]);
196198
Rectangle const & r = mGlyph[c];
197-
std::cerr << " glyph '" << glyphs[i] << "' (" << (int)c << ") -> x=" << r.x << " y=" << r.y
198-
<< " w=" << r.width << " h=" << r.height << "\n";
199+
std::cerr << " glyph '" << glyphs[i] << "' (" << static_cast<int>(c) << ") -> x=" << r.x
200+
<< " y=" << r.y << " w=" << r.width << " h=" << r.height << "\n";
199201
}
200202
}
201203

202-
mHeight = 0;
203-
for (auto const & r : found)
204-
mHeight = std::max(mHeight, r.height);
204+
mHeight = std::accumulate(found.begin(), found.end(), 0, [](int maxHeight, auto const & r) {
205+
return std::max(maxHeight, r.height);
206+
});
205207

206208
mImage->convertToDisplayFormat();
207209
mRowSpacing = 0;
@@ -320,7 +322,8 @@ namespace fcn
320322
std::ostringstream os;
321323
os << "Image " << mFilename << " is corrupt or uses wrong separator.\n"
322324
<< "Expected: " << expected << " glyphs, Found: " << found.size() << "\n"
323-
<< "Detected separator: R:" << (int)sep.r << " G:" << (int)sep.g << " B:" << (int)sep.b << "\n"
325+
<< "Detected separator: R:" << static_cast<int>(sep.r) << " G:" << static_cast<int>(sep.g)
326+
<< " B:" << static_cast<int>(sep.b) << "\n"
324327
<< "Suggestion: Use ExplicitColor strategy with magenta (255,0,255)";
325328
throwException(os.str());
326329
}
@@ -329,9 +332,9 @@ namespace fcn
329332
mGlyph[static_cast<unsigned char>(glyphs[i])] = found[i];
330333
}
331334

332-
mHeight = 0;
333-
for (auto const & r : found)
334-
mHeight = std::max(mHeight, r.height);
335+
mHeight = std::accumulate(found.begin(), found.end(), 0, [](int maxHeight, auto const & r) {
336+
return std::max(maxHeight, r.height);
337+
});
335338

336339
mImage->convertToDisplayFormat();
337340
mRowSpacing = 0;
@@ -399,7 +402,8 @@ namespace fcn
399402
std::ostringstream os;
400403
os << "Image " << mFilename << " is corrupt or uses wrong separator.\n"
401404
<< "Expected: " << expected << " glyphs, Found: " << found.size() << "\n"
402-
<< "Detected separator: R:" << (int)sep.r << " G:" << (int)sep.g << " B:" << (int)sep.b << "\n"
405+
<< "Detected separator: R:" << static_cast<int>(sep.r) << " G:" << static_cast<int>(sep.g)
406+
<< " B:" << static_cast<int>(sep.b) << "\n"
403407
<< "Suggestion: Use ExplicitColor strategy with magenta (255,0,255)";
404408
throwException(os.str());
405409
}

src/widgets/activitybaritem.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
// Project headers
55
#include "fifechan/widgets/activitybaritem.hpp"
66

7+
// Standard library includes
8+
#include <string>
9+
10+
// Project headers (subdirs before local)
711
#include "fifechan/widgets/label.hpp"
812

913
namespace fcn

src/widgets/menubar.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// Corresponding header include
55
#include "fifechan/widgets/menubar.hpp"
66

7+
// Standard library includes
8+
#include <string>
9+
710
// Project headers
811
#include "fifechan/graphics.hpp"
912
#include "fifechan/widgets/menuitem.hpp"

src/widgets/menuitem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
// Corresponding header include
55
#include "fifechan/widgets/menuitem.hpp"
66

7+
// Standard library includes
8+
#include <algorithm>
9+
#include <memory>
10+
#include <string>
11+
712
// Project headers
813
#include "fifechan/font.hpp"
914
#include "fifechan/graphics.hpp"

src/widgets/menupopup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include "fifechan/widgets/menupopup.hpp"
66

77
// Standard library includes
8+
#include <algorithm>
9+
#include <memory>
810
#include <unordered_map>
911

1012
// Project headers

0 commit comments

Comments
 (0)