- 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:
Aleksandar Fabijanic
2012-09-24 03:51:40 +00:00
parent a6cc973fe3
commit d8397b9153
30 changed files with 3715 additions and 3739 deletions

View File

@@ -37,45 +37,52 @@
#include "Poco/JSON/Object.h"
#include "Poco/JSON/Stringifier.h"
namespace Poco
{
namespace JSON
{
using Poco::Dynamic::Var;
namespace Poco {
namespace JSON {
Array::Array()
{
}
Array::Array(const Array& copy) : _values(copy._values)
{
}
Array::~Array()
{
}
DynamicAny Array::get(unsigned int index) const
Var Array::get(unsigned int index) const
{
DynamicAny value;
Var value;
try
{
value = _values.at(index);
}
catch(std::out_of_range)
catch(std::out_of_range&)
{
//Ignore, we return an empty value
}
return value;
}
Array::Ptr Array::getArray(unsigned int index) const
{
Array::Ptr result;
DynamicAny value = get(index);
Var value = get(index);
if ( value.type() == typeid(Array::Ptr) )
{
result = value.extract<Array::Ptr>();
@@ -88,7 +95,7 @@ Object::Ptr Array::getObject(unsigned int index) const
{
Object::Ptr result;
DynamicAny value = get(index);
Var value = get(index);
if ( value.type() == typeid(Object::Ptr) )
{
result = value.extract<Object::Ptr>();
@@ -96,9 +103,10 @@ Object::Ptr Array::getObject(unsigned int index) const
return result;
}
bool Array::isObject(unsigned int index) const
{
DynamicAny value = get(index);
Var value = get(index);
return value.type() == typeid(Object::Ptr);
}
@@ -144,4 +152,5 @@ void Array::stringify(std::ostream& out, unsigned int indent) const
out << "]";
}
}} // Namespace Poco::JSON