Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
Inkscape::Extension::DB Class Reference

#include <db.h>

Public Types

typedef std::list< Template * > TemplateList
 
typedef std::list< Output * > OutputList
 
typedef std::list< Input * > InputList
 
typedef std::list< Effect * > EffectList
 

Public Member Functions

 DB ()=default
 
 DB (DB &&)=delete
 
DBoperator= (DB &&)=delete
 
Extensionget (const gchar *key) const
 This function looks up a Inkscape::Extension::Extension by using its unique id. It then returns a reference to that module.
 
void take_ownership (std::unique_ptr< Extension > module)
 Take the ownership of an extension to ensure that it is freed on program exit.
 
void foreach (void(*in_func)(Extension *in_plug, gpointer in_data), gpointer in_data)
 A function to execute another function with every entry in the database as a parameter.
 
TemplateListget_template_list (TemplateList &ou_list)
 Create a list of all the Template extensions.
 
InputListget_input_list (InputList &ou_list)
 Creates a list of all the Input extensions.
 
OutputListget_output_list (OutputList &ou_list)
 Creates a list of all the Output extensions.
 
std::vector< Effect * > get_effect_list ()
 Creates a list of all the Effect extensions.
 

Static Private Member Functions

static void template_internal (Extension *in_plug, gpointer data)
 The function to look at each module and see if it is a template module, then add it to the list.
 
static void input_internal (Extension *in_plug, gpointer data)
 The function to look at each module and see if it is an input module, then add it to the list.
 
static void output_internal (Extension *in_plug, gpointer data)
 The function to look at each module and see if it is an output module, then add it to the list.
 
static void effect_internal (Extension *in_plug, gpointer data)
 The function to look at each module and see if it is an effect module, then add it to the list.
 

Private Attributes

std::unordered_map< std::string, std::unique_ptr< Extension > > moduledict
 This is the actual database.
 

Detailed Description

Definition at line 35 of file db.h.

Member Typedef Documentation

◆ EffectList

Definition at line 60 of file db.h.

◆ InputList

Definition at line 59 of file db.h.

◆ OutputList

Definition at line 58 of file db.h.

◆ TemplateList

Definition at line 57 of file db.h.

Constructor & Destructor Documentation

◆ DB() [1/2]

Inkscape::Extension::DB::DB ( )
default

◆ DB() [2/2]

Inkscape::Extension::DB::DB ( DB &&  )
delete

Member Function Documentation

◆ effect_internal()

void Inkscape::Extension::DB::effect_internal ( Extension in_plug,
gpointer  data 
)
staticprivate

The function to look at each module and see if it is an effect module, then add it to the list.

Returns
none
Parameters
in_plugModule to be examined
dataThe list to be attached to

The first thing that is checked is if this module is an effect module. If it is, then it is added to the list which is passed in through data.

Definition at line 208 of file db.cpp.

References data.

◆ foreach()

void Inkscape::Extension::DB::foreach ( void(*)(Extension *in_plug, gpointer in_data)  in_func,
gpointer  in_data 
)

A function to execute another function with every entry in the database as a parameter.

Returns
none
Parameters
in_funcThe function to execute for every module
in_dataA data pointer that is also passed to in_func

Enumerates the modules currently in the database, calling a given callback for each one.

Definition at line 128 of file db.cpp.

References item, and moduledict.

Referenced by Inkscape::Extension::check_extensions().

◆ get()

◆ get_effect_list()

std::vector< Effect * > Inkscape::Extension::DB::get_effect_list ( )

Creates a list of all the Effect extensions.

Definition at line 266 of file db.cpp.

References item, and moduledict.

Referenced by add_document_actions_effect(), and InkscapeApplication::init_extension_action_data().

◆ get_input_list()

DB::InputList & Inkscape::Extension::DB::get_input_list ( DB::InputList ou_list)

Creates a list of all the Input extensions.

Parameters
ou_listThe list that is used to put all the extensions in

Calls the database foreach function with input_internal.

Definition at line 242 of file db.cpp.

References input_internal().

Referenced by Inkscape::UI::Dialog::create_open_filters(), Inkscape::Extension::Input::find_by_filename(), Inkscape::Extension::Input::find_by_mime(), and InkscapeApplication::print_input_type_list().

◆ get_output_list()

DB::OutputList & Inkscape::Extension::DB::get_output_list ( DB::OutputList ou_list)

Creates a list of all the Output extensions.

Parameters
ou_listThe list that is used to put all the extensions in

Calls the database foreach function with output_internal.

Definition at line 256 of file db.cpp.

References output_internal().

Referenced by Inkscape::UI::Dialog::create_export_filters(), InkFileExportCmd::do_export(), InkFileExportCmd::do_export_ps_pdf(), Inkscape::Extension::save(), Inkscape::UI::Dialog::ExtensionList::setup(), and sp_file_save_dialog().

◆ get_template_list()

DB::TemplateList & Inkscape::Extension::DB::get_template_list ( DB::TemplateList ou_list)

Create a list of all the Template extensions.

Parameters
ou_list- The list that is used to put all the extensions in

Calls the database foreach function with template_internal.

Definition at line 228 of file db.cpp.

References template_internal().

Referenced by Inkscape::Extension::Template::get_any_preset(), Inkscape::Extension::Template::get_any_preset(), Inkscape::UI::Widget::TemplateList::init(), and Inkscape::UI::Toolbar::PageToolbar::populate_sizes().

◆ input_internal()

void Inkscape::Extension::DB::input_internal ( Extension in_plug,
gpointer  data 
)
staticprivate

The function to look at each module and see if it is an input module, then add it to the list.

Returns
none
Parameters
in_plugModule to be examined
dataThe list to be attached to

The first thing that is checked is if this module is an input module. If it is, then it is added to the list which is passed in through data.

Definition at line 162 of file db.cpp.

References data.

Referenced by get_input_list().

◆ operator=()

DB & Inkscape::Extension::DB::operator= ( DB &&  )
delete

◆ output_internal()

void Inkscape::Extension::DB::output_internal ( Extension in_plug,
gpointer  data 
)
staticprivate

The function to look at each module and see if it is an output module, then add it to the list.

Returns
none
Parameters
in_plugModule to be examined
dataThe list to be attached to

The first thing that is checked is if this module is an output module. If it is, then it is added to the list which is passed in through data.

Definition at line 182 of file db.cpp.

References data.

Referenced by get_output_list().

◆ take_ownership()

void Inkscape::Extension::DB::take_ownership ( std::unique_ptr< Extension module)

Take the ownership of an extension to ensure that it is freed on program exit.

Parameters
moduleAn owning pointer to the extension.

Definition at line 86 of file db.cpp.

References moduledict.

Referenced by Inkscape::Extension::build_from_reprdoc().

◆ template_internal()

void Inkscape::Extension::DB::template_internal ( Extension in_plug,
gpointer  data 
)
staticprivate

The function to look at each module and see if it is a template module, then add it to the list.

Returns
none
Parameters
in_plug- Module to be examined
data- The list to be attached to

Definition at line 142 of file db.cpp.

References data.

Referenced by get_template_list().

Member Data Documentation

◆ moduledict

std::unordered_map<std::string, std::unique_ptr<Extension> > Inkscape::Extension::DB::moduledict
private

This is the actual database.

It has all of the modules in it, indexed by their ids. It's a hash table for faster lookups

Definition at line 39 of file db.h.

Referenced by foreach(), get(), get_effect_list(), and take_ownership().


The documentation for this class was generated from the following files: