~ubuntu-branches/ubuntu/maverick/gnubiff/maverick

« back to all changes in this revision

Viewing changes to src/option.h

  • Committer: Bazaar Package Importer
  • Author(s): Adrien Cunin
  • Date: 2007-05-03 23:04:11 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20070503230411-t6tf8qmx3h4rkzkc
Tags: 2.2.6-2ubuntu1
* Merge from Debian unstable. Remaining Ubuntu change:
   - Update the libfam-dev build-dep to libgamin-dev instead
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
                        guint flags = OPTFLG_NONE, OptionGUI gui = OPTGUI_NONE,
93
93
                        std::string gui_name = std::string(""));
94
94
        /// Destructor.
95
 
        virtual ~Option () {};
 
95
        virtual ~Option () {}
96
96
 
97
 
        virtual std::string type_string (void) {return "none";};
98
 
        virtual std::string to_string (void) {return std::string("");};
99
 
        virtual gboolean from_string (const std::string &value) {return false;};
100
 
        virtual void set_gui (std::vector<GtkWidget *> &widgets) {};
101
 
        virtual void get_gui (std::vector<GtkWidget *> &widgets) {};
 
97
        virtual std::string type_string (void) {return "none";}
 
98
        virtual std::string to_string (void) {return std::string("");}
 
99
        virtual gboolean from_string (const std::string &value) {return false;}
 
100
        virtual void set_gui (std::vector<GtkWidget *> &widgets) {}
 
101
        virtual void get_gui (std::vector<GtkWidget *> &widgets) {}
102
102
        /**
103
103
         *  Reset the option to the default value.
104
104
         *
105
105
         *  Remark: Instead of calling this function directly better call
106
106
         *  Options::reset(). This function handles flags like OPTFLG_CHANGE!
107
107
         */
108
 
        virtual void reset (void) {};
109
 
        virtual gboolean is_default (void) {return false;};
110
 
        virtual std::string default_string (void) {return std::string("");};
111
 
        virtual Option *copy (void) {return new Option(*this);};
 
108
        virtual void reset (void) {}
 
109
        virtual gboolean is_default (void) {return false;}
 
110
        virtual std::string default_string (void) {return std::string("");}
 
111
        virtual Option *copy (void) {return new Option(*this);}
112
112
        std::string flags_string (std::string sep = std::string("; "));
113
113
 
114
114
        /// Access function to Option::flags_
155
155
                                 OptionGUI gui = OPTGUI_NONE,
156
156
                                 std::string gui_name = std::string(""));
157
157
 
158
 
        std::string type_string (void) {return ((flags_ & OPTFLG_ID_INT_STRICT) ? "enum" : "unsigned int");};
 
158
        std::string type_string (void) {return ((flags_ & OPTFLG_ID_INT_STRICT) ? "enum" : "unsigned int");}
159
159
        std::string to_string (void);
160
160
        std::string default_string (void);
161
161
        gboolean from_string (const std::string &value);
163
163
        void set_gui (std::vector<GtkWidget *> &widgets);
164
164
        void reset (void);
165
165
        std::string allowed_ids (std::string sep = std::string(" "));
166
 
        gboolean is_default (void) {return value_ == default_;};
167
 
        Option *copy (void) {return new Option_UInt(*this);};
 
166
        gboolean is_default (void) {return value_ == default_;}
 
167
        Option *copy (void) {return new Option_UInt(*this);}
168
168
 
169
169
        /// Access function to Option_UInt::value_
170
 
        guint value (void) {return value_;};
 
170
        guint value (void) {return value_;}
171
171
        /// Access function to Option_UInt::value_
172
 
        void value (guint val) {value_ = val;};
 
172
        void value (guint val) {value_ = val;}
173
173
 
174
174
        const std::string value_to_string (guint val);
175
175
        guint string_to_value (const std::string &str);
192
192
                                 const gchar *gui_sensitive[] = NULL,
193
193
                                 const gchar *gui_show[] = NULL);
194
194
 
195
 
        Option *copy (void) {return new Option_Bool(*this);};
196
 
        std::string type_string (void) {return "bool";};
 
195
        Option *copy (void) {return new Option_Bool(*this);}
 
196
        std::string type_string (void) {return "bool";}
197
197
 
198
198
        /// Access function to Option_UInt::value_
199
 
        gboolean value (void) {return (gboolean)value_;};
 
199
        gboolean value (void) {return (gboolean)value_;}
200
200
        /// Access function to Option_UInt::value_
201
 
        void value (gboolean val) {value_ = (guint)val;};
 
201
        void value (gboolean val) {value_ = (guint)val;}
202
202
        /// Access function to Option_UInt::gui_sensitive_
203
 
        void gui_sensitive (std::set<std::string> &gs) {gs = gui_sensitive_;};
 
203
        void gui_sensitive (std::set<std::string> &gs) {gs = gui_sensitive_;}
204
204
        /// Access function to Option_UInt::gui_sensitive_neg_
205
 
        void gui_show (std::set<std::string> &gs) {gs = gui_show_;};
 
205
        void gui_show (std::set<std::string> &gs) {gs = gui_show_;}
206
206
private:
207
207
        static const gchar *ids_[3];
208
208
        static const guint ints_[3];
223
223
                                   OptionGUI gui = OPTGUI_NONE,
224
224
                                   std::string gui_name = std::string(""));
225
225
 
226
 
        std::string type_string (void) {return ((flags_ & OPTFLG_STRINGLIST) ? "list (strings)" : "string");};
 
226
        std::string type_string (void) {return ((flags_ & OPTFLG_STRINGLIST) ? "list (strings)" : "string");}
227
227
        std::string to_string (void);
228
228
        std::string default_string (void);
229
229
        gboolean from_string (const std::string &value);
230
230
        void get_gui (std::vector<GtkWidget *> &widgets);
231
231
        void set_gui (std::vector<GtkWidget *> &widgets);
232
232
        void reset (void);
233
 
        gboolean is_default (void) {return value_ == default_;};
234
 
        Option *copy (void) {return new Option_String(*this);};
 
233
        gboolean is_default (void) {return value_ == default_;}
 
234
        Option *copy (void) {return new Option_String(*this);}
235
235
 
236
236
        void set_values (const std::set<std::string> &values, gboolean empty=true);
237
237
        void get_values (std::set<std::string> &values, gboolean empty = true);
240
240
                                         gboolean empty = true);
241
241
 
242
242
        /// Access function to Option_UInt::value_
243
 
        std::string value (void) {return value_;};
 
243
        std::string value (void) {return value_;}
244
244
        /// Access function to Option_UInt::value_
245
 
        void value (const std::string val) {from_string (val);};
 
245
        void value (const std::string val) {from_string (val);}
246
246
protected:
247
247
        /// Value of the option
248
248
        std::string value_;