From dbbef17103dc21c085c8b5713433fb730a5f8d3a Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 11 Dec 2016 12:36:04 +0100 Subject: Move `util` namespace classes into matching folder --- src/box_indicator.h | 40 ---------------------------------------- src/box_traverser.h | 26 -------------------------- src/util/box_indicator.h | 40 ++++++++++++++++++++++++++++++++++++++++ src/util/box_traverser.h | 26 ++++++++++++++++++++++++++ src/world.h | 2 +- 5 files changed, 67 insertions(+), 67 deletions(-) delete mode 100644 src/box_indicator.h delete mode 100644 src/box_traverser.h create mode 100644 src/util/box_indicator.h create mode 100644 src/util/box_traverser.h diff --git a/src/box_indicator.h b/src/box_indicator.h deleted file mode 100644 index db750e4..0000000 --- a/src/box_indicator.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef LIFE_SRC_BOX_INDICATOR_ -#define LIFE_SRC_BOX_INDICATOR_ - -namespace life { -namespace util { - -class BoxIndicator { - public: - BoxIndicator( - const std::size_t offset_x, - const std::size_t offset_y, - const std::size_t size_x, - const std::size_t size_y): - a_x_{offset_x}, - a_y_{offset_y}, - b_x_{a_x_ + size_x}, - b_y_{a_y_ + size_y} { } - - BoxIndicator(const std::size_t size_x, const std::size_t size_y): - BoxIndicator(0, 0, size_x, size_y) { } - - bool operator()(const std::size_t x, const std::size_t y) const { - return x >= this->a_x_ - && x < this->b_x_ - && y >= this->a_y_ - && y < this->b_y_; - } - - protected: - const std::size_t a_x_; - const std::size_t a_y_; - const std::size_t b_x_; - const std::size_t b_y_; - -}; - -} -} - -#endif // LIFE_SRC_BOX_INDICATOR_ diff --git a/src/box_traverser.h b/src/box_traverser.h deleted file mode 100644 index 1bc0edd..0000000 --- a/src/box_traverser.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef LIFE_SRC_BOX_TRAVERSER_ -#define LIFE_SRC_BOX_TRAVERSER_ - -#include - -#include "box_indicator.h" - -namespace life { -namespace util { - -struct BoxTraverser : public BoxIndicator { - using BoxIndicator::BoxIndicator; - - void for_each(const std::function f) const { - for ( std::size_t x = this->a_x_; x < this->b_x_; x++ ) { - for ( std::size_t y = this->a_y_; y < this->b_y_; y++ ) { - f(x, y); - } - } - } -}; - -} -} - -#endif // LIFE_SRC_BOX_TRAVERSER_ diff --git a/src/util/box_indicator.h b/src/util/box_indicator.h new file mode 100644 index 0000000..c0493c7 --- /dev/null +++ b/src/util/box_indicator.h @@ -0,0 +1,40 @@ +#ifndef LIFE_SRC_UTIL_BOX_INDICATOR_ +#define LIFE_SRC_UTIL_BOX_INDICATOR_ + +namespace life { +namespace util { + +class BoxIndicator { + public: + BoxIndicator( + const std::size_t offset_x, + const std::size_t offset_y, + const std::size_t size_x, + const std::size_t size_y): + a_x_{offset_x}, + a_y_{offset_y}, + b_x_{a_x_ + size_x}, + b_y_{a_y_ + size_y} { } + + BoxIndicator(const std::size_t size_x, const std::size_t size_y): + BoxIndicator(0, 0, size_x, size_y) { } + + bool operator()(const std::size_t x, const std::size_t y) const { + return x >= this->a_x_ + && x < this->b_x_ + && y >= this->a_y_ + && y < this->b_y_; + } + + protected: + const std::size_t a_x_; + const std::size_t a_y_; + const std::size_t b_x_; + const std::size_t b_y_; + +}; + +} +} + +#endif // LIFE_SRC_UTIL_BOX_INDICATOR_ diff --git a/src/util/box_traverser.h b/src/util/box_traverser.h new file mode 100644 index 0000000..cb7dfeb --- /dev/null +++ b/src/util/box_traverser.h @@ -0,0 +1,26 @@ +#ifndef LIFE_SRC_UTIL_BOX_TRAVERSER_ +#define LIFE_SRC_UTIL_BOX_TRAVERSER_ + +#include + +#include "box_indicator.h" + +namespace life { +namespace util { + +struct BoxTraverser : public BoxIndicator { + using BoxIndicator::BoxIndicator; + + void for_each(const std::function f) const { + for ( std::size_t x = this->a_x_; x < this->b_x_; x++ ) { + for ( std::size_t y = this->a_y_; y < this->b_y_; y++ ) { + f(x, y); + } + } + } +}; + +} +} + +#endif // LIFE_SRC_UTIL_BOX_TRAVERSER_ diff --git a/src/world.h b/src/world.h index b60c658..fde9762 100644 --- a/src/world.h +++ b/src/world.h @@ -6,7 +6,7 @@ #include #include -#include "box_traverser.h" +#include "util/box_traverser.h" namespace life { -- cgit v1.2.3