Add docker file
This commit is contained in:
@ -11,19 +11,23 @@ namespace Tesses::Framework::Filesystem
|
||||
public:
|
||||
static VFSPath RelativeCurrentDirectory();
|
||||
bool relative;
|
||||
static std::vector<std::string> SplitPath(std::string path,bool native=false);
|
||||
static std::vector<std::string> SplitPath(std::string path);
|
||||
std::vector<std::string> path;
|
||||
VFSPath();
|
||||
VFSPath(std::vector<std::string> path);
|
||||
VFSPath(std::string path);
|
||||
VFSPath(VFSPath p, std::string subent);
|
||||
VFSPath(VFSPath p, VFSPath p2);
|
||||
|
||||
|
||||
|
||||
|
||||
VFSPath GetParent();
|
||||
VFSPath CollapseRelativeParents();
|
||||
std::string GetFileName();
|
||||
bool HasExtension();
|
||||
std::string GetExtension();
|
||||
void ChangeExtension(std::string ext);
|
||||
void RemoveExtension();
|
||||
std::string ToString();
|
||||
};
|
||||
VFSPath operator/(VFSPath p, VFSPath p2);
|
||||
@ -32,7 +36,12 @@ namespace Tesses::Framework::Filesystem
|
||||
VFSPath operator+(VFSPath p, VFSPath p2);
|
||||
VFSPath operator+(VFSPath p, std::string p2);
|
||||
VFSPath operator+(std::string p, VFSPath p2);
|
||||
|
||||
bool operator==(VFSPath p,VFSPath p2);
|
||||
bool operator!=(VFSPath p,VFSPath p2);
|
||||
bool operator==(std::string p,VFSPath p2);
|
||||
bool operator!=(std::string p,VFSPath p2);
|
||||
bool operator==(VFSPath p,std::string p2);
|
||||
bool operator!=(VFSPath p,std::string p2);
|
||||
class VFSPathEnumeratorData {
|
||||
public:
|
||||
VFSPathEnumeratorData(std::function<bool(VFSPath&)> moveNext, std::function<void()> destroy)
|
||||
|
||||
51
include/TessesFramework/Lazy.hpp
Normal file
51
include/TessesFramework/Lazy.hpp
Normal file
@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "Common.hpp"
|
||||
#include "Threading/Mutex.hpp"
|
||||
#include <functional>
|
||||
namespace Tesses::Framework {
|
||||
template<typename T>
|
||||
class Lazy {
|
||||
Threading::Mutex mtx;
|
||||
T value;
|
||||
bool hasInit=false;
|
||||
std::function<T()> init;
|
||||
std::function<void(T)> free;
|
||||
public:
|
||||
Lazy(std::function<T()> init, std::function<void(T)> free)
|
||||
{
|
||||
this->init = init;
|
||||
this->free = free;
|
||||
}
|
||||
Lazy(std::function<T()> init) : Lazy(init, [](T item)->void {})
|
||||
{
|
||||
|
||||
}
|
||||
bool HasInit()
|
||||
{
|
||||
mtx.Lock();
|
||||
bool hI = this->hasInit;
|
||||
mtx.Unlock();
|
||||
return hI;
|
||||
}
|
||||
T& GetValue()
|
||||
{
|
||||
mtx.Lock();
|
||||
if(hasInit)
|
||||
{
|
||||
mtx.Unlock();
|
||||
return this->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->value = this->init();
|
||||
mtx.Unlock();
|
||||
return this->value;
|
||||
}
|
||||
mtx.Unlock();
|
||||
}
|
||||
~Lazy()
|
||||
{
|
||||
if(hasInit) this->free(this->value);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -17,4 +17,5 @@
|
||||
#include "Filesystem/NullFilesystem.hpp"
|
||||
#include "Filesystem/MountableFilesystem.hpp"
|
||||
#include "Filesystem/MemoryFilesystem.hpp"
|
||||
#include "Crypto/ClientTLSStream.hpp"
|
||||
#include "Crypto/ClientTLSStream.hpp"
|
||||
#include "Lazy.hpp"
|
||||
@ -4,7 +4,7 @@
|
||||
#elif defined(GEKKO)
|
||||
#include <ogc/mutex.h>
|
||||
#else
|
||||
#include <threads.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
namespace Tesses::Framework::Threading
|
||||
{
|
||||
@ -14,7 +14,8 @@ namespace Tesses::Framework::Threading
|
||||
#elif defined(GEKKO)
|
||||
mutex_t mtx;
|
||||
#else
|
||||
mtx_t mtx;
|
||||
pthread_mutex_t mtx;
|
||||
pthread_mutexattr_t attr;
|
||||
#endif
|
||||
public:
|
||||
Mutex();
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#elif defined(GEKKO)
|
||||
#include <ogc/lwp.h>
|
||||
#else
|
||||
#include <threads.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <atomic>
|
||||
namespace Tesses::Framework::Threading
|
||||
@ -22,8 +22,8 @@ namespace Tesses::Framework::Threading
|
||||
lwp_t thrd;
|
||||
static void* cb(void* ptr);
|
||||
#else
|
||||
thrd_t thrd;
|
||||
static int cb(void* ptr);
|
||||
pthread_t thrd;
|
||||
static void* cb(void* ptr);
|
||||
#endif
|
||||
std::function<void()> fn;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user