|
|
@@ -0,0 +1,54 @@ |
|
|
|
// |
|
|
|
// Lol Engine |
|
|
|
// |
|
|
|
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net> |
|
|
|
// This program is free software; you can redistribute it and/or |
|
|
|
// modify it under the terms of the Do What The Fuck You Want To |
|
|
|
// Public License, Version 2, as published by Sam Hocevar. See |
|
|
|
// http://www.wtfpl.net/ for more details. |
|
|
|
// |
|
|
|
|
|
|
|
// |
|
|
|
// File and buffer reading |
|
|
|
// ----------------------- |
|
|
|
// |
|
|
|
|
|
|
|
#if !defined __LOL_SYS_FILE_H__ |
|
|
|
#define __LOL_SYS_FILE_H__ |
|
|
|
|
|
|
|
#include <stdint.h> |
|
|
|
|
|
|
|
namespace lol |
|
|
|
{ |
|
|
|
|
|
|
|
struct FileAccess |
|
|
|
{ |
|
|
|
enum Value |
|
|
|
{ |
|
|
|
Read = 0, |
|
|
|
Write, |
|
|
|
} |
|
|
|
m_value; |
|
|
|
|
|
|
|
inline FileAccess(Value v) : m_value(v) {} |
|
|
|
inline operator Value() { return m_value; } |
|
|
|
}; |
|
|
|
|
|
|
|
class File |
|
|
|
{ |
|
|
|
public: |
|
|
|
inline File() : m_data(0) {} |
|
|
|
inline ~File() {} |
|
|
|
|
|
|
|
void Open(String const &file, FileAccess mode); |
|
|
|
String const &ReadString(); |
|
|
|
void Close(); |
|
|
|
|
|
|
|
private: |
|
|
|
class FileData *m_data; |
|
|
|
}; |
|
|
|
|
|
|
|
} /* namespace lol */ |
|
|
|
|
|
|
|
#endif // __LOL_SYS_FILE_H__ |
|
|
|
|