The application class of ExchangeFileContents.
More...
#include <EfcApp.h>
|
class | EfcCallBackFileFount |
| Class to process found files; passed to eut::FileHelper::iterateDirectory( const fs::path & rIterPath, bool bRecursive, CallBackFileDirFount & rProcessingObject ). More...
|
|
|
| EfcApp (const std::vector< std::wstring > &rArgVector) |
|
virtual | ~EfcApp () |
|
int | exec () |
|
The application class of ExchangeFileContents.
◆ EfcApp() [1/3]
EfcApp::EfcApp |
( |
const std::vector< std::wstring > & | rArgVector | ) |
|
Constructor with parameter passing.
- Parameters
-
[in] | rArgVector | The arguments (parameters) passed to the application.
Structur:
- rArgVector[0] The file whose content is to be changed (e.g. 'c:/dir/filename.txt').
- rArgVector[1] The expression to be exchanged in the data from rArgVector[0] with the data from rArgVector[2]. Format: The parameter rArgVector[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.
- rArgVector[2] The content to be exchanged.
Format: The parameter rArgVector[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
- rArgVector[3] Optional the file into which the changed content from rArgVector[0] should be saved. If the file already exists,
- rArgVector[n] Furthermore, the following parameters can be passed:
- -r The subdirctorys are also searched recursively.
- <v>-v
Indicates wheter an how often the content of the file has been changed.
- -v+ Also displays the skipped files.
- -s Stops in case of an error and waits for a keystroke.
- -f If the parameter [targetfile] is set, an existing target file will only be overwritten if this parameter is passed.
- -nop The processing is only simulated, no files are changed or created.
|
◆ ~EfcApp()
virtual EfcApp::~EfcApp |
( |
| ) |
|
|
virtual |
Destructor, the memory is cleaned up.
◆ EfcApp() [2/3]
The standard constructor is not available.
◆ EfcApp() [3/3]
EfcApp::EfcApp |
( |
const EfcApp & | | ) |
|
|
private |
The copy constructor is not available.
◆ exec()
Starts the application. The parameters will be checked and adjusted and then eut::FileHelper::iterateDirectory(const fs::path &, bool, CallBackFileDirFount &) will be called (among others with passing an EfcApp::EfcCallBackFileFount as parameter).
- Returns
- A return value < 0 indicates an error.
◆ getFileNameAndExtension()
void EfcApp::getFileNameAndExtension |
( |
std::wstring & | rsFileName, |
|
|
std::wstring & | rsExtension, |
|
|
const fs::path & | rFileSystemPath ) |
|
private |
Returns the file name and extension from the given filesystem path. This function exists, so that with a file name == "*" an extension ".*" is also delivered.
- Parameters
-
[in,out] | rsFileName | The determined file name. |
[in,out] | rsExtension | The determined extension name. |
[in] | rFileSystemPath | The path from which the file and extension name is to be determined. |
◆ operator=()
The assignment operator is not available.
◆ showHelp()
void EfcApp::showHelp |
( |
| ) |
|
|
private |
Shows the command syntax of efc.
◆ showResult()
void EfcApp::showResult |
( |
int | iResultCode, |
|
|
const std::string & | rsCurrentFile ) |
|
private |
Shows how often an exchange has taken place or, if an error has occurred, an error message.
- Parameters
-
[in] | iResultCode | The error code. |
[in] | rsCurrentFile | The name of the currently processed file. |
◆ m_bSimulate
If true, the processing is only simulated, i.e. no change is stored (default is 'false').
◆ m_bStopOnError
bool EfcApp::m_bStopOnError |
|
private |
Wenn true, processing stops on errors and wait for a key press (default is 'false').
◆ m_iVerboseMode
int EfcApp::m_iVerboseMode |
|
private |
The output mode (default is 0).
- 0 -> Show nothing
- 1 -> show only found files
- 2 -> show all (also skipped)
◆ m_ParaVector
std::vector<std::wstring> EfcApp::m_ParaVector |
|
private |
A vector with the parameters.
◆ m_sFileExtensionFilter
std::wstring EfcApp::m_sFileExtensionFilter |
|
private |
The file extension filter can also contain wildcard characters ('*' and '?').
◆ m_sFileNameFilter
std::wstring EfcApp::m_sFileNameFilter |
|
private |
The file name filter can also contain wildcard characters ('*' and '?').
◆ m_sLanguage
std::string EfcApp::m_sLanguage |
|
private |
The determined language (default is "en" for English).
The documentation for this class was generated from the following file: