[DEV] add missing API in the attribute element

This commit is contained in:
Edouard DUPIN 2016-04-18 21:40:24 +02:00
parent b626465cca
commit 0e507add7e
2 changed files with 15 additions and 1 deletions

View File

@ -66,7 +66,16 @@ void exml::Attribute::clear() {
static_cast<exml::internal::Attribute*>(m_data.get())->clear();
}
std::pair<std::string, std::string> exml::Attribute::getPair() const {
if (m_data == nullptr) {
EXML_ERROR(" can not setName (nullptr) ...");
return std::pair<std::string, std::string>("","");
}
return std::pair<std::string, std::string>(static_cast<exml::internal::Attribute*>(m_data.get())->getName(),
static_cast<exml::internal::Attribute*>(m_data.get())->getValue());
}
ememory::SharedPtr<exml::internal::Attribute> exml::Attribute::getInternalAttribute() {
return std::static_pointer_cast<exml::internal::Attribute>(m_data);
}
}

View File

@ -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<std::string, std::string> getPair() const;
public:
void clear() override;
friend class exml::AttributeListData;