stromx  0.8.0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
stromx::runtime::File Class Reference

Data object which represents a path to a file. More...

#include <File.h>

Inheritance diagram for stromx::runtime::File:
stromx::runtime::Data stromx::runtime::DataInterface

Public Types

enum  OpenMode { BINARY, TEXT }
 

Public Member Functions

 File ()
 
 File (const std::string &path, const OpenMode mode=TEXT)
 
 File (const File &file)
 
const std::string & path () const
 
OpenMode mode () const
 
const std::string & extension () const
 
void setExtension (const std::string &extension)
 
virtual const Versionversion () const
 
virtual const std::string & type () const
 
virtual const std::string & package () const
 
virtual const VariantHandlevariant () const
 
virtual Dataclone () const
 
virtual void serialize (OutputProvider &output) const
 
virtual void deserialize (InputProvider &input, const Version &version)
 
- Public Member Functions inherited from stromx::runtime::DataInterface
bool isVariant (const VariantInterface &v) const
 

Static Public Member Functions

static const std::string & tempDir ()
 
static void setTempDir (const std::string dir)
 
static const std::string tempPath (const std::string &extension="")
 

Detailed Description

Data object which represents a path to a file.

Member Enumeration Documentation

§ OpenMode

The type the file.

Enumerator
BINARY 

Binary file.

TEXT 

Text file.

Constructor & Destructor Documentation

§ File() [1/3]

stromx::runtime::File::File ( )
inline

Creates an empty file, i.e. a file object with no path.

§ File() [2/3]

stromx::runtime::File::File ( const std::string &  path,
const OpenMode  mode = TEXT 
)

Create a file object which represents the file at path.

Exceptions
FileAccessFailedIf path does not exist or if path is not a file.

§ File() [3/3]

stromx::runtime::File::File ( const File file)

Copy constructs the file, i.e. it creates a file object which references the same file as file.

Member Function Documentation

§ clone()

virtual Data* stromx::runtime::File::clone ( ) const
inlinevirtual

Returns a copy of the data object, i.e. a object of the same type is allocated and the data of the original object is copied to the new object. A pointer to the new object is returned.

Implements stromx::runtime::DataInterface.

§ deserialize()

void stromx::runtime::File::deserialize ( InputProvider in,
const Version version 
)
virtual

Deserializes a data object.

Parameters
outThe input which the data obtained from.
versionThe version of the data class which serialized the input.

Reimplemented from stromx::runtime::Data.

§ extension()

const std::string& stromx::runtime::File::extension ( ) const
inline

Returns the extension of this file.

§ mode()

OpenMode stromx::runtime::File::mode ( ) const
inline

Returns the mode of this file.

§ package()

virtual const std::string& stromx::runtime::File::package ( ) const
inlinevirtual

Returns the package of the class of this data object.

Implements stromx::runtime::DataInterface.

§ path()

const std::string& stromx::runtime::File::path ( ) const
inline

Returns the path to this file.

§ serialize()

void stromx::runtime::File::serialize ( OutputProvider out) const
virtual

Serializes this data object.

Parameters
outThe output which the data is sent to.

Reimplemented from stromx::runtime::Data.

§ setExtension()

void stromx::runtime::File::setExtension ( const std::string &  extension)

Sets the extension of a file with no path. Use this e.g. to indicate the file type of a parameter.

Exceptions
WrongStateIf the path of this file object is set, i.e. the extension is determined by the file path.

§ setTempDir()

void stromx::runtime::File::setTempDir ( const std::string  dir)
static

Sets the path to the directory where temporary files are stored. Pass an empty string to reset the temporary directory.

§ tempDir()

const std::string & stromx::runtime::File::tempDir ( )
static

Returns the path to the directory where temporary files are stored.

§ tempPath()

const std::string stromx::runtime::File::tempPath ( const std::string &  extension = "")
static

Returns a path to an unique temporary file ending with extension.

§ type()

virtual const std::string& stromx::runtime::File::type ( ) const
inlinevirtual

Returns the name of the class of this data object.

Implements stromx::runtime::DataInterface.

§ variant()

const VariantHandle & stromx::runtime::File::variant ( ) const
virtual

Returns the data variant of this data object.

Implements stromx::runtime::DataInterface.

§ version()

virtual const Version& stromx::runtime::File::version ( ) const
inlinevirtual

Returns the version of the class of this data object.

Implements stromx::runtime::DataInterface.


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