zz::fs::FileEditor Class Reference
The FileEditor class to modify file This class is derived from UnCopyable, so no copy operation. Move operation is allowed by std::move();. More...
#include <zupply.hpp>
Inheritance diagram for zz::fs::FileEditor:
Public Member Functions | |
| FileEditor (std::string filename, bool truncateOrNot=false, int retryTimes=consts::kDefaultFileOpenRetryTimes, int retryInterval=consts::kDefaultFileOpenRetryInterval) | |
| FileEditor constructor. More... | |
| FileEditor & | operator= (FileEditor &&)=delete |
| template<typename T > | |
| FileEditor & | operator<< (T what) |
| Overload << operator just like a stream. | |
| std::string | filename () const |
| Return filename. More... | |
| bool | open (std::string filename, bool truncateOrNot=false, int retryTimes=consts::kDefaultFileOpenRetryTimes, int retryInterval=consts::kDefaultFileOpenRetryInterval) |
| Open file. More... | |
| bool | open (const char *filename, bool truncateOrNot=false, int retryTimes=consts::kDefaultFileOpenRetryTimes, int retryInterval=consts::kDefaultFileOpenRetryInterval) |
| Open file. More... | |
| bool | open (bool truncateOrNot=false) |
| Open file. More... | |
| bool | reopen (bool truncateOrNot=true) |
| Reopen current file. More... | |
| void | close () |
| Close current file. | |
| bool | is_valid () const |
| Check whether current file handler is set. More... | |
| bool | is_open () const |
| Check if file is opened. More... | |
| void | flush () |
| Flush file stream. | |
Detailed Description
The FileEditor class to modify file This class is derived from UnCopyable, so no copy operation. Move operation is allowed by std::move();.
Constructor & Destructor Documentation
| zz::fs::FileEditor::FileEditor | ( | std::string | filename, |
| bool | truncateOrNot = false, |
||
| int | retryTimes = consts::kDefaultFileOpenRetryTimes, |
||
| int | retryInterval = consts::kDefaultFileOpenRetryInterval |
||
| ) |
FileEditor constructor.
- Parameters
-
filename truncateOrNot Whether open in truncate mode or not retryTimes Retry open file if not success retryInterval Retry interval in ms
Member Function Documentation
|
inline |
Return filename.
- Returns
- Filename of this object
|
inline |
Check if file is opened.
- Returns
- True if opened
|
inline |
Check whether current file handler is set.
- Returns
- True if valid file
| bool zz::fs::FileEditor::open | ( | std::string | filename, |
| bool | truncateOrNot = false, |
||
| int | retryTimes = consts::kDefaultFileOpenRetryTimes, |
||
| int | retryInterval = consts::kDefaultFileOpenRetryInterval |
||
| ) |
Open file.
- Parameters
-
filename truncateOrNot Whether open in truncate mode or not retryTimes Retry open file if not success retryInterval Retry interval in ms
- Returns
- True if success
| bool zz::fs::FileEditor::open | ( | const char * | filename, |
| bool | truncateOrNot = false, |
||
| int | retryTimes = consts::kDefaultFileOpenRetryTimes, |
||
| int | retryInterval = consts::kDefaultFileOpenRetryInterval |
||
| ) |
Open file.
- Parameters
-
filename truncateOrNot Whether open in truncate mode or not retryTimes Retry open file if not success retryInterval Retry interval in ms
- Returns
- True if success
| bool zz::fs::FileEditor::open | ( | bool | truncateOrNot = false | ) |
Open file.
- Parameters
-
truncateOrNot Whether open in truncate mode or not
- Returns
- True if success
| bool zz::fs::FileEditor::reopen | ( | bool | truncateOrNot = true | ) |
Reopen current file.
- Parameters
-
truncateOrNot
- Returns
- True if success
The documentation for this class was generated from the following files:
- zupply.hpp
- zupply.cpp
1.8.9.1