mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
- VS2012: build/tests
- JSON: style and exceptions catch by ref fix - NumberParser: case-insensitive hex parsing - Dynamic::Var: const std::string& cast operator specialization (coaxing std::string ctor) - LocalDateTime: strftime fix (buffer too small for full tz string, use %Z instead of %z - makes no difference on windows but is more portable) - small buildwin.cmd vsvars32.bat call fix
This commit is contained in:
@@ -41,24 +41,29 @@
|
||||
|
||||
#include "Poco/JSON/Query.h"
|
||||
|
||||
namespace Poco
|
||||
{
|
||||
namespace JSON
|
||||
{
|
||||
|
||||
Query::Query(const DynamicAny& source) : _source(source)
|
||||
using Poco::Dynamic::Var;
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace JSON {
|
||||
|
||||
|
||||
Query::Query(const Var& source) : _source(source)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
Query::~Query()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Object::Ptr Query::findObject(const std::string& path) const
|
||||
{
|
||||
Object::Ptr obj;
|
||||
DynamicAny result = find(path);
|
||||
Var result = find(path);
|
||||
if ( result.type() == typeid(Object::Ptr) )
|
||||
{
|
||||
obj = result.extract<Object::Ptr>();
|
||||
@@ -66,10 +71,11 @@ Object::Ptr Query::findObject(const std::string& path) const
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Array::Ptr Query::findArray(const std::string& path) const
|
||||
{
|
||||
Array::Ptr arr;
|
||||
DynamicAny result = find(path);
|
||||
Var result = find(path);
|
||||
if ( result.type() == typeid(Array::Ptr) )
|
||||
{
|
||||
arr = result.extract<Array::Ptr>();
|
||||
@@ -78,9 +84,9 @@ Array::Ptr Query::findArray(const std::string& path) const
|
||||
}
|
||||
|
||||
|
||||
DynamicAny Query::find(const std::string& path) const
|
||||
Var Query::find(const std::string& path) const
|
||||
{
|
||||
DynamicAny result = _source;
|
||||
Var result = _source;
|
||||
StringTokenizer tokenizer(path, ".");
|
||||
for(StringTokenizer::Iterator token = tokenizer.begin(); token != tokenizer.end(); token++)
|
||||
{
|
||||
@@ -138,4 +144,5 @@ DynamicAny Query::find(const std::string& path) const
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}} // Namespace Poco::JSON
|
||||
|
||||
Reference in New Issue
Block a user