8 #ifndef _PGE_FILE_LIB_GLOBS_H
9 #define _PGE_FILE_LIB_GLOBS_H
51 #include <QStringList>
53 #include <QTextStream>
60 #if defined(PGE_ENGINE)||defined(PGE_EDITOR)
63 #define PGE_FILES_INHERED public QObject
64 #define PGESTRING QString
65 #define PGESTRINGisEmpty() isEmpty()
66 #define PGESTR_Simpl(str) str.simplified()
67 #define PGEGetChar(chr) chr.toLatin1()
69 #define PGESTRINGList QStringList
70 #define PGEVECTOR QVector
75 #define PGE_SPLITSTR(dst, src, sep) dst=src.split(sep);
76 #define PGE_ReplSTR(src, from, to) src.replace(from, to)
77 #define PGE_RemSSTR(src, substr) src.remove(substr)
78 #define PGE_RemSRng(pos, len) remove(pos, len)
79 inline bool IsNULL(
PGESTRING str) {
return str.isNull(); }
80 inline int toInt(
PGESTRING str){
return str.toInt(); }
81 inline float toFloat(
PGESTRING str){
return str.toFloat(); }
82 inline double toDouble(
PGESTRING str){
return str.toDouble(); }
85 PGESTRING fromNum(T num) {
return QString::number(num); }
96 #define PGE_FILES_INGERED
97 #define PGESTRING std::string
98 #define PGESTRINGisEmpty() empty()
100 { str.erase( std::remove_if( str.begin(), str.end(), ::isspace ), str.end() );
102 #define PGEGetChar(chr) chr
104 #define PGESTRINGList std::vector<std::string >
105 #define PGEVECTOR std::vector
106 #define PGELIST std::vector
107 #define PGEPAIR std::pair
108 #define PGEMAP std::map
109 #define PGEFILE std::fstream
110 namespace PGE_FileFormats_misc
112 void split(std::vector<std::string>& dest,
const std::string& str, std::string separator);
113 void replaceAll(std::string& str,
const std::string& from,
const std::string& to);
114 void RemoveSub(std::string& sInput,
const std::string& sub);
115 bool hasEnding (std::string
const &fullString, std::string
const &ending);
117 #define PGE_SPLITSTR(dst, src, sep) dst.clear(); PGE_FileFormats_misc::split(dst, src, sep);
119 PGE_FileFormats_misc::replaceAll(src, from, to);
124 #define PGE_RemSRng(pos, len) erase(pos, len)
125 inline bool IsNULL(
PGESTRING str) {
return (str.empty()!=0); }
126 inline int toInt(
PGESTRING str){
return std::atoi(str.c_str()); }
127 inline float toFloat(
PGESTRING str){
return std::atof(str.c_str()); }
128 inline double toDouble(
PGESTRING str){
return std::atof(str.c_str()); }
131 PGESTRING fromNum(T num) { std::ostringstream n; n<<num;
return n.str(); }
137 namespace PGE_FileFormats_misc
304 #endif // _PGE_FILE_LIB_GLOBS_H
Relative to end of file.
Definition: pge_file_lib_globs.h:226
bool eof()
Is carriage position at end of file.
Definition: pge_file_lib_globs.cpp:169
Provides cross-platform text file reading interface.
Definition: pge_file_lib_globs.h:214
TextFileInput()
Constructor.
Definition: pge_file_lib_globs.cpp:71
#define PGESTRING
A macro which equal to std::string if PGE File Library built in the STL mode and equal to QString if ...
Definition: pge_file_lib_globs.h:97
bool open(PGESTRING filePath, bool utf8=false)
Opening of the file.
Definition: pge_file_lib_globs.cpp:89
void seek(long long pos, positions relativeTo)
Changes position of carriage to specific file position.
Definition: pge_file_lib_globs.cpp:187
PGESTRING read(long len)
Reads requested number of characters from a file.
Definition: pge_file_lib_globs.cpp:121
PGESTRING readLine()
Reads whole line before line feed character.
Definition: pge_file_lib_globs.cpp:134
~TextFileInput()
Destructor.
Definition: pge_file_lib_globs.cpp:79
Relative to current position.
Definition: pge_file_lib_globs.h:222
PGESTRING readAll()
Reads all data from a file at current position of carriage.
Definition: pge_file_lib_globs.cpp:150
void close()
Close currently opened file.
Definition: pge_file_lib_globs.cpp:112
positions
Relative positions of carriage.
Definition: pge_file_lib_globs.h:220
long long tell()
Returns current position of carriage relative to begin of file.
Definition: pge_file_lib_globs.cpp:178
Relative to begin of file.
Definition: pge_file_lib_globs.h:224
static bool exists(PGESTRING filePath)
Checks is requested file exist.
Definition: pge_file_lib_globs.cpp:57