|
1 /* |
|
2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CStringList header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef _STRINGLIST_H_ |
|
20 #define _STRINGLIST_H_ |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> // for CDesCArrayFlat |
|
26 #include <f32file.h> |
|
27 |
|
28 // |
|
29 // CStringList is used for storing lines of text. |
|
30 // |
|
31 NONSHARABLE_CLASS( CStringList ) : public CBase |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Two-phase constructor. The created instance is placed to cleanup stack |
|
36 * @param aFileName Default KNullDesC |
|
37 * @return CStringList instance |
|
38 */ |
|
39 static CStringList* NewLC(); |
|
40 /** |
|
41 * Two-phase constructor. |
|
42 * @param aFileName Default KNullDesC |
|
43 * @return CStringList instance |
|
44 */ |
|
45 static CStringList* NewL(); |
|
46 /** |
|
47 * Destructor |
|
48 * @return none |
|
49 */ |
|
50 ~CStringList(); |
|
51 |
|
52 public: |
|
53 /** |
|
54 * Returns the count of lines |
|
55 * @return The count |
|
56 */ |
|
57 TInt Count() const; |
|
58 /** |
|
59 * Returns pointer to the string |
|
60 * @param aIndex The position |
|
61 * @return String pointer |
|
62 */ |
|
63 TPtrC16 ReadPtr(TInt aIndex); |
|
64 /** |
|
65 * Copies a string / strings |
|
66 * @param aSource Source buffer |
|
67 * @param aStart A start position |
|
68 * @param aStop A stop position |
|
69 * @return none |
|
70 */ |
|
71 void CopyL(CStringList* aSource, TInt aStart, TInt aStop); |
|
72 /** |
|
73 * Resets iLines |
|
74 * @return none |
|
75 */ |
|
76 void Reset(); |
|
77 /** |
|
78 * Returns the mark |
|
79 * @return Mark value |
|
80 */ |
|
81 TInt Mark() const; |
|
82 /** |
|
83 * Sets mark |
|
84 * @param aMark The mark value |
|
85 * @return none |
|
86 */ |
|
87 void SetMark(TInt aMark); |
|
88 /** |
|
89 * Read strings from file. |
|
90 * @param aText The tag buffer |
|
91 * @return none |
|
92 */ |
|
93 void ReadFromFileL( RFs& aFs, const TDesC& aName ); |
|
94 |
|
95 private: |
|
96 /** |
|
97 * Default constuctor |
|
98 * @return none |
|
99 */ |
|
100 CStringList(); |
|
101 /** |
|
102 * Initializes member data |
|
103 * @param aFileName The file name |
|
104 * @return none |
|
105 */ |
|
106 void ConstructL(); |
|
107 /** |
|
108 * Creates a panic |
|
109 * @param aPanic Panic code |
|
110 * @return none |
|
111 */ |
|
112 void Panic(TInt aPanic) const; |
|
113 /** |
|
114 * Copies the string |
|
115 * @param aTarget Target string |
|
116 * @param aSource Source string |
|
117 * @return ETrue if successful |
|
118 */ |
|
119 TBool StrCopy(TDes& aTarget, const TDesC& aSource) const; |
|
120 /** |
|
121 * Writes a string |
|
122 * @param aText The string |
|
123 * @return none |
|
124 */ |
|
125 void WriteL(const TDesC& aText); |
|
126 /** |
|
127 * Internalizes from file |
|
128 * @param aFileName The name of the file |
|
129 * @return none |
|
130 */ |
|
131 void InternalizeL( RFs& aFs, const TDesC& aFileName ); |
|
132 |
|
133 private: |
|
134 TInt iMark; |
|
135 CDesCArrayFlat* iLines; |
|
136 }; |
|
137 |
|
138 #endif |
|
139 |
|
140 // End of file |
|
141 |
|
142 |