0
|
1 |
/*
|
|
2 |
* Copyright (c) 2004 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef _C_SYS_INI_H_
|
|
19 |
#define _C_SYS_INI_H_
|
|
20 |
|
|
21 |
// Includes
|
|
22 |
#include <e32std.h>
|
|
23 |
|
|
24 |
|
|
25 |
// Class definition
|
|
26 |
class CSysIni
|
|
27 |
{
|
|
28 |
protected:
|
|
29 |
CSysIni();
|
|
30 |
void CostructL(const TDesC& filename);
|
|
31 |
public:
|
|
32 |
IMPORT_C virtual ~CSysIni();
|
|
33 |
|
|
34 |
IMPORT_C static CSysIni* NewL(const TDesC& filename);
|
|
35 |
|
|
36 |
// Search for a boolean (0/1)
|
|
37 |
IMPORT_C bool // Returns true if line was found
|
|
38 |
SeekBool(
|
|
39 |
const char* string); // Search for this string
|
|
40 |
|
|
41 |
// Search for a string
|
|
42 |
IMPORT_C bool // Returns true if line was found
|
|
43 |
SeekStr(
|
|
44 |
const char* string // Search for this string
|
|
45 |
, TDes8& output); // OUT: string
|
|
46 |
|
|
47 |
// Fetch a whole line eg. DESCRIPTION This is a description
|
|
48 |
IMPORT_C bool // Returns true if line was found
|
|
49 |
SeekLine(
|
|
50 |
const char* string // Search for this string
|
|
51 |
, TDes8& output); // OUT: Rest of the line
|
|
52 |
|
|
53 |
// Seach for single integer eg. UDP_PORT 2948
|
|
54 |
IMPORT_C bool // Returns true if line was found
|
|
55 |
SeekInt(
|
|
56 |
const char* string // Search for this string
|
|
57 |
, int& i); // OUT: found int
|
|
58 |
|
|
59 |
// Serach for integer lists. eg. UDP_PORTS 2948, 2949
|
|
60 |
IMPORT_C bool // Returns true if line was found
|
|
61 |
SeekIntList(
|
|
62 |
const char* string // Search for this string
|
|
63 |
, int* results // OUT: results table
|
|
64 |
, int max_results // IN: max results
|
|
65 |
, int& actual_results); // OUT: Number of actual results
|
|
66 |
|
|
67 |
IMPORT_C int GetDataLength(); // Return length of actual data in bytes
|
|
68 |
|
|
69 |
protected:
|
|
70 |
inline bool SeekField(const char* string, TDes8& p, bool allow_spaces = false);
|
|
71 |
|
|
72 |
void RemoveComments(TPtr8& src);
|
|
73 |
|
|
74 |
HBufC8* iData;
|
|
75 |
HBufC8* iFiltered;
|
|
76 |
TPtr8 iFil;
|
|
77 |
};
|
|
78 |
|
|
79 |
#endif // _C_SYS_INI_H_
|