Move fourcc into seperate files
This commit is contained in:
parent
8cb01aae18
commit
d1c780aa30
@ -35,6 +35,8 @@ UTIL_FILES = \
|
|||||||
fletcher.hpp \
|
fletcher.hpp \
|
||||||
float.cpp \
|
float.cpp \
|
||||||
float.hpp \
|
float.hpp \
|
||||||
|
fourcc.cpp \
|
||||||
|
fourcc.hpp \
|
||||||
fwd.hpp \
|
fwd.hpp \
|
||||||
guid.cpp \
|
guid.cpp \
|
||||||
guid.hpp \
|
guid.hpp \
|
||||||
|
@ -19,6 +19,12 @@
|
|||||||
|
|
||||||
#include "fourcc.hpp"
|
#include "fourcc.hpp"
|
||||||
|
|
||||||
|
using util::fourcc;
|
||||||
|
using std::ostream;
|
||||||
|
|
||||||
|
|
||||||
|
static_assert (sizeof(fourcc) == 4, "fourcc must be a 4 byte POD");
|
||||||
|
|
||||||
|
|
||||||
fourcc
|
fourcc
|
||||||
fourcc::from_chars (uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
|
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
|
||||||
fourcc::from_str (const char data[4]) {
|
fourcc::from_string (const char data[4]) {
|
||||||
fourcc lhs;
|
fourcc lhs;
|
||||||
|
|
||||||
lhs.data[0] = (uint8_t)data[0];
|
lhs.data[0] = (uint8_t)data[0];
|
||||||
|
10
fourcc.hpp
10
fourcc.hpp
@ -23,16 +23,18 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
struct fourcc {
|
namespace util {
|
||||||
|
struct fourcc {
|
||||||
uint8_t data[4];
|
uint8_t data[4];
|
||||||
|
|
||||||
static fourcc from_str(const char[4]);
|
static fourcc from_string(const char[4]);
|
||||||
static fourcc from_chars(uint8_t, uint8_t, uint8_t, uint8_t);
|
static fourcc from_chars(uint8_t, uint8_t, uint8_t, uint8_t);
|
||||||
|
|
||||||
bool operator== (const char[4]) const;
|
bool operator== (const char[4]) const;
|
||||||
operator uint32_t (void) const;
|
operator uint32_t (void) const;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& operator<< (std::ostream&, fourcc);
|
std::ostream& operator<< (std::ostream&, util::fourcc);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user