From ce3c68cc5b1d995c47886488b4ab56d2c973f913 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 11 Aug 2014 21:13:44 +0200 Subject: [PATCH] [DEV] add capabilities --- exml/AttributeList.cpp | 17 +++++++++++++---- exml/AttributeList.h | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/exml/AttributeList.cpp b/exml/AttributeList.cpp index 5c92ecc..03b9a43 100644 --- a/exml/AttributeList.cpp +++ b/exml/AttributeList.cpp @@ -16,7 +16,7 @@ exml::AttributeList::~AttributeList() { for (size_t iii=0; iiim_listAttribute.size()) { - return NULL; + return nullptr; } return m_listAttribute[_id]; } const exml::Attribute* exml::AttributeList::getAttr(int32_t _id) const { if (_id <0 || (size_t)_id>m_listAttribute.size()) { - return NULL; + return nullptr; } return m_listAttribute[_id]; } +std::pair exml::AttributeList::getAttrPair(int32_t _id) const { + const exml::Attribute* att = getAttr(_id); + if (att == nullptr) { + return std::make_pair("",""); + } + return std::make_pair(att->getName(),att->getValue()); +} + + void exml::AttributeList::appendAttribute(exml::Attribute* _attr) { - if (_attr == NULL) { + if (_attr == nullptr) { EXML_ERROR("Try to set an empty node"); return; } diff --git a/exml/AttributeList.h b/exml/AttributeList.h index d8784ca..d0afd91 100644 --- a/exml/AttributeList.h +++ b/exml/AttributeList.h @@ -12,6 +12,7 @@ #include #include #include +#include namespace exml { class AttributeList : public exml::Node { @@ -54,6 +55,7 @@ namespace exml { */ Attribute* getAttr(int32_t _id); const Attribute* getAttr(int32_t _id) const; + std::pair getAttrPair(int32_t _id) const; /** * @brief get the attribute value with searching in the List with his name * @param[in] _name Attribute Name.