Class for reading files.
More...
#include <FS_Reader.h>
|
static void | addReaderHelper (FS_ReaderHelper *helper) |
|
static void | removeReaderHelper (FS_ReaderHelper *helper) |
|
|
static bool | splitIndexFileSectionPath (const char *source_section_path, UT_String &index_file_path, UT_String §ion_name) |
|
static bool | splitIndexFileSectionPath (const char *source_section_path, UT_StringHolder &index_file_path, UT_StringHolder §ion_name) |
|
static bool | splitIndexFileSectionPath (const char *source_section_path, UT_String &index_file_path, UT_StringArray §ion_names) |
|
|
static void | combineIndexFileSectionPath (UT_String &source_section_path, const char *index_file_path, const char *section_name) |
|
static void | combineIndexFileSectionPath (UT_String &source_section_path, const char *index_file_path, const UT_StringArray §ion_names) |
|
Class for reading files.
Definition at line 33 of file FS_Reader.h.
FS_Reader::FS_Reader |
( |
const char * |
source, |
|
|
const UT_Options * |
options = 0 |
|
) |
| |
Use this constructor to create a new reader. The specified file is opened immediately. Common options:
- "string cache_mode" - Specify the "caching" pattern. This gives a hint to the file system about how the stream will be accessed.
- "normal" - Normal caching
- "random" - Access pattern is random
- "sequential" - Access pattern is sequential
- "int buffer_size" - Specify the buffer size (see setvbuf)
- "bool ascii" - Specify whether the file should be opened in ASCII read mode for automatically translating line-endings.
FS_Reader::~FS_Reader |
( |
| ) |
|
void FS_Reader::close |
( |
| ) |
|
Closes the stream. After calling this function, the getStream() function will always return nullptr
.
static void FS_Reader::combineIndexFileSectionPath |
( |
UT_String & |
source_section_path, |
|
|
const char * |
index_file_path, |
|
|
const char * |
section_name |
|
) |
| |
|
static |
Utility function to combine index file name and section name into the section path. It asks all registered reader helpers whether they recognize the index_file_path path protocol and can combine it with the section name into the section full path. If none of the helpers do, then it asks FS_IndexFile to combine the components, joining them with '?' by default.
- Parameters
-
[out] | source_section_path | The combined section full path. |
[in] | index_file_path | The base path to the index file. |
[in] | section_name | The name of the section inside the index file. |
[in] | section_names | The names of the nested sections in the index file, with the outermost section at the beginning of the array and the innermost section (contained within the outer sections) at the end of the array. If the array contains only one entry, it's equivalent to the method that takes just a single string. |
static void FS_Reader::combineIndexFileSectionPath |
( |
UT_String & |
source_section_path, |
|
|
const char * |
index_file_path, |
|
|
const UT_StringArray & |
section_names |
|
) |
| |
|
static |
Utility function to combine index file name and section name into the section path. It asks all registered reader helpers whether they recognize the index_file_path path protocol and can combine it with the section name into the section full path. If none of the helpers do, then it asks FS_IndexFile to combine the components, joining them with '?' by default.
- Parameters
-
[out] | source_section_path | The combined section full path. |
[in] | index_file_path | The base path to the index file. |
[in] | section_name | The name of the section inside the index file. |
[in] | section_names | The names of the nested sections in the index file, with the outermost section at the beginning of the array and the innermost section (contained within the outer sections) at the end of the array. If the array contains only one entry, it's equivalent to the method that takes just a single string. |
int64 FS_Reader::getLength |
( |
| ) |
const |
int64 FS_Reader::getMemoryUsage |
( |
bool |
inclusive | ) |
const |
Get the amount of memory owned by this FS_Reader.
time_t FS_Reader::getModTime |
( |
| ) |
const |
This function retrieves the C++ stream object which you can interact with in the normal ways. If this function returns nullptr
, the file specified in the constructor could not be found.
bool FS_Reader::isGood |
( |
| ) |
const |
|
inline |
This function is used to check if the file was successfully opened.
Definition at line 67 of file FS_Reader.h.
static bool FS_Reader::splitIndexFileSectionPath |
( |
const char * |
source_section_path, |
|
|
UT_String & |
index_file_path, |
|
|
UT_String & |
section_name |
|
) |
| |
|
static |
Utility fuction to split the original source path into the index file path and the section name. It asks all registered reader helpers whether they recognize the source path protocol and can provide the section name. If none of the helpers do, then it tries FS_IndexFile to split the source path on '?' by default.
- Parameters
-
[in] | source_section_path | The original source path to split. |
[out] | index_file_path | If the original source path refers to an index file section, this parameter is set to the index file path. Otherwise, it is set to the source_section_path parameter. |
[out] | section_name | If the original source path refers to and index file section, this parameter is set to the name of that section. Otherwise, it is set to an empty string. If there are many nested sections in the source path, then this argument will contain the innermost section name, and the index_file_path will point to the containing section (itself an index file). |
[out] | section_names | If the original source path refers to a section that is nested within other sections (that themselves are index files), then this parameter is set to these section names, with the outermost section at the beginning of the array and the innermost section (contained within the outer sections) at the end of the array. If there is just a single section, the array will contain just one entry (ie, the single section name), and the call will be equivalent to the method that takes just the single string. |
- Returns
- True if the path refered to a section name and the outgoing parameter 'section_name' contains a non-empty string; otherwise, returns false.
static bool FS_Reader::splitIndexFileSectionPath |
( |
const char * |
source_section_path, |
|
|
UT_StringHolder & |
index_file_path, |
|
|
UT_StringHolder & |
section_name |
|
) |
| |
|
static |
Utility fuction to split the original source path into the index file path and the section name. It asks all registered reader helpers whether they recognize the source path protocol and can provide the section name. If none of the helpers do, then it tries FS_IndexFile to split the source path on '?' by default.
- Parameters
-
[in] | source_section_path | The original source path to split. |
[out] | index_file_path | If the original source path refers to an index file section, this parameter is set to the index file path. Otherwise, it is set to the source_section_path parameter. |
[out] | section_name | If the original source path refers to and index file section, this parameter is set to the name of that section. Otherwise, it is set to an empty string. If there are many nested sections in the source path, then this argument will contain the innermost section name, and the index_file_path will point to the containing section (itself an index file). |
[out] | section_names | If the original source path refers to a section that is nested within other sections (that themselves are index files), then this parameter is set to these section names, with the outermost section at the beginning of the array and the innermost section (contained within the outer sections) at the end of the array. If there is just a single section, the array will contain just one entry (ie, the single section name), and the call will be equivalent to the method that takes just the single string. |
- Returns
- True if the path refered to a section name and the outgoing parameter 'section_name' contains a non-empty string; otherwise, returns false.
static bool FS_Reader::splitIndexFileSectionPath |
( |
const char * |
source_section_path, |
|
|
UT_String & |
index_file_path, |
|
|
UT_StringArray & |
section_names |
|
) |
| |
|
static |
Utility fuction to split the original source path into the index file path and the section name. It asks all registered reader helpers whether they recognize the source path protocol and can provide the section name. If none of the helpers do, then it tries FS_IndexFile to split the source path on '?' by default.
- Parameters
-
[in] | source_section_path | The original source path to split. |
[out] | index_file_path | If the original source path refers to an index file section, this parameter is set to the index file path. Otherwise, it is set to the source_section_path parameter. |
[out] | section_name | If the original source path refers to and index file section, this parameter is set to the name of that section. Otherwise, it is set to an empty string. If there are many nested sections in the source path, then this argument will contain the innermost section name, and the index_file_path will point to the containing section (itself an index file). |
[out] | section_names | If the original source path refers to a section that is nested within other sections (that themselves are index files), then this parameter is set to these section names, with the outermost section at the beginning of the array and the innermost section (contained within the outer sections) at the end of the array. If there is just a single section, the array will contain just one entry (ie, the single section name), and the call will be equivalent to the method that takes just the single string. |
- Returns
- True if the path refered to a section name and the outgoing parameter 'section_name' contains a non-empty string; otherwise, returns false.
The documentation for this class was generated from the following file: