From 0a103a150a50c5e233f29b69db79cac884925e58 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Mon, 9 May 2011 19:56:11 +0000 Subject: QPID-3004: Get Clang to compile qpid c++ - Add new template function for FieldValue::getIntegerValue() to avoid compile error when extracting into 1 byte ints. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1101183 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/include/qpid/framing/FieldValue.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'cpp/include') diff --git a/cpp/include/qpid/framing/FieldValue.h b/cpp/include/qpid/framing/FieldValue.h index 19220e74d5..e6255066c4 100644 --- a/cpp/include/qpid/framing/FieldValue.h +++ b/cpp/include/qpid/framing/FieldValue.h @@ -98,6 +98,7 @@ class FieldValue { template T get() const { throw InvalidConversionException(); } template T getIntegerValue() const; + template T getIntegerValue() const; template T getFloatingPointValue() const; template void getFixedWidthValue(unsigned char*) const; template bool get(T&) const; @@ -196,6 +197,18 @@ inline T FieldValue::getIntegerValue() const } } +template +inline T FieldValue::getIntegerValue() const +{ + FixedWidthValue<1>* const fwv = dynamic_cast< FixedWidthValue<1>* const>(data.get()); + if (fwv) { + uint8_t* octets = fwv->rawOctets(); + return octets[0]; + } else { + throw InvalidConversionException(); + } +} + template inline T FieldValue::getFloatingPointValue() const { FixedWidthValue* const fwv = dynamic_cast< FixedWidthValue* const>(data.get()); -- cgit v1.2.1