GlobalObjects
Loading...
Searching...
No Matches
eut::FileHelper Namespace Reference

Helper with static methods for processing the file system. More...

Classes

class  CallBackFileDirFount
 

Typedefs

typedef void(* PROCESSING_DIR_MEMBERPTR) (const fs::path &rFullPathName)
 
typedef void(* PROCESSING_FILE_MEMBERPTR) (const fs::path &rFullFileName)
 

Functions

int _iterateDirectory (const fs::path &rIterPath, bool bRecursive, PROCESSING_FILE_MEMBERPTR ProcessingFileFunction, PROCESSING_DIR_MEMBERPTR ProcessingDirFunction, CallBackFileDirFount *pProcessingObject)
 
__tool_export_dll int closeInputFile (std::ifstream *&pFileStream)
 
__tool_export_dll int closeInputFile (std::wifstream *&pFileStream)
 
__tool_export_dll int closeOutputFile (std::ofstream *&pFileStream)
 
__tool_export_dll int closeOutputFile (std::wofstream *&pFileStream)
 
__tool_export_dll int copyFile (const std::string &rsSourceFileName, const std::string &rsTargetFileName)
 
__tool_export_dll int deleteFile (const fs::path &rFullFileName)
 
__tool_export_dll int deleteFile (const std::string &rsFullFileName)
 
__tool_export_dll void deleteFileForIterateDirectory (const fs::path &rFullFileName)
 
__tool_export_dll int dirExist (const std::string &rsCheckPath)
 
__tool_export_dll int dirExist (const std::wstring &rsCheckPath)
 
__tool_export_dll int fileExist (const std::string &rsFullFileName)
 
__tool_export_dll int fileExist (const std::wstring &rsFullFileName)
 
__tool_export_dll std::string getCurrentWorkingDirAsString ()
 
__tool_export_dll std::wstring getCurrentWorkingDirAsWString ()
 
__tool_export_dll int iterateDirectory (const fs::path &rIterPath, bool bRecursive, CallBackFileDirFount &rProcessingObject)
 
__tool_export_dll int iterateDirectory (const fs::path &rIterPath, bool bRecursive, PROCESSING_FILE_MEMBERPTR ProcessingFileFunction, PROCESSING_DIR_MEMBERPTR ProcessingDirFunction)
 
__tool_export_dll int loadFile (std::string &rstr, const std::string &rsFileName)
 
__tool_export_dll int lockFile (std::ofstream *&prLockFile, const std::string &rsLockFileName)
 
__tool_export_dll int storeFile (const std::string &rsStr, const std::string &rsFileName)
 
__tool_export_dll int storeFile (char *pszData, std::streamsize nSize, const std::string &rsFileName)
 Saves data to a file in the file system.
 
__tool_export_dll int storeFile (char *pszData, std::streamsize nSize, const std::wstring &rsFileName)
 Saves data to a file in the file system.
 
__tool_export_dll int storeFile (const Blob *pBlob, const std::string &rsFileName)
 Saves the contents of a blob to a file in the file system.
 
__tool_export_dll int storeFile (const Blob *pBlob, const std::wstring &rsFileName)
 Saves the contents of a blob to a file in the file system.
 
__tool_export_dll int storeFile (const Blob &rBlob, const std::string &rsFileName)
 Saves the contents of a blob to a file in the file system.
 
__tool_export_dll int storeFile (const Blob &rBlob, const std::wstring &rsFileName)
 Saves the contents of a blob to a file in the file system.
 
__tool_export_dll int loadFile (char *&prszData, std::streamsize &rnSize, const std::string &rsFileName, bool bText=false)
 Returns the content and size of a file from the file system.
 
__tool_export_dll int loadFile (char *&prszData, std::streamsize &rnSize, const std::wstring &rsFileName, bool bText=false)
 Returns the content and size of a file from the file system.
 
__tool_export_dll int loadFile (Blob *&prBlob, const std::string &rsFileName)
 
__tool_export_dll int loadFile (Blob *&prBlob, const std::wstring &rsFileName)
 
__tool_export_dll int loadFile (Blob &rBlob, const std::string &rsFileName)
 Returns the contents of a file from the file system.
 
__tool_export_dll int loadFile (Blob &rBlob, const std::wstring &rsFileName)
 Returns the contents of a file from the file system.
 
__tool_export_dll int openInputFile (std::ifstream *&pInputFileStream, const std::string &rsFileName)
 Returns an open file of type std::ifstream for writing to the File system.
 
