22 extern void openInpStream(std::ifstream & io_inpSt,
const char * i_filePath, std::ios_base::openmode i_mode);
28 extern void openOutStream(std::ofstream & io_outSt,
const char * i_filePath, std::ios_base::openmode i_mode);
31 extern const std::string
baseDirOf(
const std::string & i_path);
34 extern const std::string
baseDirOf(
const char * i_path);
37 extern const std::string
makeDefaultPath(
const char * i_exePath,
const char * i_extension);
52 std::string
const makeFilePath(
const char * i_dirPath,
const char * i_name,
const char * i_extension =
nullptr);
55 extern const std::string
toUtf8(
const char * i_byteArr,
const char * i_codePageName =
nullptr);
58 extern const std::string
toUtf8(
size_t i_size,
const char * i_byteArr,
const char * i_codePageName =
nullptr);
61 extern bool isUtf8(
size_t i_size,
const char * i_byteArr);
64 extern const std::string
fileToUtf8(
const char * i_filePath,
const char * i_codePageName =
nullptr);
67 extern const std::list<std::string>
fileToUtf8Lines(
const char * i_filePath,
const char * i_codePageName =
nullptr);
75 extern const std::wstring fromUtf8(
const char * i_byteArr);
openM++ namespace
Definition: log.h:32
const std::string fileToUtf8(const char *i_filePath, const char *i_codePageName=nullptr)
read file and return content as UTF-8 as string
Definition: utf8Convert.cpp:533
const std::string baseDirOf(const std::string &i_path)
return base directory of the path or empty string if path is "." or ".."
const std::string toUtf8(const char *i_byteArr, const char *i_codePageName=nullptr)
convert null-terminated bytes from current user (or specified) code page to UTF-8 string.
Definition: utf8Convert.cpp:406
void openInpStream(std::ifstream &io_inpSt, const char *i_filePath, std::ios_base::openmode i_mode)
open input file stream
bool isFileExists(const char *i_filePath)
return true if file or directory exists
Definition: file.cpp:28
const std::list< std::string > fileToUtf8Lines(const char *i_filePath, const char *i_codePageName=nullptr)
read file, split by linefeed and return content as list of UTF-8 as strings
Definition: utf8Convert.cpp:562
bool isUtf8(size_t i_size, const char *i_byteArr)
return true if bytes are valid UTF-8
Definition: utf8Convert.cpp:441
void openOutStream(std::ofstream &io_outSt, const char *i_filePath, std::ios_base::openmode i_mode)
open output file stream
std::string const makeFilePath(const char *i_dirPath, const char *i_name, const char *i_extension=nullptr)
make path by join directory, file name and specified extension.
Definition: file.cpp:143
const std::string makeDefaultPath(const char *i_exePath, const char *i_extension)
make path from current working directory, executable name and specified extension.
Definition: file.cpp:107
OpenM++ common helper utilities.