Regina Calculation Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
regina::NFileInfo Class Reference

Stores information about a Regina data file, including file type and version. More...

#include <file/nfileinfo.h>

Inheritance diagram for regina::NFileInfo:
regina::Output< NFileInfo >

Public Member Functions

const std::string & pathname () const
 Returns the pathname of the data file being described. More...
 
REGINA_DEPRECATED const std::string & getPathname () const
 Deprecated routine that returns the pathname of the data file being described. More...
 
int type () const
 Returns the type of data file. More...
 
REGINA_DEPRECATED int getType () const
 Deprecated routine that returns the type of data file. More...
 
const std::string & typeDescription () const
 Returns a human-readable description of the type of data file. More...
 
REGINA_DEPRECATED const std::string & getTypeDescription () const
 Deprecated routine that returns a human-readable description of the type of data file. More...
 
const std::string & engine () const
 Returns the version of the calculation engine that wrote this file. More...
 
REGINA_DEPRECATED const std::string & getEngine () const
 Deprecated routine that returns the version of the calculation engine that wrote this file. More...
 
bool isCompressed () const
 Returns whether this file is stored in compressed format. More...
 
bool isInvalid () const
 Returns whether the file metadata could not be read. More...
 
void writeTextShort (std::ostream &out) const
 Writes a short text representation of this object to the given output stream. More...
 
void writeTextLong (std::ostream &out) const
 Writes a detailed text representation of this object to the given output stream. More...
 
std::string str () const
 Returns a short text representation of this object. More...
 
std::string utf8 () const
 Returns a short text representation of this object using unicode characters. More...
 
std::string detail () const
 Returns a detailed text representation of this object. More...
 
REGINA_DEPRECATED std::string toString () const
 A deprecated alias for str(). More...
 
REGINA_DEPRECATED std::string toStringLong () const
 A deprecated alias for detail(). More...
 

Static Public Member Functions

static NFileInfoidentify (const std::string &idPathname)
 Return information about the given Regina data file. More...
 

Static Public Attributes

static const int TYPE_XML
 Represents a new-style XML data file. More...
 

Detailed Description

Stores information about a Regina data file, including file type and version.

Routine identify() can be used to determine this information for a given file.

As of Regina 4.94, the old-style binary files are no longer supported. These have not been in use for over a decade. The only file type that this class now recognises is TYPE_XML (compressed or uncompressed XML data files).

Member Function Documentation

§ detail()

std::string regina::Output< NFileInfo , false >::detail ( ) const
inherited

Returns a detailed text representation of this object.

This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.

Returns
a detailed text representation of this object.

§ engine()

const std::string & regina::NFileInfo::engine ( ) const
inline

Returns the version of the calculation engine that wrote this file.

Returns
the engine version for this file.

§ getEngine()

const std::string & regina::NFileInfo::getEngine ( ) const
inline

Deprecated routine that returns the version of the calculation engine that wrote this file.

Deprecated:
This routine has been renamed to engine(). See the engine() documentation for further details.

§ getPathname()

const std::string & regina::NFileInfo::getPathname ( ) const
inline

Deprecated routine that returns the pathname of the data file being described.

Deprecated:
This routine has been renamed to pathname(). See the pathname() routine for further details.

§ getType()

int regina::NFileInfo::getType ( ) const
inline

Deprecated routine that returns the type of data file.

Deprecated:
This routine has been renamed to type(). See the type() documentation for further details.

§ getTypeDescription()

const std::string & regina::NFileInfo::getTypeDescription ( ) const
inline

Deprecated routine that returns a human-readable description of the type of data file.

Deprecated:
This routine has been renamed to typeDescription(). See the typeDescription() documentation for further details.

§ identify()

static NFileInfo* regina::NFileInfo::identify ( const std::string &  idPathname)
static

Return information about the given Regina data file.

Internationalisation:
This routine makes no assumptions about the character encoding used in the given path name, and simply passes it through unchanged to low-level C/C++ file I/O routines. If an NFileInfo structure is returned, its pathname() routine will use the same encoding that is passed here.
Parameters
idPathnamethe pathname of the data file to be examined.
Returns
a newly created NFileInfo structure containing information about the given file, or 0 if the file type could not be identified.

§ isCompressed()

bool regina::NFileInfo::isCompressed ( ) const
inline

Returns whether this file is stored in compressed format.

Currently this option only applies to XML data files.

Returns
true if this file is compressed or false otherwise.

§ isInvalid()

bool regina::NFileInfo::isInvalid ( ) const
inline

Returns whether the file metadata could not be read.

Returns
true if the metadata could not be read, false otherwise.

§ pathname()

const std::string & regina::NFileInfo::pathname ( ) const
inline

Returns the pathname of the data file being described.

Internationalisation:
The character encoding used in the pathname will be whatever was originally passed to identify(). This might or might not be UTF-8, since it needs to be understood by the low-level C/C++ file I/O routines.
Returns
the pathname.

§ str()

std::string regina::Output< NFileInfo , false >::str ( ) const
inherited

Returns a short text representation of this object.

This text should be human-readable, should fit on a single line, and should not end with a newline. Where possible, it should use plain ASCII characters.

Python:
In addition to str(), this is also used as the Python "stringification" function __str__().
Returns
a short text representation of this object.

§ toString()

REGINA_DEPRECATED std::string regina::Output< NFileInfo , false >::toString ( ) const
inherited

A deprecated alias for str().

Deprecated:
This routine has (at long last) been deprecated; use the simpler-to-type str() instead.
Returns
a short text representation of this object.

§ toStringLong()

REGINA_DEPRECATED std::string regina::Output< NFileInfo , false >::toStringLong ( ) const
inherited

A deprecated alias for detail().

Deprecated:
This routine has (at long last) been deprecated; use the simpler-to-type detail() instead.
Returns
a long text representation of this object.

§ type()

int regina::NFileInfo::type ( ) const
inline

Returns the type of data file.

The type will be given as one of the file type constants defined in this class.

Returns
the type of data file.

§ typeDescription()

const std::string & regina::NFileInfo::typeDescription ( ) const
inline

Returns a human-readable description of the type of data file.

Returns
a description of the type of data file.

§ utf8()

std::string regina::Output< NFileInfo , false >::utf8 ( ) const
inherited

Returns a short text representation of this object using unicode characters.

Like str(), this text should be human-readable, should fit on a single line, and should not end with a newline. In addition, it may use unicode characters to make the output more pleasant to read. This string will be encoded in UTF-8.

Returns
a short text representation of this object.

§ writeTextLong()

void regina::NFileInfo::writeTextLong ( std::ostream &  out) const

Writes a detailed text representation of this object to the given output stream.

Python:
Not present.
Parameters
outthe output stream to which to write.

§ writeTextShort()

void regina::NFileInfo::writeTextShort ( std::ostream &  out) const

Writes a short text representation of this object to the given output stream.

Python:
Not present.
Parameters
outthe output stream to which to write.

Member Data Documentation

§ TYPE_XML

const int regina::NFileInfo::TYPE_XML
static

Represents a new-style XML data file.


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

Copyright © 1999-2016, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).