From 2865b4b3c5be02bf4ef1238711ade43af39e9e07 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Thu, 19 Jan 2012 21:30:17 -0500 Subject: [PATCH] lib: added int32_t to FieldHandle<> --- src/record.h | 20 ++++++++++++++++++-- test/fhbuild.cc | 4 ++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/record.h b/src/record.h index 85dce204..ddd9dd7b 100644 --- a/src/record.h +++ b/src/record.h @@ -574,8 +574,8 @@ public: /// For type bool virtual void operator()(const bool &v, const FieldIdentity &id) const = 0; - /// For type int - virtual void operator()(const int &v, + /// For type int32_t + virtual void operator()(const int32_t &v, const FieldIdentity &id) const = 0; /// For type EmailList virtual void operator()(const EmailList &v, @@ -722,6 +722,7 @@ private: uint16_t RecordT::* m_uint16; // 13 PostalAddress RecordT::* m_PostalAddress; // 14 // used by non-union m_enum below: // 15 + int32_t RecordT::* m_int32; // 16 }; int m_type_index; @@ -876,6 +877,15 @@ public: { } + // 16 + FieldHandle(int32_t RecordT::* mp, const FieldIdentity &id) + : m_type_index(16) + , m_enum(0) + , m_id(id) + { + m_union.m_int32 = mp; + } + /// Extracts FieldIdentity object from FieldHandle<> const FieldIdentity& GetIdentity() const { return m_id; } @@ -935,6 +945,9 @@ public: case 15: vh(m_enum->GetValue(rec), m_id); break; + case 16: + vh(rec.*(m_union.m_int32), m_id); + break; default: throw std::logic_error("Unknown field handle type index"); } @@ -997,6 +1010,9 @@ public: case 15: func(m_enum, m_id); break; + case 16: + func(m_union.m_int32, m_id); + break; default: throw std::logic_error("Unknown field handle type index"); } diff --git a/test/fhbuild.cc b/test/fhbuild.cc index 7432997d..10a155c4 100644 --- a/test/fhbuild.cc +++ b/test/fhbuild.cc @@ -175,8 +175,8 @@ public: << v << endl; DumpId(id); } - /// For type int - virtual void operator()(const int &v, + /// For type int32_t + virtual void operator()(const int32_t &v, const FieldIdentity &id) const { cout << id.DisplayName << " (" << id.Name << "): " -- 2.11.4.GIT