Kaynağa Gözat

Remove StlUtils class

Patrick-Christopher Mattulat 1 yıl önce
ebeveyn
işleme
ebfe6e262f

+ 0 - 1
CMakeLists.txt

@@ -231,7 +231,6 @@ if (${LS_STD_BUILD_WITH_TESTS})
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IllegalArithmeticOperationExceptionTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/IncompleteJsonExceptionTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/exception/NullPointerExceptionTest.cpp
-            ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/utils/StlUtilsTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/ClassTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/LibraryVersionTest.cpp
             ${CMAKE_CURRENT_SOURCE_DIR}/test/cases/core/VersionTest.cpp

+ 0 - 56
include/ls-std/core/utils/StlUtils.hpp

@@ -1,56 +0,0 @@
-/*
- * Author:          Patrick-Christopher Mattulat
- * Company:         Lynar Studios
- * E-Mail:          webmaster@lynarstudios.com
- * Created:         2020-08-17
- * Changed:         2023-02-04
- *
- * */
-
-#ifndef LS_STD_STL_UTILS_HPP
-#define LS_STD_STL_UTILS_HPP
-
-#include <algorithm>
-#include <list>
-
-namespace ls::std::core
-{
-  class StlUtils // TODO: remove this class entirely
-  {
-    public:
-
-      StlUtils() = default;
-      ~StlUtils() = default;
-
-      template<class container, class dataType>
-      static bool contains(container _container, const dataType &_value)
-      {
-        return ::std::find(_container.begin(), _container.end(), _value) != _container.end();
-      }
-
-      template<class dataType>
-      static dataType getListElementAt(const ::std::list<dataType> &_list, size_t _index)
-      {
-        dataType value{};
-        size_t counter{};
-
-        if (_index < _list.size())
-        {
-          for (const auto &_value: _list)
-          {
-            if (counter == _index)
-            {
-              value = _value;
-              break;
-            }
-
-            counter++;
-          }
-        }
-
-        return value;
-      }
-  };
-}
-
-#endif

+ 3 - 1
include/ls-std/event/Narrator.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-11-14
- * Changed:         2023-02-04
+ * Changed:         2023-02-06
  *
  * */
 
@@ -34,6 +34,8 @@ namespace ls::std::event
     private:
 
       ::std::list<::std::shared_ptr<ls::std::core::interface_type::IListener>> listeners{};
+
+      bool _hasListener(const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener);
   };
 }
 

+ 0 - 1
include/ls-std/ls-std-core.hpp

@@ -32,7 +32,6 @@
 #include <ls-std/core/types/KvTypes.hpp>
 #include <ls-std/core/types/Types.hpp>
 
-#include <ls-std/core/utils/StlUtils.hpp>
 #if _WIN32
   #include <ls-std/core/utils/WindowsUtils.hpp>
 #endif

+ 9 - 4
source/ls-std/event/Narrator.cpp

@@ -3,12 +3,12 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-11-14
- * Changed:         2023-02-04
+ * Changed:         2023-02-06
  *
  * */
 
+#include <algorithm>
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
-#include <ls-std/core/utils/StlUtils.hpp>
 #include <ls-std/event/Narrator.hpp>
 
 ls::std::event::Narrator::Narrator() : ls::std::core::Class("Narrator")
