#include <FileOp.h>
Public Member Functions | |
FileOp () | |
virtual | ~FileOp () |
virtual Op * | op ()=0 |
void | Reload_Button (Knob_Callback f) |
int | version () const |
void | setVersion (int newVersion) |
void | internalError (const char *fmt,...) |
void | internalErrorV (const char *fmt, va_list args) |
int | replaced_knobs () const |
int | extra_knobs () const |
Knob * | placemarker () const |
Knob * | extraPlacemarker () const |
virtual const char * | getFilename () const =0 |
virtual const char * | file_type () const =0 |
virtual FileHandler * | handler () const =0 |
virtual void | filehandler_knobs (Knob_Callback f) |
virtual int | filehandler_knob_changed (Knob *k) |
virtual int | filehandler_knob_change_finished (Knob *k, bool changeByUser) |
virtual void | filehandler_extra_knobs (Knob_Callback f) |
virtual void | replaceable_knobs (Knob_Callback f) |
virtual void | extra_knobs (Knob_Callback f) |
void | replace_knobs (const void *id, const char *fileExt) |
Change the set of knobs in response to the user changing the filename or the file type pulldown. | |
const void * | replaced_knobs_id () const |
void | add_extra_knobs (const void *id, const char *fileExt) |
const void * | extra_knobs_id () const |
Static Public Member Functions | |
static const char * | StripPrefix (const char *filename, std::string *prefix=nullptr) |
static const char * | StripSuffix (const char *filename, std::string *suffix=nullptr) |
static bool | GetFormatAndName (const char *fname, std::string &format, std::string &name) |
static const char *const * | file_types (const char *suffix, const char *altsuffix, const char **prefixBlacklist, const char **extras, const char **obsoleteIDs=nullptr) |
Return an array of names of file types known about. This is generated by searching the pluigin directories for any plugins called "*Writer.plugin_ext". The first location in the array is a blank string for 'unknown' and the array is NULL-terminated. | |
static void | AddAlias (const char *from, const char *to) |
static const char * | LookupAlias (const char *from) |
Protected Attributes | |
bool | _readerError |
whether or not the reader is in error (set by internalError) | |
std::string | _readerErrorString |
the last reader error (set by internalError) | |
This class is a mixin class for Read/Write/ReadGeo/WriteGeo etc. It allows file-format-specific knobs to be substituted in to a particular place more easily
|
inline |
constructor
|
inlinevirtual |
descructor
|
static |
parse fname and figure out what fileformat it should be in, and the remaining filename to use. If the filename is prefixed with "format:" it will strip that out and use it as the format, putting the remainder of the filename in name, otherwise it will place the extension in format and the full filename in name.
Returns true if it found both components, false otherwise.
void FileOp::Reload_Button | ( | Knob_Callback | f | ) |
add a reload button
References DD::Image::Int_knob(), DD::Image::INVISIBLE, and DD::Image::Script_knob().
void FileOp::internalError | ( | const char * | fmt, |
... | |||
) |
Normally calls Op::error(), but prefixes "filename: " to the message. This also switches it so that it produces a checkerboard pattern, so the Reader is not called anymore.
Referenced by DD::Image::Read::_validate().
|
inline |
get the number of replaced knobs
Referenced by replaceable_knobs().
|
inline |
get the number of extra knobs
Referenced by extra_knobs().
|
inline |
the placemarker: the knob immediately before the first file-format-specific knobs
Referenced by replace_knobs().
|
inline |
the placemarker: the knob immediately before the extra file-format-specific knobs
Referenced by add_extra_knobs().
|
pure virtual |
get the file extension of the file format
Implemented in DD::Image::Write, and DD::Image::WriteGeo.
|
pure virtual |
return the file format handler for the current knob settings
Referenced by extra_knobs(), filehandler_extra_knobs(), filehandler_knob_change_finished(), filehandler_knob_changed(), filehandler_knobs(), and replaceable_knobs().
|
virtual |
insert in the file-format specific file handle knobs.
References handler().
|
virtual |
call file-format specific file handle knob callbacks.
References handler().
|
virtual |
call file-format specific file handle knob callbacks.
References handler().
|
virtual |
insert in the extra file-format specific file handle knobs.
References handler().
|
virtual |
insert in the file-format specific knobs. subclasses should call this in their knobs() implementation
References DD::Image::Op::add_knobs(), handler(), and replaced_knobs().
|
virtual |
insert in the file-format specific knobs. subclasses should call this in their knobs() implementation
References DD::Image::Op::add_knobs(), extra_knobs(), and handler().
void FileOp::replace_knobs | ( | const void * | id, |
const char * | fileExt | ||
) |
Change the set of knobs in response to the user changing the filename or the file type pulldown.
If the id is different, replace the knobs by calling the above. Subclasses should call this in e.g. knob_changed() after the handler has changed
References placemarker(), and DD::Image::Op::replace_knobs().
Referenced by DD::Image::Read::make_format().
|
inline |
return the id sent to replace_knobs() most recently. 0 is the initial value.
void FileOp::add_extra_knobs | ( | const void * | id, |
const char * | fileExt | ||
) |
If the id is different, replace the knobs by calling the above. Subclasses should call this in e.g. knob_changed() after the handler has changed
References extraPlacemarker(), and DD::Image::Op::replace_knobs().
|
inline |
return the id sent to replace_knobs() most recently. 0 is the initial value.
|
static |
Return an array of names of file types known about. This is generated by searching the pluigin directories for any plugins called "*Writer.plugin_ext". The first location in the array is a blank string for 'unknown' and the array is NULL-terminated.
Helper function for implementation of Write::file_types() and WriteGeo::file_types() and similar functions. Suffix is a user-specific suffix (e.g. "WriterGeo"), altsuffix is an (optional) backwards-compatability suffix to look for ("Writer")
prefixBlackList is a pointer to a NULL-terminated list of strings to not include (these are compared to the start of the found string, so "foo" would block foobar", for example.) It can be NULL.
extras is a pointer to a NULL-terminated list of strings to force to be included in the list, even if no matching plugins were found. It can be NULL.
obsoleteIDs is an (optional) pointer to a NULL-terminated list of strings to extend with obsoleteIDs. This allows file types to have synonyms. The format is: id\t\t\tobsoleteID1,obsoleteID2,... For example, to make ffmpeg load as mov64: mov64\t\t\tffmpeg
References DD::Image::plugin_ext, DD::Image::plugin_path(), and DD::Image::plugin_path_list().
|
static |
look up a file extension alias. If there is no alias, returns the core extension.
©2024 The Foundry Visionmongers, Ltd. All Rights Reserved. |