Poco::Dynamic::Var isn't anything

A general discussion forum.
smallB007
Posts: 8
Joined: 28 Mar 2016, 18:00

Poco::Dynamic::Var isn't anything

Postby smallB007 » 26 Apr 2016, 15:01

Guys, I have a piece of code:

Code: Select all

Poco::Dynamic::Var result_ = parser_.parse(response);//<<--Here response is std::string

and when I try testing the result_ for the type, in order to adjust next step depending on what type result_ is of, with following code:

Code: Select all

if (result_.isArray())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isBoolean())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isDeque())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isEmpty())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isInteger())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isList())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isNumeric())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isSigned())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isString())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isStruct())
      {
         int a{ 0 };<<--breakpoint set here
      }
      else if (result_.isVector())
      {
         int a{ 0 };<<--breakpoint set here
      }


I'm surprised to discover that result isn't any of those types. What is the type of the result_ then (apart from being of course Var)? What are the methods for testing the result if none of them seem to be type of the result?
Thank you

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

Re: Poco::Dynamic::Var isn't anything

Postby alex » 27 Apr 2016, 15:28

Depending on the JSON, it will be either JSON::Array::Ptr or JSON::Object::Ptr.

smallB007
Posts: 8
Joined: 28 Mar 2016, 18:00

Re: Poco::Dynamic::Var isn't anything

Postby smallB007 » 29 Apr 2016, 09:59

Hi Alex,
Thank you for your reply.
What are those methods for then? That is, what for is the method isArray? When would I use it?
Thank you

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

Re: Poco::Dynamic::Var isn't anything

Postby alex » 29 Apr 2016, 15:15

See here and here

for isArray() test, here.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest

cron