@@ -26,7 +26,7 @@ bool ls::std::event::Narrator::addListener(const ::std::shared_ptr<ls::std::core
   }
   else
   {
-    if (!ls::std::core::StlUtils::contains(this->listeners, _listener))
+    if (!this->_hasListener(_listener))
     {
       this->listeners.push_back(_listener);
       wasAdded = true;
@@ -56,7 +56,7 @@ bool ls::std::event::Narrator::removeListener(const ::std::shared_ptr<ls::std::c
   }
   else
   {
-    if (ls::std::core::StlUtils::contains(this->listeners, _listener))
+    if (this->_hasListener(_listener))
     {
       this->listeners.remove(_listener);
       wasRemoved = true;
@@ -73,3 +73,8 @@ void ls::std::event::Narrator::tell(const ls::std::core::Class &_info)
     listener->listen(_info);
   }
 }
+
+bool ls::std::event::Narrator::_hasListener(const ::std::shared_ptr<ls::std::core::interface_type::IListener> &_listener)
+{
+  return ::std::find(this->listeners.begin(), this->listeners.end(), _listener) != this->listeners.end();
+}

+ 3 - 3
source/ls-std/io/xml/XmlNode.cpp

@@ -3,12 +3,12 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-24
- * Changed:         2023-02-04
+ * Changed:         2023-02-06
  *
  * */
 
+#include <algorithm>
 #include <ls-std/core/exception/IllegalArgumentException.hpp>
-#include <ls-std/core/utils/StlUtils.hpp>
 #include <ls-std/io/xml/XmlNode.hpp>
 
 ls::std::io::XmlNode::XmlNode(::std::string _name) : ls::std::core::Class("XmlNode"), name(::std::move(_name))
@@ -390,7 +390,7 @@ bool ls::std::io::XmlNode::_hasAttribute(const ::std::string &_name)
 bool ls::std::io::XmlNode::_hasChild(const ::std::shared_ptr<ls::std::io::XmlNode> &_child)
 {
   _checkIfNodeReferenceIsValid(_child);
-  return ls::std::core::StlUtils::contains(this->children, _child);
+  return ::std::find(this->children.begin(), this->children.end(), _child) != this->children.end();
 }
 
 bool ls::std::io::XmlNode::_hasChild(const ::std::string &_name)

+ 0 - 85
test/cases/core/utils/StlUtilsTest.cpp

@@ -1,85 +0,0 @@
-/*
- * Author:          Patrick-Christopher Mattulat
- * Company:         Lynar Studios
- * E-Mail:          webmaster@lynarstudios.com
- * Created:         2020-08-17
- * Changed:         2023-02-03
- *
- * */
-
-#include <gtest/gtest.h>
-#include <list>
-#include <ls-std/ls-std-core.hpp>
-#include <string>
-#include <vector>
-
-using namespace ls::std::core;
-using namespace ::std;
-
-namespace
-{
-  class StlUtilsTest : public ::testing::Test
-  {
-    protected:
-
-      StlUtilsTest() = default;
-      ~StlUtilsTest() override = default;
-
-      void SetUp() override
-      {}
-
-      void TearDown() override
-      {}
-  };
-
-  TEST_F(StlUtilsTest, contains)
-  {
-    vector<int> values{1, 13, 7, 8};
-    list<string> names{"Tim", "Alex", "Nadine"};
-
-    ASSERT_TRUE((StlUtils::contains(values, 1)));
-    ASSERT_TRUE((StlUtils::contains(values, 13)));
-    ASSERT_TRUE((StlUtils::contains(values, 7)));
-    ASSERT_TRUE((StlUtils::contains(values, 8)));
-
-    ASSERT_TRUE((StlUtils::contains(names, "Tim")));
-    ASSERT_TRUE((StlUtils::contains(names, "Alex")));
-    ASSERT_TRUE((StlUtils::contains(names, "Nadine")));
-  }
-
-  TEST_F(StlUtilsTest, containsNegative)
-  {
-    vector<int> values{1, 13, 7, 8};
-    list<string> names{"Tim", "Alex", "Nadine"};
-
-    ASSERT_FALSE((StlUtils::contains(values, 55)));
-    ASSERT_FALSE((StlUtils::contains(values, 9)));
-
-    ASSERT_FALSE((StlUtils::contains(names, "Lena")));
-    ASSERT_FALSE((StlUtils::contains(names, "Mirco")));
-  }
-
-  TEST_F(StlUtilsTest, getListElementAt)
-  {
-    list<int> values{1, 13, 7, 8};
-    list<string> names{"Tim", "Alex", "Nadine"};
-
-    ASSERT_EQ(1, (StlUtils::getListElementAt(values, 0)));
-    ASSERT_EQ(13, (StlUtils::getListElementAt(values, 1)));
-    ASSERT_EQ(7, (StlUtils::getListElementAt(values, 2)));
-    ASSERT_EQ(8, (StlUtils::getListElementAt(values, 3)));
-
-    ASSERT_STREQ("Tim", StlUtils::getListElementAt(names, 0).c_str());
-    ASSERT_STREQ("Alex", StlUtils::getListElementAt(names, 1).c_str());
-    ASSERT_STREQ("Nadine", StlUtils::getListElementAt(names, 2).c_str());
-  }
-
-  TEST_F(StlUtilsTest, getListElementAtNegative)
-  {
-    list<int> values{1, 13, 7, 8};
-    list<string> names{"Tim", "Alex", "Nadine"};
-
-    ASSERT_EQ(0, (StlUtils::getListElementAt(values, 15)));
-    ASSERT_STREQ("", StlUtils::getListElementAt(names, 15).c_str());
-  }
-}

+ 16 - 11
test/cases/io/FileTest.cpp

@@ -33,6 +33,11 @@ namespace
 
       void TearDown() override
       {}
+
+      static bool hasFileInDirectory(const list<string> &_fileNamesInDirectory, const string &_fileName)
+      {
+        return find(_fileNamesInDirectory.begin(), _fileNamesInDirectory.end(), _fileName) != _fileNamesInDirectory.end();
+      }
   };
 
   // comparison operators
@@ -259,19 +264,19 @@ namespace
     ASSERT_EQ(7, filesInDirectory.size());
 
     expectedFile = file.getAbsoluteFilePath() + separator + ".";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + "..";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + "another-file.txt";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + "bla.txt";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + "hello.txt";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + "list-test-sub";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + ".hidden-file.txt";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
   }
 
   TEST_F(FileTest, listFiles)
@@ -285,13 +290,13 @@ namespace
     ASSERT_EQ(4, filesInDirectory.size());
 
     expectedFile = file.getAbsoluteFilePath() + separator + "another-file.txt";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + "bla.txt";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + "hello.txt";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
     expectedFile = file.getAbsoluteFilePath() + separator + ".hidden-file.txt";
-    ASSERT_TRUE((StlUtils::contains(filesInDirectory, expectedFile)));
+    ASSERT_TRUE(FileTest::hasFileInDirectory(filesInDirectory, expectedFile));
   }
 
   TEST_F(FileTest, makeDirectory)

+ 158 - 114
test/cases/io/xml/XmlParserTest.cpp

@@ -27,6 +27,50 @@ namespace
       XmlParserTest() = default;
       ~XmlParserTest() override = default;
 
+      static shared_ptr<XmlAttribute> getAttributeAtPosition(const list<shared_ptr<XmlAttribute>> &_attributes, size_t _index)
+      {
+        shared_ptr<XmlAttribute> attribute{};
+        size_t counter{};
+
+        if (_index < _attributes.size())
+        {
+          for (const auto &_value: _attributes)
+          {
+            if (counter == _index)
+            {
+              attribute = _value;
+              break;
+            }
+
+            counter++;
+          }
+        }
+
+        return attribute;
+      }
+
+      static shared_ptr<XmlNode> getChildAtPosition(const list<shared_ptr<XmlNode>> &_children, size_t _index)
+      {
+        shared_ptr<XmlNode> node{};
+        size_t counter{};
+
+        if (_index < _children.size())
+        {
+          for (const auto &_value: _children)
+          {
+            if (counter == _index)
+            {
+              node = _value;
+              break;
+            }
+
+            counter++;
+          }
+        }
+
+        return node;
+      }
+
       static byte_field readXmlStateMachine()
       {
         string xmlPath = TestHelper::getResourcesFolderLocation() + "state-machine-test.xml";
@@ -88,144 +132,144 @@ namespace
 
     children = root->getChildren();
     ASSERT_EQ(3, children.size());
-    ASSERT_STREQ("states", StlUtils::getListElementAt(children, 0)->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(children, 0)->getAttributes().empty());
-    ASSERT_STREQ("currentState", StlUtils::getListElementAt(children, 1)->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(children, 1)->getAttributes().empty());
-    ASSERT_STREQ("memory", StlUtils::getListElementAt(children, 2)->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(children, 2)->getAttributes().empty());
+    ASSERT_STREQ("states", XmlParserTest::getChildAtPosition(children, 0)->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(children, 0)->getAttributes().empty());
+    ASSERT_STREQ("currentState", XmlParserTest::getChildAtPosition(children, 1)->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(children, 1)->getAttributes().empty());
+    ASSERT_STREQ("memory", XmlParserTest::getChildAtPosition(children, 2)->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(children, 2)->getAttributes().empty());
 
     // states
 
-    statesChildren = StlUtils::getListElementAt(children, 0)->getChildren();
+    statesChildren = XmlParserTest::getChildAtPosition(children, 0)->getChildren();
     ASSERT_EQ(5, statesChildren.size());
 
-    ASSERT_STREQ("state", StlUtils::getListElementAt(statesChildren, 0)->getName().c_str());
-    ASSERT_EQ(1, StlUtils::getListElementAt(statesChildren, 0)->getAttributes().size());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(statesChildren, 0)->getAttributes().front()->getName().c_str());
-    ASSERT_STREQ("A", StlUtils::getListElementAt(statesChildren, 0)->getAttributes().front()->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 0)->getValue().empty());
-    ASSERT_EQ(1, StlUtils::getListElementAt(statesChildren, 0)->getChildren().size());
-    ASSERT_STREQ("connections", StlUtils::getListElementAt(statesChildren, 0)->getChildren().front()->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 0)->getChildren().front()->getValue().empty());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 0)->getChildren().front()->getAttributes().empty());
-    connectionChildren = StlUtils::getListElementAt(statesChildren, 0)->getChildren().front()->getChildren();
+    ASSERT_STREQ("state", XmlParserTest::getChildAtPosition(statesChildren, 0)->getName().c_str());
+    ASSERT_EQ(1, XmlParserTest::getChildAtPosition(statesChildren, 0)->getAttributes().size());
+    ASSERT_STREQ("id", XmlParserTest::getChildAtPosition(statesChildren, 0)->getAttributes().front()->getName().c_str());
+    ASSERT_STREQ("A", XmlParserTest::getChildAtPosition(statesChildren, 0)->getAttributes().front()->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 0)->getValue().empty());
+    ASSERT_EQ(1, XmlParserTest::getChildAtPosition(statesChildren, 0)->getChildren().size());
+    ASSERT_STREQ("connections", XmlParserTest::getChildAtPosition(statesChildren, 0)->getChildren().front()->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 0)->getChildren().front()->getValue().empty());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 0)->getChildren().front()->getAttributes().empty());
+    connectionChildren = XmlParserTest::getChildAtPosition(statesChildren, 0)->getChildren().front()->getChildren();
     ASSERT_EQ(1, connectionChildren.size());
