|
1 /* |
|
2 * Copyright (c) 2009 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: Class used to read text files iterating lines. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CATFILEREADER_H__ |
|
20 #define __CATFILEREADER_H__ |
|
21 |
|
22 #include "ATCommonDefines.h" |
|
23 |
|
24 class CATFileReader |
|
25 { |
|
26 public: |
|
27 /** |
|
28 * Constructor. |
|
29 */ |
|
30 CATFileReader(); |
|
31 /** |
|
32 * Destructor. |
|
33 */ |
|
34 ~CATFileReader(); |
|
35 #ifndef MODULE_TEST |
|
36 private: |
|
37 #endif |
|
38 /** |
|
39 * Prevent copy of this class. |
|
40 */ |
|
41 CATFileReader& operator =( const CATFileReader& /*other*/ ) { } |
|
42 CATFileReader( const CATFileReader& /*other*/ ) { } |
|
43 public: |
|
44 /** |
|
45 * Open/Read file. |
|
46 * @param cFile file to be read/opened. |
|
47 * @return true if succesful. |
|
48 */ |
|
49 bool Open( const char* cFile ); |
|
50 /** |
|
51 * Close file. |
|
52 * @return true if succesful. |
|
53 */ |
|
54 bool Close( void ); |
|
55 /** |
|
56 * Get line from file. |
|
57 * @sLine where line content is stored. |
|
58 * @return true if lines left. |
|
59 */ |
|
60 bool GetLine( string& sLine ); |
|
61 /** |
|
62 * Set the line delimiter. |
|
63 * @param cDelimiter char that ends the line. |
|
64 */ |
|
65 void SetDelimiter( char cDelimiter ); |
|
66 /** |
|
67 * Get current line delimiter. |
|
68 * @return char that ends the line. |
|
69 */ |
|
70 char GetDelimiter() const; |
|
71 #ifndef MODULE_TEST |
|
72 private: |
|
73 #endif |
|
74 // Stream where file content is stored. |
|
75 stringstream m_stream; |
|
76 // Line delimiting character used. |
|
77 char m_cDelimiter; |
|
78 }; |
|
79 #endif |
|
80 // EOF |