Base Framework
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
FileDescriptor Class Reference

File descriptor. More...

#include <base/io/FileDescriptor.h>

Inherits Object, and Stream.

Inherited by FileDescriptorInputStream, and FileDescriptorOutputStream.

Classes

class  Descriptor
 File descriptor. More...
 

Public Member Functions

 FileDescriptor () noexcept
 
 FileDescriptor (OperatingSystem::Handle handle) noexcept
 
 FileDescriptor (const FileDescriptor &copy) noexcept
 
FileDescriptoroperator= (const FileDescriptor &assign) noexcept
 
void close ()
 
bool isANSITerminal () const noexcept
 
bool isTerminal () const noexcept
 
bool isPipe () const noexcept
 
int getFlags () const
 
void setFlags (int flags)
 
OperatingSystem::Handle getHandle () const noexcept
 
bool isValid () const noexcept
 
void setHandle (OperatingSystem::Handle handle) noexcept
 
void setNonBlocking (bool value)
 
 ~FileDescriptor ()
 
- Public Member Functions inherited from Stream
virtual ~Stream () noexcept(false)
 
- Public Member Functions inherited from ReferenceCountedObject
 ReferenceCountedObject () noexcept
 
 ReferenceCountedObject (const ReferenceCountedObject &copy) noexcept
 
 ReferenceCountedObject (ReferenceCountedObject &&move) noexcept
 
ReferenceCountedObjectoperator= (const ReferenceCountedObject &copy) noexcept
 
ReferenceCountedObjectoperator= (ReferenceCountedObject &&move) noexcept
 
MemorySize getNumberOfReferences_INTERNAL () const noexcept
 
virtual bool useGarbageCollector () const noexcept
 
- Public Member Functions inherited from DynamicObject
 DynamicObject () noexcept
 
bool isValidObject () const noexcept
 
virtual ~DynamicObject () noexcept(false)
 
 _COM_AZURE_DEV__BASE__OVERRIDE_ALLOC ()
 

Static Public Member Functions

static FileDescriptor getStandardInput () noexcept
 
static FileDescriptor getStandardOutput () noexcept
 
static FileDescriptor getStandardError () noexcept
 

Protected Attributes

Reference< Handlefd
 

Detailed Description

File descriptor.

The FileDescriptor class serves as a general handle to a source or sink of bytes within the operatingsystem (e.g. file, socket and pipe). This class is normally not used directly by the application.

Version
1.0

Constructor & Destructor Documentation

◆ FileDescriptor() [1/3]

FileDescriptor::FileDescriptor ( )
noexcept

Initializes the file descriptor as invalid.

◆ FileDescriptor() [2/3]

FileDescriptor::FileDescriptor ( OperatingSystem::Handle  handle)
noexcept

Initializes the file descriptor.

Parameters
handleHandle to file descriptor.

◆ FileDescriptor() [3/3]

FileDescriptor::FileDescriptor ( const FileDescriptor copy)
noexcept

Copy constructor.

◆ ~FileDescriptor()

FileDescriptor::~FileDescriptor ( )

Destroys the file descriptor.

Member Function Documentation

◆ close()

void FileDescriptor::close ( )
virtual

Closes the file descriptor.

Implements Stream.

Reimplemented in FileDescriptorInputStream, and FileDescriptorOutputStream.

◆ getFlags()

int FileDescriptor::getFlags ( ) const

Gets the flags of the file descriptor.

◆ getHandle()

OperatingSystem::Handle FileDescriptor::getHandle ( ) const
noexcept

Gets the handle of the file descriptor.

◆ getStandardError()

static FileDescriptor FileDescriptor::getStandardError ( )
staticnoexcept

Returns the standard error file descriptor.

◆ getStandardInput()

static FileDescriptor FileDescriptor::getStandardInput ( )
staticnoexcept

Returns the standard input file descriptor.

◆ getStandardOutput()

static FileDescriptor FileDescriptor::getStandardOutput ( )
staticnoexcept

Returns the standard output file descriptor.

◆ isANSITerminal()

bool FileDescriptor::isANSITerminal ( ) const
noexcept

Returns true if the handle is an ANSI terminal.

◆ isPipe()

bool FileDescriptor::isPipe ( ) const
noexcept

Returns true if the file descriptor is a pipe.

◆ isTerminal()

bool FileDescriptor::isTerminal ( ) const
noexcept

Returns true if the handle is a terminal.

◆ isValid()

bool FileDescriptor::isValid ( ) const
noexcept

Returns true if the handle is valid.

◆ operator=()

FileDescriptor& FileDescriptor::operator= ( const FileDescriptor assign)
noexcept

Assignment operator.

◆ setFlags()

void FileDescriptor::setFlags ( int  flags)

Sets the flags of the file descriptor.

◆ setHandle()

void FileDescriptor::setHandle ( OperatingSystem::Handle  handle)
noexcept

Sets the handle of the file descriptor.

◆ setNonBlocking()

void FileDescriptor::setNonBlocking ( bool  value)

Sets the non-blocking flag of the file descriptor.

Member Data Documentation

◆ fd

Reference<Handle> FileDescriptor::fd
protected

Reference counted handle to file descriptor.