[Libreoffice-commits] .: starmath/inc starmath/source
Joseph Powers
jpowers at kemper.freedesktop.org
Sun Dec 12 07:08:45 PST 2010
starmath/inc/parse.hxx | 25 +++++++++++-----------
starmath/source/parse.cxx | 51 +++++++++++++++++++++-------------------------
2 files changed, 37 insertions(+), 39 deletions(-)
New commits:
commit 7b49d837e0052dd36f5d6e9d4a4ba03f2f5dff4a
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun Dec 12 06:59:49 2010 -0800
remove DECLARE_LIST(SmErrDescList, SmErrorDesc *)
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index e67dbba..4dfa2d1 100644
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -36,6 +36,8 @@
#include "types.hxx"
+#include <vector>
+
class SmNode;
class SmDocShell;
@@ -159,7 +161,7 @@ struct SmErrorDesc
};
DECLARE_STACK(SmNodeStack, SmNode *)
-DECLARE_LIST(SmErrDescList, SmErrorDesc *)
+typedef ::std::vector< SmErrorDesc* > SmErrDescList;
/**************************************************************************/
@@ -260,19 +262,18 @@ public:
const String & GetText() const { return BufferString; };
- SmConvert GetConversion() const { return eConversion; }
- void SetConversion(SmConvert eConv) { eConversion = eConv; }
-
- bool IsImportSymbolNames() const { return bImportSymNames; }
- void SetImportSymbolNames(bool bVal) { bImportSymNames = bVal; }
- bool IsExportSymbolNames() const { return bExportSymNames; }
- void SetExportSymbolNames(bool bVal) { bExportSymNames = bVal; }
+ SmConvert GetConversion() const { return eConversion; }
+ void SetConversion(SmConvert eConv) { eConversion = eConv; }
- USHORT AddError(SmParseError Type, SmNode *pNode);
+ bool IsImportSymbolNames() const { return bImportSymNames; }
+ void SetImportSymbolNames(bool bVal) { bImportSymNames = bVal; }
+ bool IsExportSymbolNames() const { return bExportSymNames; }
+ void SetExportSymbolNames(bool bVal) { bExportSymNames = bVal; }
- const SmErrorDesc * NextError();
- const SmErrorDesc * PrevError();
- const SmErrorDesc * GetError(USHORT i = 0xFFFF);
+ size_t AddError(SmParseError Type, SmNode *pNode);
+ const SmErrorDesc* NextError();
+ const SmErrorDesc* PrevError();
+ const SmErrorDesc* GetError(size_t i = size_t(-1) );
static const SmTokenTableEntry* GetTokenTableEntry( const String &rName );
};
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index dc5f75e..59d03d5 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -2401,10 +2401,9 @@ SmNode *SmParser::Parse(const String &rBuffer)
ColOff = 0;
CurError = -1;
- for (USHORT i = 0; i < ErrDescList.Count(); i++)
- delete ErrDescList.Remove(i);
-
- ErrDescList.Clear();
+ for ( size_t i = 0, n = ErrDescList.size(); i < n; ++i )
+ delete ErrDescList[ i ];
+ ErrDescList.clear();
NodeStack.Clear();
@@ -2425,10 +2424,9 @@ SmNode *SmParser::ParseExpression(const String &rBuffer)
ColOff = 0;
CurError = -1;
- for (USHORT i = 0; i < ErrDescList.Count(); i++)
- delete ErrDescList.Remove(i);
-
- ErrDescList.Clear();
+ for ( size_t i = 0, n = ErrDescList.size(); i < n; ++i )
+ delete ErrDescList[ i ];
+ ErrDescList.clear();
NodeStack.Clear();
@@ -2440,7 +2438,7 @@ SmNode *SmParser::ParseExpression(const String &rBuffer)
}
-USHORT SmParser::AddError(SmParseError Type, SmNode *pNode)
+size_t SmParser::AddError(SmParseError Type, SmNode *pNode)
{
SmErrorDesc *pErrDesc = new SmErrorDesc;
@@ -2470,44 +2468,43 @@ USHORT SmParser::AddError(SmParseError Type, SmNode *pNode)
}
pErrDesc->Text += SmResId(nRID);
- ErrDescList.Insert(pErrDesc);
+ ErrDescList.push_back( pErrDesc );
- return (USHORT) ErrDescList.GetPos(pErrDesc);
+ return ErrDescList.size()-1;
}
-const SmErrorDesc *SmParser::NextError()
+const SmErrorDesc *SmParser::NextError()
{
- if (ErrDescList.Count())
- if (CurError > 0) return ErrDescList.Seek(--CurError);
+ if ( !ErrDescList.empty() )
+ if (CurError > 0) return ErrDescList[ --CurError ];
else
{
CurError = 0;
- return ErrDescList.Seek(CurError);
+ return ErrDescList[ CurError ];
}
- else return 0;
+ else return NULL;
}
-const SmErrorDesc *SmParser::PrevError()
+const SmErrorDesc *SmParser::PrevError()
{
- if (ErrDescList.Count())
- if (CurError < (int) (ErrDescList.Count() - 1)) return ErrDescList.Seek(++CurError);
+ if ( !ErrDescList.empty() )
+ if (CurError < (int) (ErrDescList.size() - 1)) return ErrDescList[ ++CurError ];
else
{
- CurError = (int) (ErrDescList.Count() - 1);
- return ErrDescList.Seek(CurError);
+ CurError = (int) (ErrDescList.size() - 1);
+ return ErrDescList[ CurError ];
}
- else return 0;
+ else return NULL;
}
-const SmErrorDesc *SmParser::GetError(USHORT i)
+const SmErrorDesc *SmParser::GetError(size_t i)
{
- return (/*i >= 0 &&*/ i < ErrDescList.Count())
- ? ErrDescList.Seek(i)
- : ErrDescList.Seek(CurError);
+ return ( i < ErrDescList.size() )
+ ? ErrDescList[ i ]
+ : ErrDescList[ CurError ];
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list