-    ASSERT_STREQ("connection", StlUtils::getListElementAt(connectionChildren, 0)->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(connectionChildren, 0)->getValue().empty());
-    attributes = StlUtils::getListElementAt(connectionChildren, 0)->getAttributes();
+    ASSERT_STREQ("connection", XmlParserTest::getChildAtPosition(connectionChildren, 0)->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(connectionChildren, 0)->getValue().empty());
+    attributes = XmlParserTest::getChildAtPosition(connectionChildren, 0)->getAttributes();
     ASSERT_EQ(3, attributes.size());
-    ASSERT_STREQ("connectionId", StlUtils::getListElementAt(attributes, 0)->getName().c_str());
-    ASSERT_STREQ("AB", StlUtils::getListElementAt(attributes, 0)->getValue().c_str());
-    ASSERT_STREQ("condition", StlUtils::getListElementAt(attributes, 1)->getName().c_str());
-    ASSERT_STREQ("false", StlUtils::getListElementAt(attributes, 1)->getValue().c_str());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(attributes, 2)->getName().c_str());
-    ASSERT_STREQ("B", StlUtils::getListElementAt(attributes, 2)->getValue().c_str());
-
-    ASSERT_STREQ("state", StlUtils::getListElementAt(statesChildren, 1)->getName().c_str());
-    ASSERT_EQ(1, StlUtils::getListElementAt(statesChildren, 1)->getAttributes().size());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(statesChildren, 1)->getAttributes().front()->getName().c_str());
-    ASSERT_STREQ("B", StlUtils::getListElementAt(statesChildren, 1)->getAttributes().front()->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 1)->getValue().empty());
-    ASSERT_EQ(1, StlUtils::getListElementAt(statesChildren, 1)->getChildren().size());
-    ASSERT_STREQ("connections", StlUtils::getListElementAt(statesChildren, 1)->getChildren().front()->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 1)->getChildren().front()->getValue().empty());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 1)->getChildren().front()->getAttributes().empty());
-    connectionChildren = StlUtils::getListElementAt(statesChildren, 1)->getChildren().front()->getChildren();
+    ASSERT_STREQ("connectionId", XmlParserTest::getAttributeAtPosition(attributes, 0)->getName().c_str());
+    ASSERT_STREQ("AB", XmlParserTest::getAttributeAtPosition(attributes, 0)->getValue().c_str());
+    ASSERT_STREQ("condition", XmlParserTest::getAttributeAtPosition(attributes, 1)->getName().c_str());
+    ASSERT_STREQ("false", XmlParserTest::getAttributeAtPosition(attributes, 1)->getValue().c_str());
+    ASSERT_STREQ("id", XmlParserTest::getAttributeAtPosition(attributes, 2)->getName().c_str());
+    ASSERT_STREQ("B", XmlParserTest::getAttributeAtPosition(attributes, 2)->getValue().c_str());
+
+    ASSERT_STREQ("state", XmlParserTest::getChildAtPosition(statesChildren, 1)->getName().c_str());
+    ASSERT_EQ(1, XmlParserTest::getChildAtPosition(statesChildren, 1)->getAttributes().size());
+    ASSERT_STREQ("id", XmlParserTest::getChildAtPosition(statesChildren, 1)->getAttributes().front()->getName().c_str());
+    ASSERT_STREQ("B", XmlParserTest::getChildAtPosition(statesChildren, 1)->getAttributes().front()->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 1)->getValue().empty());
+    ASSERT_EQ(1, XmlParserTest::getChildAtPosition(statesChildren, 1)->getChildren().size());
+    ASSERT_STREQ("connections", XmlParserTest::getChildAtPosition(statesChildren, 1)->getChildren().front()->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 1)->getChildren().front()->getValue().empty());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 1)->getChildren().front()->getAttributes().empty());
+    connectionChildren = XmlParserTest::getChildAtPosition(statesChildren, 1)->getChildren().front()->getChildren();
     ASSERT_EQ(2, connectionChildren.size());
