From 5873c8e36219e57ca7c92c93f37e1275e6050918 Mon Sep 17 00:00:00 2001 From: aleks-f Date: Wed, 3 Apr 2013 21:05:22 -0500 Subject: [PATCH] few more POCO_NO_SOO compile fixes --- Foundation/include/Poco/Any.h | 51 ++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/Foundation/include/Poco/Any.h b/Foundation/include/Poco/Any.h index ce26cfd7d..256f617fe 100644 --- a/Foundation/include/Poco/Any.h +++ b/Foundation/include/Poco/Any.h @@ -59,12 +59,9 @@ template class VarHolderImpl; } - -template + +template union Placeholder /// ValueHolder union (used by Poco::Any and Poco::Dynamic::Var for small /// object optimization). @@ -112,7 +109,7 @@ public: // MSVC71,80 won't extend friendship to nested class (Any::Holder) #if !defined(POCO_MSVC_VERSION) || (defined(POCO_MSVC_VERSION) && (POCO_MSVC_VERSION > 80)) -// private: +private: #endif PlaceholderT* pHolder; @@ -127,6 +124,48 @@ public: }; +#else // !POCO_NO_SOO + + +template +union Placeholder + /// ValueHolder union (used by Poco::Any and Poco::Dynamic::Var for small + /// object optimization). + /// + /// If Holder fits into POCO_SMALL_OBJECT_SIZE bytes of storage, + /// it will be placement-new-allocated into the local buffer + /// (i.e. there will be no heap-allocation). The local buffer size is one byte + /// larger - [POCO_SMALL_OBJECT_SIZE + 1], additional byte value indicating + /// where the object was allocated (0 => heap, 1 => local). +{ +public: + + Placeholder () + { + } + + PlaceholderT* content() const + { + return pHolder; + } + +// MSVC71,80 won't extend friendship to nested class (Any::Holder) +#if !defined(POCO_MSVC_VERSION) || (defined(POCO_MSVC_VERSION) && (POCO_MSVC_VERSION > 80)) +private: +#endif + + PlaceholderT* pHolder; + + friend class Any; + friend class Dynamic::Var; + friend class Dynamic::VarHolder; + template friend class Dynamic::VarHolderImpl; +}; + + +#endif // POCO_NO_SOO + + class Any /// An Any class represents a general type and is capable of storing any type, supporting type-safe extraction /// of the internally stored data.