[glom] Python: Take the Document as const.



commit 34d2913721b7cfad71c83a9366d90eab385be445
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Nov 29 11:59:58 2013 +0100

    Python: Take the Document as const.

 glom/libglom/python_embed/py_glom_record.cc        |    2 +-
 glom/libglom/python_embed/py_glom_record.h         |    4 ++--
 glom/libglom/python_embed/py_glom_relatedrecord.cc |    2 +-
 glom/libglom/python_embed/py_glom_relatedrecord.h  |    4 ++--
 glom/libglom/python_embed/py_glom_ui.h             |    1 -
 glom/python_embed/glom_python.cc                   |    6 +++---
 glom/python_embed/glom_python.h                    |    4 ++--
 7 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/glom/libglom/python_embed/py_glom_record.cc b/glom/libglom/python_embed/py_glom_record.cc
index 90f8856..460f64c 100644
--- a/glom/libglom/python_embed/py_glom_record.cc
+++ b/glom/libglom/python_embed/py_glom_record.cc
@@ -212,7 +212,7 @@ void PyGlomRecord::setitem(const boost::python::object& key, const boost::python
   //TODO: Do dependent calculations and lookups. Or just do them for all fields for this record when 
finishing the script?
 }
 
-void PyGlomRecord::set_fields(const PyGlomRecord::type_map_field_values& field_values, Document* document, 
const Glib::ustring& table_name, const sharedptr<const Field>& key_field, const Gnome::Gda::Value& 
key_field_value, const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection)
+void PyGlomRecord::set_fields(const PyGlomRecord::type_map_field_values& field_values, const Document* 
document, const Glib::ustring& table_name, const sharedptr<const Field>& key_field, const Gnome::Gda::Value& 
key_field_value, const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection)
 {
   m_map_field_values = field_values;
   /* Just for debugging:
diff --git a/glom/libglom/python_embed/py_glom_record.h b/glom/libglom/python_embed/py_glom_record.h
index 35f564d..10e9604 100644
--- a/glom/libglom/python_embed/py_glom_record.h
+++ b/glom/libglom/python_embed/py_glom_record.h
@@ -61,14 +61,14 @@ public:
   void setitem(const boost::python::object& /* key */, const boost::python::object& /* value */);
 
   void set_fields(const PyGlomRecord::type_map_field_values& field_values,
-    Document* document,
+    const Document* document,
     const Glib::ustring& table_name,
     const sharedptr<const Field>& key_field,
     const Gnome::Gda::Value& key_field_value,
     const Glib::RefPtr<Gnome::Gda::Connection>& opened_connection);
 
 public:
-  Document* m_document;
+  const Document* m_document;
   Glib::ustring m_table_name;
   type_map_field_values m_map_field_values;
 private:
diff --git a/glom/libglom/python_embed/py_glom_relatedrecord.cc 
b/glom/libglom/python_embed/py_glom_relatedrecord.cc
index ecae130..f4ae40a 100644
--- a/glom/libglom/python_embed/py_glom_relatedrecord.cc
+++ b/glom/libglom/python_embed/py_glom_relatedrecord.cc
@@ -242,7 +242,7 @@ boost::python::object PyGlomRelatedRecord::max(const std::string& field_name) co
   return generic_aggregate(field_name, "max");
 }
 
