#ifndef SOLVESPACE_PLATFORM_H
#define SOLVESPACE_PLATFORM_H
namespace SolveSpace {
namespace Platform {
#if defined(WIN32)
std::string Narrow(const wchar_t *s);
std::wstring Widen(const char *s);
std::string Narrow(const std::wstring &s);
std::wstring Widen(const std::string &s);
#endif
#if defined(_WIN32)
const std::string embeddedFont = "res://fonts/BitstreamVeraSans-Roman-builtin.ttf";
#else
const std::string embeddedFont = "BitstreamVeraSans-Roman-builtin.ttf";
#endif
class Path {
public:
std::string raw;
static Path From(std::string raw);
static Path CurrentDirectory();
void Clear() { raw.clear(); }
bool Equals(const Path &other) const;
bool IsEmpty() const { return raw.empty(); }
bool IsAbsolute() const;
bool HasExtension(std::string ext) const;
std::string FileName() const;
std::string FileStem() const;
std::string Extension() const;
Path WithExtension(std::string ext) const;
Path Parent() const;
Path Join(const std::string &component) const;
Path Join(const Path &other) const;
Path Expand(bool fromCurrentDirectory = false) const;
Path RelativeTo(const Path &base) const;
static Path FromPortable(const std::string &repr);
std::string ToPortable() const;
};
struct PathLess {
bool operator()(const Path &a, const Path &b) const { return a.raw < b.raw; }
};
bool FileExists(const Platform::Path &filename);
FILE *OpenFile(const Platform::Path &filename, const char *mode);
bool ReadFile(const Platform::Path &filename, std::string *data);
bool WriteFile(const Platform::Path &filename, const std::string &data);
void RemoveFile(const Platform::Path &filename);
std::vector<std::string> InitCli(int argc, char **argv);
void DebugPrint(const char *fmt, ...);
void *AllocTemporary(size_t size);
void FreeAllTemporary();
} }
#endif