[Libreoffice-commits] .: binfilter/bf_basic
Joseph Powers
jpowers at kemper.freedesktop.org
Sun Jan 9 19:24:29 PST 2011
binfilter/bf_basic/source/basmgr/basmgr.cxx | 99 +++++++++++++++++++++++++++-
1 file changed, 96 insertions(+), 3 deletions(-)
New commits:
commit 67fbf6a6992df9bd78035c02e099f48d7699e4e6
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun Jan 9 19:24:21 2011 -0800
Remove DECLARE_LIST( BasicLibsBase, BasicLibInfo* )
Passes SMOKETEST this time.
diff --git a/binfilter/bf_basic/source/basmgr/basmgr.cxx b/binfilter/bf_basic/source/basmgr/basmgr.cxx
index d9d3742..6012e4b 100644
--- a/binfilter/bf_basic/source/basmgr/basmgr.cxx
+++ b/binfilter/bf_basic/source/basmgr/basmgr.cxx
@@ -44,7 +44,6 @@
#include "basmgr.hxx"
#include "sbintern.hxx"
-
#define LIB_SEP 0x01
#define LIBINFO_SEP 0x02
#define LIBINFO_ID 0x1491
@@ -61,6 +60,7 @@
#include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
#include <cppuhelper/implbase1.hxx>
+#include <vector>
namespace binfilter {
@@ -70,6 +70,8 @@ using namespace com::sun::star::lang;
using namespace com::sun::star::script;
using namespace cppu;
using namespace rtl;
+using ::std::vector;
+using ::std::advance;
typedef WeakImplHelper1< XNameContainer > NameContainerHelper;
typedef WeakImplHelper1< XStarBasicModuleInfo > ModuleInfoHelper;
@@ -482,14 +484,105 @@ public:
{ mxScriptCont = xScriptCont; }
};
-DECLARE_LIST( BasicLibsBase, BasicLibInfo* )
+typedef vector< BasicLibInfo* > BasicLibsBase;
-class BasicLibs : public BasicLibsBase
+class BasicLibs
{
+private:
+ BasicLibsBase mpList;
+ size_t current;
+
public:
String aBasicLibPath; // soll eigentlich Member vom Manager werden, aber jetzt nicht inkompatibel!
+ BasicLibInfo* GetObject( size_t i );
+ void Insert( BasicLibInfo* item, size_t i );
+ void Clear() { mpList.clear(); }
+ size_t Count() { return mpList.size(); }
+ size_t GetPos( BasicLibInfo* pItem );
+ size_t GetCurPos() { return current; }
+ BasicLibInfo* First();
+ BasicLibInfo* Next();
+ BasicLibInfo* Prev();
+ BasicLibInfo* Last();
+ BasicLibInfo* Remove( BasicLibInfo* pItem );
};
+size_t BasicLibs::GetPos( BasicLibInfo* pItem )
+{
+ for ( size_t i = 0, n = mpList.size(); i < n; ++i )
+ if ( mpList[ i ] == pItem )
+ return i;
+ return size_t(-1);
+}
+
+void BasicLibs::Insert( BasicLibInfo* pItem, size_t i )
+{
+ if ( i >= mpList.size() )
+ {
+ mpList.push_back( pItem );
+ current = mpList.size() - 1;
+ }
+ else
+ {
+ BasicLibsBase::iterator it = mpList.begin();
+ advance( it, i );
+ mpList.insert( it, pItem );
+ current = i;
+ }
+}
+
+BasicLibInfo* BasicLibs::Remove( BasicLibInfo* pItem )
+{
+ size_t pos = GetPos( pItem );
+ if ( pos == size_t(-1) ) return NULL;
+
+ current = pos;
+ BasicLibsBase::iterator it = mpList.begin();
+ advance( it, pos );
+ mpList.erase( it );
+ return pItem;
+}
+
+BasicLibInfo* BasicLibs::GetObject( size_t i )
+{
+ if ( i >= mpList.size() ) return NULL;
+ return mpList[ i ];
+}
+
+BasicLibInfo* BasicLibs::First()
+{
+ current = 0;
+ if ( mpList.empty() ) return NULL;
+ return mpList[ current ];
+}
+
+BasicLibInfo* BasicLibs::Next()
+{
+ if ( mpList.empty()
+ || current+1 >= mpList.size()
+ )
+ return NULL;
+ current++;
+ return mpList[ current ];
+}
+
+BasicLibInfo* BasicLibs::Prev()
+{
+ if ( mpList.empty()
+ || current == 0
+ )
+ return NULL;
+ current--;
+ return mpList[ current ];
+}
+
+BasicLibInfo* BasicLibs::Last()
+{
+ if ( mpList.empty() ) return NULL;
+ current = mpList.size() - 1;
+ return mpList[ current ];
+}
+
BasicLibInfo::BasicLibInfo()
{
bReference = FALSE;
More information about the Libreoffice-commits
mailing list