-void PyGlomRelatedRecord::set_relationship(const sharedptr<const Relationship>& relationship, const 
Gnome::Gda::Value& from_key_value,  Document* document)
+void PyGlomRelatedRecord::set_relationship(const sharedptr<const Relationship>& relationship, const 
Gnome::Gda::Value& from_key_value, const Document* document)
 {
   m_relationship = relationship;
   m_from_key_value = from_key_value;
diff --git a/glom/libglom/python_embed/py_glom_relatedrecord.h 
b/glom/libglom/python_embed/py_glom_relatedrecord.h
index 6da7dea..c54107c 100644
--- a/glom/libglom/python_embed/py_glom_relatedrecord.h
+++ b/glom/libglom/python_embed/py_glom_relatedrecord.h
@@ -38,7 +38,7 @@ public:
   PyGlomRelatedRecord();
   ~PyGlomRelatedRecord();
 
-  void set_relationship(const sharedptr<const Relationship>& relationship, const Gnome::Gda::Value& 
from_key_value, Document* document);
+  void set_relationship(const sharedptr<const Relationship>& relationship, const Gnome::Gda::Value& 
from_key_value, const Document* document);
 
   boost::python::object sum(const std::string& field_name) const;
   boost::python::object count(const std::string& field_name) const;
@@ -58,7 +58,7 @@ private:
 
   //PyObject* m_fields_dict; //Dictionary (map) of field names (string) to field values (Gnome::Gda::Value).
   //PyGlomRecord* m_record_parent;
-  Document* m_document;
+  const Document* m_document;
 
   sharedptr<const Relationship> m_relationship;
   Gnome::Gda::Value m_from_key_value;
diff --git a/glom/libglom/python_embed/py_glom_ui.h b/glom/libglom/python_embed/py_glom_ui.h
index cde952e..6982425 100644
--- a/glom/libglom/python_embed/py_glom_ui.h
+++ b/glom/libglom/python_embed/py_glom_ui.h
@@ -23,7 +23,6 @@
 
 #include <boost/python.hpp>
 
-#include <libglom/document/document.h>
 #include <libglom/data_structure/field.h>
 #include <libglom/python_embed/py_glom_ui_callbacks.h>
 #include <glibmm/ustring.h>
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index 61ea618..42ca8ec 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -168,7 +168,7 @@ bool gda_python_module_is_available()
 }
 
 static boost::python::object glom_python_call(Field::glom_field_type result_type,
-  Document* pDocument,
+  const Document* pDocument,
   const Glib::ustring& func_impl,
   Glib::ustring& error_message,
   const boost::python::object& param1,
@@ -369,7 +369,7 @@ static boost::python::object glom_python_call(Field::glom_field_type result_type
 
 void glom_execute_python_function_implementation(const Glib::ustring& func_impl,
   const type_map_fields& field_values,
-  Document* pDocument,
+  const Document* pDocument,
   const Glib::ustring& table_name,
   const sharedptr<const Field>& key_field,
   const Gnome::Gda::Value& key_field_value,
@@ -409,7 +409,7 @@ void glom_execute_python_function_implementation(const Glib::ustring& func_impl,
 Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field_type result_type,
   const Glib::ustring& func_impl,
   const type_map_fields& field_values,
-  Document* pDocument,
+  const Document* pDocument,
   const Glib::ustring& table_name,
   const sharedptr<const Field>& key_field,
   const Gnome::Gda::Value& key_field_value,
diff --git a/glom/python_embed/glom_python.h b/glom/python_embed/glom_python.h
index c4337e6..277e430 100644
--- a/glom/python_embed/glom_python.h
+++ b/glom/python_embed/glom_python.h
@@ -52,7 +52,7 @@ typedef std::map<Glib::ustring, Gnome::Gda::Value> type_map_fields;
  */
 void glom_execute_python_function_implementation(const Glib::ustring& func_impl,
   const type_map_fields& field_values,
-  Document* pDocument,
+  const Document* pDocument,
   const Glib::ustring& table_name,
   const sharedptr<const Field>& key_field,
   const Gnome::Gda::Value& key_field_value,
@@ -67,7 +67,7 @@ void glom_execute_python_function_implementation(const Glib::ustring& func_impl,
 Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field_type result_type,
   const Glib::ustring& func_impl,
   const type_map_fields& field_values,
-  Document* pDocument,
+  const Document* pDocument,
   const Glib::ustring& table_name,
   const sharedptr<const Field>& key_field,
   const Gnome::Gda::Value& key_field_value,


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