DD::Image::FileOp Class Referenceabstract

Inherited by DD::Image::FileIop, DD::Image::Read, DD::Image::ReadGeo, and DD::Image::WriteGeo.

Public Member Functions

 FileOp ()
 
virtual ~FileOp ()
 
virtual Opop ()=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
 
Knobplacemarker () const
 
KnobextraPlacemarker () 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. More...
 
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. More...
 
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)
 

Detailed Description

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

Constructor & Destructor Documentation

DD::Image::FileOp::FileOp ( )
inline

constructor

virtual DD::Image::FileOp::~FileOp ( )
inlinevirtual

descructor

Member Function Documentation

bool FileOp::GetFormatAndName ( const char *  fname,
std::string &  format,
std::string &  name 
)
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)
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.

int DD::Image::FileOp::replaced_knobs ( ) const
inline

get the number of replaced knobs

Referenced by replaceable_knobs().

int DD::Image::FileOp::extra_knobs ( ) const
inline

get the number of extra knobs

Referenced by extra_knobs().

Knob* DD::Image::FileOp::placemarker ( ) const
inline

the placemarker: the knob immediately before the first file-format-specific knobs

Referenced by replace_knobs().

Knob* DD::Image::FileOp::extraPlacemarker ( ) const
inline

the placemarker: the knob immediately before the extra file-format-specific knobs

Referenced by add_extra_knobs().

virtual const char* DD::Image::FileOp::file_type ( ) const
pure virtual

get the file extension of the file format

Implemented in DD::Image::Write, and DD::Image::WriteGeo.

virtual FileHandler* DD::Image::FileOp::handler ( ) const
pure virtual

return the file format handler for the current knob settings

Referenced by extra_knobs(), filehandler_extra_knobs(), filehandler_knob_changed(), filehandler_knobs(), and replaceable_knobs().

void FileOp::filehandler_knobs ( Knob_Callback  f)
virtual

insert in the file-format specific file handle knobs.

References handler().

int FileOp::filehandler_knob_changed ( Knob k)
virtual

call file-format specific file handle knob callbacks.

References handler().

void FileOp::filehandler_extra_knobs ( Knob_Callback  f)
virtual

insert in the extra file-format specific file handle knobs.

References handler().

void FileOp::replaceable_knobs ( Knob_Callback  f)
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().

void FileOp::extra_knobs ( Knob_Callback  f)
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().

const void* DD::Image::FileOp::replaced_knobs_id ( ) const
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().

const void* DD::Image::FileOp::extra_knobs_id ( ) const
inline

return the id sent to replace_knobs() most recently. 0 is the initial value.

const char *const * FileOp::file_types ( const char *  suffix,
const char *  altsuffix,
const char **  prefixBlacklist,
const char **  extras,
const char **  obsoleteIDs = nullptr 
)
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,obsoleteID2,... For example, to make ffmpeg load as mov64: mov64

References DD::Image::plugin_ext, DD::Image::plugin_path(), and DD::Image::plugin_path_list().

const char * FileOp::LookupAlias ( const char *  from)
static

look up a file extension alias. If there is no alias, returns the core extension.



©2019 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk