[gtksourceviewmm] Completion: Use const_iterator where appropriate.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceviewmm] Completion: Use const_iterator where appropriate.
- Date: Fri, 31 Mar 2017 12:19:04 +0000 (UTC)
commit 3d9043012ce9117fa97b8756bf06458fa3ca66f6
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Mar 31 14:11:35 2017 +0200
Completion: Use const_iterator where appropriate.
gtksourceview/src/completion.hg | 5 +++--
gtksourceview/src/completioncontext.ccg | 9 ++++++++-
gtksourceview/src/completioncontext.hg | 13 ++++++++++++-
gtksourceview/src/completioninfo.hg | 6 +++---
gtksourceview/src/completionprovider.hg | 11 ++++++-----
5 files changed, 32 insertions(+), 12 deletions(-)
---
diff --git a/gtksourceview/src/completion.hg b/gtksourceview/src/completion.hg
index 49a092e..5ac9a9d 100644
--- a/gtksourceview/src/completion.hg
+++ b/gtksourceview/src/completion.hg
@@ -136,7 +136,8 @@ public:
_WRAP_METHOD(const View* get_view() const, gtk_source_completion_get_view, constversion)
// TODO: Does "The reference being returned is a 'floating' reference, so if you invoke
gtk_source_completion_show with this context you don't need to unref it." something mean for us? krnowak
-#m4 _CONVERSION(`const Gtk::TextBuffer::iterator&',`GtkTextIter*',`const_cast<GtkTextIter*>(($3).gobj())')
+#m4 _CONVERSION(`const
Gtk::TextBuffer::const_iterator&',`GtkTextIter*',`const_cast<GtkTextIter*>(($3).gobj())')
+
/** Create a new CompletionContext for completion.
*
* The position at which the completion using the new context will consider
@@ -148,7 +149,7 @@ public:
*
* @newin{2,10}
*/
- _WRAP_METHOD(Glib::RefPtr<CompletionContext> create_context(const Gtk::TextBuffer::iterator& position),
gtk_source_completion_create_context)
+ _WRAP_METHOD(Glib::RefPtr<CompletionContext> create_context(const Gtk::TextBuffer::const_iterator&
position), gtk_source_completion_create_context)
// TODO: better wording could be used here - it is too convoluted. krnowak
/** Create a new CompletionContext for completion.
diff --git a/gtksourceview/src/completioncontext.ccg b/gtksourceview/src/completioncontext.ccg
index 2bf5bd7..a4e4b41 100644
--- a/gtksourceview/src/completioncontext.ccg
+++ b/gtksourceview/src/completioncontext.ccg
@@ -24,11 +24,18 @@
namespace Gsv
{
-Gtk::TextBuffer::iterator CompletionContext::get_iter() const
+Gtk::TextBuffer::iterator CompletionContext::get_iter()
{
Gtk::TextBuffer::iterator iter;
gtk_source_completion_context_get_iter(const_cast<GtkSourceCompletionContext*>(gobj()), iter.gobj());
return iter;
}
+Gtk::TextBuffer::const_iterator CompletionContext::get_iter() const
+{
+ Gtk::TextBuffer::const_iterator iter;
+ gtk_source_completion_context_get_iter(const_cast<GtkSourceCompletionContext*>(gobj()), iter.gobj());
+ return iter;
+}
+
} // namespace Gsv
diff --git a/gtksourceview/src/completioncontext.hg b/gtksourceview/src/completioncontext.hg
index 7a5fad0..dc50181 100644
--- a/gtksourceview/src/completioncontext.hg
+++ b/gtksourceview/src/completioncontext.hg
@@ -68,6 +68,7 @@ public:
_WRAP_METHOD(void add_proposals(const Glib::RefPtr<CompletionProvider>& provider, const
std::vector<Glib::RefPtr<CompletionProposal> >& proposals, bool finished),
gtk_source_completion_context_add_proposals)
_IGNORE(gtk_source_completion_context_get_iter)
+
/** Get the iter at which the completion was invoked.
*
* Providers can use this to determine how and if to match proposals.
@@ -76,7 +77,17 @@ public:
*
* @newin{2,10}
*/
- Gtk::TextBuffer::iterator get_iter() const;
+ Gtk::TextBuffer::iterator get_iter();
+
+ /** Get the iter at which the completion was invoked.
+ *
+ * Providers can use this to determine how and if to match proposals.
+ *
+ * @return A Gtk::TextBuffer::const_iterator.
+ *
+ * @newin{2,10}
+ */
+ Gtk::TextBuffer::const_iterator get_iter() const;
/** Get the context activation
*
diff --git a/gtksourceview/src/completioninfo.hg b/gtksourceview/src/completioninfo.hg
index b3f173d..fd9db67 100644
--- a/gtksourceview/src/completioninfo.hg
+++ b/gtksourceview/src/completioninfo.hg
@@ -49,17 +49,17 @@ public:
CompletionInfo();
#m4 _CONVERSION(`const Gtk::TextView&',`GtkTextView*',`const_cast<GtkTextView*>(($3).gobj())')
-#m4 _CONVERSION(`const Gtk::TextBuffer::iterator&',`GtkTextIter*',`const_cast<GtkTextIter*>(($3).gobj())')
+#m4 _CONVERSION(`const
Gtk::TextBuffer::const_iterator&',`GtkTextIter*',`const_cast<GtkTextIter*>(($3).gobj())')
/** Moves the CompletionInfo to @a iter. Moving will respect the
* Gdk::Gravity setting of the info window and will ensure the line at @a iter
* is not occluded by the window.
*
* @param view A Gtk::TextView on which the info window should be positioned.
- * @param iter A Gtk::TextBuffer::iterator.
+ * @param iter A Gtk::TextBuffer::const_iterator.
*
* @newin{2,10}
*/
- _WRAP_METHOD(void move_to_iter(const Gtk::TextView& view, const Gtk::TextBuffer::iterator& iter),
gtk_source_completion_info_move_to_iter)
+ _WRAP_METHOD(void move_to_iter(const Gtk::TextView& view, const Gtk::TextBuffer::const_iterator& iter),
gtk_source_completion_info_move_to_iter)
/** Moves the Gtk::CompletionInfo to the cursor position. Moving will
* respect the Gdk::Gravity setting of the info window and will ensure the
diff --git a/gtksourceview/src/completionprovider.hg b/gtksourceview/src/completionprovider.hg
index 6a5348c..a9a8e83 100644
--- a/gtksourceview/src/completionprovider.hg
+++ b/gtksourceview/src/completionprovider.hg
@@ -147,7 +147,7 @@ public:
*/
_WRAP_METHOD(bool get_start_iter(const Glib::RefPtr<const CompletionContext>& context, const
Glib::RefPtr<const CompletionProposal>& proposal, Gtk::TextBuffer::iterator& iter),
gtk_source_completion_provider_get_start_iter)
-#m4 _CONVERSION(`const Gtk::TextBuffer::iterator&',`GtkTextIter*',`const_cast<GtkTextIter*>(($3).gobj())')
+#m4 _CONVERSION(`const
Gtk::TextBuffer::const_iterator&',`GtkTextIter*',`const_cast<GtkTextIter*>(($3).gobj())')
/** Activate @a proposal at @a iter.
*
* When this functions returns <tt>false</tt>, the default activation of
@@ -155,14 +155,14 @@ public:
* label of @a proposal.
*
* @param proposal A CompletionProposal.
- * @param iter A Gtk::TextBuffer::iterator.
+ * @param iter A Gtk::TextBuffer::const_iterator.
*
* @return @c true to indicate that the proposal activation has been handled,
* @c false otherwise.
*
* @newin{2,10}
*/
- _WRAP_METHOD(bool activate_proposal(const Glib::RefPtr<CompletionProposal>& proposal, const
Gtk::TextBuffer::iterator& iter), gtk_source_completion_provider_activate_proposal)
+ _WRAP_METHOD(bool activate_proposal(const Glib::RefPtr<CompletionProposal>& proposal, const
Gtk::TextBuffer::const_iterator& iter), gtk_source_completion_provider_activate_proposal)
/** Get with what kind of activation the provider should be activated.
*
@@ -225,12 +225,13 @@ private:
#m4 _CONVERSION(`GtkSourceCompletionProposal*', `const Glib::RefPtr<const CompletionProposal>&',
`Glib::wrap($3, true)')
#m4 _CONVERSION(`GtkTextIter*',`Gtk::TextBuffer::iterator&',`Glib::wrap_iter($3)')
_WRAP_VFUNC(bool get_start_iter(const Glib::RefPtr<const CompletionContext>& context, const
Glib::RefPtr<const CompletionProposal>& proposal, Gtk::TextBuffer::iterator& iter), get_start_iter)
+
#m4 _CONVERSION(`GtkSourceCompletionProposal*', `const Glib::RefPtr<const CompletionProposal>&',
`Glib::wrap($3)')
#m4 _CONVERSION(`GtkSourceCompletionContext*', `const Glib::RefPtr<const CompletionContext>&',
`Glib::wrap($3)')
#m4 _CONVERSION(`GtkSourceCompletionProposal*', `const Glib::RefPtr<CompletionProposal>&', `Glib::wrap($3,
true)')
-#m4 _CONVERSION(`GtkTextIter*',`const Gtk::TextBuffer::iterator&',`Glib::wrap_iter($3)')
- _WRAP_VFUNC(bool activate_proposal(const Glib::RefPtr<CompletionProposal>& proposal, const
Gtk::TextBuffer::iterator& iter), activate_proposal)
+#m4 _CONVERSION(`GtkTextIter*',`const Gtk::TextBuffer::const_iterator&',`Glib::wrap_const_iter($3)')
+ _WRAP_VFUNC(bool activate_proposal(const Glib::RefPtr<CompletionProposal>& proposal, const
Gtk::TextBuffer::const_iterator& iter), activate_proposal)
#m4 _CONVERSION(`GtkSourceCompletionProposal*', `const Glib::RefPtr<CompletionProposal>&', `Glib::wrap($3)')
_WRAP_VFUNC(int get_interactive_delay() const, get_interactive_delay)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]