Namespaced everything
This commit is contained in:
parent
ec3d796774
commit
5cdd4f8835
3 changed files with 170 additions and 160 deletions
|
@ -4,6 +4,8 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#define BUFFER_SIZE 1024
|
#define BUFFER_SIZE 1024
|
||||||
|
|
||||||
|
namespace file_reader
|
||||||
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct buffer
|
struct buffer
|
||||||
{
|
{
|
||||||
|
@ -81,3 +83,4 @@ void buffer<T>::allocate(size_t s)
|
||||||
allocations++;
|
allocations++;
|
||||||
allocated += s;
|
allocated += s;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <print>
|
#include <print>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#define read_comp(size, ptr, t) const_for_<size>([&](auto i){read_var<std::tuple_element_t<i.value, std::remove_cvref_t<decltype(t)>>>::call(std::get<i.value>(t), &ptr);});
|
#define read_comp(size, ptr, t) ::file_reader::const_for_<size>([&](auto i){::file_reader::read_var<std::tuple_element_t<i.value, std::remove_cvref_t<decltype(t)>>>::call(std::get<i.value>(t), &ptr);});
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <libkern/OSByteOrder.h>
|
#include <libkern/OSByteOrder.h>
|
||||||
|
|
||||||
|
@ -26,6 +26,9 @@
|
||||||
#define le64toh(x) OSSwapLittleToHostInt64(x)
|
#define le64toh(x) OSSwapLittleToHostInt64(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
namespace file_reader
|
||||||
|
{
|
||||||
struct parsing_buffer
|
struct parsing_buffer
|
||||||
{
|
{
|
||||||
parsing_buffer(buffer<char> &b)
|
parsing_buffer(buffer<char> &b)
|
||||||
|
@ -122,3 +125,4 @@ template <auto N, typename F> constexpr void const_for_(F&& func)
|
||||||
if constexpr (N > 0)
|
if constexpr (N > 0)
|
||||||
const_for_each_(std::make_integer_sequence<decltype(N), N>{}, std::forward<F>(func));
|
const_for_each_(std::make_integer_sequence<decltype(N), N>{}, std::forward<F>(func));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include <print>
|
#include <print>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
namespace file_reader
|
||||||
|
{
|
||||||
enum RESULT
|
enum RESULT
|
||||||
{
|
{
|
||||||
READ_CORRECT, //read was as expected
|
READ_CORRECT, //read was as expected
|
||||||
|
@ -193,3 +195,4 @@ class file_reader
|
||||||
off_t file_size;
|
off_t file_size;
|
||||||
off_t file_size_remaining;
|
off_t file_size_remaining;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue