Implement write support for file types.
More...
#include <io.hpp>
|
template<auto CountFmt, typename ... ArgTs> |
FileT & | printf (char const (&fmt)[CountFmt], ArgTs const &... args) |
| Output with printf style formatting. More...
|
|
template<auto CountFmt> |
FileT & | printf (char const (&fmt)[CountFmt]) |
| Output a printf style formatted string. More...
|
|
template<std::size_t Count> |
FileT & | print (char const (&msg)[Count]) |
| Print an unformatted string, excluding the last character. More...
|
|
FileT & | putc (int const character) |
| Write a single character to the string. More...
|
|
template<typename T > |
FileT & | write (T const &src) |
| Write an object to file. More...
|
|
template<typename T , std::size_t Count> |
FileT & | write (T const (&src)[Count], std::size_t const count) |
| Write an objects to file. More...
|
|
FileT & | flush () |
| Flush file buffers. More...
|
|
| operator bool () const |
| Cast to boolean. More...
|
|
bool | eof () const |
| Return whether the file instance is in EOF state. More...
|
|
bool | error () const |
| Return whether the file instance is in an error state. More...
|
|
template<class FileT, feature ... Tail>
class sys::io::file_feature< FileT, write, Tail ... >
Implement write support for file types.
- Template Parameters
-
FileT | The file access type inheriting the feature |
Tail | The remaining features |
◆ flush()
template<class FileT , feature ... Tail>
Flush file buffers.
- See also
- fflush()
- Returns
- A self reference
◆ print()
template<class FileT , feature ... Tail>
template<std::size_t Count>
Print an unformatted string, excluding the last character.
This method is built around the assumption that the argument is a string literal and the last character is a terminating zero.
- See also
- fwrite()
- Template Parameters
-
Count | The number of characters in the string |
- Parameters
-
- Returns
- A self reference
◆ printf() [1/2]
template<class FileT , feature ... Tail>
template<auto CountFmt>
Output a printf style formatted string.
This overload exists as a workaround for a bug in clang++-8's -Wformat-security that does not recognise the format as a literal string if no arguments follow.
- See also
- fprintf()
- Template Parameters
-
CountFmt | The number of characters in the formatting string |
- Parameters
-
- Returns
- A self reference
◆ printf() [2/2]
template<class FileT , feature ... Tail>
template<auto CountFmt, typename ... ArgTs>
Output with printf style formatting.
- See also
- fprintf()
- Template Parameters
-
CountFmt | The number of characters in the formatting string |
ArgTs | The argument types of the data to print |
- Parameters
-
fmt | The format string |
args | The set of data to print |
- Returns
- A self reference
◆ putc()
template<class FileT , feature ... Tail>
Write a single character to the string.
- See also
- fputc()
- Parameters
-
character | The character to write |
- Returns
- A self reference
◆ write() [1/2]
template<class FileT , feature ... Tail>
template<typename T >
Write an object to file.
- See also
- fwrite()
- Template Parameters
-
T | The object type, should be a POD type |
- Parameters
-
src | The object to write out to the file |
- Returns
- A self reference
◆ write() [2/2]
template<class FileT , feature ... Tail>
template<typename T , std::size_t Count>
FileT& sys::io::file_feature< FileT, write, Tail ... >::write |
( |
T const (&) |
src[Count], |
|
|
std::size_t const |
count |
|
) |
| |
|
inline |
Write an objects to file.
- See also
- fwrite()
- Template Parameters
-
T | The object type, should be a POD type |
Count | The number of objects in the source buffer |
- Parameters
-
src | The object to write out to the file |
count | The number of objects to write |
- Returns
- A self reference
The documentation for this class was generated from the following file: