1 /*
2 * Authors:
3 * Ted Gould <ted@gould.cx>
4 *
5 * Copyright (C) 2004 Authors
6 *
7 * Released under GNU GPL, read the file 'COPYING' for more information
8 */
10 #ifndef INKSCAPE_EXTENSION_DEPENDENCY_H__
11 #define INKSCAPE_EXTENSION_DEPENDENCY_H__
13 #include <glibmm/ustring.h>
14 #include "xml/repr.h"
16 namespace Inkscape {
17 namespace Extension {
19 /** \brief A class to represent a dependency for an extension. There
20 are different things that can be done in a dependency, and
21 this class takes care of all of them. */
22 class Dependency {
23 /** \brief The XML representation of the dependency. */
24 Inkscape::XML::Node * _repr;
25 /** \brief The string that is in the XML tags pulled out. */
26 const gchar * _string;
27 /** \brief The description of the dependency for the users. */
28 const gchar * _description;
30 /** \brief All the possible types of dependencies. */
31 enum type_t {
32 TYPE_EXECUTABLE, /**< Look for an executable */
33 TYPE_FILE, /**< Look to make sure a file exists */
34 TYPE_EXTENSION, /**< Make sure a specific extension is loaded and functional */
35 TYPE_PLUGIN, /**< Look for a library to be loaded as a plugin */
36 TYPE_CNT /**< Number of types */
37 };
38 /** \brief Storing the type of this particular dependency. */
39 type_t _type;
41 /** \brief All of the possible locations to look for the dependency. */
42 enum location_t {
43 LOCATION_PATH, /**< Look in the PATH for this depdendency */
44 LOCATION_EXTENSIONS, /**< Look in the extensions directory */
45 LOCATION_ABSOLUTE, /**< This dependency is already defined in absolute terms */
46 LOCATION_CNT /**< Number of locations to look */
47 };
48 /** \brief The location to look for this particular dependency. */
49 location_t _location;
51 /** \brief Strings to reperesent the different enum values in
52 \c type_t in the XML */
53 static gchar const * _type_str[TYPE_CNT];
54 /** \brief Strings to reperesent the different enum values in
55 \c location_t in the XML */
56 static gchar const * _location_str[LOCATION_CNT];
58 public:
59 Dependency (Inkscape::XML::Node * in_repr);
60 ~Dependency (void);
61 bool check (void) const;
62 Glib::ustring &get_help (void) const;
63 Glib::ustring &get_link (void) const;
65 friend std::ostream & operator<< (std::ostream &out_file, const Dependency & in_dep);
66 }; /* class Dependency */
68 std::ostream & operator<< (std::ostream &out_file, const Dependency & in_dep);
70 } } /* namespace Extension, Inkscape */
72 #endif /* INKSCAPE_EXTENSION_DEPENDENCY_H__ */
74 /*
75 Local Variables:
76 mode:c++
77 c-file-style:"stroustrup"
78 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
79 indent-tabs-mode:nil
80 fill-column:99
81 End:
82 */
83 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :