Move fourcc into seperate files
This commit is contained in:
parent
8cb01aae18
commit
d1c780aa30
@ -35,6 +35,8 @@ UTIL_FILES = \
|
||||
fletcher.hpp \
|
||||
float.cpp \
|
||||
float.hpp \
|
||||
fourcc.cpp \
|
||||
fourcc.hpp \
|
||||
fwd.hpp \
|
||||
guid.cpp \
|
||||
guid.hpp \
|
||||
|
@ -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];
|
||||
|
18
fourcc.hpp
18
fourcc.hpp
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user