diff --git a/example.cpp b/example.cpp index 2841dbb..d7e6bd3 100644 --- a/example.cpp +++ b/example.cpp @@ -27,7 +27,7 @@ int main(int argc, char *argv[]) return 1; } - Identiconpp identicon(5, 5, "ffffffff", {"000000ff", "000000"}); + Identiconpp identicon(5, 5, 0xffffffff, { 0x000000ff, 0x000000 }); return 0; } diff --git a/src/identiconpp.cpp b/src/identiconpp.cpp index 6f048d0..fcaf2de 100644 --- a/src/identiconpp.cpp +++ b/src/identiconpp.cpp @@ -20,26 +20,12 @@ #include "debug.hpp" Identiconpp::Identiconpp(const uint8_t rows, const uint8_t columns, - const string &background, - const vector &foreground) + const uint32_t background, + const vector &foreground) : _rows(rows) , _columns(columns) , _background(background) , _foreground(foreground) { - // TODO: Check rows and columns - if (_background.size() != 8) - { - throw std::invalid_argument("Background color has the wrong format: " + - _background); - } - for (const string &color : _foreground) - { - if (color.size() != 8) - { - throw std::invalid_argument("Foreground color has the wrong format: " + - color); - } - } } diff --git a/src/identiconpp.hpp b/src/identiconpp.hpp index 43ab1a0..9e90fa6 100644 --- a/src/identiconpp.hpp +++ b/src/identiconpp.hpp @@ -19,6 +19,7 @@ #include using std::uint8_t; +using std::uint32_t; using std::string; using std::vector; @@ -43,12 +44,12 @@ public: * @param foreground vector of foreground colors */ explicit Identiconpp(const uint8_t rows, const uint8_t columns, - const string &background = "ffffffff", - const vector &foreground = { "000000ff" } ); + const uint32_t background = 0xffffffff, + const vector &foreground = { 0x000000ff } ); private: const uint8_t _rows; const uint8_t _columns; - const string _background; - const vector _foreground; + const uint32_t _background; + const vector _foreground; };