diff --git a/lib/myxmlpp/.idea/misc.xml b/lib/myxmlpp/.idea/misc.xml
index 79b3c948..3c7e8c23 100644
--- a/lib/myxmlpp/.idea/misc.xml
+++ b/lib/myxmlpp/.idea/misc.xml
@@ -1,4 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/myxmlpp/include/Attribute.hpp b/lib/myxmlpp/include/Attribute.hpp
index 3dd9fd06..fecfe60b 100644
--- a/lib/myxmlpp/include/Attribute.hpp
+++ b/lib/myxmlpp/include/Attribute.hpp
@@ -42,7 +42,7 @@ namespace myxmlpp {
* @param key the key of the attribute
* @param value the value of the attribute
*/
- Attribute(const std::string& key, const std::string& value);
+ Attribute(std::string key, std::string value);
/**
* Construct and attribute by a string with a attrName="attrValue"
diff --git a/lib/myxmlpp/include/Doc.hpp b/lib/myxmlpp/include/Doc.hpp
index 80d72ee4..16bf6a93 100644
--- a/lib/myxmlpp/include/Doc.hpp
+++ b/lib/myxmlpp/include/Doc.hpp
@@ -46,7 +46,7 @@ namespace myxmlpp {
std::shared_ptr _root;
/**
- * Check commons file openning errors and throw the correct exception
+ * Check commons file opening errors and throw the correct exception
* @throws NoFileException if the required file does not exists
* @throws PermissionDeniedException if there is not enough permissions to work with the file
* @throws FileException Default exception for other errors
@@ -68,11 +68,11 @@ namespace myxmlpp {
* @param filepath path to the xml file
* @param keepOpen keep the file stream opened
* @throws NoFileException if the required file does not exists
- * @throws PermissionDeniedException if ther is not enough permissions to work with the file
+ * @throws PermissionDeniedException if there is not enough permissions to work with the file
* @throws FileException Default exception for other errors
* @throws ParsingException If the file is not correctly formatted
*/
- Doc(const std::string& filepath, bool keepOpen = false);
+ explicit Doc(const std::string& filepath, bool keepOpen = false);
/**
* @details This method will write all the doc structure to a file in a minified way (only necessary spaces)
diff --git a/lib/myxmlpp/include/Node.hpp b/lib/myxmlpp/include/Node.hpp
index 55034375..b3b505c4 100644
--- a/lib/myxmlpp/include/Node.hpp
+++ b/lib/myxmlpp/include/Node.hpp
@@ -53,7 +53,7 @@ namespace myxmlpp {
int depth) const;
static std::vector _split(const std::string &str,
- char delim);
+ char delimiter);
static std::shared_ptr
_searchChild(const Node *current,
@@ -99,7 +99,7 @@ namespace myxmlpp {
* @param indent the number of tab to return
* @return the indentation helper string
*/
- static std::string _strIdent(std::size_t indent);
+ static std::string _strIndent(std::size_t indent);
/**
* @details This method will return all the attributes serialized
@@ -123,7 +123,7 @@ namespace myxmlpp {
* @param tag the tag of the node.
* @return the created node.
*/
- Node(Node *parent) noexcept;
+ explicit Node(Node *parent) noexcept;
/**
* Method to create a node with its tag and its children.
@@ -257,7 +257,7 @@ namespace myxmlpp {
{
return _children.end();
}
-
+
/**
* Method to find a child node by its tag.
* This method will return the first matched node
diff --git a/lib/myxmlpp/include/exceptions/AttributeNotFoundException.hpp b/lib/myxmlpp/include/exceptions/AttributeNotFoundException.hpp
index 291858fe..f83c67f3 100644
--- a/lib/myxmlpp/include/exceptions/AttributeNotFoundException.hpp
+++ b/lib/myxmlpp/include/exceptions/AttributeNotFoundException.hpp
@@ -24,7 +24,7 @@ namespace myxmlpp {
std::string _key;
public:
- AttributeNotFoundException(const std::string& key,
+ AttributeNotFoundException(std::string key,
const std::string& file,
int line,
const std::string& description="") noexcept;
diff --git a/lib/myxmlpp/include/exceptions/Exception.hpp b/lib/myxmlpp/include/exceptions/Exception.hpp
index 837fc697..5e340b35 100644
--- a/lib/myxmlpp/include/exceptions/Exception.hpp
+++ b/lib/myxmlpp/include/exceptions/Exception.hpp
@@ -14,12 +14,12 @@
namespace myxmlpp {
/**
- * Base exception for the lib, only containing mandatory informations to debug
+ * Base exception for the lib, only containing mandatory information to debug
*/
class Exception: public std::exception {
protected:
/**
- * Short descripition of the error
+ * Short description of the error
*/
std::string _description;
@@ -32,7 +32,7 @@ namespace myxmlpp {
* Line at which the error was raised
*/
std::string _line;
-
+
/**
* Complete error message
*/
@@ -47,7 +47,7 @@ namespace myxmlpp {
* @return error message
*/
const char *what() const noexcept override;
-
+
void build() noexcept;
/**
diff --git a/lib/myxmlpp/include/exceptions/FileException.hpp b/lib/myxmlpp/include/exceptions/FileException.hpp
index 528e0ec6..e6cffcf7 100644
--- a/lib/myxmlpp/include/exceptions/FileException.hpp
+++ b/lib/myxmlpp/include/exceptions/FileException.hpp
@@ -26,7 +26,7 @@ namespace myxmlpp {
std::string _filepath;
public:
- FileException(const std::string& filepath,
+ FileException(std::string filepath,
const std::string& file,
int line,
const std::string& description="") noexcept;
diff --git a/lib/myxmlpp/include/exceptions/NodeNotFoundException.hpp b/lib/myxmlpp/include/exceptions/NodeNotFoundException.hpp
index 5685a535..75c80a64 100644
--- a/lib/myxmlpp/include/exceptions/NodeNotFoundException.hpp
+++ b/lib/myxmlpp/include/exceptions/NodeNotFoundException.hpp
@@ -23,7 +23,7 @@ namespace myxmlpp {
std::string _tag;
public:
- NodeNotFoundException(const std::string& tag,
+ NodeNotFoundException(std::string tag,
const std::string& file,
int line,
const std::string& description="") noexcept;
diff --git a/lib/myxmlpp/src/Attribute.cpp b/lib/myxmlpp/src/Attribute.cpp
index 648bdfc3..6f585850 100644
--- a/lib/myxmlpp/src/Attribute.cpp
+++ b/lib/myxmlpp/src/Attribute.cpp
@@ -7,6 +7,7 @@
#include
#include
+#include
#include "IllegalValueException.hpp"
#include "FileException.hpp"
#include "Attribute.hpp"
@@ -15,9 +16,9 @@
namespace myxmlpp {
- Attribute::Attribute(const std::string &key,
- const std::string &value)
- : _key(key), _value(value)
+ Attribute::Attribute(std::string key,
+ std::string value)
+ : _key(std::move(key)), _value(std::move(value))
{}
Attribute::Attribute(std::string &fileContent)
diff --git a/lib/myxmlpp/src/Node/Node_addChild.cpp b/lib/myxmlpp/src/Node/Node_addChild.cpp
index 36d87a96..96f6d947 100644
--- a/lib/myxmlpp/src/Node/Node_addChild.cpp
+++ b/lib/myxmlpp/src/Node/Node_addChild.cpp
@@ -5,8 +5,6 @@
** Node_addChild.cpp
*/
-#include
-
#include "Node.hpp"
void myxmlpp::Node::addChild(const std::shared_ptr& child) noexcept
diff --git a/lib/myxmlpp/src/Node/Node_children.cpp b/lib/myxmlpp/src/Node/Node_children.cpp
index e3660853..57b1c2e3 100644
--- a/lib/myxmlpp/src/Node/Node_children.cpp
+++ b/lib/myxmlpp/src/Node/Node_children.cpp
@@ -16,8 +16,8 @@ unsigned int myxmlpp::Node::getNbChildrenR() const noexcept
{
size_t total = _children.size();
- for (auto it = _children.begin(); it != _children.end(); ++it)
- total += (*it)->getNbChildrenR();
+ for (const auto & child : _children)
+ total += child->getNbChildrenR();
return total;
}
diff --git a/lib/myxmlpp/src/Node/Node_parseUtils.cpp b/lib/myxmlpp/src/Node/Node_parseUtils.cpp
index 4ad96ebc..001c3045 100644
--- a/lib/myxmlpp/src/Node/Node_parseUtils.cpp
+++ b/lib/myxmlpp/src/Node/Node_parseUtils.cpp
@@ -5,6 +5,7 @@
** Node_parseUtils.cpp
*/
+#include
#include
#include "Node.hpp"
#include "ParsingException.hpp"
@@ -12,7 +13,7 @@
bool myxmlpp::Node::_isEndOfNode(std::string &str)
{
std::string rgx("[\r\n\t\f\v ]*(?:(?:<[a-zA-Z0-9_\\-]*"
- "(?:[\r\n\t\f\v ].*\"[\r\n\t\f\v ]*?)*\/?>)|(?:<(\/).*>))");
+ "(?:[\r\n\t\f\v ].*\"[\r\n\t\f\v ]*?)*/?>)|(?:<(/).*>))");
std::smatch matches;
if (!_performRegex(matches, rgx, str, nullptr))
@@ -26,7 +27,7 @@ bool myxmlpp::Node::_isEndOfNode(std::string &str)
void myxmlpp::Node::_checkEndOfNode(std::string &str,
std::string &remaining) noexcept
{
- std::string rgx("[\r\n\t\f\v ]*<\/(.*)>");
+ std::string rgx("[\r\n\t\f\v ]*(.*)>");
std::smatch matches;
if (!_performRegex(matches, rgx, str, &remaining) || matches[1].str() != _tag)
@@ -45,7 +46,7 @@ bool myxmlpp::Node::_performRegex(std::smatch &matches, std::string ®exStr,
if (remaining) {
if (!std::regex_search(*remaining, remainingMatches, rgx))
throw myxmlpp::ParsingException(*remaining, MYXMLPP_ERROR_LOCATION,
- "Malformated file");
+ "Malformed file");
remaining->replace(remainingMatches.position(),
remainingMatches.length(),
"");
@@ -56,7 +57,7 @@ bool myxmlpp::Node::_performRegex(std::smatch &matches, std::string ®exStr,
void myxmlpp::Node::_parseNodeString(std::string &str, std::string &remaining)
{
std::string rgx("[\r\n\t\f\v ]*(<([a-zA-Z0-9_\\-]*)"
- "(?:[\r\n\t\f\v ](.*\")[\r\n\t\f\v ]*?)*(\/?)>)");
+ "(?:[\r\n\t\f\v ](.*\")[\r\n\t\f\v ]*?)*(/?)>)");
std::smatch matches;
if (!_performRegex(matches, rgx, str, &remaining))
@@ -82,7 +83,7 @@ void myxmlpp::Node::_extractAttributes(std::string &str) noexcept
while (std::regex_search(str, matches, rgx)) {
_attributes.push_back(
- std::unique_ptr(new Attribute(matches[1], matches[2]))
+ std::make_unique(matches[1], matches[2])
);
str = matches.suffix().str();
}
diff --git a/lib/myxmlpp/src/Node/Node_writeUtils.cpp b/lib/myxmlpp/src/Node/Node_writeUtils.cpp
index 15a72e79..0bc9ca81 100644
--- a/lib/myxmlpp/src/Node/Node_writeUtils.cpp
+++ b/lib/myxmlpp/src/Node/Node_writeUtils.cpp
@@ -7,8 +7,8 @@
#include
-std::string myxmlpp::Node::_strIdent(std::size_t indent) {
- std::string tab = "";
+std::string myxmlpp::Node::_strIndent(std::size_t indent) {
+ std::string tab;
for (std::size_t i = 0; i < indent; ++i)
tab += '\t';
@@ -63,7 +63,7 @@ std::string myxmlpp::Node::asString(bool includeChildren) const noexcept {
std::string
myxmlpp::Node::asFString(size_t indent, bool includeChildren) const noexcept {
- std::string str = includeChildren ? _strIdent(indent) + "<" : "<";
+ std::string str = includeChildren ? _strIndent(indent) + "<" : "<";
str += _tag;
str += _dumpAttrsF();
@@ -75,10 +75,10 @@ myxmlpp::Node::asFString(size_t indent, bool includeChildren) const noexcept {
str += ">\n";
for (auto &c : _children)
str += c->asFString(indent + 1);
- str += _strIdent(indent)
- + std::string("")
- + _tag
- + (_parent ? ">\n" : ">");
+ str += _strIndent(indent)
+ + std::string("")
+ + _tag
+ + (_parent ? ">\n" : ">");
} else
str += _parent ? "/>\n" : "/>";
return str;
diff --git a/lib/myxmlpp/src/Node/delete/pop/Node_popChildrenR.cpp b/lib/myxmlpp/src/Node/delete/pop/Node_popChildrenR.cpp
index ef628f3b..0a1d95c1 100644
--- a/lib/myxmlpp/src/Node/delete/pop/Node_popChildrenR.cpp
+++ b/lib/myxmlpp/src/Node/delete/pop/Node_popChildrenR.cpp
@@ -20,9 +20,8 @@ myxmlpp::Node::_popChildrenRecurs(std::vector> &children,
children.push_back(**it);
_children.erase(*it);
}
- for (auto it = _children.begin();
- it != _children.end(); ++it)
- (*it)->_popChildrenRecurs(children, tag, depth - 1);
+ for (auto & it : _children)
+ it->_popChildrenRecurs(children, tag, depth - 1);
}
std::vector>
diff --git a/lib/myxmlpp/src/Node/find/Node_findChildByPath.cpp b/lib/myxmlpp/src/Node/find/Node_findChildByPath.cpp
index de9ae3f8..78e9d24f 100644
--- a/lib/myxmlpp/src/Node/find/Node_findChildByPath.cpp
+++ b/lib/myxmlpp/src/Node/find/Node_findChildByPath.cpp
@@ -9,13 +9,13 @@
#include "Node.hpp"
std::vector myxmlpp::Node::_split(const std::string &str,
- char delim)
+ char delimiter)
{
std::vector result;
std::stringstream ss (str);
std::string item;
- while (getline(ss, item, delim)) {
+ while (getline(ss, item, delimiter)) {
result.push_back (item);
}
diff --git a/lib/myxmlpp/src/exceptions/AttributeNotFoundException.cpp b/lib/myxmlpp/src/exceptions/AttributeNotFoundException.cpp
index 499c6dbd..49d3c999 100644
--- a/lib/myxmlpp/src/exceptions/AttributeNotFoundException.cpp
+++ b/lib/myxmlpp/src/exceptions/AttributeNotFoundException.cpp
@@ -8,12 +8,14 @@
#include "AttributeNotFoundException.hpp"
+#include
+
myxmlpp::AttributeNotFoundException::AttributeNotFoundException(
- const std::string& key,
+ std::string key,
const std::string& file,
int line,
const std::string& description) noexcept
- : _key(key), Exception(file, line, description)
+ : _key(std::move(key)), Exception(file, line, description)
{
build();
}
diff --git a/lib/myxmlpp/src/exceptions/Exception.cpp b/lib/myxmlpp/src/exceptions/Exception.cpp
index cfb11a8f..b68f632b 100644
--- a/lib/myxmlpp/src/exceptions/Exception.cpp
+++ b/lib/myxmlpp/src/exceptions/Exception.cpp
@@ -33,11 +33,11 @@ std::string myxmlpp::Exception::baseWhat() const noexcept{
std::string myxmlpp::Exception::details() const noexcept {
if (!_description.empty())
- return std::string("\nOptionnal details : ")
+ return std::string("\nOptional details : ")
+ _description
+ std::string("\n");
else
- return std::string("\n");
+ return "\n";
}
const std::string &myxmlpp::Exception::getFile() const noexcept {
diff --git a/lib/myxmlpp/src/exceptions/FileException.cpp b/lib/myxmlpp/src/exceptions/FileException.cpp
index 69facb8a..42a02d6d 100644
--- a/lib/myxmlpp/src/exceptions/FileException.cpp
+++ b/lib/myxmlpp/src/exceptions/FileException.cpp
@@ -7,11 +7,13 @@
#include "FileException.hpp"
-myxmlpp::FileException::FileException(const std::string &filepath,
+#include
+
+myxmlpp::FileException::FileException(std::string filepath,
const std::string &file,
int line,
const std::string &description) noexcept
- : _filepath(filepath), Exception(file, line, description)
+ : _filepath(std::move(filepath)), Exception(file, line, description)
{
build();
}
diff --git a/lib/myxmlpp/src/exceptions/NodeNotFoundException.cpp b/lib/myxmlpp/src/exceptions/NodeNotFoundException.cpp
index 59c6fdca..09eb807d 100644
--- a/lib/myxmlpp/src/exceptions/NodeNotFoundException.cpp
+++ b/lib/myxmlpp/src/exceptions/NodeNotFoundException.cpp
@@ -8,11 +8,13 @@
#include "NodeNotFoundException.hpp"
-myxmlpp::NodeNotFoundException::NodeNotFoundException(const std::string& tag,
+#include
+
+myxmlpp::NodeNotFoundException::NodeNotFoundException(std::string tag,
const std::string& file,
int line,
const std::string& description) noexcept
- : _tag(tag), Exception(file, line, description)
+ : _tag(std::move(tag)), Exception(file, line, description)
{
build();
}
diff --git a/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueBool.cpp b/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueBool.cpp
index 0ae7290d..43f3b484 100644
--- a/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueBool.cpp
+++ b/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueBool.cpp
@@ -68,11 +68,11 @@ Test(Attribute_getValueBool, illegal)
std::string k = "key";
std::string v = "1kappa";
myxmlpp::Attribute a(k, v);
-
+
try {
- bool i = a.getValueBool();
+ (void)a.getValueBool();
cr_expect(0);
- } catch (const myxmlpp::IllegalValueException) {
+ } catch (const myxmlpp::IllegalValueException &e) {
cr_expect(1);
}
}
@@ -84,9 +84,9 @@ Test(Attribute_getValueBool, illegal_overriden)
myxmlpp::Attribute a(k, v);
try {
- bool i = a.getValueBool("TRUE");
+ (void)a.getValueBool("TRUE");
cr_expect(0);
- } catch (const myxmlpp::IllegalValueException) {
+ } catch (const myxmlpp::IllegalValueException &e) {
cr_expect(1);
}
}
\ No newline at end of file
diff --git a/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueFloat.cpp b/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueFloat.cpp
index 70ed89bf..6bb9a9a8 100644
--- a/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueFloat.cpp
+++ b/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueFloat.cpp
@@ -44,9 +44,9 @@ Test(Attribute_getValueFloat, illegal)
std::string k = "key";
std::string v = "1kappa";
myxmlpp::Attribute a(k, v);
-
+
try {
- float i = a.getValueFloat();
+ (void)a.getValueFloat();
cr_expect(0);
} catch (const myxmlpp::IllegalValueException) {
cr_expect(1);
diff --git a/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueInt.cpp b/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueInt.cpp
index 5915f736..d3bbed67 100644
--- a/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueInt.cpp
+++ b/lib/myxmlpp/tests/unit-testing/Attribute/Attribute_getValueInt.cpp
@@ -44,9 +44,9 @@ Test(Attribute_getValueInt, illegal)
std::string k = "key";
std::string v = "1kappa";
myxmlpp::Attribute a(k, v);
-
+
try {
- int i = a.getValueInt();
+ (void)a.getValueInt();
cr_expect(0);
} catch (const myxmlpp::IllegalValueException) {
cr_expect(1);