Regina Calculation Engine
|
File reading and writing. More...
Classes | |
class | regina::NFileInfo |
Stores information about a Regina data file, including file type and version. More... | |
class | regina::NGlobalDirs |
Provides global routines that return directories in which various components of Regina are installed on the system. More... | |
class | regina::NXMLCallback |
Provides the callbacks for an XMLParser required to parse an entire file using a series of NXMLElementReader objects. More... | |
class | regina::NXMLElementReader |
Used to read the contents of a single XML element. More... | |
class | regina::NXMLCharsReader |
A reader for an XML element that contains only characters. More... | |
Functions | |
REGINA_API bool | regina::writeXMLFile (const char *fileName, NPacket *subtree, bool compressed=true) |
Writes the subtree with the given packet as matriarch to disk as a complete XML file. More... | |
REGINA_API NPacket * | regina::readXMLFile (const char *fileName) |
Reads the packet tree stored in the given XML file. More... | |
REGINA_API NPacket * | regina::readFileMagic (const std::string &fileName) |
Reads a packet tree from a file whose format is unknown. More... | |
File reading and writing.
REGINA_API NPacket* regina::readFileMagic | ( | const std::string & | fileName) |
Reads a packet tree from a file whose format is unknown.
As of Regina 4.94, old-style binary files are no longer supported. This means that the file must be in XML format (optionally compressed). In other words, this routine now behaves identically to readXMLFile().
If the matriarch of the packet tree could not be read, this routine will return 0. If a lower-level packet could not be read, it (and its descendants) will simply be ignored.
The given file might be opened and closed multiple times during this routine.
fileName | the pathname of the file to read from. |
REGINA_API NPacket* regina::readXMLFile | ( | const char * | fileName) |
Reads the packet tree stored in the given XML file.
It does not matter whether the XML file is compressed.
If the matriarch of the packet tree could not be read, this routine will return 0. If a lower-level packet could not be read, it (and its descendants) will simply be ignored.
fileName | the pathname of the file to read from. |
REGINA_API bool regina::writeXMLFile | ( | const char * | fileName, |
NPacket * | subtree, | ||
bool | compressed = true |
||
) |
Writes the subtree with the given packet as matriarch to disk as a complete XML file.
The XML file may be optionally compressed.
This is the preferred way of writing a packet tree to file.
fileName | the pathname of the file to write to. |
subtree | the matriarch of the packet tree that should be written. |
compressed | true if the XML file should be compressed or false if it should be stored as plain text. |
true
if and only if the packet subtree was successfully written.