From db74590950afc8def36a42abae786be5ebad85d9 Mon Sep 17 00:00:00 2001 From: Szabolcs Dezsi Date: Fri, 2 Mar 2012 17:01:52 +0100 Subject: Kill LinkedList in hwpfilter --- hwpfilter/source/drawing.h | 7 +- hwpfilter/source/formula.cxx | 8 +- hwpfilter/source/grammar.cxx | 152 +++++++++++++++++----------------- hwpfilter/source/hbox.cxx | 38 +++++---- hwpfilter/source/hbox.h | 22 ++--- hwpfilter/source/hiodev.cxx | 2 + hwpfilter/source/hpara.cxx | 2 + hwpfilter/source/hwpfile.cxx | 184 +++++++++++++++++++++++++++-------------- hwpfilter/source/hwpfile.h | 50 +++++------ hwpfilter/source/hwpread.cxx | 6 +- hwpfilter/source/hwpreader.cxx | 58 ++++++++----- 11 files changed, 310 insertions(+), 219 deletions(-) (limited to 'hwpfilter/source') diff --git a/hwpfilter/source/drawing.h b/hwpfilter/source/drawing.h index b3835d216980..2da39fb23ec0 100644 --- a/hwpfilter/source/drawing.h +++ b/hwpfilter/source/drawing.h @@ -31,8 +31,11 @@ #include "precompile.h" +#include #include +#include + #include "hwplib.h" #include "hwpfile.h" #include "hiodev.h" @@ -600,12 +603,12 @@ static HWPPara *LoadParaList() HWPFile *hwpf = GetCurrentDoc(); HIODev *hio = hwpf->SetIODevice(hmem); - LinkedList < HWPPara > plist; + std::list < HWPPara* > plist; hwpf->ReadParaList(plist); hwpf->SetIODevice(hio); - return plist.count()? plist.first() : 0; + return plist.size()? plist.front() : 0; } diff --git a/hwpfilter/source/formula.cxx b/hwpfilter/source/formula.cxx index d2a73ac72d07..ec44f7d0ad74 100644 --- a/hwpfilter/source/formula.cxx +++ b/hwpfilter/source/formula.cxx @@ -33,8 +33,9 @@ #include "mapping.h" #include "hwpeq.h" #include +#include -extern LinkedList nodelist; +extern std::list nodelist; #ifndef DEBUG @@ -645,9 +646,10 @@ int Formula::parse() makeMathML( res ); } Node *tmpNode; - int count = nodelist.count(); + int count = nodelist.size(); for( int i = 0 ; i < count ; i++ ){ - tmpNode = nodelist.remove(0); + tmpNode = nodelist.front(); + nodelist.pop_front(); delete tmpNode; } diff --git a/hwpfilter/source/grammar.cxx b/hwpfilter/source/grammar.cxx index 2285aabc62b3..99c2f3c1286d 100644 --- a/hwpfilter/source/grammar.cxx +++ b/hwpfilter/source/grammar.cxx @@ -71,12 +71,13 @@ #line 1 "grammar.y" +#include #include #include #include "nodes.h" -LinkedList nodelist; +std::list nodelist; Node *mainParse(const char *_code); void yyerror(const char *); @@ -909,291 +910,291 @@ yyreduce: case 1: #line 60 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 2: #line 61 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 3: #line 62 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 4: #line 63 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 5: #line 64 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 6: #line 65 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 7: #line 66 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 8: #line 67 "grammar.y" -{ yyval.ptr = new Node(ID_CHARACTER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_CHARACTER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 9: #line 68 "grammar.y" -{ yyval.ptr = new Node(ID_OPERATOR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_OPERATOR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 10: #line 69 "grammar.y" -{ yyval.ptr = new Node(ID_OPERATOR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_OPERATOR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 11: #line 70 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 12: #line 71 "grammar.y" -{ yyval.ptr = new Node(ID_DELIMETER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_DELIMETER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 13: #line 72 "grammar.y" -{ yyval.ptr = new Node(ID_DELIMETER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_DELIMETER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 14: #line 73 "grammar.y" -{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_IDENTIFIER); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Identifier : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 15: #line 74 "grammar.y" -{ yyval.ptr = new Node(ID_CHARACTER); allocChar(yyval.ptr->value , '|'); debug("Identifier : '|'\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_CHARACTER); allocChar(yyval.ptr->value , '|'); debug("Identifier : '|'\n"); nodelist.push_back(yyval.ptr); ; break;} case 16: #line 75 "grammar.y" -{ yyval.ptr = new Node(ID_NUMBER); allocValue(yyval.ptr->value , yyvsp[0].dval); debug("Number : %s\n",yyvsp[0].dval); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_NUMBER); allocValue(yyval.ptr->value , yyvsp[0].dval); debug("Number : %s\n",yyvsp[0].dval); nodelist.push_back(yyval.ptr); ; break;} case 17: #line 76 "grammar.y" -{ yyval.ptr = new Node(ID_STRING); allocValue(yyval.ptr->value , yyvsp[0].str); debug("String : %s\n",yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_STRING); allocValue(yyval.ptr->value , yyvsp[0].str); debug("String : %s\n",yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 18: #line 80 "grammar.y" -{ yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("PrimaryExpr\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("PrimaryExpr\n"); nodelist.push_back(yyval.ptr); ; break;} case 19: #line 81 "grammar.y" -{ yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyval.ptr->next = yyvsp[0].ptr; debug("PrimaryExpr : PrimaryExpr Identifier\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_PRIMARYEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyval.ptr->next = yyvsp[0].ptr; debug("PrimaryExpr : PrimaryExpr Identifier\n"); nodelist.push_back(yyval.ptr); ; break;} case 20: #line 85 "grammar.y" -{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '('); debug("EQLeft \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '('); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ; break;} case 21: #line 86 "grammar.y" -{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '['); debug("EQLeft \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '['); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ; break;} case 22: #line 87 "grammar.y" -{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '{'); debug("EQLeft \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '{'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ; break;} case 23: #line 88 "grammar.y" -{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '<'); debug("EQLeft \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '<'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ; break;} case 24: #line 89 "grammar.y" -{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '|'); debug("EQLeft \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_LEFT); allocChar(yyval.ptr->value , '|'); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ; break;} case 25: #line 90 "grammar.y" -{ yyval.ptr = new Node(ID_LEFT); allocValue(yyval.ptr->value , "||"); debug("EQLeft \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_LEFT); allocValue(yyval.ptr->value , "||"); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ; break;} case 26: #line 91 "grammar.y" -{ yyval.ptr = new Node(ID_LEFT); allocValue(yyval.ptr->value , yyvsp[0].str); debug("EQLeft \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_LEFT); allocValue(yyval.ptr->value , yyvsp[0].str); debug("EQLeft \n"); nodelist.push_back(yyval.ptr); ; break;} case 27: #line 95 "grammar.y" -{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , ')'); debug("EQRight \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , ')'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ; break;} case 28: #line 96 "grammar.y" -{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , ']'); debug("EQRight \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , ']'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ; break;} case 29: #line 97 "grammar.y" -{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '}'); debug("EQRight \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '}'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ; break;} case 30: #line 98 "grammar.y" -{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '>'); debug("EQRight \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '>'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ; break;} case 31: #line 99 "grammar.y" -{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '|'); debug("EQRight \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_RIGHT); allocChar(yyval.ptr->value , '|'); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ; break;} case 32: #line 100 "grammar.y" -{ yyval.ptr = new Node(ID_RIGHT); allocValue(yyval.ptr->value , "||"); debug("EQRight \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_RIGHT); allocValue(yyval.ptr->value , "||"); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ; break;} case 33: #line 101 "grammar.y" -{ yyval.ptr = new Node(ID_RIGHT); allocValue(yyval.ptr->value , yyvsp[0].str); debug("EQRight \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_RIGHT); allocValue(yyval.ptr->value , yyvsp[0].str); debug("EQRight \n"); nodelist.push_back(yyval.ptr); ; break;} case 34: #line 105 "grammar.y" -{ yyval.ptr = new Node(ID_FENCE); yyval.ptr->child=yyvsp[-2].ptr; yyvsp[-2].ptr->next=yyvsp[-1].ptr; yyvsp[-1].ptr->next=yyvsp[0].ptr; debug("Fence \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_FENCE); yyval.ptr->child=yyvsp[-2].ptr; yyvsp[-2].ptr->next=yyvsp[-1].ptr; yyvsp[-1].ptr->next=yyvsp[0].ptr; debug("Fence \n"); nodelist.push_back(yyval.ptr); ; break;} case 35: #line 109 "grammar.y" -{ yyval.ptr = new Node(ID_PARENTH); yyval.ptr->child = yyvsp[-1].ptr; debug("Parenth: '(' ExprList ')' \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_PARENTH); yyval.ptr->child = yyvsp[-1].ptr; debug("Parenth: '(' ExprList ')' \n"); nodelist.push_back(yyval.ptr); ; break;} case 36: #line 110 "grammar.y" -{ yyval.ptr = new Node(ID_PARENTH); debug("Parenth: '(' ')' \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_PARENTH); debug("Parenth: '(' ')' \n"); nodelist.push_back(yyval.ptr); ; break;} case 37: #line 114 "grammar.y" -{ yyval.ptr = new Node(ID_BLOCK); yyval.ptr->child = yyvsp[-1].ptr; debug("Block: '{' ExprList '}' \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_BLOCK); yyval.ptr->child = yyvsp[-1].ptr; debug("Block: '{' ExprList '}' \n"); nodelist.push_back(yyval.ptr); ; break;} case 38: #line 115 "grammar.y" -{ yyval.ptr = new Node(ID_BLOCK); debug("Block: '{' '}' \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_BLOCK); debug("Block: '{' '}' \n"); nodelist.push_back(yyval.ptr); ; break;} case 39: #line 119 "grammar.y" -{ yyval.ptr = new Node(ID_BRACKET); yyval.ptr->child = yyvsp[-1].ptr; debug("Bracket \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_BRACKET); yyval.ptr->child = yyvsp[-1].ptr; debug("Bracket \n"); nodelist.push_back(yyval.ptr); ; break;} case 40: #line 120 "grammar.y" -{ yyval.ptr = new Node(ID_BRACKET); debug("Bracket \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_BRACKET); debug("Bracket \n"); nodelist.push_back(yyval.ptr); ; break;} case 41: #line 124 "grammar.y" -{ yyval.ptr = new Node(ID_SUBEXPR); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; debug("SubSupExpr : ID_SUBEXPR\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_SUBEXPR); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; debug("SubSupExpr : ID_SUBEXPR\n"); nodelist.push_back(yyval.ptr); ; break;} case 42: #line 125 "grammar.y" -{ yyval.ptr = new Node(ID_SUPEXPR); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; debug("SubSupExpr : ID_SUPEXPR\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_SUPEXPR); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; debug("SubSupExpr : ID_SUPEXPR\n"); nodelist.push_back(yyval.ptr); ; break;} case 43: #line 126 "grammar.y" -{ yyval.ptr = new Node(ID_SUBSUPEXPR); yyval.ptr->child=yyvsp[-4].ptr; yyvsp[-4].ptr->next=yyvsp[-2].ptr; yyvsp[-2].ptr->next=yyvsp[0].ptr; debug("SubSupExpr : ID_SUBSUPEXPR\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_SUBSUPEXPR); yyval.ptr->child=yyvsp[-4].ptr; yyvsp[-4].ptr->next=yyvsp[-2].ptr; yyvsp[-2].ptr->next=yyvsp[0].ptr; debug("SubSupExpr : ID_SUBSUPEXPR\n"); nodelist.push_back(yyval.ptr); ; break;} case 44: #line 130 "grammar.y" -{ yyval.ptr = new Node(ID_FRACTIONEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("FractionExpr : %s\n",yyvsp[-2].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_FRACTIONEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("FractionExpr : %s\n",yyvsp[-2].str); nodelist.push_back(yyval.ptr); ; break;} case 45: #line 134 "grammar.y" -{ yyval.ptr = new Node(ID_OVER); yyval.ptr->child = yyvsp[-3].ptr; yyvsp[-3].ptr->next = yyvsp[-1].ptr; debug("OverExpr\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_OVER); yyval.ptr->child = yyvsp[-3].ptr; yyvsp[-3].ptr->next = yyvsp[-1].ptr; debug("OverExpr\n"); nodelist.push_back(yyval.ptr); ; break;} case 46: #line 139 "grammar.y" -{ yyval.ptr = new Node(ID_ACCENTEXPR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Accent : %s\n", yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_ACCENTEXPR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Accent : %s\n", yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 47: #line 143 "grammar.y" -{ yyval.ptr = new Node(ID_ACCENTEXPR); yyval.ptr->child=yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("AccentExpr \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_ACCENTEXPR); yyval.ptr->child=yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("AccentExpr \n"); nodelist.push_back(yyval.ptr); ; break;} case 48: #line 146 "grammar.y" -{ yyval.ptr = new Node(ID_DECORATIONEXPR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Decoration : %s\n", yyvsp[0].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_DECORATIONEXPR); allocValue(yyval.ptr->value , yyvsp[0].str); debug("Decoration : %s\n", yyvsp[0].str); nodelist.push_back(yyval.ptr); ; break;} case 49: #line 150 "grammar.y" -{ yyval.ptr = new Node(ID_DECORATIONEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("DecorationExpr \n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_DECORATIONEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("DecorationExpr \n"); nodelist.push_back(yyval.ptr); ; break;} case 50: #line 154 "grammar.y" -{ yyval.ptr = new Node(ID_SQRTEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-1].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_SQRTEXPR); yyval.ptr->child = yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-1].str); nodelist.push_back(yyval.ptr); ; break;} case 51: #line 155 "grammar.y" -{ yyval.ptr = new Node(ID_ROOTEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next= yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-2].str); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_ROOTEXPR); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next= yyvsp[0].ptr; debug("RootExpr : %s\n", yyvsp[-2].str); nodelist.push_back(yyval.ptr); ; break;} case 52: #line 159 "grammar.y" -{ yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[0].ptr; nodelist.insert(yyval.ptr); debug("BeginExpr\n"); ; +{ yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("BeginExpr\n"); ; break;} case 53: #line 160 "grammar.y" -{ yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next= yyvsp[0].ptr; nodelist.insert(yyval.ptr); debug("BeginExpr\n"); ; +{ yyval.ptr = new Node(ID_BEGIN); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next= yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("BeginExpr\n"); ; break;} case 54: #line 164 "grammar.y" -{ yyval.ptr = new Node(ID_END); yyval.ptr->child = yyvsp[0].ptr; nodelist.insert(yyval.ptr); debug("EndExpr\n"); ; +{ yyval.ptr = new Node(ID_END); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("EndExpr\n"); ; break;} case 55: #line 169 "grammar.y" -{ yyval.ptr = new Node(ID_MATHML); yyval.ptr->child = yyvsp[0].ptr; nodelist.insert(yyval.ptr); top = yyval.ptr; debug("MathML\n"); ; +{ yyval.ptr = new Node(ID_MATHML); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); top = yyval.ptr; debug("MathML\n"); ; break;} case 56: #line 173 "grammar.y" -{ yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[0].ptr; nodelist.insert(yyval.ptr); debug("Lines\n"); ; +{ yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("Lines\n"); ; break;} case 57: #line 174 "grammar.y" -{ yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; nodelist.insert(yyval.ptr); debug("Lines\n"); ; +{ yyval.ptr = new Node(ID_LINES); yyval.ptr->child = yyvsp[-2].ptr; yyvsp[-2].ptr->next = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("Lines\n"); ; break;} case 58: #line 178 "grammar.y" -{ yyval.ptr = new Node(ID_LINE); yyval.ptr->child = yyvsp[0].ptr; nodelist.insert(yyval.ptr); debug("Line\n"); ; +{ yyval.ptr = new Node(ID_LINE); yyval.ptr->child = yyvsp[0].ptr; nodelist.push_back(yyval.ptr); debug("Line\n"); ; break;} case 59: #line 182 "grammar.y" -{ yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[0].ptr; debug("ExprList : Expr\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[0].ptr; debug("ExprList : Expr\n"); nodelist.push_back(yyval.ptr); ; break;} case 60: #line 183 "grammar.y" -{ yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("ExprList : ExprList Expr\n"); nodelist.insert(yyval.ptr); ; +{ yyval.ptr = new Node(ID_EXPRLIST); yyval.ptr->child = yyvsp[-1].ptr; yyvsp[-1].ptr->next = yyvsp[0].ptr; debug("ExprList : ExprList Expr\n"); nodelist.push_back(yyval.ptr); ; break;} case 61: #line 187 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Block\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Block\n"); nodelist.push_back(yyval.ptr);; break;} case 62: #line 188 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Parenth\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Parenth\n"); nodelist.push_back(yyval.ptr);; break;} case 63: #line 189 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Fence\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : Fence\n"); nodelist.push_back(yyval.ptr);; break;} case 64: #line 190 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : SubSupExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : SubSupExpr\n"); nodelist.push_back(yyval.ptr);; break;} case 65: #line 191 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : FractionExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : FractionExpr\n"); nodelist.push_back(yyval.ptr);; break;} case 66: #line 192 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : OverExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : OverExpr\n"); nodelist.push_back(yyval.ptr);; break;} case 67: #line 193 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : DecorationExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : DecorationExpr\n"); nodelist.push_back(yyval.ptr);; break;} case 68: #line 194 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : RootExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : RootExpr\n"); nodelist.push_back(yyval.ptr);; break;} case 69: #line 195 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : AccentExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : AccentExpr\n"); nodelist.push_back(yyval.ptr);; break;} case 70: #line 196 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : PrimaryExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : PrimaryExpr\n"); nodelist.push_back(yyval.ptr);; break;} case 71: #line 197 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : BeginExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : BeginExpr\n"); nodelist.push_back(yyval.ptr);; break;} case 72: #line 198 "grammar.y" -{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : EndExpr\n"); nodelist.insert(yyval.ptr);; +{ yyval.ptr = new Node(ID_EXPR); yyval.ptr->child = yyvsp[0].ptr; debug("Expr : EndExpr\n"); nodelist.push_back(yyval.ptr);; break;} } /* the action file gets copied in in place of this dollarsign */ @@ -1436,9 +1437,10 @@ void yyerror(const char * /*err*/) // printf("REALKING ERR[%s]\n",err); // if error, delete all nodes. Node *pNode = 0L; - int ncount = nodelist.count(); + int ncount = nodelist.size(); for( int i = 0 ; i < ncount ; i++){ - pNode = nodelist.remove(0); + pNode = nodelist.front(); + nodelist.pop_front(); delete pNode; } top = 0L; diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index fdecbdfde83f..3f9ea3df1f7f 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -30,6 +30,8 @@ #include +#include + #include "hwpfile.h" #include "hbox.h" #include "hpara.h" @@ -334,14 +336,14 @@ TxtBox::~TxtBox(void) for (int ii = 0; ii < nCell; ++ii) { - LinkedListIterator < HWPPara > it(&plists[ii]); - for (; it.current(); ++it) - delete it.current(); + std::list < HWPPara* >::iterator it = plists[ii].begin(); + for (; it != plists[ii].end(); ++it) + delete ⁢ } - LinkedListIterator < HWPPara > it(&caption); - for (; it.current(); ++it) - delete it.current(); + std::list < HWPPara* >::iterator it = caption.begin(); + for (; it != caption.end(); ++it) + delete ⁢ delete[]plists; } @@ -368,9 +370,9 @@ Picture::~Picture(void) if( pictype == PICTYPE_DRAW && picinfo.picdraw.hdo ) delete (HWPDrawingObject *) picinfo.picdraw.hdo; - LinkedListIterator < HWPPara > it(&caption); - for (; it.current(); ++it) - delete it.current(); + std::list < HWPPara* >::iterator it = caption.begin(); + for (; it != caption.end(); ++it) + delete ⁢ } @@ -390,27 +392,27 @@ hunit Picture::Height(CharShape * sty) // hidden(15) Hidden::~Hidden(void) { - LinkedListIterator < HWPPara > it(&plist); - for (; it.current(); ++it) - delete it.current(); + std::list < HWPPara* >::iterator it = plist.begin(); + for (; it != plist.end(); ++it) + delete ⁢ } // header/footer(16) HeaderFooter::~HeaderFooter(void) { - LinkedListIterator < HWPPara > it(&plist); - for (; it.current(); ++it) - delete it.current(); + std::list < HWPPara* >::iterator it = plist.begin(); + for (; it != plist.end(); ++it) + delete ⁢ } // footnote(17) Footnote::~Footnote(void) { - LinkedListIterator < HWPPara > it(&plist); - for (; it.current(); ++it) - delete it.current(); + std::list < HWPPara* >::iterator it = plist.begin(); + for (; it != plist.end(); ++it) + delete ⁢ } diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h index bbd5a3756d12..74c771334563 100644 --- a/hwpfilter/source/hbox.h +++ b/hwpfilter/source/hbox.h @@ -29,7 +29,7 @@ #ifndef _HBOX_H_ #define _HBOX_H_ -#include "list.hxx" +#include #include "hwplib.h" #include "hwpfile.h" @@ -381,11 +381,11 @@ struct TxtBox: public FBox /** * Paragraph list */ - LinkedList *plists; + std::list *plists; /** * Caption */ - LinkedList caption; + std::list caption; TxtBox(); virtual ~TxtBox(); @@ -536,13 +536,13 @@ struct Table { Table(){}; ~Table(){ - LinkedListIterator it(&cells); - for( ; it.current(); ++it) - delete it.current(); + std::list::iterator it = cells.begin(); + for( ; it != cells.end(); ++it) + delete *it; }; Columns columns; Rows rows; - LinkedList cells; + std::list cells; TxtBox *box; }; @@ -651,7 +651,7 @@ struct Picture: public FBox PicDef picinfo; char reserved3[9]; - LinkedList caption; + std::list caption; /** * It's for the Drawing object */ @@ -697,7 +697,7 @@ struct Hidden: public HBox hchar dummy; unsigned char info[8]; // h, next, dummy - LinkedList plist; + std::list plist; Hidden(); virtual ~Hidden(); @@ -726,7 +726,7 @@ struct HeaderFooter: public HBox /** * Paragraph list of header or footer */ - LinkedList plist; + std::list plist; HeaderFooter(); virtual ~HeaderFooter(); @@ -759,7 +759,7 @@ struct Footnote: public HBox /** * Paragraph list of Footnote objects */ - LinkedList plist; + std::list plist; Footnote(); virtual ~Footnote(); diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx index e2c8352d84f4..20b368a770cb 100644 --- a/hwpfilter/source/hiodev.cxx +++ b/hwpfilter/source/hiodev.cxx @@ -40,6 +40,8 @@ # include #endif +#include + #include "hwplib.h" #include "hgzip.h" #include "hiodev.h" diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx index 06a5786d90ea..9544f7ee0b8a 100644 --- a/hwpfilter/source/hpara.cxx +++ b/hwpfilter/source/hpara.cxx @@ -28,6 +28,8 @@ #include "precompile.h" +#include + #include "hwplib.h" #include "hwpfile.h" #include "hpara.h" diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index 6de5198a1018..1631c7a7a4ca 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -43,6 +43,8 @@ #include "hcode.h" #include "hstream.h" +#include + #define HWPHeadLen 128 #define HWPSummaryLen 1008 @@ -75,22 +77,22 @@ HWPFile::~HWPFile() delete oledata; delete hiodev; - LinkedListIterator < ColumnInfo > it_column(&columnlist); - for (; it_column.current(); ++it_column) - delete it_column.current(); + std::list < ColumnInfo* >::iterator it_column = columnlist.begin(); + for (; it_column != columnlist.end(); ++it_column) + delete *it_column; - LinkedListIterator < HWPPara > it(&plist); - for (; it.current(); ++it) - delete it.current(); + std::list < HWPPara* >::iterator it = plist.begin(); + for (; it != plist.end(); ++it) + delete *it; - LinkedListIterator < Table > tbl(&tables); - for (; tbl.current(); ++tbl) - delete tbl.current(); + std::list < Table* >::iterator tbl = tables.begin(); + for (; tbl != tables.end(); ++tbl) + delete *tbl; - LinkedListIterator < HyperText > hyp(&hyperlist); - for (; hyp.current(); ++hyp) + std::list < HyperText* >::iterator hyp = hyperlist.begin(); + for (; hyp != hyperlist.end(); ++hyp) { - delete hyp.current(); + delete *hyp; } } @@ -248,10 +250,8 @@ bool HWPFile::ParaListRead(void) return ReadParaList(plist); } -bool HWPFile::ReadParaList(LinkedList < HWPPara > &aplist, unsigned char flag) +bool HWPFile::ReadParaList(std::list < HWPPara* > &aplist, unsigned char flag) { - LinkedListIterator < HWPPara > it(&aplist); - HWPPara *spNode = new HWPPara; unsigned char tmp_etcflag; unsigned char prev_etcflag = 0; @@ -264,8 +264,8 @@ bool HWPFile::ReadParaList(LinkedList < HWPPara > &aplist, unsigned char flag) } if (spNode->nch && spNode->reuse_shape) { - if (aplist.count()){ - spNode->pshape = aplist.last()->pshape; + if (aplist.size()){ + spNode->pshape = aplist.back()->pshape; } else{ spNode->nch = 0; @@ -276,9 +276,9 @@ bool HWPFile::ReadParaList(LinkedList < HWPPara > &aplist, unsigned char flag) if( spNode->nch ) AddParaShape( &spNode->pshape ); - if (aplist.count()) - aplist.last()->SetNext(spNode); - aplist.insert(spNode, -1); + if (aplist.size()) + aplist.back()->SetNext(spNode); + aplist.push_back(spNode); spNode = new HWPPara; } delete spNode; @@ -310,7 +310,7 @@ bool HWPFile::TagsRead(void) EmPicture *emb = new EmPicture(size); if (true == emb->Read(*this)) - emblist.insert(emb, -1); + emblist.push_back(emb); else delete emb; } @@ -330,7 +330,7 @@ bool HWPFile::TagsRead(void) { HyperText *hypert = new HyperText; hypert->Read(*this); - hyperlist.insert(hypert, -1); + hyperlist.push_back(hypert); } break; } @@ -377,21 +377,27 @@ bool HWPFile::TagsRead(void) ColumnDef *HWPFile::GetColumnDef(int num) { - ColumnInfo *cinfo = columnlist.find(num); - if( cinfo ) - return cinfo->coldef; + std::list::iterator it = columnlist.begin(); + + for(int i = 0; it != columnlist.end() ; ++it, i++){ + if( i == num ) + break; + } + + if( it != columnlist.end() ) + return (*it)->coldef; else return 0; } /* @return ε 1 Ѵ. */ int HWPFile::GetPageMasterNum(int page) { - LinkedListIterator it(&columnlist); + std::list::iterator it = columnlist.begin(); ColumnInfo *now = 0; int i; - for( i = 1 ; it.current() ; ++it, i++){ - now = it.current(); + for( i = 1 ; it != columnlist.end() ; ++it, i++){ + now = *it; if( page < now->start_page ) return i-1; } @@ -400,7 +406,15 @@ int HWPFile::GetPageMasterNum(int page) HyperText *HWPFile::GetHyperText() { - return hyperlist.find(currenthyper++); + std::list::iterator it = hyperlist.begin(); + + for( int i = 0; it != hyperlist.end(); ++it, i++ ){ + if( i == currenthyper ) + break; + } + + currenthyper++; + return *it; } EmPicture *HWPFile::GetEmPicture(Picture * pic) @@ -411,10 +425,10 @@ EmPicture *HWPFile::GetEmPicture(Picture * pic) name[1] = 'W'; name[2] = 'P'; - LinkedListIterator < EmPicture > it(&emblist); - for (; it.current(); ++it) - if (strcmp(name, it.current()->name) == 0) - return it.current(); + std::list < EmPicture* >::iterator it = emblist.begin(); + for (; it != emblist.end(); ++it) + if (strcmp(name, (*it)->name) == 0) + return *it; return 0; } @@ -424,10 +438,10 @@ EmPicture *HWPFile::GetEmPictureByName(char * name) name[1] = 'W'; name[2] = 'P'; - LinkedListIterator < EmPicture > it(&emblist); - for (; it.current(); ++it) - if (strcmp(name, it.current()->name) == 0) - return it.current(); + std::list < EmPicture* >::iterator it = emblist.begin(); + for (; it != emblist.end(); ++it) + if (strcmp(name, (*it)->name) == 0) + return *it; return 0; } @@ -436,52 +450,102 @@ void HWPFile::AddBox(FBox * box) { // LATER if we don't use box->next(), // AddBox() and GetBoxHead() are useless; - if (blist.count()) + if (blist.size()) { - box->prev = blist.last(); + box->prev = blist.back(); box->prev->next = box; } else box->prev = 0; - blist.insert(box, -1); + blist.push_back(box); } ParaShape *HWPFile::getParaShape(int index) { - return pslist.find(index); + std::list::iterator it = pslist.begin(); + + for( int i = 0; it != pslist.end(); ++it, i++ ){ + if( i == index ) + break; + } + + return *it; } CharShape *HWPFile::getCharShape(int index) { - return cslist.find(index); + std::list::iterator it = cslist.begin(); + + for( int i = 0; it != cslist.end(); ++it, i++ ){ + if( i == index ) + break; + } + + return *it; } FBoxStyle *HWPFile::getFBoxStyle(int index) { - return fbslist.find(index); + std::list::iterator it = fbslist.begin(); + + for( int i = 0; it != fbslist.end(); ++it, i++ ){ + if( i == index ) + break; + } + + return *it; } DateCode *HWPFile::getDateCode(int index) { - return datecodes.find(index); + std::list::iterator it = datecodes.begin(); + + for( int i = 0; it != datecodes.end(); ++it, i++ ){ + if( i == index ) + break; + } + + return *it; } HeaderFooter *HWPFile::getHeaderFooter(int index) { - return headerfooters.find(index); + std::list::iterator it = headerfooters.begin(); + + for( int i = 0; it != headerfooters.end(); ++it, i++ ){ + if( i == index ) + break; + } + + return *it; } ShowPageNum *HWPFile::getPageNumber(int index) { - return pagenumbers.find(index); + std::list::iterator it = pagenumbers.begin(); + + for( int i = 0; it != pagenumbers.end(); ++it, i++ ){ + if( i == index ) + break; + } + + return *it; + } Table *HWPFile::getTable(int index) { - return tables.find(index); + std::list::iterator it = tables.begin(); + + for( int i = 0; it != tables.end(); ++it, i++ ){ + if( i == index ) + break; + } + + return *it; } void HWPFile::AddParaShape(ParaShape * pshape) @@ -508,7 +572,7 @@ void HWPFile::AddParaShape(ParaShape * pshape) if( value == 0 || nscount ) { pshape->index = ++pcount; - pslist.insert(pshape, -1); + pslist.push_back(pshape); } else pshape->index = value; @@ -521,7 +585,7 @@ void HWPFile::AddCharShape(CharShape * cshape) if( value == 0 ) { cshape->index = ++ccount; - cslist.insert(cshape, -1); + cslist.push_back(cshape); } else cshape->index = value; @@ -530,13 +594,13 @@ void HWPFile::AddCharShape(CharShape * cshape) void HWPFile::AddColumnInfo() { ColumnInfo *cinfo = new ColumnInfo(m_nCurrentPage); - columnlist.insert(cinfo, -1); + columnlist.push_back(cinfo); setMaxSettedPage(); } void HWPFile::SetColumnDef(ColumnDef *coldef) { - ColumnInfo *cinfo = columnlist.last(); + ColumnInfo *cinfo = columnlist.back(); if( cinfo->bIsSet ) return; cinfo->coldef = coldef; @@ -546,38 +610,38 @@ void HWPFile::SetColumnDef(ColumnDef *coldef) void HWPFile::AddDateFormat(DateCode * hbox) { hbox->key = sal::static_int_cast(++datecodecount); - datecodes.insert(hbox, -1); + datecodes.push_back(hbox); } void HWPFile::AddPageNumber(ShowPageNum * hbox) { - pagenumbers.insert(hbox, -1); + pagenumbers.push_back(hbox); } void HWPFile::AddHeaderFooter(HeaderFooter * hbox) { - headerfooters.insert(hbox, -1); + headerfooters.push_back(hbox); } void HWPFile::AddTable(Table * hbox) { - tables.insert(hbox, -1); + tables.push_back(hbox); } void HWPFile::AddFBoxStyle(FBoxStyle * fbstyle) { - fbslist.insert(fbstyle, -1); + fbslist.push_back(fbstyle); } int HWPFile::compareCharShape(CharShape *shape) { - int count = cslist.count(); + int count = cslist.size(); if( count > 0 ) { CharShape *cshape=0; for(int i = 0; i< count; i++) { - cshape = cslist.find(i); + cshape = getCharShape(i); if( shape->size == cshape->size && shape->font[0] == cshape->font[0] && @@ -598,13 +662,13 @@ int HWPFile::compareCharShape(CharShape *shape) int HWPFile::compareParaShape(ParaShape *shape) { - int count = pslist.count(); + int count = pslist.size(); if( count > 0 ) { ParaShape *pshape=0; for(int i = 0; i< count; i++) { - pshape = pslist.find(i); + pshape = getParaShape(i); if( shape->left_margin == pshape->left_margin && shape->right_margin == pshape->right_margin && shape->pspacing_prev == pshape->pspacing_prev && diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h index 8f71c4aa0d08..e389fdf378b8 100644 --- a/hwpfilter/source/hwpfile.h +++ b/hwpfilter/source/hwpfile.h @@ -34,6 +34,7 @@ #ifndef _HWPFILE_H_ #define _HWPFILE_H_ +#include #include #include #include @@ -42,7 +43,6 @@ #include "hfont.h" #include "hstyle.h" #include "hpara.h" -#include "list.hxx" #define HWPIDLen 30 #define V20SIGNATURE "HWP Document File V2.00 \032\1\2\3\4\5" @@ -166,7 +166,7 @@ class DLLEXPORT HWPFile /** * Reads main paragraph list */ - bool ReadParaList(LinkedList &plist, unsigned char flag = 0); + bool ReadParaList(std::list &aplist, unsigned char flag = 0); /** * Sets if the stream is compressed */ @@ -234,13 +234,13 @@ class DLLEXPORT HWPFile HWPInfo *GetHWPInfo(void) { return &_hwpInfo; } HWPFont *GetHWPFont(void) { return &_hwpFont; } HWPStyle *GetHWPStyle(void) { return &_hwpStyle; } - HWPPara *GetFirstPara(void) { return plist.first(); } - HWPPara *GetLastPara(void) { return plist.last(); } + HWPPara *GetFirstPara(void) { return plist.front(); } + HWPPara *GetLastPara(void) { return plist.back(); } EmPicture *GetEmPicture(Picture *pic); EmPicture *GetEmPictureByName(char * name); HyperText *GetHyperText(); - FBox *GetBoxHead (void) { return blist.count()?blist.first():0; } + FBox *GetBoxHead (void) { return blist.size()?blist.front():0; } ParaShape *getParaShape(int); CharShape *getCharShape(int); FBoxStyle *getFBoxStyle(int); @@ -249,14 +249,14 @@ class DLLEXPORT HWPFile ShowPageNum *getPageNumber(int); Table *getTable(int); - int getParaShapeCount(){ return pslist.count(); } - int getCharShapeCount(){ return cslist.count(); } - int getFBoxStyleCount(){ return fbslist.count(); } - int getDateFormatCount(){ return datecodes.count(); } - int getHeaderFooterCount(){ return headerfooters.count(); } - int getPageNumberCount(){ return pagenumbers.count(); } - int getTableCount(){ return tables.count(); } - int getColumnCount(){ return columnlist.count(); } + int getParaShapeCount(){ return pslist.size(); } + int getCharShapeCount(){ return cslist.size(); } + int getFBoxStyleCount(){ return fbslist.size(); } + int getDateFormatCount(){ return datecodes.size(); } + int getHeaderFooterCount(){ return headerfooters.size(); } + int getPageNumberCount(){ return pagenumbers.size(); } + int getTableCount(){ return tables.size(); } + int getColumnCount(){ return columnlist.size(); } int getMaxSettedPage(){ return m_nMaxSettedPage; } void setMaxSettedPage(){ m_nMaxSettedPage = m_nCurrentPage; } @@ -284,22 +284,22 @@ class DLLEXPORT HWPFile HWPInfo _hwpInfo; HWPFont _hwpFont; HWPStyle _hwpStyle; - LinkedList columnlist; + std::list columnlist; // paragraph linked list - LinkedList plist; + std::list plist; // floating box linked list - LinkedList blist; + std::list blist; // embedded picture list(tag datas) - LinkedList emblist; - LinkedList hyperlist; + std::list emblist; + std::list hyperlist; int currenthyper; - LinkedList pslist; /* Ÿǽ ʿ */ - LinkedList cslist; - LinkedList fbslist; - LinkedList datecodes; - LinkedList headerfooters; - LinkedList pagenumbers; - LinkedList tables; + std::list pslist; /* Ÿǽ ʿ */ + std::list cslist; + std::list fbslist; + std::list datecodes; + std::list headerfooters; + std::list pagenumbers; + std::list tables; // for global document handling static HWPFile *cur_doc; diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index b67b814fe211..db905f0c8986 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -28,7 +28,7 @@ #include "precompile.h" -#include "list.hxx" +#include #include "hwpfile.h" #include "hbox.h" @@ -294,7 +294,7 @@ int TxtBox::Read(HWPFile & hwpf) } if (ncell == 1) style.cell = &cell[0]; - plists = new LinkedList < HWPPara >[ncell]; + plists = new std::list < HWPPara* >[ncell]; for (ii = 0; ii < ncell; ii++) hwpf.ReadParaList(plists[ii]); // caption @@ -342,7 +342,7 @@ int TxtBox::Read(HWPFile & hwpf) } } for( ii = 0 ; ii < ncell ; ii++ ){ - tbl->cells.insert(pArr[ii]); + tbl->cells.push_back(pArr[ii]); } tbl->box = this; hwpf.AddTable(tbl); diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 19cd8ec4bd06..4d4732523a26 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -1121,7 +1121,7 @@ void HwpReader::makeMasterStyles() d->bInHeader = sal_True; d->pPn = pPage->pagenumber; } - parsePara(pPage->header->plist.first()); + parsePara(pPage->header->plist.front()); d->bInHeader = sal_False; d->pPn = 0L; rendEl(ascii("style:header")); @@ -1136,7 +1136,7 @@ void HwpReader::makeMasterStyles() d->pPn = pPage->pagenumber; d->nPnPos = 3; } - parsePara(pPage->header_even->plist.first()); + parsePara(pPage->header_even->plist.front()); d->bInHeader = sal_False; d->pPn = 0L; d->nPnPos = 0; @@ -1171,7 +1171,7 @@ void HwpReader::makeMasterStyles() d->nPnPos = 1; d->pPn = pPage->pagenumber; } - parsePara(pPage->header_odd->plist.first()); + parsePara(pPage->header_odd->plist.front()); d->bInHeader = sal_False; d->pPn = 0L; d->nPnPos = 0; @@ -1222,7 +1222,7 @@ void HwpReader::makeMasterStyles() d->bInHeader = sal_True; d->pPn = pPage->pagenumber; } - parsePara(pPage->footer->plist.first()); + parsePara(pPage->footer->plist.front()); d->bInHeader = sal_False; d->pPn = 0L; rendEl(ascii("style:footer")); @@ -1237,7 +1237,7 @@ void HwpReader::makeMasterStyles() d->pPn = pPage->pagenumber; d->nPnPos = 3; } - parsePara(pPage->footer_even->plist.first()); + parsePara(pPage->footer_even->plist.front()); d->bInHeader = sal_False; d->pPn = 0L; d->nPnPos = 0; @@ -1272,7 +1272,7 @@ void HwpReader::makeMasterStyles() d->pPn = pPage->pagenumber; d->nPnPos = 1; } - parsePara(pPage->footer_odd->plist.first()); + parsePara(pPage->footer_odd->plist.front()); d->bInHeader = sal_False; d->pPn = 0L; d->nPnPos = 0; @@ -1917,9 +1917,16 @@ void HwpReader::makeTableStyle(Table *tbl) } // --------------- cell --------------------- // - for( i = 0 ; i < tbl->cells.count(); i++ ) + for( i = 0 ; i < (int)tbl->cells.size(); i++ ) { - TCell *tcell = tbl->cells.find(i); + std::list::iterator it = tbl->cells.begin(); + + for( int ii = 0; it != tbl->cells.end(); ++it, ii++ ){ + if( ii == i ) + break; + } + + TCell *tcell = *it; sprintf(buf,"Table%d.%c%d",hbox->style.boxnum, 'A'+ tcell->nColumnIndex, tcell->nRowIndex +1); padd(ascii("style:name"), sXML_CDATA, ascii( buf )); padd(ascii("style:family"), sXML_CDATA,ascii("table-cell")); @@ -3478,9 +3485,16 @@ void HwpReader::makeTable(TxtBox * hbox) // ----------- cell ---------------- // int j = -1, k = -1; - for( i = 0 ; i < tbl->cells.count(); i++ ) + for( i = 0 ; i < (int)tbl->cells.size(); i++ ) { - TCell *tcell = tbl->cells.find(i); + std::list::iterator it = tbl->cells.begin(); + + for( int ii = 0; it != tbl->cells.end(); ++it, ii++ ){ + if( ii == i ) + break; + } + + TCell *tcell = *it; if( tcell->nRowIndex > j ) { if( j > k ) @@ -3509,7 +3523,7 @@ void HwpReader::makeTable(TxtBox * hbox) padd(ascii("table:protected"), sXML_CDATA,ascii("true")); rstartEl(ascii("table:table-cell"), rList); pList->clear(); - parsePara(hbox->plists[tcell->pCell->key].first()); + parsePara(hbox->plists[tcell->pCell->key].front()); rendEl(ascii("table:table-cell")); } rendEl(ascii("table:table-row")); @@ -3565,7 +3579,7 @@ void HwpReader::makeTextBox(TxtBox * hbox) pList->clear(); if( hbox->cap_pos % 2 ) /* 캡션이 위쪽에 위치한다 */ { - parsePara(hbox->caption.first()); + parsePara(hbox->caption.front()); } padd( ascii("text:style-name"), sXML_CDATA, ascii("Standard")); rstartEl(ascii("text:p"), rList); @@ -3633,7 +3647,7 @@ void HwpReader::makeTextBox(TxtBox * hbox) /* 캡션이 존재하고, 위쪽에 있으면 */ if( hbox->style.cap_len > 0 && (hbox->cap_pos % 2) && hbox->type == TBL_TYPE ) { - parsePara(hbox->caption.first()); + parsePara(hbox->caption.front()); } if( hbox->type == TBL_TYPE) // Is Table { @@ -3641,12 +3655,12 @@ void HwpReader::makeTextBox(TxtBox * hbox) } else // Is TextBox { - parsePara(hbox->plists[0].first()); + parsePara(hbox->plists[0].front()); } /* 캡션이 존재하고, 아래쪽에 있으면 */ if( hbox->style.cap_len > 0 && !(hbox->cap_pos % 2) && hbox->type == TBL_TYPE) { - parsePara(hbox->caption.first()); + parsePara(hbox->caption.front()); } rendEl(ascii("draw:text-box")); // Caption exist and it is text-box @@ -3655,7 +3669,7 @@ void HwpReader::makeTextBox(TxtBox * hbox) rendEl( ascii("text:p")); if( !(hbox->cap_pos % 2)) { - parsePara(hbox->caption.first()); + parsePara(hbox->caption.front()); } rendEl( ascii("draw:text-box")); } @@ -3684,7 +3698,7 @@ void HwpReader::makeFormula(TxtBox * hbox) hchar dest[3]; size_t l = 0; - pPar = hbox->plists[0].first(); + pPar = hbox->plists[0].front(); while( pPar ) { for( n = 0; n < pPar->nch && pPar->hhstr[n]->hh; @@ -3822,7 +3836,7 @@ void HwpReader::makePicture(Picture * hbox) pList->clear(); if( hbox->cap_pos % 2 ) /* 캡션이 위쪽에 위치한다 */ { - parsePara(hbox->caption.first()); + parsePara(hbox->caption.front()); } padd( ascii("text:style-name"), sXML_CDATA, ascii("Standard")); rstartEl(ascii("text:p"), rList); @@ -3967,7 +3981,7 @@ void HwpReader::makePicture(Picture * hbox) rendEl( ascii("text:p")); if( !(hbox->cap_pos % 2)) /* 캡션이 아래쪽에 위치하면, */ { - parsePara(hbox->caption.first()); + parsePara(hbox->caption.front()); } rendEl( ascii("draw:text-box")); } @@ -4608,7 +4622,7 @@ void HwpReader::makeHidden(Hidden * hbox) padd(ascii("text:string-value"), sXML_CDATA, ascii("")); rstartEl(ascii("text:hidden-text"), rList); pList->clear(); - HWPPara *para = hbox->plist.first(); + HWPPara *para = hbox->plist.front(); while (para) { @@ -4644,7 +4658,7 @@ void HwpReader::makeFootnote(Footnote * hbox) rchars(ascii(Int2Str(hbox->number, "%d", buf))); rendEl(ascii("text:endnote-citation")); rstartEl(ascii("text:endnote-body"), rList); - parsePara(hbox->plist.first()); + parsePara(hbox->plist.front()); rendEl(ascii("text:endnote-body")); rendEl(ascii("text:endnote")); } @@ -4661,7 +4675,7 @@ void HwpReader::makeFootnote(Footnote * hbox) rchars(ascii(Int2Str(hbox->number, "%d", buf))); rendEl(ascii("text:footnote-citation")); rstartEl(ascii("text:footnote-body"), rList); - parsePara(hbox->plist.first()); + parsePara(hbox->plist.front()); rendEl(ascii("text:footnote-body")); rendEl(ascii("text:footnote")); } -- cgit