-    ASSERT_STREQ("connection", StlUtils::getListElementAt(connectionChildren, 0)->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(connectionChildren, 0)->getValue().empty());
-    attributes = StlUtils::getListElementAt(connectionChildren, 0)->getAttributes();
+    ASSERT_STREQ("connection", XmlParserTest::getChildAtPosition(connectionChildren, 0)->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(connectionChildren, 0)->getValue().empty());
+    attributes = XmlParserTest::getChildAtPosition(connectionChildren, 0)->getAttributes();
     ASSERT_EQ(3, attributes.size());
-    ASSERT_STREQ("connectionId", StlUtils::getListElementAt(attributes, 0)->getName().c_str());
-    ASSERT_STREQ("BC", StlUtils::getListElementAt(attributes, 0)->getValue().c_str());
-    ASSERT_STREQ("condition", StlUtils::getListElementAt(attributes, 1)->getName().c_str());
-    ASSERT_STREQ("false", StlUtils::getListElementAt(attributes, 1)->getValue().c_str());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(attributes, 2)->getName().c_str());
-    ASSERT_STREQ("C", StlUtils::getListElementAt(attributes, 2)->getValue().c_str());
-    ASSERT_STREQ("connection", StlUtils::getListElementAt(connectionChildren, 1)->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(connectionChildren, 1)->getValue().empty());
-    attributes = StlUtils::getListElementAt(connectionChildren, 1)->getAttributes();
+    ASSERT_STREQ("connectionId", XmlParserTest::getAttributeAtPosition(attributes, 0)->getName().c_str());
+    ASSERT_STREQ("BC", XmlParserTest::getAttributeAtPosition(attributes, 0)->getValue().c_str());
+    ASSERT_STREQ("condition", XmlParserTest::getAttributeAtPosition(attributes, 1)->getName().c_str());
+    ASSERT_STREQ("false", XmlParserTest::getAttributeAtPosition(attributes, 1)->getValue().c_str());
+    ASSERT_STREQ("id", XmlParserTest::getAttributeAtPosition(attributes, 2)->getName().c_str());
+    ASSERT_STREQ("C", XmlParserTest::getAttributeAtPosition(attributes, 2)->getValue().c_str());
+    ASSERT_STREQ("connection", XmlParserTest::getChildAtPosition(connectionChildren, 1)->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(connectionChildren, 1)->getValue().empty());
+    attributes = XmlParserTest::getChildAtPosition(connectionChildren, 1)->getAttributes();
     ASSERT_EQ(3, attributes.size());
