HDK
|
#include <FS_Reader.h>
Public Member Functions | |
FS_ReaderHelper () | |
virtual | ~FS_ReaderHelper () |
virtual FS_ReaderStream * | createStream (const char *source, const UT_Options *options=nullptr)=0 |
virtual bool | splitIndexFileSectionPath (const char *source_section_path, UT_String &index_file_path, UT_String §ion_name) |
virtual bool | combineIndexFileSectionPath (UT_String &source_section_path, const char *index_file_path, const char *section_name) |
This class provides a plug-in method for adding a custom "file-system"
Definition at line 180 of file FS_Reader.h.
|
inline |
Definition at line 183 of file FS_Reader.h.
|
inlinevirtual |
Definition at line 185 of file FS_Reader.h.
|
inlinevirtual |
Utility function to combine index file name and section name into the section path. Performs the reverse of splitIndexFileSectionPath(). If the helper does not use '?' for any special purpose in the source path, then it does not need to override this virtual (see above).
[out] | source_section_path | The combined full section path. |
[in] | index_file_path | The base path to the index file. |
[in] | section_name | The name of the section inside the index file. |
Reimplemented in HDK_Sample::FS_HomeReadHelper.
Definition at line 270 of file FS_Reader.h.
|
pure virtual |
Return an FS_ReaderStream if the helper is able to open the source filename.
The options are passed through directly from the FS_Reader constructor. See FS_Reader for list of options.
Implemented in HDK_Sample::FS_HomeReadHelper, OP_DataBlockReadHelper, and FS_IconReadHelper.
|
inlinevirtual |
Parse the source path into the index file path and the section name.
The FS library recognizes a special source format for FS_IndexFile, which is a file containing several sections indexed and accessible by their name. That source format contains '?' as a separator between the file path and the section name. FS_Reader scans for '?' in the source path before asking helpers to handle it. This way index files are supported for custom protoclos automatically without them needing to implement it explicitly. Eg, "myfiles:path/to/indexfile?section" will work automaticaly, since FS_Reader will ask the helper for a read stream for "myfiles:/path/to/indexfile" but will create and use the "section" read stream itself. The downside is that custom protocols can't use '?' in their path format. To address this isse, this method has been added to let the helpers decide how to handle the '?'.
If the helper does not use '?' for any special purpose, it does not need to override this virtual (or it can overloaded it and return false). If the helper uses '?' for some special meaning (or if it supports some custom syntax to refer to sections of an index file), then it should override it and return true. Further, it can return a non-empty section name if the protocol supports section naming and the source path indeed refers to a section in an index file. Or, it can return an empty string for the section name, if the source path does not refer to an index file (or if helper does not want the automatic index file handling and plans to handle index files explicitly by itself).
[in] | source_section_path | Original source path to be opened for reading. |
[out] | index_file_path | If source_section_path refers to a section in an index file, then this parameter is set to the index file path (and method returns true). If source_section_path does not refer to a section, then this parameter is set to original path, ie, equal to source_section_path (and method returns true). If the helper does not recognize the source_section_path (ie, it's another protocol), or if recognizes it but does not need (nor want) custom handling for '?' separator, then this parameter is not set (and method returns false). |
[out] | section_name | This Similar to index_file_path, but this outgoing parameter is set to the section name, if source_section_path refers to a section and is set to empty-string if it does not (and method returns true). If the method returns false, it is not set. |
Reimplemented in HDK_Sample::FS_HomeReadHelper.
Definition at line 251 of file FS_Reader.h.