Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Base/Aliases.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

namespace ProjectA {
namespace USER_NAMESPACE {
typedef std::int8_t sint8;
typedef std::int16_t sint16;
typedef std::int32_t sint32;
Expand Down
4 changes: 4 additions & 0 deletions Base/Base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include <cstdint>
#include <cstdlib>

#ifndef USER_NAMESPACE
#error "ModuleBase: Please define USER_NAMESPACE with a user namespace name."
#endif

#include "Context.hpp"
#include "Macros.hpp"

Expand Down
2 changes: 1 addition & 1 deletion Base/Bit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Returns a number with a single set bit at `index`.
#define BIT(index) (1 << (index))

namespace ProjectA {
namespace USER_NAMESPACE {
// Returns the minimum number of bits necessary to store `value`.
inline uint8 countBits(uint64 value) {
uint8 bitCount = 0;
Expand Down
2 changes: 1 addition & 1 deletion Base/Cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

namespace ProjectA {
namespace USER_NAMESPACE {
template<typename O, typename I>
typename std::enable_if<std::is_const<typename std::remove_pointer<O>::type>::value, O>::type pointer_cast(I pointer) {
return static_cast<O>(static_cast<const void*>(pointer));
Expand Down
2 changes: 1 addition & 1 deletion Base/Limits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

namespace ProjectA {
namespace USER_NAMESPACE {
// Returns the minimum value representable by `T`.
template<typename T>
constexpr T min() noexcept;
Expand Down
4 changes: 2 additions & 2 deletions Base/Types/base_sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

#pragma once

namespace ProjectA {
namespace USER_NAMESPACE {
// TODO(upgrade): Allocate from arena.
template<typename T>
class base_sequence {
private:
protected:
static T* allocate(uint64 count) {
return new T[count]();
}
Expand Down
2 changes: 1 addition & 1 deletion Base/Types/base_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

namespace ProjectA {
namespace USER_NAMESPACE {
template<typename T>
class base_view {
public:
Expand Down
11 changes: 10 additions & 1 deletion Base/Types/sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Types/base_sequence.hpp"
#include "Types/base_view.hpp"

namespace ProjectA {
namespace USER_NAMESPACE {
// A container that encapsulates a dynamic size array.
// Unlike `std::vector<T>`, `sequence<T>` is not resizeable.
// It *should* be used when the number of elements is known at runtime, before creating the sequence.
Expand Down Expand Up @@ -42,5 +42,14 @@ namespace ProjectA {
sequence<char8>(const sequence<char8>& sequence) :
sequence(sequence.begin(), sequence.count())
{}

void operator=(const sequence<char8>& sequence) {
free(_data);

_count = sequence._count;
_data = allocate(_count + 1);

copy(sequence.begin(), sequence.end(), _data);
}
};
}
2 changes: 1 addition & 1 deletion Base/Types/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "Types/base_view.hpp"

namespace ProjectA {
namespace USER_NAMESPACE {
template<typename T>
class view : public base_view<T> {
public:
Expand Down
2 changes: 1 addition & 1 deletion Base/Utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

namespace ProjectA {
namespace USER_NAMESPACE {
template<typename T>
inline void copy(const T* sourceBegin, const T* sourceEnd, T* destination) {
std::copy(sourceBegin, sourceEnd, destination);
Expand Down