-    ASSERT_STREQ("connectionId", StlUtils::getListElementAt(attributes, 0)->getName().c_str());
-    ASSERT_STREQ("BD", StlUtils::getListElementAt(attributes, 0)->getValue().c_str());
-    ASSERT_STREQ("condition", StlUtils::getListElementAt(attributes, 1)->getName().c_str());
-    ASSERT_STREQ("false", StlUtils::getListElementAt(attributes, 1)->getValue().c_str());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(attributes, 2)->getName().c_str());
-    ASSERT_STREQ("D", StlUtils::getListElementAt(attributes, 2)->getValue().c_str());
-
-    ASSERT_STREQ("state", StlUtils::getListElementAt(statesChildren, 2)->getName().c_str());
-    ASSERT_EQ(1, StlUtils::getListElementAt(statesChildren, 2)->getAttributes().size());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(statesChildren, 2)->getAttributes().front()->getName().c_str());
-    ASSERT_STREQ("C", StlUtils::getListElementAt(statesChildren, 2)->getAttributes().front()->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 2)->getValue().empty());
-    ASSERT_EQ(1, StlUtils::getListElementAt(statesChildren, 2)->getChildren().size());
-    ASSERT_STREQ("connections", StlUtils::getListElementAt(statesChildren, 2)->getChildren().front()->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 2)->getChildren().front()->getValue().empty());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 2)->getChildren().front()->getAttributes().empty());
-    connectionChildren = StlUtils::getListElementAt(statesChildren, 2)->getChildren().front()->getChildren();
+    ASSERT_STREQ("connectionId", XmlParserTest::getAttributeAtPosition(attributes, 0)->getName().c_str());
+    ASSERT_STREQ("BD", XmlParserTest::getAttributeAtPosition(attributes, 0)->getValue().c_str());
+    ASSERT_STREQ("condition", XmlParserTest::getAttributeAtPosition(attributes, 1)->getName().c_str());
+    ASSERT_STREQ("false", XmlParserTest::getAttributeAtPosition(attributes, 1)->getValue().c_str());
+    ASSERT_STREQ("id", XmlParserTest::getAttributeAtPosition(attributes, 2)->getName().c_str());
+    ASSERT_STREQ("D", XmlParserTest::getAttributeAtPosition(attributes, 2)->getValue().c_str());
+
+    ASSERT_STREQ("state", XmlParserTest::getChildAtPosition(statesChildren, 2)->getName().c_str());
+    ASSERT_EQ(1, XmlParserTest::getChildAtPosition(statesChildren, 2)->getAttributes().size());
+    ASSERT_STREQ("id", XmlParserTest::getChildAtPosition(statesChildren, 2)->getAttributes().front()->getName().c_str());
+    ASSERT_STREQ("C", XmlParserTest::getChildAtPosition(statesChildren, 2)->getAttributes().front()->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 2)->getValue().empty());
+    ASSERT_EQ(1, XmlParserTest::getChildAtPosition(statesChildren, 2)->getChildren().size());
+    ASSERT_STREQ("connections", XmlParserTest::getChildAtPosition(statesChildren, 2)->getChildren().front()->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 2)->getChildren().front()->getValue().empty());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 2)->getChildren().front()->getAttributes().empty());
+    connectionChildren = XmlParserTest::getChildAtPosition(statesChildren, 2)->getChildren().front()->getChildren();
     ASSERT_EQ(1, connectionChildren.size());
-    ASSERT_STREQ("connection", StlUtils::getListElementAt(connectionChildren, 0)->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(connectionChildren, 0)->getValue().empty());
-    attributes = StlUtils::getListElementAt(connectionChildren, 0)->getAttributes();
+    ASSERT_STREQ("connection", XmlParserTest::getChildAtPosition(connectionChildren, 0)->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(connectionChildren, 0)->getValue().empty());
+    attributes = XmlParserTest::getChildAtPosition(connectionChildren, 0)->getAttributes();
     ASSERT_EQ(3, attributes.size());
