diff --git a/Foundation/include/Poco/DynamicAny.h b/Foundation/include/Poco/DynamicAny.h index 96d042ba2..1d576609a 100644 --- a/Foundation/include/Poco/DynamicAny.h +++ b/Foundation/include/Poco/DynamicAny.h @@ -345,13 +345,31 @@ public: bool isStruct() const; /// Returns true if DynamicAny represents a struct - DynamicAny& operator [] (std::vector::size_type n); + template + DynamicAny& operator [] (T n) /// Index operator, only use on DynamicAnys where isArray /// returns true! In all other cases a BadCastException is thrown! + { + DynamicAnyHolderImpl >* pHolder = + dynamic_cast > *>(_pHolder); + if (pHolder) + return pHolder->operator[](n); + else + throw BadCastException(); + } - const DynamicAny& operator [] (std::vector::size_type n) const; + template + const DynamicAny& operator [] (T n) const /// const Index operator, only use on DynamicAnys where isArray /// returns true! In all other cases a BadCastException is thrown! + { + const DynamicAnyHolderImpl >* pHolder = + dynamic_cast > *>(_pHolder); + if (pHolder) + return pHolder->operator[](n); + else + throw BadCastException(); + } DynamicAny& operator [] (const std::string& name); /// Index operator by name, only use on DynamicAnys where isStruct @@ -361,6 +379,14 @@ public: /// Index operator by name, only use on DynamicAnys where isStruct /// returns true! In all other cases a BadCastException is thrown! + DynamicAny& operator [] (const char* name); + /// Index operator by name, only use on DynamicAnys where isStruct + /// returns true! In all other cases a BadCastException is thrown! + + const DynamicAny& operator [] (const char* name) const; + /// Index operator by name, only use on DynamicAnys where isStruct + /// returns true! In all other cases a BadCastException is thrown! + const std::type_info& type() const; /// Returns the type information of the stored content. @@ -442,6 +468,18 @@ inline const std::type_info& DynamicAny::type() const } +inline DynamicAny& DynamicAny::operator [] (const char* name) +{ + return operator [] (std::string(name)); +} + + +inline const DynamicAny& DynamicAny::operator [] (const char* name) const +{ + return operator [] (std::string(name)); +} + + inline const DynamicAny DynamicAny::operator + (const char* other) const { return convert() + other; diff --git a/Foundation/src/DynamicAny.cpp b/Foundation/src/DynamicAny.cpp index 769240ff1..d9fb10d89 100644 --- a/Foundation/src/DynamicAny.cpp +++ b/Foundation/src/DynamicAny.cpp @@ -246,26 +246,6 @@ DynamicAny DynamicAny::operator -- (int) } -DynamicAny& DynamicAny::operator [] (std::vector::size_type n) -{ - DynamicAnyHolderImpl >* pHolder = dynamic_cast > *>(_pHolder); - if (pHolder) - return pHolder->operator[](n); - else - throw BadCastException(); -} - - -const DynamicAny& DynamicAny::operator [] (std::vector::size_type n) const -{ - const DynamicAnyHolderImpl >* pHolder = dynamic_cast > *>(_pHolder); - if (pHolder) - return pHolder->operator[](n); - else - throw BadCastException(); -} - - DynamicAny& DynamicAny::operator [] (const std::string& name) { DynamicAnyHolderImpl* pHolder = dynamic_cast *>(_pHolder); diff --git a/Foundation/src/MSG00001.bin b/Foundation/src/MSG00001.bin deleted file mode 100644 index 543d281d3..000000000 Binary files a/Foundation/src/MSG00001.bin and /dev/null differ diff --git a/Foundation/src/pocomsg.h b/Foundation/src/pocomsg.h deleted file mode 100644 index dd2cb6f7f..000000000 --- a/Foundation/src/pocomsg.h +++ /dev/null @@ -1,158 +0,0 @@ -// -// pocomsg.mc[.h] -// -// $Id: //poco/svn/Foundation/src/pocomsg.h#2 $ -// -// The Poco message source/header file. -// -// NOTE: pocomsg.h is automatically generated from pocomsg.mc. -// Never edit pocomsg.h directly! -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// Permission is hereby granted, free of charge, to any person or organization -// obtaining a copy of the software and accompanying documentation covered by -// this license (the "Software") to use, reproduce, display, distribute, -// execute, and transmit the Software, and to prepare derivative works of the -// Software, and to permit third-parties to whom the Software is furnished to -// do so, all subject to the following: -// -// The copyright notices in the Software and this entire statement, including -// the above license grant, this restriction and the following disclaimer, -// must be included in all copies of the Software, in whole or in part, and -// all derivative works of the Software, unless such copies or derivative -// works are solely in the form of machine-executable object code generated by -// a source language processor. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -// DEALINGS IN THE SOFTWARE. -// -// -// Categories -// -// -// Values are 32 bit values layed out as follows: -// -// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 -// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 -// +---+-+-+-----------------------+-------------------------------+ -// |Sev|C|R| Facility | Code | -// +---+-+-+-----------------------+-------------------------------+ -// -// where -// -// Sev - is the severity code -// -// 00 - Success -// 01 - Informational -// 10 - Warning -// 11 - Error -// -// C - is the Customer code flag -// -// R - is a reserved bit -// -// Facility - is the facility code -// -// Code - is the facility's status code -// -// -// Define the facility codes -// - - -// -// Define the severity codes -// - - -// -// MessageId: POCO_CTG_FATAL -// -// MessageText: -// -// Fatal -// -#define POCO_CTG_FATAL 0x00000001L - -// -// MessageId: POCO_CTG_CRITICAL -// -// MessageText: -// -// Critical -// -#define POCO_CTG_CRITICAL 0x00000002L - -// -// MessageId: POCO_CTG_ERROR -// -// MessageText: -// -// Error -// -#define POCO_CTG_ERROR 0x00000003L - -// -// MessageId: POCO_CTG_WARNING -// -// MessageText: -// -// Warning -// -#define POCO_CTG_WARNING 0x00000004L - -// -// MessageId: POCO_CTG_NOTICE -// -// MessageText: -// -// Notice -// -#define POCO_CTG_NOTICE 0x00000005L - -// -// MessageId: POCO_CTG_INFORMATION -// -// MessageText: -// -// Information -// -#define POCO_CTG_INFORMATION 0x00000006L - -// -// MessageId: POCO_CTG_DEBUG -// -// MessageText: -// -// Debug -// -#define POCO_CTG_DEBUG 0x00000007L - -// -// MessageId: POCO_CTG_TRACE -// -// MessageText: -// -// Trace -// -#define POCO_CTG_TRACE 0x00000008L - -// -// Event Identifiers -// -// -// MessageId: POCO_MSG_LOG -// -// MessageText: -// -// %1 -// -#define POCO_MSG_LOG 0x00001000L - diff --git a/Foundation/testsuite/src/DynamicAnyTest.h b/Foundation/testsuite/src/DynamicAnyTest.h index d4b7870e7..3c7283bfb 100644 --- a/Foundation/testsuite/src/DynamicAnyTest.h +++ b/Foundation/testsuite/src/DynamicAnyTest.h @@ -108,12 +108,12 @@ private: { TL iMin = std::numeric_limits::min(); Poco::DynamicAny da = iMin - 1; - try { TS i; i = da; fail("must fail"); } + try { TS i; i = da.convert(); fail("must fail"); } catch (Poco::RangeException&) {} TL iMax = std::numeric_limits::max(); da = iMax + 1; - try { TS i; i = da; fail("must fail"); } + try { TS i; i = da.convert(); fail("must fail"); } catch (Poco::RangeException&) {} } @@ -126,13 +126,13 @@ private: { TL iMin = static_cast(std::numeric_limits::min()); da = iMin * 10; - try { TS i; i = da; fail("must fail"); } + try { TS i; i = da.convert(); fail("must fail"); } catch (Poco::RangeException&) {} } TL iMax = static_cast(std::numeric_limits::max()); da = iMax * 10; - try { TS i; i = da; fail("must fail"); } + try { TS i; i = da.convert(); fail("must fail"); } catch (Poco::RangeException&) {} } @@ -144,7 +144,7 @@ private: TS iMin = std::numeric_limits::min(); Poco::DynamicAny da = iMin; - try { TU i; i = da; fail("must fail"); } + try { TU i; i = da.convert(); fail("must fail"); } catch (Poco::RangeException&) {} } @@ -153,7 +153,7 @@ private: { TL iMax = std::numeric_limits::max(); Poco::DynamicAny da = iMax + 1; - try { TS i; i = da; fail("must fail"); } + try { TS i; i = da.convert(); fail("must fail"); } catch (Poco::RangeException&) {} } };