diff --git a/Makefile.am b/Makefile.am index 4e778af8..2acd472c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,6 +35,8 @@ UTIL_FILES = \ fletcher.hpp \ float.cpp \ float.hpp \ + fourcc.cpp \ + fourcc.hpp \ fwd.hpp \ guid.cpp \ guid.hpp \ diff --git a/fourcc.cpp b/fourcc.cpp index 485a8182..2c96646a 100644 --- a/fourcc.cpp +++ b/fourcc.cpp @@ -19,6 +19,12 @@ #include "fourcc.hpp" +using util::fourcc; +using std::ostream; + + +static_assert (sizeof(fourcc) == 4, "fourcc must be a 4 byte POD"); + fourcc fourcc::from_chars (uint8_t a, uint8_t b, uint8_t c, uint8_t d) { @@ -34,7 +40,7 @@ fourcc::from_chars (uint8_t a, uint8_t b, uint8_t c, uint8_t d) { fourcc -fourcc::from_str (const char data[4]) { +fourcc::from_string (const char data[4]) { fourcc lhs; lhs.data[0] = (uint8_t)data[0]; diff --git a/fourcc.hpp b/fourcc.hpp index ed8eef1b..356e6dc2 100644 --- a/fourcc.hpp +++ b/fourcc.hpp @@ -23,16 +23,18 @@ #include #include -struct fourcc { - uint8_t data[4]; +namespace util { + struct fourcc { + uint8_t data[4]; - static fourcc from_str(const char[4]); - static fourcc from_chars(uint8_t, uint8_t, uint8_t, uint8_t); + static fourcc from_string(const char[4]); + static fourcc from_chars(uint8_t, uint8_t, uint8_t, uint8_t); - bool operator== (const char[4]) const; - operator uint32_t (void) const; -}; + bool operator== (const char[4]) const; + operator uint32_t (void) const; + }; +} -std::ostream& operator<< (std::ostream&, fourcc); +std::ostream& operator<< (std::ostream&, util::fourcc); #endif