powerd++  0.4.4
Public Member Functions | List of all members
sys::io::file_feature< FileT, write, Tail ... > Class Template Reference

Implement write support for file types. More...

#include <io.hpp>

Inheritance diagram for sys::io::file_feature< FileT, write, Tail ... >:
[legend]
Collaboration diagram for sys::io::file_feature< FileT, write, Tail ... >:
[legend]

Public Member Functions

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...
 
- Public Member Functions inherited from sys::io::file_feature< FileT, Tail ... >
 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...
 

Additional Inherited Members

- Protected Member Functions inherited from sys::io::file_feature< FileT, Tail ... >
 operator FileT & ()
 Implicit cast up to inheriting file access type.
 
 file_feature (FILE *const handle)
 Construct from a FILE object pointer. More...
 
- Protected Attributes inherited from sys::io::file_feature< FileT, Tail ... >
FILE * handle
 A pointer to the underlying FILE object.
 

Detailed Description

template<class FileT, feature ... Tail>
class sys::io::file_feature< FileT, write, Tail ... >

Implement write support for file types.

Template Parameters
FileTThe file access type inheriting the feature
TailThe remaining features

Member Function Documentation

◆ flush()

template<class FileT , feature ... Tail>
FileT& sys::io::file_feature< FileT, write, Tail ... >::flush ( )
inline

Flush file buffers.

See also
fflush()
Returns
A self reference

◆ print()

template<class FileT , feature ... Tail>
template<std::size_t Count>
FileT& sys::io::file_feature< FileT, write, Tail ... >::print ( char const (&)  msg[Count])
inline

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
CountThe number of characters in the string
Parameters
msgThe string to print
Returns
A self reference

◆ printf() [1/2]

template<class FileT , feature ... Tail>
template<auto CountFmt>
FileT& sys::io::file_feature< FileT, write, Tail ... >::printf ( char const (&)  fmt[CountFmt])
inline

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
CountFmtThe number of characters in the formatting string
Parameters
fmtThe format string
Returns
A self reference

◆ printf() [2/2]

template<class FileT , feature ... Tail>
template<auto CountFmt, typename ... ArgTs>
FileT& sys::io::file_feature< FileT, write, Tail ... >::printf ( char const (&)  fmt[CountFmt],
ArgTs const &...  args 
)
inline

Output with printf style formatting.

See also
fprintf()
Template Parameters
CountFmtThe number of characters in the formatting string
ArgTsThe argument types of the data to print
Parameters
fmtThe format string
argsThe set of data to print
Returns
A self reference

◆ putc()

template<class FileT , feature ... Tail>
FileT& sys::io::file_feature< FileT, write, Tail ... >::putc ( int const  character)
inline

Write a single character to the string.

See also
fputc()
Parameters
characterThe character to write
Returns
A self reference

◆ write() [1/2]

template<class FileT , feature ... Tail>
template<typename T >
FileT& sys::io::file_feature< FileT, write, Tail ... >::write ( T const &  src)
inline

Write an object to file.

See also
fwrite()
Template Parameters
TThe object type, should be a POD type
Parameters
srcThe 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
TThe object type, should be a POD type
CountThe number of objects in the source buffer
Parameters
srcThe object to write out to the file
countThe number of objects to write
Returns
A self reference

The documentation for this class was generated from the following file: