summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorJoseph Powers <jpowers27@cox.net>2010-12-12 06:59:49 -0800
committerJoseph Powers <jpowers27@cox.net>2010-12-12 06:59:49 -0800
commit941320e732b8fdceb8512991814a73ed65b3f14d (patch)
treeed346985fa4f0a8ab64b2bd5e18bfab688c565d6 /starmath
parentb343ca0dfbae0731ac0ce89d14bc9c8fc667825d (diff)
remove DECLARE_LIST(SmErrDescList, SmErrorDesc *)
Diffstat (limited to 'starmath')
-rw-r--r--starmath/inc/parse.hxx25
-rw-r--r--starmath/source/parse.cxx51
2 files changed, 37 insertions, 39 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 8e85f4dfc32d..f369e858ebbb 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 61d40ab3fb8f..cfc6b12b1d03 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: */