-    ASSERT_STREQ("connectionId", StlUtils::getListElementAt(attributes, 0)->getName().c_str());
-    ASSERT_STREQ("CE", StlUtils::getListElementAt(attributes, 0)->getValue().c_str());
-    ASSERT_STREQ("condition", StlUtils::getListElementAt(attributes, 1)->getName().c_str());
-    ASSERT_STREQ("false", StlUtils::getListElementAt(attributes, 1)->getValue().c_str());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(attributes, 2)->getName().c_str());
-    ASSERT_STREQ("E", StlUtils::getListElementAt(attributes, 2)->getValue().c_str());
-
-    ASSERT_STREQ("state", StlUtils::getListElementAt(statesChildren, 3)->getName().c_str());
-    ASSERT_EQ(1, StlUtils::getListElementAt(statesChildren, 3)->getAttributes().size());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(statesChildren, 3)->getAttributes().front()->getName().c_str());
-    ASSERT_STREQ("D", StlUtils::getListElementAt(statesChildren, 3)->getAttributes().front()->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 3)->getChildren().front()->getAttributes().empty());
-    connectionChildren = StlUtils::getListElementAt(statesChildren, 3)->getChildren().front()->getChildren();
+    ASSERT_STREQ("connectionId", XmlParserTest::getAttributeAtPosition(attributes, 0)->getName().c_str());
+    ASSERT_STREQ("CE", XmlParserTest::getAttributeAtPosition(attributes, 0)->getValue().c_str());
+    ASSERT_STREQ("condition", XmlParserTest::getAttributeAtPosition(attributes, 1)->getName().c_str());
+    ASSERT_STREQ("false", XmlParserTest::getAttributeAtPosition(attributes, 1)->getValue().c_str());
+    ASSERT_STREQ("id", XmlParserTest::getAttributeAtPosition(attributes, 2)->getName().c_str());
+    ASSERT_STREQ("E", XmlParserTest::getAttributeAtPosition(attributes, 2)->getValue().c_str());
+
+    ASSERT_STREQ("state", XmlParserTest::getChildAtPosition(statesChildren, 3)->getName().c_str());
+    ASSERT_EQ(1, XmlParserTest::getChildAtPosition(statesChildren, 3)->getAttributes().size());
+    ASSERT_STREQ("id", XmlParserTest::getChildAtPosition(statesChildren, 3)->getAttributes().front()->getName().c_str());
+    ASSERT_STREQ("D", XmlParserTest::getChildAtPosition(statesChildren, 3)->getAttributes().front()->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 3)->getChildren().front()->getAttributes().empty());
+    connectionChildren = XmlParserTest::getChildAtPosition(statesChildren, 3)->getChildren().front()->getChildren();
     ASSERT_EQ(1, connectionChildren.size());
-    ASSERT_STREQ("connection", StlUtils::getListElementAt(connectionChildren, 0)->getName().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(connectionChildren, 0)->getValue().empty());
-    attributes = StlUtils::getListElementAt(connectionChildren, 0)->getAttributes();
+    ASSERT_STREQ("connection", XmlParserTest::getChildAtPosition(connectionChildren, 0)->getName().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(connectionChildren, 0)->getValue().empty());
+    attributes = XmlParserTest::getChildAtPosition(connectionChildren, 0)->getAttributes();
     ASSERT_EQ(3, attributes.size());
-    ASSERT_STREQ("connectionId", StlUtils::getListElementAt(attributes, 0)->getName().c_str());
-    ASSERT_STREQ("DE", StlUtils::getListElementAt(attributes, 0)->getValue().c_str());
-    ASSERT_STREQ("condition", StlUtils::getListElementAt(attributes, 1)->getName().c_str());
-    ASSERT_STREQ("false", StlUtils::getListElementAt(attributes, 1)->getValue().c_str());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(attributes, 2)->getName().c_str());
-    ASSERT_STREQ("E", StlUtils::getListElementAt(attributes, 2)->getValue().c_str());
-
-    ASSERT_STREQ("state", StlUtils::getListElementAt(statesChildren, 4)->getName().c_str());
-    ASSERT_EQ(1, StlUtils::getListElementAt(statesChildren, 4)->getAttributes().size());
-    ASSERT_STREQ("id", StlUtils::getListElementAt(statesChildren, 4)->getAttributes().front()->getName().c_str());
-    ASSERT_STREQ("E", StlUtils::getListElementAt(statesChildren, 4)->getAttributes().front()->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(statesChildren, 4)->getChildren().empty());
+    ASSERT_STREQ("connectionId", XmlParserTest::getAttributeAtPosition(attributes, 0)->getName().c_str());
+    ASSERT_STREQ("DE", XmlParserTest::getAttributeAtPosition(attributes, 0)->getValue().c_str());
+    ASSERT_STREQ("condition", XmlParserTest::getAttributeAtPosition(attributes, 1)->getName().c_str());
+    ASSERT_STREQ("false", XmlParserTest::getAttributeAtPosition(attributes, 1)->getValue().c_str());
+    ASSERT_STREQ("id", XmlParserTest::getAttributeAtPosition(attributes, 2)->getName().c_str());
+    ASSERT_STREQ("E", XmlParserTest::getAttributeAtPosition(attributes, 2)->getValue().c_str());
+
+    ASSERT_STREQ("state", XmlParserTest::getChildAtPosition(statesChildren, 4)->getName().c_str());
+    ASSERT_EQ(1, XmlParserTest::getChildAtPosition(statesChildren, 4)->getAttributes().size());
+    ASSERT_STREQ("id", XmlParserTest::getChildAtPosition(statesChildren, 4)->getAttributes().front()->getName().c_str());
+    ASSERT_STREQ("E", XmlParserTest::getChildAtPosition(statesChildren, 4)->getAttributes().front()->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(statesChildren, 4)->getChildren().empty());
 
     // current state
 
-    ASSERT_STREQ("currentState", StlUtils::getListElementAt(children, 1)->getName().c_str());
-    ASSERT_STREQ("A", StlUtils::getListElementAt(children, 1)->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(children, 1)->getChildren().empty());
-    ASSERT_TRUE(StlUtils::getListElementAt(children, 1)->getAttributes().empty());
+    ASSERT_STREQ("currentState", XmlParserTest::getChildAtPosition(children, 1)->getName().c_str());
+    ASSERT_STREQ("A", XmlParserTest::getChildAtPosition(children, 1)->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(children, 1)->getChildren().empty());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(children, 1)->getAttributes().empty());
 
     // memory
 
-    memoryChildren = StlUtils::getListElementAt(children, 2)->getChildren();
+    memoryChildren = XmlParserTest::getChildAtPosition(children, 2)->getChildren();
     ASSERT_EQ(3, memoryChildren.size());
 
-    ASSERT_STREQ("location", StlUtils::getListElementAt(memoryChildren, 0)->getName().c_str());
-    ASSERT_STREQ("A", StlUtils::getListElementAt(memoryChildren, 0)->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(memoryChildren, 0)->getChildren().empty());
-    ASSERT_TRUE(StlUtils::getListElementAt(memoryChildren, 0)->getAttributes().empty());
+    ASSERT_STREQ("location", XmlParserTest::getChildAtPosition(memoryChildren, 0)->getName().c_str());
+    ASSERT_STREQ("A", XmlParserTest::getChildAtPosition(memoryChildren, 0)->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(memoryChildren, 0)->getChildren().empty());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(memoryChildren, 0)->getAttributes().empty());
 
-    ASSERT_STREQ("location", StlUtils::getListElementAt(memoryChildren, 1)->getName().c_str());
-    ASSERT_STREQ("B", StlUtils::getListElementAt(memoryChildren, 1)->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(memoryChildren, 1)->getChildren().empty());
-    ASSERT_TRUE(StlUtils::getListElementAt(memoryChildren, 1)->getAttributes().empty());
+    ASSERT_STREQ("location", XmlParserTest::getChildAtPosition(memoryChildren, 1)->getName().c_str());
+    ASSERT_STREQ("B", XmlParserTest::getChildAtPosition(memoryChildren, 1)->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(memoryChildren, 1)->getChildren().empty());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(memoryChildren, 1)->getAttributes().empty());
 
-    ASSERT_STREQ("location", StlUtils::getListElementAt(memoryChildren, 2)->getName().c_str());
-    ASSERT_STREQ("C", StlUtils::getListElementAt(memoryChildren, 2)->getValue().c_str());
-    ASSERT_TRUE(StlUtils::getListElementAt(memoryChildren, 2)->getChildren().empty());
-    ASSERT_TRUE(StlUtils::getListElementAt(memoryChildren, 2)->getAttributes().empty());
+    ASSERT_STREQ("location", XmlParserTest::getChildAtPosition(memoryChildren, 2)->getName().c_str());
+    ASSERT_STREQ("C", XmlParserTest::getChildAtPosition(memoryChildren, 2)->getValue().c_str());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(memoryChildren, 2)->getChildren().empty());
+    ASSERT_TRUE(XmlParserTest::getChildAtPosition(memoryChildren, 2)->getAttributes().empty());
   }
 
   TEST_F(XmlParserTest, getDocument)