Attached patch removes DynamicList and migrate its users from
DynamicList<T> to std::vector<T *>.
<vector> header is included. "list.hxx" is not removed because it is
still used for List class.
--
Seo Sanghyeon
diff --git a/xml2cmp/source/support/list.hxx b/xml2cmp/source/support/list.hxx
index 984ccba..e98d4fc 100644
--- a/xml2cmp/source/support/list.hxx
+++ b/xml2cmp/source/support/list.hxx
@@ -102,18 +102,6 @@ class List
};
-template <class XY>
-class DynamicList : public List<XY*>
-{
- public:
- virtual ~DynamicList();
-
- virtual void insert(
- unsigned pos,
- XY * const & elem );
- virtual void remove(
- unsigned pos );
-};
@@ -212,35 +200,6 @@ List<XX>::alloc( unsigned newSpace,
}
-template <class XY>
-DynamicList<XY>::~DynamicList()
-{
- this->erase_all();
-}
-
-template <class XY>
-void
-DynamicList<XY>::insert(unsigned pos, XY * const & elem_)
-{
- if ( pos > this->len )
- return;
-
- checkSize(this->len+2);
- memmove(this->inhalt[pos+1], this->inhalt[pos], (this->len-pos) * sizeof(XY*) );
- this->inhalt[pos] = elem_;
- this->len++;
-}
-
-template <class XY>
-void
-DynamicList<XY>::remove( unsigned pos )
-{
- if (pos >= this->len)
- return;
- this->len--;
- delete this->inhalt[pos];
- memmove(this->inhalt[pos], this->inhalt[pos+1], (this->len-pos) * sizeof(XY*) );
-}
diff --git a/xml2cmp/source/xcd/parse.cxx b/xml2cmp/source/xcd/parse.cxx
index 80d5fe8..b02b413 100644
--- a/xml2cmp/source/xcd/parse.cxx
+++ b/xml2cmp/source/xcd/parse.cxx
@@ -127,7 +127,7 @@ X2CParser::Parse_Doctype()
}
void
-X2CParser::Parse_Sequence( DynamicList<XmlElement> & o_rElements,
+X2CParser::Parse_Sequence( std::vector<XmlElement *> & o_rElements,
const Simstr & i_sElementName )
{
CheckAndPassBeginTag(i_sElementName.str());
@@ -142,7 +142,7 @@ X2CParser::Parse_Sequence( DynamicList<XmlElement> & o_rElements,
}
void
-X2CParser::Parse_FreeChoice( DynamicList<XmlElement> & o_rElements )
+X2CParser::Parse_FreeChoice( std::vector<XmlElement *> & o_rElements )
{
unsigned nSize = o_rElements.size();
diff --git a/xml2cmp/source/xcd/parse.hxx b/xml2cmp/source/xcd/parse.hxx
index 40cef61..e4011cc 100644
--- a/xml2cmp/source/xcd/parse.hxx
+++ b/xml2cmp/source/xcd/parse.hxx
@@ -36,6 +36,7 @@
#include "filebuff.hxx"
#include "../support/sistr.hxx"
#include "../support/list.hxx"
+#include <vector>
// PARAMETERS
@@ -61,11 +62,11 @@ class X2CParser
const char * PureText() const { return aFile.operator const
char*(); }
void Parse_Sequence(
- DynamicList<XmlElement> &
+ std::vector<XmlElement *> &
o_rElements,
const Simstr & i_sElementName );
void Parse_FreeChoice(
- DynamicList<XmlElement> &
+ std::vector<XmlElement *> &
o_rElements );
void Parse_List(
ListElement & o_rListElem );
diff --git a/xml2cmp/source/xcd/xmlelem.hxx b/xml2cmp/source/xcd/xmlelem.hxx
index 86f114a..452f4a8 100644
--- a/xml2cmp/source/xcd/xmlelem.hxx
+++ b/xml2cmp/source/xcd/xmlelem.hxx
@@ -35,6 +35,7 @@
// COMPONENTS
#include "../support/sistr.hxx"
#include "../support/list.hxx"
+#include <vector>
#include "../support/syshelp.hxx"
// PARAMETERS
@@ -77,7 +78,7 @@ class MultipleElement : public XmlElement
protected:
- typedef DynamicList<XmlElement> ChildList;
+ typedef std::vector<XmlElement *> ChildList;
MultipleElement(
const char * i_sName );
Context
- [Libreoffice] Using STL for xml2cmp (2) · Seo Sanghyeon
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.