[java-libglom] Rename class variables in FieldFormatting and NumericFormat.
- From: Benjamin Konrath <bkonrath src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [java-libglom] Rename class variables in FieldFormatting and NumericFormat.
- Date: Wed, 30 Nov 2011 13:17:05 +0000 (UTC)
commit 7d33f330470c4c7bd4baab4c874de06dbbc40bac
Author: Ben Konrath <ben bagu org>
Date: Wed Nov 30 14:16:45 2011 +0100
Rename class variables in FieldFormatting and NumericFormat.
By default, SWIG wraps public class variables by creating getters and
setters for them. A variable such as m_variable will be wrapped as
getM_variable() and setM_variable(). Variables in FieldFormatting and
NumericFormat starting with m_ have been renamed to remove the 'M' in
the getters and setters.
* src/glom.i: Rename variables starting with m_ in FieldFormatting and
NumericFormat.
* src/test/java/org/glom/libglom/tests/DocumentTest.java: Update tests
for new API.
ChangeLog | 15 +++++++++++++
src/glom.i | 9 +++++++-
.../java/org/glom/libglom/tests/DocumentTest.java | 22 ++++++++++----------
3 files changed, 34 insertions(+), 12 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ac2ad3e..cabbdd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2011-11-30 Ben Konrath <ben bagu org>
+ Rename class variables in FieldFormatting and NumericFormat.
+
+ By default, SWIG wraps public class variables by creating getters and
+ setters for them. A variable such as m_variable will be wrapped as
+ getM_variable() and setM_variable(). Variables in FieldFormatting and
+ NumericFormat starting with m_ have been renamed to remove the 'M' in
+ the getters and setters.
+
+ * src/glom.i: Rename variables starting with m_ in FieldFormatting and
+ NumericFormat.
+ * src/test/java/org/glom/libglom/tests/DocumentTest.java: Update tests
+ for new API.
+
+2011-11-30 Ben Konrath <ben bagu org>
+
Add doap file.
* java-libglom.doap:
diff --git a/src/glom.i b/src/glom.i
index 509e1ef..746c96f 100644
--- a/src/glom.i
+++ b/src/glom.i
@@ -143,6 +143,12 @@ using namespace Glom;
%ignore Glom::UsesRelationship;
// Enable Glom::NumericFormat
+// the %rename makes the getter and setter look better
+%rename(_currency_symbol) Glom::NumericFormat::m_currency_symbol;
+%rename(_use_thousands_separator) Glom::NumericFormat::m_use_thousands_separator;
+%rename(_decimal_places_restricted) Glom::NumericFormat::m_decimal_places_restricted;
+%rename(_decimal_places) Glom::NumericFormat::m_decimal_places;
+%rename(_alt_foreground_color_for_negatives) Glom::NumericFormat::m_alt_foreground_color_for_negatives;
%include <libglom/data_structure/numeric_format.h>
/*
@@ -151,7 +157,8 @@ using namespace Glom;
*/
%ignore Glom::FieldFormatting::get_choices_related(sharedptr<const Relationship>& relationship, sharedptr<const LayoutItem_Field>& field, sharedptr<const LayoutGroup>& extra_layout, bool& show_all) const;
-
+// the %rename makes the getter and setter look better
+%rename(_numeric_format) Glom::FieldFormatting::m_numeric_format;
%include <libglom/data_structure/layout/fieldformatting.h>
diff --git a/src/test/java/org/glom/libglom/tests/DocumentTest.java b/src/test/java/org/glom/libglom/tests/DocumentTest.java
index bdfaa76..61c30ad 100644
--- a/src/test/java/org/glom/libglom/tests/DocumentTest.java
+++ b/src/test/java/org/glom/libglom/tests/DocumentTest.java
@@ -182,14 +182,14 @@ public class DocumentTest {
LayoutItem_Field item_field = LayoutItem_Field.cast_dynamic(item);
if (item_field != null) {
// don't keep a reference to the FeildFormatting object
- NumericFormat numFormat = item_field.get_formatting_used().getM_numeric_format();
+ NumericFormat numFormat = item_field.get_formatting_used().get_numeric_format();
// get the values
- boolean altForegroundColorForNegatives = numFormat.getM_alt_foreground_color_for_negatives();
- String currencySymbol = numFormat.getM_currency_symbol();
- long decimalPlaces = numFormat.getM_decimal_places();
- boolean decimalPlacesRestricted = numFormat.getM_decimal_places_restricted();
- boolean useThousandsSepator = numFormat.getM_use_thousands_separator();
+ boolean altForegroundColorForNegatives = numFormat.get_alt_foreground_color_for_negatives();
+ String currencySymbol = numFormat.get_currency_symbol();
+ long decimalPlaces = numFormat.get_decimal_places();
+ boolean decimalPlacesRestricted = numFormat.get_decimal_places_restricted();
+ boolean useThousandsSepator = numFormat.get_use_thousands_separator();
String alternativeColorForNegatives = NumericFormat.get_alternative_color_for_negatives();
long defaultPrecision = NumericFormat.get_default_precision();
@@ -198,11 +198,11 @@ public class DocumentTest {
System.runFinalization();
// re-get the values and test
- assertEquals(altForegroundColorForNegatives, numFormat.getM_alt_foreground_color_for_negatives());
- assertEquals(currencySymbol, numFormat.getM_currency_symbol());
- assertEquals(decimalPlaces, numFormat.getM_decimal_places());
- assertEquals(decimalPlacesRestricted, numFormat.getM_decimal_places_restricted());
- assertEquals(useThousandsSepator, numFormat.getM_use_thousands_separator());
+ assertEquals(altForegroundColorForNegatives, numFormat.get_alt_foreground_color_for_negatives());
+ assertEquals(currencySymbol, numFormat.get_currency_symbol());
+ assertEquals(decimalPlaces, numFormat.get_decimal_places());
+ assertEquals(decimalPlacesRestricted, numFormat.get_decimal_places_restricted());
+ assertEquals(useThousandsSepator, numFormat.get_use_thousands_separator());
assertEquals(alternativeColorForNegatives, NumericFormat.get_alternative_color_for_negatives());
assertEquals(defaultPrecision, NumericFormat.get_default_precision());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]