From 0e507add7e3b2a66bdd911c9622e3f1554f8429a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 18 Apr 2016 21:40:24 +0200 Subject: [PATCH] [DEV] add missing API in the attribute element --- exml/Attribute.cpp | 11 ++++++++++- exml/Attribute.h | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/exml/Attribute.cpp b/exml/Attribute.cpp index 6494f03..e113e4e 100644 --- a/exml/Attribute.cpp +++ b/exml/Attribute.cpp @@ -66,7 +66,16 @@ void exml::Attribute::clear() { static_cast(m_data.get())->clear(); } +std::pair exml::Attribute::getPair() const { + if (m_data == nullptr) { + EXML_ERROR(" can not setName (nullptr) ..."); + return std::pair("",""); + } + return std::pair(static_cast(m_data.get())->getName(), + static_cast(m_data.get())->getValue()); +} ememory::SharedPtr exml::Attribute::getInternalAttribute() { return std::static_pointer_cast(m_data); -} \ No newline at end of file +} + diff --git a/exml/Attribute.h b/exml/Attribute.h index bdbaba9..3d90f0e 100644 --- a/exml/Attribute.h +++ b/exml/Attribute.h @@ -57,6 +57,11 @@ namespace exml { * @return String of the attribute */ virtual const std::string& getName() const; + /** + * @brief get attribute name and value + * @return Name and value of the attribute + */ + std::pair getPair() const; public: void clear() override; friend class exml::AttributeListData;