[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi] [PATCH] tn_range prerequisites for inline editing
From: |
Vaclav Slavik |
Subject: |
[lmi] [PATCH] tn_range prerequisites for inline editing |
Date: |
Sun, 17 Jul 2011 18:27:21 +0200 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
Hi,
these two patches add access to type metadata necessary for upcoming
patch that implements inline editing in CensusView. Knowing that a value
is a range is not enough; I need to know the underlying type so that I
can create appropriate picker control. Similarly for str(): I need to have
a way to access any tn_range's value data.
Regards,
Vaclav
===============================================================
Add tn_range_base::value_type().
This makes it much easier to handle tn_range<> types in generic
GUI code. This information is not readily available otherwise, as
tn_range<> has two template parameters and we're only interested
in the first one in GUI code.
---
tn_range.hpp | 3 +++
tn_range.tpp | 5 +++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/tn_range.hpp b/tn_range.hpp
index ea2717d..00da419 100644
--- a/tn_range.hpp
+++ b/tn_range.hpp
@@ -149,6 +149,7 @@ class LMI_SO tn_range_base
virtual bool equal_to(std::string const&) const = 0;
virtual double universal_minimum() const = 0;
virtual double universal_maximum() const = 0;
+ virtual std::type_info const& value_type() const = 0;
};
/// Design notes for class template tn_range.
@@ -276,6 +277,8 @@ class tn_range
Trammel const& trammel() const;
Number value() const;
+ virtual std::type_info const& value_type() const;
+
private:
Number curb(Number) const;
std::string format_limits_for_error_message() const;
diff --git a/tn_range.tpp b/tn_range.tpp
index 0b8ed6c..e2a084f 100644
--- a/tn_range.tpp
+++ b/tn_range.tpp
@@ -745,3 +745,8 @@ double tn_range<Number,Trammel>::universal_maximum() const
return value_cast<double>(maximum_);
}
+template<typename Number, typename Trammel>
+std::type_info const& tn_range<Number,Trammel>::value_type() const
+{
+ return typeid(Number);
+}
--
1.7.5.4
===============================================================
Make tn_range<>::str() public and move it to tn_range_base.
This, together with existing universal_minimum() and universal_maximum()
methods, makes it possible to access all data that are necessary for the
GUI to construct appropriate UI elements.
---
tn_range.hpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tn_range.hpp b/tn_range.hpp
index 00da419..f8548e3 100644
--- a/tn_range.hpp
+++ b/tn_range.hpp
@@ -149,6 +149,7 @@ class LMI_SO tn_range_base
virtual bool equal_to(std::string const&) const = 0;
virtual double universal_minimum() const = 0;
virtual double universal_maximum() const = 0;
+ virtual std::string str() const = 0;
virtual std::type_info const& value_type() const = 0;
};
@@ -277,13 +278,14 @@ class tn_range
Trammel const& trammel() const;
Number value() const;
+ virtual std::string str() const;
+
virtual std::type_info const& value_type() const;
private:
Number curb(Number) const;
std::string format_limits_for_error_message() const;
bool is_valid(Number) const;
- std::string str() const;
// datum_base required implementation.
virtual std::istream& read (std::istream&);
--
1.7.5.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi] [PATCH] tn_range prerequisites for inline editing,
Vaclav Slavik <=