formatting Any by Poco itself

Please post support and help requests here.
pdf
Posts: 2
Joined: 19 Jul 2012, 22:54

formatting Any by Poco itself

Postby pdf » 20 Jul 2012, 17:56

Hello,

'Any' seems to be like a Variant is'nt it ?
So, as the Poco::format() function accept 'Any' type as parameters, is there a way to not specify the type of the parameters (%ld, %i, %s, %f, etc...) and to let Poco detect the type itself ?
for example:

Code: Select all

Poco::Int32 cpt = 5000;
Poco::Any cptAny = cpt;
std::string formatted = Poco::format( "counter is %1", cptAny);


Best regards

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

Re: formatting Any by Poco itself

Postby alex » 20 Jul 2012, 19:40

Any is asymmetric in regards to types, it will accept any type but it won't tell you what type it holds, i.e. it is dynamic on receiving and static on the giving end. Poco::DynamicAny (aka Poco::Dynamic::Var in trunk) is dynamic on both ends.

See DynamicAny articles for detailed explanation:

http://accu.org/index.php/journals/1502
http://accu.org/index.php/journals/1511


Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest

cron