Kaydet (Commit) 2aacf6c2 authored tarafından Noel Grandin's avatar Noel Grandin

sc: boost::ptr_vector->std::vector

Change-Id: Ic4af0579f31c2076fcbc4ac76266e0ae49cb2be8
üst ab3d557b
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "scdllapi.h" #include "scdllapi.h"
#include <boost/ptr_container/ptr_vector.hpp>
#include <vector> #include <vector>
/** /**
...@@ -47,7 +46,6 @@ private: ...@@ -47,7 +46,6 @@ private:
public: public:
ScUserListData(const OUString& rStr); ScUserListData(const OUString& rStr);
ScUserListData(const ScUserListData& rData); ScUserListData(const ScUserListData& rData);
~ScUserListData();
const OUString& GetString() const { return aStr; } const OUString& GetString() const { return aStr; }
void SetString(const OUString& rStr); void SetString(const OUString& rStr);
...@@ -63,7 +61,7 @@ public: ...@@ -63,7 +61,7 @@ public:
*/ */
class SC_DLLPUBLIC ScUserList class SC_DLLPUBLIC ScUserList
{ {
typedef ::boost::ptr_vector<ScUserListData> DataType; typedef std::vector<ScUserListData> DataType;
DataType maData; DataType maData;
public: public:
typedef DataType::iterator iterator; typedef DataType::iterator iterator;
...@@ -85,8 +83,9 @@ public: ...@@ -85,8 +83,9 @@ public:
iterator begin(); iterator begin();
const_iterator begin() const; const_iterator begin() const;
void clear(); void clear();
void reserve(size_t size) { maData.reserve(size); }
size_t size() const; size_t size() const;
void push_back(ScUserListData* p); void push_back(const ScUserListData& r) { maData.push_back(r); }
void erase(iterator itr); void erase(iterator itr);
}; };
......
...@@ -180,11 +180,11 @@ static void lcl_SetSortList( const Any& rValue ) ...@@ -180,11 +180,11 @@ static void lcl_SetSortList( const Any& rValue )
if (!bDefault) if (!bDefault)
{ {
aList.clear(); aList.clear();
aList.reserve(nCount);
for (long i=0; i<nCount; i++) for (long i=0; i<nCount; i++)
{ {
ScUserListData* pNew = new ScUserListData( pArray[i] ); aList.push_back( ScUserListData( pArray[i] ) );
aList.push_back(pNew);
} }
} }
......
...@@ -96,10 +96,6 @@ ScUserListData::ScUserListData(const ScUserListData& rData) : ...@@ -96,10 +96,6 @@ ScUserListData::ScUserListData(const ScUserListData& rData) :
InitTokens(); InitTokens();
} }
ScUserListData::~ScUserListData()
{
}
void ScUserListData::SetString( const OUString& rStr ) void ScUserListData::SetString( const OUString& rStr )
{ {
aStr = rStr; aStr = rStr;
...@@ -237,9 +233,9 @@ ScUserList::ScUserList() ...@@ -237,9 +233,9 @@ ScUserList::ScUserList()
OUString aDayLong = aDayLongBuf.makeStringAndClear(); OUString aDayLong = aDayLongBuf.makeStringAndClear();
if ( !HasEntry( aDayShort ) ) if ( !HasEntry( aDayShort ) )
maData.push_back( new ScUserListData( aDayShort )); maData.push_back( ScUserListData( aDayShort ));
if ( !HasEntry( aDayLong ) ) if ( !HasEntry( aDayLong ) )
maData.push_back( new ScUserListData( aDayLong )); maData.push_back( ScUserListData( aDayLong ));
} }
xCal = xCalendars[j].Months; xCal = xCalendars[j].Months;
...@@ -262,9 +258,9 @@ ScUserList::ScUserList() ...@@ -262,9 +258,9 @@ ScUserList::ScUserList()
OUString aMonthLong = aMonthLongBuf.makeStringAndClear(); OUString aMonthLong = aMonthLongBuf.makeStringAndClear();
if ( !HasEntry( aMonthShort ) ) if ( !HasEntry( aMonthShort ) )
maData.push_back( new ScUserListData( aMonthShort )); maData.push_back( ScUserListData( aMonthShort ));
if ( !HasEntry( aMonthLong ) ) if ( !HasEntry( aMonthLong ) )
maData.push_back( new ScUserListData( aMonthLong )); maData.push_back( ScUserListData( aMonthLong ));
} }
} }
} }
...@@ -350,11 +346,6 @@ size_t ScUserList::size() const ...@@ -350,11 +346,6 @@ size_t ScUserList::size() const
return maData.size(); return maData.size();
} }
void ScUserList::push_back(ScUserListData* p)
{
maData.push_back(p);
}
void ScUserList::erase(iterator itr) void ScUserList::erase(iterator itr)
{ {
maData.erase(itr); maData.erase(itr);
......
...@@ -344,7 +344,7 @@ void ScTpUserLists::AddNewList( const OUString& rEntriesStr ) ...@@ -344,7 +344,7 @@ void ScTpUserLists::AddNewList( const OUString& rEntriesStr )
MakeListStr( theEntriesStr ); MakeListStr( theEntriesStr );
pUserLists->push_back(new ScUserListData(theEntriesStr)); pUserLists->push_back(ScUserListData(rEntriesStr));
} }
void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos, void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos,
......
...@@ -358,12 +358,12 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( ...@@ -358,12 +358,12 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue(
pUserList->clear(); // alle Eintraege raus pUserList->clear(); // alle Eintraege raus
sal_uInt16 nCount = (sal_uInt16)aSeq.getLength(); sal_uInt16 nCount = (sal_uInt16)aSeq.getLength();
pUserList->reserve(nCount);
const OUString* pAry = aSeq.getConstArray(); const OUString* pAry = aSeq.getConstArray();
for (sal_uInt16 i=0; i<nCount; i++) for (sal_uInt16 i=0; i<nCount; i++)
{ {
OUString aEntry = pAry[i]; OUString aEntry = pAry[i];
ScUserListData* pData = new ScUserListData(aEntry); pUserList->push_back( ScUserListData(aEntry) );
pUserList->push_back(pData);
} }
bSaveApp = true; // Liste wird mit den App-Optionen gespeichert bSaveApp = true; // Liste wird mit den App-Optionen gespeichert
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment