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_CNT /**< Number of types */
36 };
37 /** \brief Storing the type of this particular dependency. */
38 type_t _type;
40 /** \brief All of the possible locations to look for the dependency. */
41 enum location_t {
42 LOCATION_PATH, /**< Look in the PATH for this depdendency */
43 LOCATION_EXTENSIONS, /**< Look in the extensions directory */
44 LOCATION_ABSOLUTE, /**< This dependency is already defined in absolute terms */
45 LOCATION_CNT /**< Number of locations to look */
46 };
47 /** \brief The location to look for this particular dependency. */
48 location_t _location;
50 /** \brief Strings to reperesent the different enum values in
51 \c type_t in the XML */
52 static gchar const * _type_str[TYPE_CNT];
53 /** \brief Strings to reperesent the different enum values in
54 \c location_t in the XML */
55 static gchar const * _location_str[LOCATION_CNT];
57 public:
58 Dependency (Inkscape::XML::Node * in_repr);
59 virtual ~Dependency (void);
60 bool check (void) const;
61 Glib::ustring &get_help (void) const;
62 Glib::ustring &get_link (void) const;
64 friend std::ostream & operator<< (std::ostream &out_file, const Dependency & in_dep);
65 }; /* class Dependency */
67 std::ostream & operator<< (std::ostream &out_file, const Dependency & in_dep);
69 } } /* namespace Extension, Inkscape */
71 #endif /* INKSCAPE_EXTENSION_DEPENDENCY_H__ */
73 /*
74 Local Variables:
75 mode:c++
76 c-file-style:"stroustrup"
77 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
78 indent-tabs-mode:nil
79 fill-column:99
80 End:
81 */
82 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :