refactor: nuke all widestrings and widechars everywhere
This commit is contained in:
@@ -7,19 +7,19 @@ class EOFException : public std::exception {};
|
||||
|
||||
class IllegalArgumentException : public std::exception {
|
||||
public:
|
||||
std::wstring information;
|
||||
std::string information;
|
||||
|
||||
IllegalArgumentException(const std::wstring& information);
|
||||
IllegalArgumentException(const std::string& information);
|
||||
};
|
||||
|
||||
class IOException : public std::exception {
|
||||
public:
|
||||
std::wstring information;
|
||||
std::string information;
|
||||
|
||||
IOException(const std::wstring& information);
|
||||
IOException(const std::string& information);
|
||||
};
|
||||
|
||||
class RuntimeException : public std::exception {
|
||||
public:
|
||||
RuntimeException(const std::wstring& information);
|
||||
RuntimeException(const std::string& information);
|
||||
};
|
||||
@@ -11,16 +11,16 @@ class FileFilter;
|
||||
class File {
|
||||
public:
|
||||
// The system-dependent path-separator character
|
||||
static const wchar_t pathSeparator;
|
||||
static const char pathSeparator;
|
||||
|
||||
// 4J Jev, the start of the file root
|
||||
static const std::wstring pathRoot;
|
||||
static const std::string pathRoot;
|
||||
|
||||
File() { m_abstractPathName = L""; }
|
||||
File() { m_abstractPathName = ""; }
|
||||
|
||||
File(const File& parent, const std::wstring& child);
|
||||
File(const std::wstring& pathname);
|
||||
File(const std::wstring& parent, const std::wstring& child);
|
||||
File(const File& parent, const std::string& child);
|
||||
File(const std::string& pathname);
|
||||
File(const std::string& parent, const std::string& child);
|
||||
bool _delete();
|
||||
bool mkdir() const;
|
||||
bool mkdirs() const;
|
||||
@@ -32,19 +32,19 @@ public:
|
||||
bool isDirectory() const;
|
||||
int64_t length();
|
||||
int64_t lastModified();
|
||||
const std::wstring getPath() const; // 4J Jev: TODO
|
||||
std::wstring getName() const;
|
||||
const std::string getPath() const; // 4J Jev: TODO
|
||||
std::string getName() const;
|
||||
|
||||
static int hash_fnct(const File& k);
|
||||
static bool eq_test(const File& x, const File& y);
|
||||
|
||||
private:
|
||||
void _init();
|
||||
std::wstring m_abstractPathName;
|
||||
std::string m_abstractPathName;
|
||||
|
||||
// 4J Jev, just helper functions, change between paths and
|
||||
// std::vector<string>
|
||||
// File(std::vector<std::wstring> *path);
|
||||
// File(std::vector<std::string> *path);
|
||||
};
|
||||
|
||||
struct FileKeyHash {
|
||||
|
||||
@@ -7,5 +7,5 @@ class File;
|
||||
// 4J Jev, java lirary interface.
|
||||
class FilenameFilter {
|
||||
public:
|
||||
virtual bool accept(File* dir, const std::wstring& name) = 0;
|
||||
virtual bool accept(File* dir, const std::string& name) = 0;
|
||||
};
|
||||
@@ -7,7 +7,7 @@
|
||||
class BufferedReader : public Reader {
|
||||
private:
|
||||
Reader* reader;
|
||||
wchar_t* buffer;
|
||||
char* buffer;
|
||||
|
||||
unsigned int readMark;
|
||||
unsigned int bufferedMark;
|
||||
@@ -23,6 +23,6 @@ public:
|
||||
|
||||
virtual void close();
|
||||
virtual int read();
|
||||
virtual int read(wchar_t cbuf[], unsigned int off, unsigned int len);
|
||||
std::wstring readLine();
|
||||
virtual int read(char cbuf[], unsigned int off, unsigned int len);
|
||||
std::string readLine();
|
||||
};
|
||||
@@ -19,8 +19,8 @@ public:
|
||||
virtual int readInt() = 0;
|
||||
virtual int64_t readLong() = 0;
|
||||
virtual short readShort() = 0;
|
||||
virtual wchar_t readChar() = 0;
|
||||
virtual std::wstring readUTF() = 0;
|
||||
virtual char readChar() = 0;
|
||||
virtual std::string readUTF() = 0;
|
||||
virtual unsigned long long readPlayerUID() = 0; // 4J Added
|
||||
virtual int skipBytes(int n) = 0;
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
virtual bool readBoolean();
|
||||
virtual uint8_t readByte();
|
||||
virtual unsigned char readUnsignedByte();
|
||||
virtual wchar_t readChar();
|
||||
virtual char readChar();
|
||||
virtual bool readFully(std::vector<uint8_t>& b);
|
||||
virtual bool readFully(std::vector<char>& b);
|
||||
virtual double readDouble();
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
virtual int64_t readLong();
|
||||
virtual short readShort();
|
||||
virtual unsigned short readUnsignedShort();
|
||||
virtual std::wstring readUTF();
|
||||
virtual std::string readUTF();
|
||||
void deleteChildStream();
|
||||
virtual int readUTFChar();
|
||||
virtual unsigned long long readPlayerUID(); // 4J Added
|
||||
|
||||
@@ -17,8 +17,8 @@ public:
|
||||
virtual void writeLong(int64_t a) = 0;
|
||||
virtual void writeShort(short a) = 0;
|
||||
virtual void writeBoolean(bool v) = 0;
|
||||
virtual void writeChar(wchar_t v) = 0;
|
||||
virtual void writeChars(const std::wstring& s) = 0;
|
||||
virtual void writeUTF(const std::wstring& a) = 0;
|
||||
virtual void writeChar(char v) = 0;
|
||||
virtual void writeChars(const std::string& s) = 0;
|
||||
virtual void writeUTF(const std::string& a) = 0;
|
||||
virtual void writePlayerUID(unsigned long long player) = 0; // 4J Added
|
||||
};
|
||||
@@ -35,10 +35,10 @@ public:
|
||||
virtual void writeLong(int64_t a);
|
||||
virtual void writeShort(short a);
|
||||
virtual void writeUnsignedShort(unsigned short a);
|
||||
virtual void writeChar(wchar_t a);
|
||||
virtual void writeChars(const std::wstring& a);
|
||||
virtual void writeChar(char a);
|
||||
virtual void writeChars(const std::string& a);
|
||||
virtual void writeBoolean(bool b);
|
||||
virtual void writeUTF(const std::wstring& a);
|
||||
virtual void writeUTF(const std::string& a);
|
||||
virtual void writePlayerUID(unsigned long long player);
|
||||
virtual void flush();
|
||||
};
|
||||
@@ -17,5 +17,5 @@ public:
|
||||
virtual void close() = 0;
|
||||
virtual int64_t skip(int64_t n) = 0;
|
||||
|
||||
static InputStream* getResourceAsStream(const std::wstring& fileName);
|
||||
static InputStream* getResourceAsStream(const std::string& fileName);
|
||||
};
|
||||
@@ -15,5 +15,5 @@ public:
|
||||
|
||||
virtual void close();
|
||||
virtual int read();
|
||||
virtual int read(wchar_t cbuf[], unsigned int offset, unsigned int length);
|
||||
virtual int read(char cbuf[], unsigned int offset, unsigned int length);
|
||||
};
|
||||
@@ -8,6 +8,6 @@ public:
|
||||
// resources associated with it.
|
||||
virtual int read() = 0; // Reads a single character.
|
||||
virtual int read(
|
||||
wchar_t cbuf[], unsigned int off,
|
||||
char cbuf[], unsigned int off,
|
||||
unsigned int len) = 0; // Reads characters into a portion of an array.
|
||||
};
|
||||
@@ -42,5 +42,5 @@ public:
|
||||
static void ReverseULONG(unsigned int* pulVal);
|
||||
static void ReverseINT(int* piVal);
|
||||
static void ReverseULONGLONG(int64_t* pullVal);
|
||||
static void ReverseWCHARA(wchar_t* pwch, int iLen);
|
||||
static void ReverseWCHARA(char* pwch, int iLen);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user