Move fourcc into seperate files

This commit is contained in:
Danny Robson 2012-11-09 15:11:02 +11:00
parent 8cb01aae18
commit d1c780aa30
3 changed files with 19 additions and 9 deletions

View File

@ -35,6 +35,8 @@ UTIL_FILES = \
fletcher.hpp \
float.cpp \
float.hpp \
fourcc.cpp \
fourcc.hpp \
fwd.hpp \
guid.cpp \
guid.hpp \

View File

@ -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];

View File

@ -23,16 +23,18 @@
#include <iostream>
#include <cstdint>
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