Skip to content

Commit

Permalink
Code formatting: Namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-dejoue committed Jan 24, 2024
1 parent 6adf424 commit 99aa7c9
Show file tree
Hide file tree
Showing 73 changed files with 169 additions and 296 deletions.
3 changes: 1 addition & 2 deletions src/cli/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#include <vector>


namespace
{
namespace {

struct ValidationModeData
{
Expand Down
8 changes: 3 additions & 5 deletions src/gui/src/draw_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
#include <vector>


namespace picross_grid
{
namespace
{
namespace picross_grid {
namespace {
// Grid background
constexpr ImU32 ColorGridBack = IM_COL32(255, 255, 255, 255);
constexpr ImU32 ColorGridOutline = IM_COL32(224, 224, 224, 255);
Expand Down Expand Up @@ -128,7 +126,7 @@ namespace
}
}

} // Anonymous namespace
} // namespace


size_t get_tile_size(int size_enum)
Expand Down
3 changes: 1 addition & 2 deletions src/gui/src/draw_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include <cstddef>

namespace picross_grid
{
namespace picross_grid {

size_t get_tile_size(int size_enum);
void draw_background_grid(ImDrawList* draw_list, ImVec2 tl_corner, size_t tile_size, size_t width, size_t height, bool outline = false, bool five_tile_outline = false);
Expand Down
5 changes: 2 additions & 3 deletions src/gui/src/glfw_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include <GLFW/glfw3.h>


namespace
{
namespace {

constexpr int TARGET_OPENGL_MAJOR = 3;
constexpr int TARGET_OPENGL_MINOR = 0;
Expand All @@ -23,7 +22,7 @@ void glfw_error_callback(int error, const char* description)
s_glfw_err_handler(stdutils::io::Severity::ERR, out.str());
}

} // Anonymous namespace
} // namespace

GLFWWindowContext::GLFWWindowContext(int width, int height, const std::string_view& title, const stdutils::io::ErrorHandler* err_handler)
: m_window_ptr(nullptr)
Expand Down
6 changes: 2 additions & 4 deletions src/gui/src/grid_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include <utility>


namespace
{
namespace {
constexpr std::string_view GRID_INFO = "Grid Info";
constexpr std::string_view SOLVER_STATS = "Solver Stats";
constexpr std::string_view GRID_CONSTRAINTS = "Grid Constraints";
Expand Down Expand Up @@ -236,8 +235,7 @@ void GridInfo::refresh_stats_info()
solver_stats_flag = false;
}

namespace
{
namespace {
std::size_t key_col_width(const GridInfo::InfoMap& map)
{
std::size_t result = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/gui/src/imgui_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include "glfw_context.h"


namespace ImGui
{
namespace ImGui {

void HelpMarker(const char* desc)
{
Expand Down
3 changes: 1 addition & 2 deletions src/gui/src/imgui_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ inline ImVec2 to_imgui_vec2(ScreenPos pos)
return ImVec2(pos.x, pos.y);
}

namespace ImGui
{
namespace ImGui {
void HelpMarker(const char* desc); // Function taken from imgui_demo.cpp
void SetNextWindowPosAndSize(const WindowLayout& window_layout, ImGuiCond cond = 0);
}
Expand Down
5 changes: 2 additions & 3 deletions src/gui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
#include <vector>


namespace
{
namespace {

void err_callback(stdutils::io::SeverityCode sev, std::string_view msg)
{
Expand Down Expand Up @@ -121,7 +120,7 @@ void main_menu_bar(AppWindows& windows, bool& application_should_close, bool& gu
}
}

} // Anonymous namespace
} // namespace


int main(int argc, char *argv[])
Expand Down
5 changes: 2 additions & 3 deletions src/gui/src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#include <cassert>
#include <limits>

namespace
{
namespace {

Settings::TileLimits tile_settings_limits()
{
Expand Down Expand Up @@ -61,7 +60,7 @@ namespace
return result;
}

} // Anonymous namespace
} // namespace

Settings::Settings()
{
Expand Down
3 changes: 1 addition & 2 deletions src/gui/src/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#include <imgui_wrap.h>


namespace
{
namespace {
constexpr ImColor WindowBackgroundColor_Classic(29, 75, 99, 217);
constexpr ImColor WindowBackgroundColor_Dark(4, 8, 25, 240);
constexpr ImColor WindowMainBackgroundColor_Classic(35, 92, 121, 255);
Expand Down
4 changes: 1 addition & 3 deletions src/picross/include/picross/picross.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
#include <string_view>
#include <vector>


namespace picross
{
namespace picross {

/*
* Get the version of the library
Expand Down
4 changes: 1 addition & 3 deletions src/picross/include/picross/picross_input_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
#include <utility>
#include <vector>


namespace picross
{
namespace picross {

/*
* InputGrid class
Expand Down
7 changes: 2 additions & 5 deletions src/picross/include/picross/picross_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include <string_view>
#include <vector>


namespace picross
{
namespace picross {

/*
* IOGrid class
Expand All @@ -38,8 +36,7 @@ struct IOGrid
std::optional<OutputGrid> m_goal;
};

namespace io
{
namespace io {

/*
* IO error handling
Expand Down
4 changes: 1 addition & 3 deletions src/picross/include/picross/picross_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#include <ostream>
#include <string>


namespace picross
{
namespace picross {

//
// The observer is a function object with the following signature:
Expand Down
3 changes: 1 addition & 2 deletions src/picross/include/picross/picross_output_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include <string>
#include <vector>

namespace picross
{
namespace picross {

/*
* A tile is the base element to construct lines and grids: it can be empty or filled
Expand Down
4 changes: 1 addition & 3 deletions src/picross/include/picross/picross_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#include <ostream>
#include <vector>


namespace picross
{
namespace picross {

/*
* GridStats
Expand Down
8 changes: 3 additions & 5 deletions src/picross/src/binomial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

#include <cstddef>

namespace picross
{
namespace BinomialCoefficients
{
namespace picross {
namespace binomial {

Rep Cache::partition_n_elts_into_k_buckets(unsigned int nb_elts, unsigned int nb_buckets)
{
Expand Down Expand Up @@ -55,5 +53,5 @@ Rep Cache::partition_n_elts_into_k_buckets(unsigned int nb_elts, unsigned int nb
return binomial_number;
}

} // namespace BinomialCoefficients
} // namespace binomial
} // namespace picross
9 changes: 4 additions & 5 deletions src/picross/src/binomial.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
#include <limits>
#include <vector>

namespace picross
{
namespace BinomialCoefficients
{
namespace picross {
namespace binomial {

using Rep = std::uint32_t;

/*
Expand Down Expand Up @@ -82,5 +81,5 @@ class Cache
std::vector<Rep> binomial_numbers;
};

} // namespace BinomialCoefficients
} // namespace binomial
} // namespace picross
9 changes: 3 additions & 6 deletions src/picross/src/grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@
#include <utility>


namespace picross
{
namespace picross {

namespace
{
namespace Tiles
{
namespace {
namespace Tiles {
inline bool set(Tile& t, Tile val)
{
const bool changed = (val != t);
Expand Down
4 changes: 1 addition & 3 deletions src/picross/src/grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
#include <string_view>
#include <vector>

namespace picross {

namespace picross
{
class Grid
{
public:
Expand Down Expand Up @@ -99,5 +98,4 @@ class GridSnapshot
Grid::Container m_tiles;
};


} // namespace picross
6 changes: 2 additions & 4 deletions src/picross/src/input_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@

#include <sstream>


namespace picross
{
namespace picross {

InputGrid::InputGrid(const Constraints& rows, const Constraints& cols, const std::string_view name)
: m_rows(rows)
Expand Down Expand Up @@ -99,4 +97,4 @@ std::pair<bool, std::string> check_input_grid(const InputGrid& grid)
return std::make_pair(true, std::string());
}

} // namespace picross
} // namespace picross
4 changes: 1 addition & 3 deletions src/picross/src/line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
#include <string>
#include <vector>


namespace picross
{
namespace picross {

Line::Line(Line::Type type, Line::Index index, size_t size, Tile init_tile) :
m_type(type),
Expand Down
4 changes: 1 addition & 3 deletions src/picross/src/line.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

#include <cassert>


namespace picross
{
namespace picross {

/*
* Line range
Expand Down
Loading

0 comments on commit 99aa7c9

Please sign in to comment.