[gnome-builder/wip/chergert/debugger: 5/38] debugger: start on IdeDebugger interface



commit 78098c8f6998a0988038f8d58eea95e996928fe2
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 22 13:01:14 2017 -0700

    debugger: start on IdeDebugger interface

 libide/Makefile.am             |    2 +
 libide/debugger/ide-debugger.c |   66 ++++++++++++++++++++++++++++++++++++++++
 libide/debugger/ide-debugger.h |   45 +++++++++++++++++++++++++++
 3 files changed, 113 insertions(+), 0 deletions(-)
---
diff --git a/libide/Makefile.am b/libide/Makefile.am
index d906921..30cab42 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -49,6 +49,7 @@ libide_1_0_la_public_headers =                                              \
        buildsystem/ide-configuration-provider.h                            \
        buildsystem/ide-environment-variable.h                              \
        buildsystem/ide-environment.h                                       \
+       debugger/ide-debugger.h                                             \
        debugger/ide-debug-manager.h                                        \
        debugger/ide-debugger-breakpoints.h                                 \
        debugger/ide-debugger-editor-view-addin.h                           \
@@ -232,6 +233,7 @@ libide_1_0_la_public_sources =                                              \
        buildsystem/ide-configuration-provider.c                            \
        buildsystem/ide-environment-variable.c                              \
        buildsystem/ide-environment.c                                       \
+       debugger/ide-debugger.c                                             \
        debugger/ide-debug-manager.c                                        \
        debugger/ide-debugger-breakpoints.c                                 \
        debugger/ide-debugger-editor-view-addin.c                           \
diff --git a/libide/debugger/ide-debugger.c b/libide/debugger/ide-debugger.c
new file mode 100644
index 0000000..f86025e
--- /dev/null
+++ b/libide/debugger/ide-debugger.c
@@ -0,0 +1,66 @@
+/* ide-debugger.c
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define G_LOG_DOMAIN "ide-debugger"
+
+#include "ide-debug.h"
+
+#include "debugger/ide-debugger.h"
+#include "runner/ide-runner.h"
+
+G_DEFINE_INTERFACE (IdeDebugger, ide_debugger, IDE_TYPE_OBJECT)
+
+static void
+ide_debugger_default_init (IdeDebuggerInterface *iface)
+{
+}
+
+/**
+ * ide_debugger_supports_runner:
+ * @self: An #IdeDebugger
+ * @runner: An #IdeRunner
+ * @priority: (out): A location to set the priority
+ *
+ * This function checks to see if the debugger supports the runner. This
+ * allows the debugger to verify the program type or other necessary
+ * dependency information.
+ *
+ * Returns: %TRUE if the @self supports @runner.
+ */
+gboolean
+ide_debugger_supports_runner (IdeDebugger *self,
+                              IdeRunner   *runner,
+                              gint        *priority)
+{
+  gboolean ret = FALSE;
+
+  g_return_val_if_fail (IDE_IS_DEBUGGER (self), FALSE);
+  g_return_val_if_fail (IDE_IS_RUNNER (runner), FALSE);
+
+  if (priority != NULL)
+    *priority = G_MAXINT;
+
+  if (IDE_DEBUGGER_GET_IFACE (self)->supports_runner)
+    ret = IDE_DEBUGGER_GET_IFACE (self)->supports_runner (self, runner, priority);
+
+  IDE_TRACE_MSG ("Chceking if %s supports runner %s",
+                 G_OBJECT_TYPE_NAME (self),
+                 G_OBJECT_TYPE_NAME (runner));
+
+  return ret;
+}
diff --git a/libide/debugger/ide-debugger.h b/libide/debugger/ide-debugger.h
new file mode 100644
index 0000000..bd974a9
--- /dev/null
+++ b/libide/debugger/ide-debugger.h
@@ -0,0 +1,45 @@
+/* ide-debugger.h
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef IDE_DEBUGGER_H
+#define IDE_DEBUGGER_H
+
+#include "ide-object.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_DEBUGGER (ide_debugger_get_type())
+
+G_DECLARE_INTERFACE (IdeDebugger, ide_debugger, IDE, DEBUGGER, IdeObject)
+
+struct _IdeDebuggerInterface
+{
+  GTypeInterface parent_iface;
+
+  gboolean (*supports_runner) (IdeDebugger *self,
+                               IdeRunner   *runner,
+                               gint        *priority);
+};
+
+gboolean ide_debugger_supports_runner (IdeDebugger *self,
+                                       IdeRunner   *runner,
+                                       gint        *priority);
+
+G_END_DECLS
+
+#endif /* IDE_DEBUGGER_H */


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