[DEV] change 'enum' in 'enum class'

This commit is contained in:
Edouard DUPIN 2016-04-18 21:46:42 +02:00
parent ee2583c175
commit b626465cca
17 changed files with 52 additions and 52 deletions

View File

@ -73,7 +73,7 @@ size_t exml::ElementData::size() const {
enum exml::nodeType exml::ElementData::getType(int32_t _id) const {
if (m_data->m_data == nullptr) {
EXML_ERROR(" can not get type ...");
return exml::nodeType_unknow;
return exml::nodeType::unknow;
}
return static_cast<exml::internal::Element*>(m_data->m_data.get())->getType(_id);
}

View File

@ -71,7 +71,7 @@ const std::string& exml::Node::getValue() const {
enum exml::nodeType exml::Node::getType() const {
if (m_data == nullptr) {
EXML_ERROR(" can not get type ...");
return exml::nodeType_unknow;
return exml::nodeType::unknow;
}
return m_data->getType();
}

View File

@ -50,7 +50,7 @@ namespace exml {
};
public:
enum nodeType getType() const override {
return exml::nodeType_attribute;
return exml::nodeType::attribute;
};
bool iParse(const std::string& _data, int32_t& _pos, bool _caseSensitive, exml::FilePos& _filePos, exml::internal::Document& _doc) override;
bool iGenerate(std::string& _data, int32_t _indent) const override;

View File

@ -33,7 +33,7 @@ namespace exml {
}
public:
enum nodeType getType() const override {
return nodeType_comment;
return nodeType::comment;
}
bool iParse(const std::string& _data, int32_t& _pos, bool _caseSensitive, exml::FilePos& _filePos, exml::internal::Document& _doc) override;
bool iGenerate(std::string& _data, int32_t _indent) const override;

View File

@ -33,7 +33,7 @@ namespace exml {
static ememory::SharedPtr<Declaration> create(const std::string& _name="");
public:
enum nodeType getType() const override{
return nodeType_declaration;
return nodeType::declaration;
};
bool iGenerate(std::string& _data, int32_t _indent) const override;
bool iParse(const std::string& _data, int32_t& _pos, bool _caseSensitive, exml::FilePos& _filePos, exml::internal::Document& _doc) override;

View File

@ -109,7 +109,7 @@ namespace exml {
void displayError();
public:
enum nodeType getType() const override {
return nodeType_document;
return nodeType::document;
}
bool iGenerate(std::string& _data, int32_t _indent) const override;
ememory::SharedPtr<exml::internal::Document> toDocument() override {

View File

@ -31,7 +31,7 @@ ememory::SharedPtr<exml::internal::Element> exml::internal::Element::create(cons
enum exml::nodeType exml::internal::Element::getType(int32_t _id) const {
ememory::SharedPtr<const exml::internal::Node> tmpp = getNode(_id);
if (tmpp == nullptr) {
return exml::nodeType_unknow;
return exml::nodeType::unknow;
}
return tmpp->getType();
}
@ -75,7 +75,7 @@ ememory::SharedPtr<exml::internal::Element> exml::internal::Element::getNamed(co
}
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if( m_listSub[iii] != nullptr
&& m_listSub[iii]->getType() == exml::nodeType_element
&& m_listSub[iii]->getType() == exml::nodeType::element
&& m_listSub[iii]->getValue() == _name) {
if (m_listSub[iii] == nullptr) {
return nullptr;
@ -92,7 +92,7 @@ ememory::SharedPtr<const exml::internal::Element> exml::internal::Element::getNa
}
for (size_t iii=0; iii<m_listSub.size(); iii++) {
if( m_listSub[iii] != nullptr
&& m_listSub[iii]->getType() == exml::nodeType_element
&& m_listSub[iii]->getType() == exml::nodeType::element
&& m_listSub[iii]->getValue() == _name) {
if (m_listSub[iii] == nullptr) {
return nullptr;
@ -108,7 +108,7 @@ void exml::internal::Element::append(const ememory::SharedPtr<exml::internal::No
EXML_ERROR("Try to set an empty node");
return;
}
if (_node->getType() == exml::nodeType_attribute) {
if (_node->getType() == exml::nodeType::attribute) {
appendAttribute(_node->toAttribute());
return;
}
@ -140,7 +140,7 @@ void exml::internal::Element::remove(const std::string& _nodeName) {
std::string exml::internal::Element::getText() const {
std::string res;
if (m_listSub.size() == 1) {
if (m_listSub[0]->getType() == nodeType_text) {
if (m_listSub[0]->getType() == nodeType::text) {
res = m_listSub[0]->getValue();
} else {
m_listSub[0]->iGenerate(res, 0);
@ -164,7 +164,7 @@ bool exml::internal::Element::iGenerate(std::string& _data, int32_t _indent) con
if (m_listSub.size()>0) {
if( m_listSub.size() == 1
&& m_listSub[0] != nullptr
&& m_listSub[0]->getType() == exml::nodeType_text
&& m_listSub[0]->getType() == exml::nodeType::text
&& std::dynamic_pointer_cast<exml::internal::Text>(m_listSub[0])->countLines() == 1) {
_data += ">";
m_listSub[0]->iGenerate(_data,0);

View File

@ -124,7 +124,7 @@ namespace exml {
bool _mainNode=false);
public:
enum nodeType getType() const override {
return nodeType_element;
return nodeType::element;
}
bool iParse(const std::string& _data, int32_t& _pos, bool _caseSensitive, exml::FilePos& _filePos, exml::internal::Document& _doc) override;
bool iGenerate(std::string& _data, int32_t _indent) const override;

View File

@ -126,7 +126,7 @@ const std::string& exml::internal::Node::getValue() const {
}
enum exml::nodeType exml::internal::Node::getType() const {
return nodeType_node;
return nodeType::node;
}
ememory::SharedPtr<exml::internal::Document> exml::internal::Node::toDocument() {
@ -178,26 +178,26 @@ ememory::SharedPtr<const exml::internal::Text> exml::internal::Node::toText() co
}
bool exml::internal::Node::isDocument() const {
return getType() == exml::nodeType_document;
return getType() == exml::nodeType::document;
}
bool exml::internal::Node::isAttribute() const {
return getType() == exml::nodeType_attribute;
return getType() == exml::nodeType::attribute;
}
bool exml::internal::Node::isComment() const {
return getType() == exml::nodeType_comment;
return getType() == exml::nodeType::comment;
}
bool exml::internal::Node::isDeclaration() const {
return getType() == exml::nodeType_declaration;
return getType() == exml::nodeType::declaration;
}
bool exml::internal::Node::isElement() const {
return getType() == exml::nodeType_element;
return getType() == exml::nodeType::element;
}
bool exml::internal::Node::isText() const {
return getType() == exml::nodeType_text;
return getType() == exml::nodeType::text;
}

View File

@ -40,7 +40,7 @@ namespace exml {
int32_t countLines() const;
public:
enum nodeType getType() const override{
return nodeType_text;
return nodeType::text;
};
bool iParse(const std::string& _data,
int32_t& _pos,

View File

@ -13,29 +13,29 @@
std::ostream& exml::operator <<(std::ostream& _os, enum exml::nodeType _obj) {
switch (_obj) {
case nodeType_unknow:
_os << "exml::nodeType_unknow";
case nodeType::unknow:
_os << "exml::nodeType::unknow";
break;
case nodeType_node:
_os << "exml::nodeType_node";
case nodeType::node:
_os << "exml::nodeType::node";
break;
case nodeType_document:
_os << "exml::nodeType_document";
case nodeType::document:
_os << "exml::nodeType::document";
break;
case nodeType_declaration:
_os << "exml::nodeType_declaration";
case nodeType::declaration:
_os << "exml::nodeType::declaration";
break;
case nodeType_attribute:
_os << "exml::nodeType_attribute";
case nodeType::attribute:
_os << "exml::nodeType::attribute";
break;
case nodeType_element:
_os << "exml::nodeType_element";
case nodeType::element:
_os << "exml::nodeType::element";
break;
case nodeType_comment:
_os << "exml::nodeType_comment";
case nodeType::comment:
_os << "exml::nodeType::comment";
break;
case nodeType_text:
_os << "exml::nodeType_text";
case nodeType::text:
_os << "exml::nodeType::text";
break;
}
return _os;

View File

@ -16,15 +16,15 @@ namespace exml {
/**
* @brief Type of the XML elements.
*/
enum nodeType {
nodeType_unknow, //!< might be an error ...
nodeType_node, //!< might be an error ...
nodeType_document, //!< all the file main access
nodeType_declaration, //!< &lt;?xml ... ?&gt;
nodeType_attribute, //!< the &lt;Element ATTRIBUTE="ATTRIBUTE_VALUE" /&gt;
nodeType_element, //!< the &lt;XXX&gt; ... &lt;/XXX&gt;
nodeType_comment, //!< comment node : &lt;!-- --&gt;
nodeType_text, //!< &lt;XXX&gt; InsideText &lt;/XXX&gt;
enum class nodeType {
unknow, //!< might be an error ...
node, //!< might be an error ...
document, //!< all the file main access
declaration, //!< &lt;?xml ... ?&gt;
attribute, //!< the &lt;Element ATTRIBUTE="ATTRIBUTE_VALUE" /&gt;
element, //!< the &lt;XXX&gt; ... &lt;/XXX&gt;
comment, //!< comment node : &lt;!-- --&gt;
text, //!< &lt;XXX&gt; InsideText &lt;/XXX&gt;
};
//! @not_in_doc
std::ostream& operator <<(std::ostream& _os, enum nodeType _obj);

View File

@ -13,7 +13,7 @@
TEST(TestAttribute, create) {
exml::Attribute myAttribute("nameAttribute", "valueAttribute");
EXPECT_EQ(myAttribute.getType(), exml::nodeType_attribute);
EXPECT_EQ(myAttribute.getType(), exml::nodeType::attribute);
}
TEST(TestAttribute, createCopy) {

View File

@ -12,7 +12,7 @@
TEST(TestComment, create) {
exml::Comment myComment("my Comment");
EXPECT_EQ(myComment.getType(), exml::nodeType_comment);
EXPECT_EQ(myComment.getType(), exml::nodeType::comment);
}
TEST(TestComment, createCopy) {

View File

@ -12,7 +12,7 @@
TEST(TestDeclaration, create) {
exml::Declaration myDeclaration("type");
EXPECT_EQ(myDeclaration.getType(), exml::nodeType_declaration);
EXPECT_EQ(myDeclaration.getType(), exml::nodeType::declaration);
}
TEST(TestDeclaration, createCopy) {

View File

@ -12,7 +12,7 @@
TEST(TestDeclarationXML, create) {
exml::DeclarationXML myDeclarationXML("1.0", "UTF-8", true);
EXPECT_EQ(myDeclarationXML.getType(), exml::nodeType_declaration);
EXPECT_EQ(myDeclarationXML.getType(), exml::nodeType::declaration);
}
TEST(TestDeclarationXML, createCopy) {

View File

@ -14,7 +14,7 @@
TEST(TestElement, create) {
exml::Element myElement("NodeName");
EXPECT_EQ(myElement.getType(), exml::nodeType_element);
EXPECT_EQ(myElement.getType(), exml::nodeType::element);
}
TEST(TestElement, createCopy) {
@ -55,7 +55,7 @@ TEST(TestElement, getText2 ) {
TEST(TestElement, getTypeId ) {
exml::Element myElement("NodeName");
EXPECT_EQ(myElement.nodes.getType(1), exml::nodeType_unknow);
EXPECT_EQ(myElement.nodes.getType(1), exml::nodeType::unknow);
}
TEST(TestElement, getNamed ) {