-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
global code restyle (snake -> camel)
- Loading branch information
Showing
114 changed files
with
2,006 additions
and
2,004 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef __DK_MEM_H__ | ||
#define __DK_MEM_H__ | ||
|
||
#include <stdlib.h> /* too prevent including of it after defines in this file */ | ||
#include "allocs/MemStd.h" | ||
|
||
#define mem_alloc(size) Mem::alloc(__FILE__, __func__, __LINE__, size) | ||
#define mem_dealloc(ptr) Mem::dealloc(__FILE__, __func__, __LINE__, ptr) | ||
#define mem_realloc(ptr, size) Mem::realloc(__FILE__, __func__, __LINE__, ptr, size) | ||
|
||
#define mem_create(T, ...) Mem::create<T>(__FILE__, __func__, __LINE__ __VA_OPT__(,) __VA_ARGS__) | ||
#define mem_destroy(ptr) Mem::destroy(__FILE__, __func__, __LINE__, ptr) | ||
|
||
namespace dk | ||
{ | ||
|
||
using Mem = MemStd; | ||
|
||
} | ||
|
||
#endif // !__DK_MEM_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef __DK_RESOURCE_GROUP_H__ | ||
#define __DK_RESOURCE_GROUP_H__ | ||
|
||
#include "Resource.h" | ||
#include "containers/Vector.h" | ||
#include "containers/HashTable.h" | ||
#include "containers/StringView.h" | ||
|
||
namespace dk | ||
{ | ||
|
||
class ResourceGroup final: public Resource | ||
{ | ||
private: | ||
HashTable<StringView, Resource*> m_res_table; | ||
Vector<Resource*> m_resources; | ||
|
||
public: | ||
~ResourceGroup() noexcept override; | ||
|
||
Resource* operator[](StringView tag) const noexcept; | ||
|
||
bool is_exists(const Resource* res) const noexcept; | ||
|
||
void add(Resource* res) noexcept; | ||
void add(Resource* res, StringView tag) noexcept; | ||
|
||
bool try_add(Resource* res) noexcept; | ||
bool try_add(Resource* res, StringView tag) noexcept; | ||
|
||
void remove(Resource* res) noexcept; | ||
void remove(StringView tag) noexcept; | ||
void remove_all() noexcept; | ||
|
||
void destroy(Resource* res) noexcept; | ||
void destroy(StringView tag) noexcept; | ||
void destroy_all() noexcept; | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_RESOURCE_GROUP_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef __DK_MEM_STD_H__ | ||
#define __DK_MEM_STD_H__ | ||
|
||
#include <utility> | ||
#include "containers/StringView.h" | ||
|
||
namespace dk | ||
{ | ||
|
||
class MemStd | ||
{ | ||
public: | ||
static void* alloc(StringView file, StringView func, size_t line, size_t size) noexcept; | ||
static void dealloc(StringView file, StringView func, size_t line, void* ptr) noexcept; | ||
static void* realloc(StringView file, StringView func, size_t line, void* ptr, size_t new_size) noexcept; | ||
|
||
template<typename T, typename... Args> | ||
static T* create(StringView file, StringView func, size_t line, Args&&... args) noexcept | ||
{ | ||
return new(alloc(file, func, line, sizeof(T))) T(std::forward<Args>(args)...); | ||
} | ||
|
||
template<typename T> | ||
static void destroy(StringView file, StringView func, size_t line, T* t) noexcept | ||
{ | ||
if (t != nullptr) { | ||
t->~T(); | ||
dealloc(file, func, line, t); | ||
} | ||
} | ||
}; | ||
|
||
} | ||
|
||
#endif // !__DK_MEM_STD_H__ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.