[nemiver] Factorize variable printing
- From: Dodji Seketeli <dodji src gnome org>
- To: svn-commits-list gnome org
- Subject: [nemiver] Factorize variable printing
- Date: Tue, 2 Jun 2009 17:03:50 -0400 (EDT)
commit 5a9241bcf4f7a6a26218e786c0ff506a31e4f055
Author: Dodji Seketeli <dodji redhat com>
Date: Tue Jun 2 22:39:49 2009 +0200
Factorize variable printing
* src/persp/dbgperspective/nmv-local-vars-inspector2.cc:
(LocalVarsInspector2::Priv::gen_white_spaces,
LocalVarsInspector2::Priv::dump_variable_value): Remove these.
(LocalVarsInspector2::Priv::on_visited_variable_signal): Use
nemiver::debugger_utils::dump_variable_value instead of our
previous own stuff.
* src/persp/dbgperspective/nmv-var-inspector2.cc:
(VarInspector2::Priv::gen_white_spaces,
VarInspector2::Priv::dump_variable_value): Remove these.
(VarInspector2::Priv::on_visited_variable_signal): Use
nemiver::debugger_utils::dump_variable_value instead of our
previous own stuff.
---
.../dbgperspective/nmv-local-vars-inspector2.cc | 62 +-------------------
src/persp/dbgperspective/nmv-var-inspector2.cc | 62 +-------------------
2 files changed, 6 insertions(+), 118 deletions(-)
diff --git a/src/persp/dbgperspective/nmv-local-vars-inspector2.cc b/src/persp/dbgperspective/nmv-local-vars-inspector2.cc
index d9b75b3..8a451d7 100644
--- a/src/persp/dbgperspective/nmv-local-vars-inspector2.cc
+++ b/src/persp/dbgperspective/nmv-local-vars-inspector2.cc
@@ -36,11 +36,13 @@
#include "nmv-i-workbench.h"
#include "nmv-i-var-walker.h"
#include "nmv-vars-treeview.h"
+#include "nmv-debugger-utils.h"
#ifdef WITH_VAROBJS
using namespace nemiver::common;
namespace vutil=nemiver::variables_utils2;
+namespace dutil=nemiver::debugger_utils;
using Glib::RefPtr;
NEMIVER_BEGIN_NAMESPACE (nemiver)
@@ -599,64 +601,6 @@ public:
}
}
- void
- gen_white_spaces (int a_nb_ws,
- std::string &a_ws_str)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- for (int i = 0; i < a_nb_ws; i++) {
- a_ws_str += ' ';
- }
-
- }
-
- void
- dump_variable_value (IDebugger::VariableSafePtr a_var,
- int a_indent_num,
- std::ostringstream &a_os,
- bool a_print_var_name = false)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- THROW_IF_FAIL (a_var);
-
- std::string ws_string;
-
- if (a_indent_num)
- gen_white_spaces (a_indent_num, ws_string);
-
- if (a_print_var_name)
- a_os << ws_string << a_var->name ();
-
- if (!a_var->members ().empty ()) {
- a_os << "\n" << ws_string << "{\n";
- IDebugger::VariableList::const_iterator it;
- for (it = a_var->members ().begin ();
- it != a_var->members ().end ();
- ++it) {
- dump_variable_value (*it, a_indent_num + 2, a_os, true);
- }
- a_os << "\n" << ws_string << "}\n";
- } else {
- a_os << ws_string;
- if (a_print_var_name)
- a_os << " = ";
- a_os << a_var->value ();
- }
- }
-
- void
- dump_variable_value (IDebugger::VariableSafePtr a_var,
- int a_indent_num,
- std::string &a_out_str)
- {
- std::ostringstream os;
- dump_variable_value (a_var, a_indent_num, os);
- a_out_str = os.str ();
- }
-
-
DynamicModuleManager*
get_module_manager ()
{
@@ -928,7 +872,7 @@ public:
NEMIVER_TRY
std::string str;
- dump_variable_value (a_var, 0, str);
+ dutil::dump_variable_value (a_var, 0, str);
if (!str.empty ())
Gtk::Clipboard::get ()->set_text (str);
diff --git a/src/persp/dbgperspective/nmv-var-inspector2.cc b/src/persp/dbgperspective/nmv-var-inspector2.cc
index b0d9117..bb866b2 100644
--- a/src/persp/dbgperspective/nmv-var-inspector2.cc
+++ b/src/persp/dbgperspective/nmv-var-inspector2.cc
@@ -34,11 +34,13 @@
#include "nmv-i-var-walker.h"
#include "nmv-ui-utils.h"
#include "nmv-vars-treeview.h"
+#include "nmv-debugger-utils.h"
#ifdef WITH_VAROBJS
namespace uutil = nemiver::ui_utils;
namespace vutil = nemiver::variables_utils2;
+namespace dutil = nemiver::debugger_utils;
namespace cmn = nemiver::common;
using cmn::DynamicModuleManager;
@@ -327,64 +329,6 @@ class VarInspector2::Priv : public sigc::trackable {
return varobj_walker;
}
- void
- gen_white_spaces (int a_nb_ws,
- std::string &a_ws_str)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- for (int i = 0; i < a_nb_ws; i++) {
- a_ws_str += ' ';
- }
-
- }
-
- void
- dump_variable_value (IDebugger::VariableSafePtr a_var,
- int a_indent_num,
- std::ostringstream &a_os,
- bool a_print_var_name = false)
- {
- LOG_FUNCTION_SCOPE_NORMAL_DD;
-
- THROW_IF_FAIL (a_var);
-
- std::string ws_string;
-
- if (a_indent_num)
- gen_white_spaces (a_indent_num, ws_string);
-
- if (a_print_var_name)
- a_os << ws_string << a_var->name ();
-
- if (!a_var->members ().empty ()) {
- a_os << "\n" << ws_string << "{\n";
- IDebugger::VariableList::const_iterator it;
- for (it = a_var->members ().begin ();
- it != a_var->members ().end ();
- ++it) {
- dump_variable_value (*it, a_indent_num + 2, a_os, true);
- }
- a_os << "\n" << ws_string << "}\n";
- } else {
- a_os << ws_string;
- if (a_print_var_name)
- a_os << " = ";
- a_os << a_var->value ();
- }
- }
-
- void
- dump_variable_value (IDebugger::VariableSafePtr a_var,
- int a_indent_num,
- std::string &a_out_str)
- {
- std::ostringstream os;
- dump_variable_value (a_var, a_indent_num, os);
- a_out_str = os.str ();
- }
-
-
// ******************
// <signal handlers>
// ******************
@@ -398,7 +342,7 @@ class VarInspector2::Priv : public sigc::trackable {
NEMIVER_TRY
std::string str;
- dump_variable_value (a_var, 0, str);
+ dutil::dump_variable_value (a_var, 0, str);
if (!str.empty ())
Gtk::Clipboard::get ()->set_text (str);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]