Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco DynamicAny library

Please post support and help requests here.

Poco DynamicAny library

Postby azanetti » 26 May 2008, 20:29

I need a library like the boost::variant<> on Poco (it looks Poco is much more consistent than boost....). Can anyone please suggest anything ?

I believe that the Foundation::Core~058~~058~DynamicAny would do the work but I need some examples of how to use it with user defined types and not the C++ standar built-in types.

Any thought will be welcome.

Thanks a lot.
azanetti
 
Posts: 1
Joined: 26 May 2008, 20:16

Re: Poco DynamicAny library

Postby alex » 26 May 2008, 23:32

> I need a library like the boost::variant on Poco (it looks Poco is much more consistent than boost....). Can anyone please suggest anything ?

What we have is Poco~058~~058~Any (basically same as boost~058~~058~any) and Poco~058~~058~))DynamicAny(( (our own creation built on Any foundation). Poco~058~~058~Any will hold any type, built-in or user-defined "out of the box". However, when retrieving the original value, you must know exactly what is contained inside (or engage in querying Any for the type). ))DynamicAny(( differs from Any in that it will implicitly and safely convert anything that can be converted (or throw an exception if it is not). However, it needs specialization for each type held. Poco provides specializations for all PODs, plus std~058~~058~string, std~058~~058~vector (for array-like semantics), ))DateTime((, ))LocalDateTime((, Timestamp, Data~058~~058~BLOB, Data~058~~058~Date and Data~058~~058~Time.

> I believe that the Foundation::Core~058~~058~DynamicAny would do the work but I need some examples of how to use it with user defined types and not the C++ standar built-in types.

There is no significant difference between specialization for built-in and UDT types. There are numerous examples in DynamicAnyHolder on how to specialize it for built-in (int, double, ...), standard library (std~058~~058~string, std~058~~058~vector) and user defined (DateTime, LocalDateTime, TimeStamp) types. For Poco~058~~058~Data library specializations (BLOB, Date, Time), look in corresponding header files for the mentioned classes.

> Any thought will be welcome.

HTH

Alex
alex
 
Posts: 1143
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron