DD::Image::Writer::Description Class Reference

Specialised Writer Description. More...

Inherits DD::Image::Description.

Public Member Functions

 Description (const char *n, const char *l, Writer *(*c)(Write *), License *f=nullptr)
 
 Description (const char *n, Writer *(*c)(Write *), License *f=nullptr)
 

Static Public Member Functions

static const Descriptionfind (int i)
 
static const Descriptionfind (const char *name)
 

Public Attributes

const char * names
 
const char * label
 
Writer *(* constructor )(Write *)
 
- Public Attributes inherited from DD::Image::Description
const char * compiled
 
const char * plugin
 
Licenselicense
 

Additional Inherited Members

- Public Types inherited from DD::Image::Description
typedef Node *(* NodeBuilder) (void *)
 
typedef std::vector< Description * > DescriptionList
 
- Protected Member Functions inherited from DD::Image::Description
void ctor (void(*f)(Description *))
 
void ctor (void(*f)(Description *), NodeBuilder nodeBuilder)
 

Detailed Description

Specialised Writer Description.

Each subclass of Writer should define at least one static instance of this structure. The constructor adds itself to a list that the Write operator searches to find the correct type of Writer to use to write a given filename.

Sample code for a plugin:

class MyWriter : public FileWriter {
static const Description d;
...
};
static Writer* build() {return new MyWriter();}
const Writer::Description MyWriter::d("myf\0", "my file type", build);

Constructor & Destructor Documentation

DD::Image::Writer::Description::Description ( const char *  n,
const char *  l,
Writer *(*)(Write *)  c,
License f = nullptr 
)
inline

Constructor that fills all fields and allows a license check.

DD::Image::Writer::Description::Description ( const char *  n,
Writer *(*)(Write *)  c,
License f = nullptr 
)
inline

Simpler constructor that sets names and label to same value.

Member Function Documentation

const Writer::Description * Writer::Description::find ( int  i)
static

Return the i'th Writer::Description known about, or return a null pointer for the last one.

Referenced by DD::Image::Write::set_file_type().

const Writer::Description * Writer::Description::find ( const char *  name)
static

Search all the defined Writer::Descriptions for one whose name matches the passed string, or return NULL if none. This will also try to plugin_load("xyzWriter") (where xyz is id) in order to find external file writing code.

If this returns null, then plugin_error() will contain an error.

References DD::Image::plugin_load(), strlcat(), and strlcpy().

Member Data Documentation

const char* DD::Image::Writer::Description::names

Null separated list (as in "sgi\0rgb\0") of identifiers for this file type.

If "xyz" in in this list then a filename of "*.xyz" or "xyz:*" is considered to be this type.

const char* DD::Image::Writer::Description::label

User-friendly version of the name.

Writer*(* DD::Image::Writer::Description::constructor) (Write *)

Make an instance of the writer. This cannot fail, instead the execute() method should try to open the output file and produce any error messages.

Referenced by DD::Image::Write::set_file_type().



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