mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-17 11:05:03 +02:00
DynamicAny:operator [] fix (did not compile w/ VS 2003)
This commit is contained in:
@@ -345,13 +345,31 @@ public:
|
||||
bool isStruct() const;
|
||||
/// Returns true if DynamicAny represents a struct
|
||||
|
||||
DynamicAny& operator [] (std::vector<DynamicAny>::size_type n);
|
||||
template <typename T>
|
||||
DynamicAny& operator [] (T n)
|
||||
/// Index operator, only use on DynamicAnys where isArray
|
||||
/// returns true! In all other cases a BadCastException is thrown!
|
||||
{
|
||||
DynamicAnyHolderImpl<std::vector<DynamicAny> >* pHolder =
|
||||
dynamic_cast<DynamicAnyHolderImpl<std::vector<DynamicAny> > *>(_pHolder);
|
||||
if (pHolder)
|
||||
return pHolder->operator[](n);
|
||||
else
|
||||
throw BadCastException();
|
||||
}
|
||||
|
||||
const DynamicAny& operator [] (std::vector<DynamicAny>::size_type n) const;
|
||||
template <typename T>
|
||||
const DynamicAny& operator [] (T n) const
|
||||
/// const Index operator, only use on DynamicAnys where isArray
|
||||
/// returns true! In all other cases a BadCastException is thrown!
|
||||
{
|
||||
const DynamicAnyHolderImpl<std::vector<DynamicAny> >* pHolder =
|
||||
dynamic_cast<const DynamicAnyHolderImpl<std::vector<DynamicAny> > *>(_pHolder);
|
||||
if (pHolder)
|
||||
return pHolder->operator[](n);
|
||||
else
|
||||
throw BadCastException();
|
||||
}
|
||||
|
||||
DynamicAny& operator [] (const std::string& name);
|
||||
/// Index operator by name, only use on DynamicAnys where isStruct
|
||||
@@ -361,6 +379,14 @@ public:
|
||||
/// Index operator by name, only use on DynamicAnys where isStruct
|
||||
/// returns true! In all other cases a BadCastException is thrown!
|
||||
|
||||
DynamicAny& operator [] (const char* name);
|
||||
/// Index operator by name, only use on DynamicAnys where isStruct
|
||||
/// returns true! In all other cases a BadCastException is thrown!
|
||||
|
||||
const DynamicAny& operator [] (const char* name) const;
|
||||
/// Index operator by name, only use on DynamicAnys where isStruct
|
||||
/// returns true! In all other cases a BadCastException is thrown!
|
||||
|
||||
const std::type_info& type() const;
|
||||
/// Returns the type information of the stored content.
|
||||
|
||||
@@ -442,6 +468,18 @@ inline const std::type_info& DynamicAny::type() const
|
||||
}
|
||||
|
||||
|
||||
inline DynamicAny& DynamicAny::operator [] (const char* name)
|
||||
{
|
||||
return operator [] (std::string(name));
|
||||
}
|
||||
|
||||
|
||||
inline const DynamicAny& DynamicAny::operator [] (const char* name) const
|
||||
{
|
||||
return operator [] (std::string(name));
|
||||
}
|
||||
|
||||
|
||||
inline const DynamicAny DynamicAny::operator + (const char* other) const
|
||||
{
|
||||
return convert<std::string>() + other;
|
||||
|
Reference in New Issue
Block a user