1 // Created on: 2002-04-30
2 // Created by: Alexander KARTOMIN (akm)
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef QANCollection_FuncLists_HeaderFile
17 #define QANCollection_FuncLists_HeaderFile
19 // ===================== Test methods of List type ==========================
20 ////////////////////////////////void TestList (QANCollection_List& theL)
21 void TestList (QANCollection_ListFunc& theL)
24 Standard_Integer iExt=theL.Extent();
27 printf ("Info: testing List(%d)\n", iExt);
28 // Append(2), Prepend(2), InsertBefore(2), InsertAfter(2),
29 // Remove, RemoveFirst, First, Last
31 ////////////////////////////////QANCollection_List aL, aL1;
32 QANCollection_ListFunc aL, aL1;
36 aL.Append (anItem); // #1
37 aL.Append (aL1); // #2
39 aL1.Prepend (anItem); // #3
40 aL1.Prepend (aL); // #4
41 ////////////////////////////////QANCollection_List::Iterator anI(theL);
42 QANCollection_ListFunc::Iterator anI(theL);
46 theL.InsertBefore (anItem, anI); // #5
47 theL.InsertBefore (aL1, anI); // #6
49 theL.InsertAfter (anItem, anI); // #7
50 theL.InsertAfter (aL, anI); // #8
51 theL.Remove (anI); // #9
52 if (theL.Extent() > 0)
53 theL.RemoveFirst(); // #10
57 theL.Prepend (anItem);
58 PrintItem(theL.First());
59 PrintItem(theL.Last());
62 // Copy constructor + operator=
63 ////////////////////////////////aL = QANCollection_List(theL);
64 aL = QANCollection_ListFunc(theL);
67 AssignCollection (theL, aL);
73 // ===================== Test methods of Sequence type ========================
74 ////////////////////////////////void TestSequence (QANCollection_Sequence& theS)
75 void TestSequence (QANCollection_SequenceFunc& theS)
79 printf ("Info: testing Sequence\n");
82 ////////////////////////////////QANCollection_Sequence aS, aS1;
83 QANCollection_SequenceFunc aS, aS1;
84 // Append(2), Prepend(2), InsertBefore(2), InsertAfter(2),
85 // Remove, RemoveFirst, First, Last
89 aS.Append (anItem); // #1
90 aS.Append (aS1); // #2
92 aS1.Prepend (anItem); // #3
93 aS1.Prepend (aS); // #4
94 if (theS.Length() > 0)
97 theS.InsertBefore (1, anItem); // #5
98 theS.InsertBefore (2, aS1); // #6
100 theS.InsertAfter (1, anItem); // #7
101 theS.InsertAfter (2, aS); // #8
102 theS.Remove (1); // #9
103 if (theS.Length() > 0)
104 theS.Remove(1); // #10
108 theS.Prepend (anItem);
109 PrintItem(theS.First());
110 PrintItem(theS.Last());
118 ////////////////////////////////Handle(QANCollection_HSequence) aHS = new QANCollection_HSequence(aS1);
119 Handle(QANCollection_HSequenceFunc) aHS = new QANCollection_HSequenceFunc(aS1);
120 theS.Split (3, aHS->ChangeSequence());
123 AssignCollection (theS, aS);