sdkcreationmw/sdkcommonutils/util/Inc/SysIni.h
author rajpuroh
Wed, 21 Apr 2010 09:56:53 +0530
changeset 1 ac50fd48361b
parent 0 b26acd06ea60
permissions -rw-r--r--
Second Contribution
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
#ifndef _C_SYS_INI_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#define _C_SYS_INI_H_
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
// Includes
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
#include <e32std.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
// Class definition 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
class CSysIni  
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
	{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
protected:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
	CSysIni();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
	void CostructL(const TDesC& filename);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
public:	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
	IMPORT_C virtual ~CSysIni();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
	IMPORT_C static CSysIni* NewL(const TDesC& filename);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
	// Search for a boolean (0/1)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
	IMPORT_C bool					// Returns true if line was found
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
		SeekBool(
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
		const char* string);		// Search for this string
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
	// Search for a string 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
	IMPORT_C bool					// Returns true if line was found
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
		SeekStr(				
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
		const char* string			// Search for this string
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
		, TDes8& output);			// OUT: string
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
	// Fetch a whole line eg. DESCRIPTION This is a description
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
	IMPORT_C bool					// Returns true if line was found 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
		SeekLine(
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
		  const char* string		// Search for this string
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
		, TDes8& output);			// OUT: Rest of the line
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
	// Seach for single integer eg. UDP_PORT 2948
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
	IMPORT_C bool					// Returns true if line was found 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
		SeekInt(
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
		const char* string			// Search for this string
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
		, int& i);					// OUT: found int
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
	// Serach for integer lists. eg. UDP_PORTS 2948, 2949 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
	IMPORT_C bool					// Returns true if line was found 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
		SeekIntList(
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
		  const char* string		// Search for this string
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
		, int* results				// OUT: results table
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
		, int  max_results			// IN:  max results
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
		, int& actual_results);		// OUT: Number of actual results
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
	IMPORT_C int GetDataLength();	// Return length of actual data in bytes
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
protected:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
	inline bool SeekField(const char* string, TDes8& p, bool allow_spaces = false);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
	void RemoveComments(TPtr8& src);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
	HBufC8*	iData;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
	HBufC8*	iFiltered;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
	TPtr8	iFil;	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
	};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
#endif // _C_SYS_INI_H_