Inkscape
Vector Graphics Editor
dependency.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Authors:
4 * Ted Gould <ted@gould.cx>
5 *
6 * Copyright (C) 2004 Authors
7 *
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10
11#ifndef INKSCAPE_EXTENSION_DEPENDENCY_H__
12#define INKSCAPE_EXTENSION_DEPENDENCY_H__
13
14#include <glibmm/ustring.h>
15
16namespace Inkscape::XML {
17class Node;
18} // namespace Inkscape::XML
19
20namespace Inkscape::Extension {
21
22class Extension;
23
28
29public:
31 enum type_t {
36 };
37
47 };
48
49private:
50 static constexpr const char *UNCHECKED = "---unchecked---";
51
55 const gchar * _string = nullptr;
57 const gchar * _description = nullptr;
60
65
68 static gchar const * _type_str[TYPE_CNT];
71 static gchar const * _location_str[LOCATION_CNT];
72
75
76public:
77 Dependency (Inkscape::XML::Node *in_repr, const Extension *extension, type_t type=TYPE_FILE);
78 virtual ~Dependency ();
79 bool check();
80 const gchar* get_name();
81 std::string get_path();
82
83 Glib::ustring info_string();
84}; /* class Dependency */
85
86
87} // namespace Inkscape::Extension
88
89#endif /* INKSCAPE_EXTENSION_DEPENDENCY_H__ */
90
91/*
92 Local Variables:
93 mode:c++
94 c-file-style:"stroustrup"
95 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
96 indent-tabs-mode:nil
97 fill-column:99
98 End:
99*/
100// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
A class to represent a dependency for an extension.
Definition: dependency.h:27
bool check()
Check if the dependency passes.
Definition: dependency.cpp:134
Inkscape::XML::Node * _repr
The XML representation of the dependency.
Definition: dependency.h:53
Dependency(Inkscape::XML::Node *in_repr, const Extension *extension, type_t type=TYPE_FILE)
Create a dependency using an XML definition.
Definition: dependency.cpp:54
virtual ~Dependency()
This dependency is not longer needed.
Definition: dependency.cpp:99
const gchar * _description
The description of the dependency for the users.
Definition: dependency.h:57
const Extension * _extension
Reference to the extension requesting this dependency.
Definition: dependency.h:74
const gchar * _string
The string that is in the XML tags pulled out.
Definition: dependency.h:55
static constexpr const char * UNCHECKED
Definition: dependency.h:50
static gchar const * _type_str[TYPE_CNT]
Strings to represent the different enum values in type_t in the XML.
Definition: dependency.h:68
const gchar * get_name()
Accessor to the name attribute.
Definition: dependency.cpp:309
std::string get_path()
Path of this dependency.
Definition: dependency.cpp:322
std::string _absolute_location
The absolute path to the dependency file determined while checking this dependency.
Definition: dependency.h:59
location_t _location
The location to look for this particular dependency.
Definition: dependency.h:64
type_t _type
Storing the type of this particular dependency.
Definition: dependency.h:62
Glib::ustring info_string()
Print out a dependency to a string.
Definition: dependency.cpp:339
static gchar const * _location_str[LOCATION_CNT]
Strings to represent the different enum values in location_t in the XML.
Definition: dependency.h:71
location_t
All of the possible locations to look for the dependency.
Definition: dependency.h:39
@ LOCATION_CNT
Number of locations to look.
Definition: dependency.h:46
@ LOCATION_EXTENSIONS
Look in the extensions directory (note: this can be in both, user and system locations!...
Definition: dependency.h:42
@ LOCATION_ABSOLUTE
This dependency is already defined in absolute terms.
Definition: dependency.h:45
@ LOCATION_INX
Look relative to the inx file's location.
Definition: dependency.h:44
@ LOCATION_PATH
Look in the PATH for this dependency - historically this is the default (it's a bit odd for interpret...
Definition: dependency.h:40
type_t
All the possible types of dependencies.
Definition: dependency.h:31
@ TYPE_CNT
Number of types.
Definition: dependency.h:35
@ TYPE_EXTENSION
Make sure a specific extension is loaded and functional.
Definition: dependency.h:34
@ TYPE_FILE
Look to make sure a file exists.
Definition: dependency.h:33
@ TYPE_EXECUTABLE
Look for an executable.
Definition: dependency.h:32
The object that is the basis for the Extension system.
Definition: extension.h:130
Interface for refcounted XML nodes.
Definition: node.h:80
Extension support.
@Inkscape XML tree.