75 lines
1.9 KiB
C++
75 lines
1.9 KiB
C++
#ifndef LSTRING_H__
|
|
#define LSTRING_H__
|
|
|
|
#define _SCL_SECURE_NO_WARNINGS
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <Windows.h>
|
|
#include "IMemoryStream.h"
|
|
|
|
|
|
|
|
#ifdef _UNICODE
|
|
typedef std::wstring String;
|
|
#define _text(str) L##str
|
|
|
|
#define PRINT wprintf
|
|
#define STRCMP wcscmp
|
|
typedef wchar_t tchar;
|
|
#define string_size(str) (str.length() * 2)
|
|
|
|
#else
|
|
|
|
#define _text(str) str
|
|
#define PRINT printf
|
|
typedef std::string String;
|
|
typedef char tchar;
|
|
#define STRCMP strcmp
|
|
#define string_size(str) (str.length())
|
|
#endif
|
|
|
|
#ifdef WIN32
|
|
#define PATH_SPLITTER _text("\\")
|
|
#else
|
|
#define PATH_SPLITTER _text("/")
|
|
#endif
|
|
|
|
typedef std::vector<String> StringVector;
|
|
typedef std::vector<std::wstring> WStringVector;
|
|
|
|
extern int StrToInt(const String& str);
|
|
|
|
extern String GetFileName(const String& path);
|
|
|
|
extern String GetFileName(const String& path, const String& pathSplitter);
|
|
|
|
extern String GetFileNameWithoutExtention(const String& path);
|
|
|
|
extern String GetFilePath(const String& path, const String& pathSplitter);
|
|
|
|
extern void GetRootFolderS(const String& path, String& folderName, String& resultPath);
|
|
|
|
extern void GetRootFolderS(const String& path, String& folderName);
|
|
|
|
extern String GetDirectoryName(const String& path);
|
|
|
|
extern void SplitString(const String& text, std::vector<String>* collection);
|
|
|
|
extern void SplitString(const String& text, std::vector<String>* collection, char splitter);
|
|
|
|
extern void SplitStringW(const std::wstring& text, std::vector<std::wstring>* collection);
|
|
|
|
extern void SplitStringW(const std::wstring& text, std::vector<std::wstring>* collection, wchar_t splitter);
|
|
|
|
extern void WCSTMBS(const wchar_t* src, String& dst);
|
|
extern void MBSTWCS(const String& src, std::wstring& dst);
|
|
|
|
extern void StringSerialize(const String& src, LifeCore::IMemoryStream* stm);
|
|
extern String StringDeserialize(LifeCore::IMemoryStream* stm);
|
|
|
|
#define AS_STRING(omg) String(_text(##omg##))
|
|
#define STR(omg) String(_text(##omg##))
|
|
|
|
#endif |