[gtkmm] get method inconsistencies



Hi,

while looking at the menu accelerator API I noticed that there are
inconsistencies in get_*-method names and is_*-method names in the
Gtkmm library. The Gtk+ library uses get_foo() function names where
get functionality is implemented and is_foo() when boolean result are
expected. The Gtkmm library uses same names for wrapped functions (of
course), but is inconsistent when new methods are implemented. This is
(I think) because STL uses a different naming scheme.

A quick scan through the sources:

        Gtkmm
accelgroup.h    name()  -> get_name()
notebook.h      pages() -> get_pages()
notebook.h      size()  -> get_size()
toolbar.h       tools() -> get_tools()
treeiter.h  TreeRow   children() -> get_children()
                      parent()   -> get_parent()
            TreeNodeChildren   size() -> get_size()
treemodel.h     children() -> get_children()
treemodelcolumn.h  TreeModelColumnRecord  size()  -> get_size()
                                          types() -> get_types()
                   TreeModelColumnBase    type()  -> get_type()
                                          index() -> get_index()

        Gdkmm
color.h   red_p()   -> get_red_p()
          green_p() -> get_green_p()
          blue_p()  -> get_blue_p()
RgbCmap   size()    -> get_size()

        Glibmm
thread.h  Thread      self()   -> get_self()
          Mutex       locked() -> is_locked()
          RecMutex    locked() -> is_locked()
          ReaderLock  locked() -> is_locked()
          WriterLock  locked() -> is_locked()
timer.h     elapsed()   -> get_elapsed()
timeval.h   negative()  -> is_negative()
            valid()     -> is_valid()
error.h     domain()    -> get_domain()
            code()      -> get_code()
ustring.h   empty()     -> is_empty()
            size()      -> get_size()
            length()    -> get_length()
            bytes()     -> get_bytes()
            capacity()  -> get_capacity()
            max_size()  -> get_max_size()
            uppercase() -> get_uppercase()
            lowercase() -> get_lowercase()
            casefold()  -> get_casefold()
main.h    MainContext  pending() -> get_pending()
quark.h     id() -> get_id()
helperlist.h  max_size() -> get_max_size()
              empty()    -> is_empty()

Here some examples of Gtk+ wrapped function names:
Gtk::TextChildAnchor  get_widgets()
Gtk::TextIter         get_tags()
Gtk::TextTagTable     get_size()
Gtk::Window           get_icon_list()
Atk::StateSet         is_empty()
Pango::PangoTabArray  get_size()

I think it is confusing to call is_empty() and sometimes empty(). Or
to call Gtk::TextChildAnchor::get_widgets() to get a list of widgets and
to call Gtk::TreeRow::children() to get a list of widgets.

What do you think? What is your opinion?

 Andreas






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]