powerd++  0.4.4
Public Member Functions | List of all members
sys::io::file< link, Features ... > Class Template Referencefinal

Specialise for FILE object linking file instances. More...

#include <io.hpp>

Inheritance diagram for sys::io::file< link, Features ... >:
[legend]
Collaboration diagram for sys::io::file< link, Features ... >:
[legend]

Public Member Functions

 file (FILE *const handle)
 Use the given FILE object. More...
 
 file ()
 Default construct.
 
template<ownership Ownership, feature ... Superset, class = is_superset_of_t<set<Superset ...>, set<Features ...>>>
 file (file< Ownership, Superset ... > const &copy)
 Copy construct from another file type instance. More...
 
template<feature ... Superset, class = is_superset_of_t<set<Superset ...>, set<Features ...>>>
 file (file< own, Superset ... > &&)=delete
 Must not move construct from files with ownership of their handle. More...
 
template<ownership Ownership, feature ... Superset, class = is_superset_of_t<set<Superset ...>, set<Features ...>>>
fileoperator= (file< Ownership, Superset ... > const &copy)
 Copy assign from another file type instance. More...
 
template<feature ... Superset, class = is_superset_of_t<set<Superset ...>, set<Features ...>>>
fileoperator= (file< own, Superset ... > &&)=delete
 Must not move assign from files with ownership of their handle. More...
 
FILE * get () const
 Provide the internal FILE object pointer. More...
 
- Public Member Functions inherited from sys::io::file_feature< file< link, Features ... >, Features ... >
 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< file< link, Features ... >, Features ... >
 operator file< link, Features ... > & ()
 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< file< link, Features ... >, Features ... >
FILE * handle
 A pointer to the underlying FILE object.
 

Detailed Description

template<feature ... Features>
class sys::io::file< link, Features ... >

Specialise for FILE object linking file instances.

Lack of ownership implies some semantics:

Template Parameters
FeaturesThe set of file access features to support

Constructor & Destructor Documentation

◆ file() [1/3]

template<feature ... Features>
sys::io::file< link, Features ... >::file ( FILE *const  handle)
inlineexplicit

Use the given FILE object.

This can be used to refer to FILE objects managed by legacy C code.

Parameters
handleA pointer to a FILE object

◆ file() [2/3]

template<feature ... Features>
template<ownership Ownership, feature ... Superset, class = is_superset_of_t<set<Superset ...>, set<Features ...>>>
sys::io::file< link, Features ... >::file ( file< Ownership, Superset ... > const &  copy)
inline

Copy construct from another file type instance.

The origin file type instance must support all features supported by this file type.

Template Parameters
OwnershipThe ownership status of the other file type
SupersetThe feature set of another file type
CondWhether Superset is an actual superset of Features
Parameters
copyThe lvalue file to acquire the FILE object from

◆ file() [3/3]

template<feature ... Features>
template<feature ... Superset, class = is_superset_of_t<set<Superset ...>, set<Features ...>>>
sys::io::file< link, Features ... >::file ( file< own, Superset ... > &&  )
delete

Must not move construct from files with ownership of their handle.

Template Parameters
SupersetThe feature set of another FILE object owning file type

Member Function Documentation

◆ get()

template<feature ... Features>
FILE* sys::io::file< link, Features ... >::get ( ) const
inline

Provide the internal FILE object pointer.

Can be used to pass the file to legacy C interfaces.

Returns
A pointer to the managed FILE object

◆ operator=() [1/2]

template<feature ... Features>
template<feature ... Superset, class = is_superset_of_t<set<Superset ...>, set<Features ...>>>
file& sys::io::file< link, Features ... >::operator= ( file< own, Superset ... > &&  )
delete

Must not move assign from files with ownership of their handle.

Template Parameters
SupersetThe feature set of another FILE object owning file type
Returns
A self reference

◆ operator=() [2/2]

template<feature ... Features>
template<ownership Ownership, feature ... Superset, class = is_superset_of_t<set<Superset ...>, set<Features ...>>>
file& sys::io::file< link, Features ... >::operator= ( file< Ownership, Superset ... > const &  copy)
inline

Copy assign from another file type instance.

The origin file type instance must support all features supported by this file type.

Template Parameters
OwnershipThe ownership status of the other file type
SupersetThe feature set of another file type
CondWhether Superset is an actual superset of Features
Parameters
copyThe lvalue file to acquire the FILE object from
Returns
A self reference

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