__tool_export_dll int openInputFile (std::ifstream *&pInputFileStream, const std::wstring &rsFileName)
 Returns an open file of type std::ifstream for writing to the File system.
 
__tool_export_dll int openInputFile (std::wifstream *&pInputFileStream, const std::string &rsFileName)
 Returns an open file of type std::wifstream for writing to the File system.
 
__tool_export_dll int openInputFile (std::wifstream *&pInputFileStream, const std::wstring &rsFileName)
 Returns an open file of type std::wifstream for writing to the File system.
 
__tool_export_dll int openOutputFile (std::ofstream *&pOutputFileStream, const std::string &rsFileName)
 Returns an open file of type std::ofstream for reading in the file system.
 
__tool_export_dll int openOutputFile (std::ofstream *&pOutputFileStream, const std::wstring &rsFileName)
 Returns an open file of type std::ofstream for reading in the file system.
 
__tool_export_dll int openOutputFile (std::wofstream *&pOutputFileStream, const std::string &rsFileName)
 Returns an open file of type std::wofstream for reading in the file system.
 
__tool_export_dll int openOutputFile (std::wofstream *&pOutputFileStream, const std::wstring &rsFileName)
 Returns an open file of type std::wofstream for reading in the file system.
 
__tool_export_dll int makeDir (const std::string &rsNewPath)
 Creates passed directory(s).
 
__tool_export_dll int makeDir (const std::wstring &rsNewPath)
 Creates passed directory(s).
 
__tool_export_dll int makePath (const std::string &rsNewPath)
 Creates passed directory(s).
 
__tool_export_dll int makePath (const std::wstring &rsNewPath)
 Creates passed directory(s).
 
__tool_export_dll void splitPath (const std::string &rsFullFileName, std::string &rsDrive, std::string &rsPath, std::string &rsFileName, std::string &rsFileExtension)
 Expects a file name including path (e.g.
 
__tool_export_dll void splitPath (const std::wstring &rsFullFileName, std::wstring &rsDrive, std::wstring &rsPath, std::wstring &rsFileName, std::wstring &rsFileExtension)
 Expects a file name including path (e.g.
 
__tool_export_dll void getFullFileName (std::string &rsFullFileName, const fs::path &rFileSystemPath, const char &rSeparator='/')
 Sets the full file name in the passed string from the passed fs::path, even if it is only relative.
 
__tool_export_dll void getFullFileName (std::wstring &rsFullFileName, const fs::path &rFileSystemPath, const std::wstring &rSeparator=L"/")
 Sets the full file name in the passed string from the passed fs::path, even if it is only relative.
 
int _getswapDatavalue (std::string &sOutText, const std::string &sInText, const std::string &sTextOrFile)
 Helper function for swapDataInFile (...) which contains a value in a std::string which either comes from a file or as a regular expression or is determined as text.
 
int _getswapDatavalue (std::string &sOutText, const std::wstring &sInText, const std::string &sTextOrFile)
 Helper function for swapDataInFile (...) which contains a value in a std::string which either comes from a file or as a regular expression or is determined as text.
 
__tool_export_dll int swapDataInFile (std::vector< std::string > &rParamVector, bool bSimulate=false)
 Searches and replaces contents in files and saves them under a different name if desired.
 

Detailed Description

Helper with static methods for processing the file system.

Note
Some functions are only available if different preprocessor directive were set.
  • __EUFILEHELPER_WITH_EUBLOB With this preprocessor directive the functions that expect an object of the Blob type are available.
  • _HAS_FILESYSTEM Some functions require <filesystem> (from c++17).
    This preprocessor directive is set in the header and should only be placed there can be extended.
Author
Helmut Jakoby

Typedef Documentation

◆ PROCESSING_DIR_MEMBERPTR

typedef void(* eut::FileHelper::PROCESSING_DIR_MEMBERPTR) (const fs::path &rFullPathName)

Definitions of the function pointer for FileHelper::iterateDirectory (...), which is called if a path is found during iteration.

Parameters
[in]rFullPathNameThe complete path in an object of type fs::path.
Note
These type definitions are only made if the preprocessor directive _HAS_FILESYSTEM is defined.

◆ PROCESSING_FILE_MEMBERPTR

typedef void(* eut::FileHelper::PROCESSING_FILE_MEMBERPTR) (const fs::path &rFullFileName)

Definitions of the function pointer for FileHelper::iterateDirectory (...), which is called when a file is found during iteration.

Parameters
[in]rFullFileNameThe file name with full path in an object of type fs::path.
Note
These type definitions are only made if the _HAS_FILESYSTEM preprocessor directive is defined.

Function Documentation

◆ _getswapDatavalue() [1/2]

int eut::FileHelper::_getswapDatavalue ( std::string & sOutText,
const std::string & sInText,
const std::string & sTextOrFile )

Helper function for swapDataInFile (...) which contains a value in a std::string which either comes from a file or as a regular expression or is determined as text.

Parameters
[in,out]sOutTextThe determined value.
[in]sInTextDer Value after the sTextOrFile value.
[in]sTextOrFileThe expression to be evaluated (see description swapDataInFile (...) rParamVector[1] and rParamVector[2].
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ _getswapDatavalue() [2/2]

int eut::FileHelper::_getswapDatavalue ( std::string & sOutText,
const std::wstring & sInText,
const std::string & sTextOrFile )

Helper function for swapDataInFile (...) which contains a value in a std::string which either comes from a file or as a regular expression or is determined as text.

Parameters
[in,out]sOutTextThe determined value.
[in]sInTextDer Value after the sTextOrFile value.
[in]sTextOrFileThe expression to be evaluated (see description swapDataInFile (...) rParamVector[1] and rParamVector[2].
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ _iterateDirectory()

int eut::FileHelper::_iterateDirectory ( const fs::path & rIterPath,
bool bRecursive,
PROCESSING_FILE_MEMBERPTR ProcessingFileFunction,
PROCESSING_DIR_MEMBERPTR ProcessingDirFunction,
CallBackFileDirFount * pProcessingObject )

Contains the functions FileHelper::iterateDirectory( const fs::path & rIterPath, bool bRecursive, PROCESSING_FILE_MEMBERPTR ProcessingFileFunction, PROCESSING_DIR_MEMBERPTR ProcessingDirFunction ) and FileHelper::iterateDirectory( const fs::path & rIterPath, bool bRecursive, CallBackFileDirFount & rProcessingObject ) together or is called by them.

Parameters
[in]rIterPathThe path; can also be a relative path through which iteration is performed.
[in]bRecursiveIf true, the path is also defined by any subdirectories itereiert.
[in]ProcessingFileFunctionA pointer to a function that is executed at each is called up in the file found.
[in]ProcessingDirFunctionA pointer to a function that is called at each found directory is called.
[in]pProcessingObjectPointer to a derived CallBackFileDirFount object; if not nullptr, its methods are called.
Returns
A return < 0 indicates an error.
Note
This function is only available if the preprocessor directive _HAS_FILESYSTEM is defined.

◆ closeInputFile() [1/2]

__tool_export_dll int eut::FileHelper::closeInputFile ( std::ifstream *& pFileStream)

Closes a file of type std::ifstream in the file system.

Parameters
[in,out]pFileStreamPointer reference to an input file stream representing the opened file.
Returns
A return value < 0 indicates an error.
Note
If a valid input file stream was delivered, it is closed and removed from memory and set to 0.

◆ closeInputFile() [2/2]

__tool_export_dll int eut::FileHelper::closeInputFile ( std::wifstream *& pFileStream)

Closes a file of type std::wifstream in the file system.

Parameters
[in,out]pFileStreamPointer reference to an input file stream representing the opened file.
Returns
A return value < 0 indicates an error.
Note
If a valid input file stream was delivered, it is closed and removed from memory and set to 0.

◆ closeOutputFile() [1/2]

__tool_export_dll int eut::FileHelper::closeOutputFile ( std::ofstream *& pFileStream)

Closes a file of type std::ofstream in the file system.

Parameters
[in,out]pFileStreamPointer reference to an output file stream representing the opened file.
Returns
A return value < 0 indicates an error.
Note
If a valid output file stream was delivered, it is closed and removed from memory and set to 0.

◆ closeOutputFile() [2/2]

__tool_export_dll int eut::FileHelper::closeOutputFile ( std::wofstream *& pFileStream)

Closes a file of type std::wofstream in the file system.

Parameters
[in,out]pFileStreamPointer reference to an output file stream representing the opened file.
Returns
A return value < 0 indicates an error.
Note
If a valid output file stream was delivered, it is closed and removed from memory and set to 0.

◆ copyFile()

__tool_export_dll int eut::FileHelper::copyFile ( const std::string & rsSourceFileName,
const std::string & rsTargetFileName )

Copies the transferred file.

Parameters
[in]rsSourceFileNameThe complete file name (e.g. "c:\\temp\\SourceText.txt") of the file to be copied.
[in]rsTargetFileNameThe complete file name (e.g. "c:\\temp\\TargetText.txt") of the file to be newly created or overwritten.
Returns
Returns 1 if copying was successful or 0 if not. A return < 0 indicates an error.
Attention
In Visual Studio the _CRT_SECURE_NO_WARNINGS must be set in the preprocessor definition.

◆ deleteFile() [1/2]

__tool_export_dll int eut::FileHelper::deleteFile ( const fs::path & rFullFileName)

A function that attempts to delete the passed file from the file system.

Parameters
[in]rFullFileNameThe file name with full path in an object of type fs::path.
Returns
A return < 0 indicates an error.
Note
These type definitions are only made if the _HAS_FILESYSTEM preprocessor directive is defined.

◆ deleteFile() [2/2]

__tool_export_dll int eut::FileHelper::deleteFile ( const std::string & rsFullFileName)

A function that attempts to delete the passed file from the file system.

Parameters
[in]rsFullFileNameThe file name with full path.
Returns
A return < 0 indicates an error.
Note
These type definitions are only made if the _HAS_FILESYSTEM preprocessor directive is defined.

◆ deleteFileForIterateDirectory()

__tool_export_dll void eut::FileHelper::deleteFileForIterateDirectory ( const fs::path & rFullFileName)

A function that attempts to delete the passed file from the file system.
Nothing will be done or reported if this fails for some reason.
No exception that may occur will be caught and/or processed.
This function can be used as the 3rd parameter for X.
iterateDirectory( const fs::path & rIterPath, bool bRecursive, PROCESSING_FILE_MEMBERPTR ProcessingFileFunction, PROCESSING_DIR_MEMBERPTR ProcessingDirFunction )

Parameters
[in]rFullFileNameThe file name with full path in an object of type fs::path.
Note
These type definitions are only made if the _HAS_FILESYSTEM preprocessor directive is defined.
If error evaluation is desired, the void deleteFile(const fs::path&) function can be used.
See also
iterateDirectory(const fs::path&,bool, PROCESSING_FILE_MEMBERPTR, PROCESSING_DIR_MEMBERPTR)

◆ dirExist() [1/2]

__tool_export_dll int eut::FileHelper::dirExist ( const std::string & rsCheckPath)

Checks if a directory exists in the file system.

Parameters
[in]rsCheckPathThe full name of the directory to check.
Returns
Returns 1 if the given directory exists, 0 if not and - 1 if the name is already given as a file name.
Note
Knows only ACII.

◆ dirExist() [2/2]

__tool_export_dll int eut::FileHelper::dirExist ( const std::wstring & rsCheckPath)

Checks if a directory exists in the file system.

Parameters
[in]rsCheckPathThe full name of the directory to check.
Returns
Returns 1 if the given directory exists, 0 if not and - 1 if the name is already given as a file name.

◆ fileExist() [1/2]

__tool_export_dll int eut::FileHelper::fileExist ( const std::string & rsFullFileName)

Checks if a file exists in the file system.

Parameters
[in]rsFullFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
Returns 1 if the file passed exists, 0 if not and - 1 if the name is already assigned as a directory name.

◆ fileExist() [2/2]

__tool_export_dll int eut::FileHelper::fileExist ( const std::wstring & rsFullFileName)

Checks if a file exists in the file system.

Parameters
[in]rsFullFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
Returns 1 if the file passed exists, 0 if not and - 1 if the name is already assigned as a directory name.

◆ getCurrentWorkingDirAsString()

__tool_export_dll std::string eut::FileHelper::getCurrentWorkingDirAsString ( )

Returns the current working directory.

Returns
The current working directory.

◆ getCurrentWorkingDirAsWString()

__tool_export_dll std::wstring eut::FileHelper::getCurrentWorkingDirAsWString ( )

Returns the current working directory.

Returns
The current working directory.

◆ getFullFileName() [1/2]

__tool_export_dll void eut::FileHelper::getFullFileName ( std::string & rsFullFileName,
const fs::path & rFileSystemPath,
const char & rSeparator = '/' )

Sets the full file name in the passed string from the passed fs::path, even if it is only relative.

Parameters
[in,out]rsFullFileNameThe determined path.
[in]rFileSystemPathThe filesystem path from which the full file name is determined.
[in]rSeparatorThe path separator. There are only the characters '/' or '\' allowed. For another character, '/' is used without exception taken.
Note
This function is only available if the preprocessor directive _HAS_FILESYSTEM is defined.

◆ getFullFileName() [2/2]

__tool_export_dll void eut::FileHelper::getFullFileName ( std::wstring & rsFullFileName,
const fs::path & rFileSystemPath,
const std::wstring & rSeparator = L"/" )

Sets the full file name in the passed string from the passed fs::path, even if it is only relative.

Parameters
[in,out]rsFullFileNameThe determined path.
[in]rFileSystemPathThe filesystem path from which the full file name is determined.
[in]rSeparatorThe path separator. There are only the characters '/' or '\' allowed. For another character, '/' is used without exception taken.
Note
This function is only available if the preprocessor directive _HAS_FILESYSTEM is defined.

◆ iterateDirectory() [1/2]

__tool_export_dll int eut::FileHelper::iterateDirectory ( const fs::path & rIterPath,
bool bRecursive,
CallBackFileDirFount & rProcessingObject )

It is iterated by the specified path (parameter 'rIterPath') and is used for each file or directory in the transferred CallBackFileDirFount contains the corresponding methods CallBackFileDirFount::processDirFount (...) or CallBackFileDirFount::processFileFount (...) are called.

Parameters
[in]rIterPathThe path; can also be a relative path through which iteration is performed.
[in]bRecursiveIf true, the path is also determined by any subdirectories itereiert.
[in]rProcessingObjectReference to a derived CallBackFileDirFount.
Returns
A return < 0 indicates an error.
Note
This function is only available if the preprocessor directive _HAS_FILESYSTEM is defined.

◆ iterateDirectory() [2/2]

__tool_export_dll int eut::FileHelper::iterateDirectory ( const fs::path & rIterPath,
bool bRecursive,
PROCESSING_FILE_MEMBERPTR ProcessingFileFunction,
PROCESSING_DIR_MEMBERPTR ProcessingDirFunction )

It is iterated by the specified path (parameter 'rIterPath') and if corresponding function pointers are passed, these are each passed for a Directory or a file is called.

Parameters
[in]rIterPathThe path; can also be a relative path through which iteration is performed.
[in]bRecursiveIf true, the path is also used by any subdirectories itereiert.
[in]ProcessingFileFunctionA pointer to a function that is executed at each is called up in the file found.
[in]ProcessingDirFunctionA pointer to a function that is called at each found directory is called.
Returns
A return < 0 indicates an error.
Note
This function is only available if the preprocessor directive _HAS_FILESYSTEM is defined.

◆ loadFile() [1/7]

__tool_export_dll int eut::FileHelper::loadFile ( Blob & rBlob,
const std::string & rsFileName )

Returns the contents of a file from the file system.

Parameters
[in,out]rBlobReference to the Blob where the content of the file is inserted.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.
Attention
The passed blob is set 'responsible' (see Blob::setMemResponsible( bool bActiv ) ).
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ loadFile() [2/7]

__tool_export_dll int eut::FileHelper::loadFile ( Blob & rBlob,
const std::wstring & rsFileName )

Returns the contents of a file from the file system.

Parameters
[in,out]rBlobReference to the Blob where the content of the file is inserted.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.
Attention
The passed blob is set 'responsible' (see Blob::setMemResponsible( bool bActiv ) ).
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ loadFile() [3/7]

__tool_export_dll int eut::FileHelper::loadFile ( Blob *& prBlob,
const std::string & rsFileName )

Returns the contents of a file from the file system.

Parameters
[in,out]prBlobPointer reference to a new Blob in which the content of the file is saved.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.
Attention
This method allocates memory for passed prBlob, which must be released again by the calling instance.
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ loadFile() [4/7]

__tool_export_dll int eut::FileHelper::loadFile ( Blob *& prBlob,
const std::wstring & rsFileName )

Returns the contents of a file from the file system.

Parameters
[in,out]prBlobPointer reference to a new Blob in which the content of the file is saved.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.
Attention
This method allocates memory for passed prBlob, which must be released again by the calling instance.
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ loadFile() [5/7]

__tool_export_dll int eut::FileHelper::loadFile ( char *& prszData,
std::streamsize & rnSize,
const std::string & rsFileName,
bool bText = false )

Returns the content and size of a file from the file system.

Parameters
[in,out]prszDataPointer reference to the memory where the content of the file is saved.
[in,out]rnSizeSize of the saved file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
[in]bTextIf true, a 0 is appended to the file data in prszData.
Returns
A return < 0 indicates an error.
Attention
This method allocates memory for prszData, which must be released again by the calling instance.

◆ loadFile() [6/7]

__tool_export_dll int eut::FileHelper::loadFile ( char *& prszData,
std::streamsize & rnSize,
const std::wstring & rsFileName,
bool bText = false )

Returns the content and size of a file from the file system.

Parameters
[in,out]prszDataPointer reference to the memory where the content of the file is saved.
[in,out]rnSizeSize of the saved file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
[in]bTextIf true, a 0 is appended to the file data in prszData.
Returns
A return < 0 indicates an error.
Attention
This method allocates memory for prszData, which must be released again by the calling instance.

◆ loadFile() [7/7]

__tool_export_dll int eut::FileHelper::loadFile ( std::string & rstr,
const std::string & rsFileName )

Returns the contents of a file from the file system in a std::string.

Parameters
[in,out]rstrThe std::string in which the content of the file is.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.

◆ lockFile()

__tool_export_dll int eut::FileHelper::lockFile ( std::ofstream *& prLockFile,
const std::string & rsLockFileName )

Locks a file in the file system.

Parameters
[in,out]prLockFileThe locked LockFile.
[in]rsLockFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If prLockFile, it must simply be removed from memory to unlock it.

◆ makeDir() [1/2]

__tool_export_dll int eut::FileHelper::makeDir ( const std::string & rsNewPath)

Creates passed directory(s).

Parameters
[in]rsNewPathThe full directory name. It does not create the full path, only the last directory if the parent directories exist. See also int FileHelper::makePath (...).
Returns
A return value < 0 indicates an error.

◆ makeDir() [2/2]

__tool_export_dll int eut::FileHelper::makeDir ( const std::wstring & rsNewPath)

Creates passed directory(s).

Parameters
[in]rsNewPathThe full directory name. It does not create the full path, only the last directory if the parent directories exist. See also int FileHelper::makePath (...).
Returns
A return value < 0 indicates an error.

◆ makePath() [1/2]

__tool_export_dll int eut::FileHelper::makePath ( const std::string & rsNewPath)

Creates passed directory(s).

Parameters
[in]rsNewPathThe full directory name. All directories will be created, if not already present.
Returns
A return value < 0 indicates an error.

◆ makePath() [2/2]

__tool_export_dll int eut::FileHelper::makePath ( const std::wstring & rsNewPath)

Creates passed directory(s).

Parameters
[in]rsNewPathThe full directory name. All directories will be created, if not already present.
Returns
A return value < 0 indicates an error.

◆ openInputFile() [1/4]

__tool_export_dll int eut::FileHelper::openInputFile ( std::ifstream *& pInputFileStream,
const std::string & rsFileName )

Returns an open file of type std::ifstream for writing to the File system.

Parameters
[in,out]pInputFileStreamPointer reference to an input file stream which represents the open file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If a valid input file stream was delivered, the the calling instance will close it again. It is used for transferred pInputFileStream allocates memory, which is used by the calling instance must be released again. To do this, you can use the function int FileHelper::closeInputFile( std::ifstream *& pFileStream ) used will be.

◆ openInputFile() [2/4]

__tool_export_dll int eut::FileHelper::openInputFile ( std::ifstream *& pInputFileStream,
const std::wstring & rsFileName )

Returns an open file of type std::ifstream for writing to the File system.

Parameters
[in,out]pInputFileStreamPointer reference to an input file stream which represents the open file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If a valid input file stream was delivered, the the calling instance will close it again. It is used for transferred pInputFileStream allocates memory, which is used by the calling instance must be released again. To do this, you can use the function int FileHelper::closeInputFile( std::ifstream *& pFileStream ) used will be.

◆ openInputFile() [3/4]

__tool_export_dll int eut::FileHelper::openInputFile ( std::wifstream *& pInputFileStream,
const std::string & rsFileName )

Returns an open file of type std::wifstream for writing to the File system.

Parameters
[in,out]pInputFileStreamPointer reference to an input file stream which represents the open file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If a valid input file stream was delivered, the the calling instance will close it again. It is used for transferred pInputFileStream allocates memory, which is used by the calling instance must be released again. To do this, you can use the function int FileHelper::closeInputFile( std::wifstream *& pFileStream ) used will be.

◆ openInputFile() [4/4]

__tool_export_dll int eut::FileHelper::openInputFile ( std::wifstream *& pInputFileStream,
const std::wstring & rsFileName )

Returns an open file of type std::wifstream for writing to the File system.

Parameters
[in,out]pInputFileStreamPointer reference to an input file stream which represents the open file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If a valid input file stream was delivered, the the calling instance will close it again. It is used for transferred pInputFileStream allocates memory, which is used by the calling instance must be released again. To do this, you can use the function int FileHelper::closeInputFile( std::wifstream *& pFileStream ) used will be.

◆ openOutputFile() [1/4]

__tool_export_dll int eut::FileHelper::openOutputFile ( std::ofstream *& pOutputFileStream,
const std::string & rsFileName )

Returns an open file of type std::ofstream for reading in the file system.

Parameters
[in,out]pOutputFileStreamPointer reference to an output file stream which represents the open file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If a valid output file stream was delivered, the the calling instance will close it again. It is used for transferred pOutputFileStream allocates memory, which is used by the calling instance must be released again. To do this, you can use the function int closeOutputFile( std::ofstream *& pFileStream ) can be used.

◆ openOutputFile() [2/4]

__tool_export_dll int eut::FileHelper::openOutputFile ( std::ofstream *& pOutputFileStream,
const std::wstring & rsFileName )

Returns an open file of type std::ofstream for reading in the file system.

Parameters
[in,out]pOutputFileStreamPointer reference to an output file stream which represents the open file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If a valid output file stream was delivered, the the calling instance will close it again. It is used for transferred pOutputFileStream allocates memory, which is used by the calling instance must be released again. To do this, you can use the function int closeOutputFile( std::ofstream *& pFileStream ) can be used.

◆ openOutputFile() [3/4]

__tool_export_dll int eut::FileHelper::openOutputFile ( std::wofstream *& pOutputFileStream,
const std::string & rsFileName )

Returns an open file of type std::wofstream for reading in the file system.

Parameters
[in,out]pOutputFileStreamPointer reference to an output file stream which represents the open file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If a valid output file stream was delivered, the the calling instance will close it again. It is used for transferred pOutputFileStream allocates memory, which is used by the calling instance must be released again. To do this, you can use the function int closeOutputFile( std::wofstream *& pFileStream ) are used.

◆ openOutputFile() [4/4]

__tool_export_dll int eut::FileHelper::openOutputFile ( std::wofstream *& pOutputFileStream,
const std::wstring & rsFileName )

Returns an open file of type std::wofstream for reading in the file system.

Parameters
[in,out]pOutputFileStreamPointer reference to an output file stream which represents the open file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt")
Returns
A return value < 0 indicates an error.
Note
If a valid output file stream was delivered, the the calling instance will close it again. It is used for transferred pOutputFileStream allocates memory, which is used by the calling instance must be released again. To do this, you can use the function int closeOutputFile( std::wofstream *& pFileStream ) are used.

◆ splitPath() [1/2]

__tool_export_dll void eut::FileHelper::splitPath ( const std::string & rsFullFileName,
std::string & rsDrive,
std::string & rsPath,
std::string & rsFileName,
std::string & rsFileExtension )

Expects a file name including path (e.g.

"c:/temp/TestText.txt"); returns all path components.

Parameters
[in]rsFullFileNameThe complete file name of the file name to be split.
Note
If only a path without file is to be passed, the path must end with a '/'.
Parameters
[in,out]rsDriveName of the drive (or the representation of such a drive).
[in,out]rsPathThe path. Path separators are supplied as '/'.
[in,out]rsFileNameThe file name
[in,out]rsFileExtensionA file extension, if available

◆ splitPath() [2/2]

__tool_export_dll void eut::FileHelper::splitPath ( const std::wstring & rsFullFileName,
std::wstring & rsDrive,
std::wstring & rsPath,
std::wstring & rsFileName,
std::wstring & rsFileExtension )

Expects a file name including path (e.g.

"c:/temp/TestText.txt"); returns all path components.

Parameters
[in]rsFullFileNameThe complete file name of the file name to be split.
Note
If only a path without file is to be passed, the path must end with a '/'.
Parameters
[in,out]rsDriveName of the drive (or the representation of such a drive).
[in,out]rsPathThe path. Path separators are supplied as '/'.
[in,out]rsFileNameThe file name
[in,out]rsFileExtensionA file extension, if available

◆ storeFile() [1/7]

__tool_export_dll int eut::FileHelper::storeFile ( char * pszData,
std::streamsize nSize,
const std::string & rsFileName )

Saves data to a file in the file system.

Parameters
[in]pszDataPointer to the memory which is to be stored in a file.
[in]nSizeSize of the memory area to be stored.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.

◆ storeFile() [2/7]

__tool_export_dll int eut::FileHelper::storeFile ( char * pszData,
std::streamsize nSize,
const std::wstring & rsFileName )

Saves data to a file in the file system.

Parameters
[in]pszDataPointer to the memory which is to be stored in a file.
[in]nSizeSize of the memory area to be stored.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.

◆ storeFile() [3/7]

__tool_export_dll int eut::FileHelper::storeFile ( const Blob & rBlob,
const std::string & rsFileName )

Saves the contents of a blob to a file in the file system.

Parameters
[in]rBlobReference to an Blob whose content is to be stored in a file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ storeFile() [4/7]

__tool_export_dll int eut::FileHelper::storeFile ( const Blob & rBlob,
const std::wstring & rsFileName )

Saves the contents of a blob to a file in the file system.

Parameters
[in]rBlobReference to an Blob whose content is to be stored in a file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ storeFile() [5/7]

__tool_export_dll int eut::FileHelper::storeFile ( const Blob * pBlob,
const std::string & rsFileName )

Saves the contents of a blob to a file in the file system.

Parameters
[in]pBlobPointer to an Blob whose content is to be stored in a file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ storeFile() [6/7]

__tool_export_dll int eut::FileHelper::storeFile ( const Blob * pBlob,
const std::wstring & rsFileName )

Saves the contents of a blob to a file in the file system.

Parameters
[in]pBlobPointer to an Blob whose content is to be stored in a file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.

◆ storeFile() [7/7]

__tool_export_dll int eut::FileHelper::storeFile ( const std::string & rsStr,
const std::string & rsFileName )

Saves a string to a file in the file system.

Parameters
[in]rsStrA standard string to be stored in a file.
[in]rsFileNameThe complete file name (e.g. "c:\\temp\\TestText.txt").
Returns
A return value < 0 indicates an error.

◆ swapDataInFile()

__tool_export_dll int eut::FileHelper::swapDataInFile ( std::vector< std::string > & rParamVector,
bool bSimulate = false )

Searches and replaces contents in files and saves them under a different name if desired.

Parameters
[in]rParamVectorA std::vector<std::string> with the parameters. The following parameters are expected:
  • rParamVector[0] The file whose content is to be changed (e.g. 'c:/dir/filename.txt').
  • rParamVector[1] The expression to be exchanged in the data from rParamVector[0] with the data from rParamVector[2]. Format: The parameter rParamVector[1] must always begin with 'text:' or 't:', 'hex:' or 'h:' or 'file:' or 'f:'.
    • If the expression starts with 'text:' or 't:', the following Text taken as text to be exchanged. For example 'text:old text'. results in 'old text'.
    • If the expression begins with 'hex:' or 'h:', the following text after 'hex:' or 'h:' is interpreted as a hexadecimal number sequence, which is to be replaced. The hex values must have two digits, must be transferred separated by commas (e.g. "h:0D,0A").
    • If the expression begins with 'file:' or 'f:', the contents of of the file whose name follows 'file:' or 'f:'. If e.g. 'file:D:/dir/filename.txt', the content of the file 'D:/dir/filename.txt' as text to be exchanged.
  • rParamVector[2] The content to be exchanged.
    Format: The parameter rParamVector[2] must always be terminated with 'text:'. or 't:' or 'file:' or 'f:'.
    • If the expression starts with 'text:' or 't:', the following Text taken as new text. For example 'text:new text'. results in 'new text' as new text.
    • If the expression begins with 'hex:' or 'h:', the original content (the second parameter 'AgeContent') by the hexadecimal number sequence after 'hex:' or 'h:' replaced. The hex values must have two digits, must be transferred separated by commas (e.g. "h:0D,0A").
    • If the expression begins with 'file:' or 'f:', the contents of of the file whose name follows 'file:' or 'f:'. If e.g. 'file:D:/dir/filename.txt', the content of the file 'D:/dir/filename.txt' taken as new text
  • rParamVector[3] The file into which the changed content from rParamVector[0] should be saved. If the file already exists, not is overwritten (Error ERR_FILE_ALREADY_EXIST). See also rParamVector[4-n] -> '-force'.
    If the parameter is empty, the file from rParamVector[0] is returned The parameter '-force' is not necessary for this.
  • rParamVector[4-n] A control command can be passed:
    • '-force' or '-f' The file from rParamVector[3] even if it already exists.
    • '-cwd' The target file is saved relative to the current working directory created.
[in]bSimulateIf true, will not be stored.
Note
The character '/' is expected as separator in the path specifications!
Returns
A return < 0 indicates an error.
Note
This function is only available if the preprocessor directive __EUFILEHELPER_WITH_EUBLOB is defined.