| 
sl@0
 | 
     1  | 
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
  | 
| 
sl@0
 | 
     2  | 
// All rights reserved.
  | 
| 
sl@0
 | 
     3  | 
// This component and the accompanying materials are made available
  | 
| 
sl@0
 | 
     4  | 
// under the terms of "Eclipse Public License v1.0"
  | 
| 
sl@0
 | 
     5  | 
// which accompanies this distribution, and is available
  | 
| 
sl@0
 | 
     6  | 
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
  | 
| 
sl@0
 | 
     7  | 
//
  | 
| 
sl@0
 | 
     8  | 
// Initial Contributors:
  | 
| 
sl@0
 | 
     9  | 
// Nokia Corporation - initial contribution.
  | 
| 
sl@0
 | 
    10  | 
//
  | 
| 
sl@0
 | 
    11  | 
// Contributors:
  | 
| 
sl@0
 | 
    12  | 
//
  | 
| 
sl@0
 | 
    13  | 
// Description:
  | 
| 
sl@0
 | 
    14  | 
// @internalComponent
  | 
| 
sl@0
 | 
    15  | 
// 
  | 
| 
sl@0
 | 
    16  | 
//
  | 
| 
sl@0
 | 
    17  | 
  | 
| 
sl@0
 | 
    18  | 
#ifndef __INIPARSERIMPL_H__
  | 
| 
sl@0
 | 
    19  | 
#define __INIPARSERIMPL_H__
  | 
| 
sl@0
 | 
    20  | 
  | 
| 
sl@0
 | 
    21  | 
#include <e32std.h>
  | 
| 
sl@0
 | 
    22  | 
#include <f32file.h>
  | 
| 
sl@0
 | 
    23  | 
#include "IniTemplate.h"
  | 
| 
sl@0
 | 
    24  | 
#include "inifile.h"
  | 
| 
sl@0
 | 
    25  | 
  | 
| 
sl@0
 | 
    26  | 
namespace BSUL
  | 
| 
sl@0
 | 
    27  | 
{
 | 
| 
sl@0
 | 
    28  | 
  | 
| 
sl@0
 | 
    29  | 
//typedef for 8 and 16 bit
  | 
| 
sl@0
 | 
    30  | 
typedef CIniLine<TDesC8,HBufC8,TPtrC8,TPtr8> CIniLine8;
  | 
| 
sl@0
 | 
    31  | 
typedef CIniLine<TDesC16,HBufC16,TPtrC16,TPtr16> CIniLine16;
  | 
| 
sl@0
 | 
    32  | 
  | 
| 
sl@0
 | 
    33  | 
typedef CIniKey<TDesC8,HBufC8,TPtrC8,CIniLine8,TPtr8,TLex8> CIniKey8;
  | 
| 
sl@0
 | 
    34  | 
typedef CIniKey<TDesC16,HBufC16,TPtrC16,CIniLine16,TPtr16,TLex16> CIniKey16;
  | 
| 
sl@0
 | 
    35  | 
  | 
| 
sl@0
 | 
    36  | 
typedef CIniSection<TDesC8,HBufC8,TPtrC8,CIniKey8,CIniLine8,TPtr8,TLex8> CIniSection8;
  | 
| 
sl@0
 | 
    37  | 
typedef CIniSection<TDesC16,HBufC16,TPtrC16,CIniKey16,CIniLine16,TPtr16,TLex16> CIniSection16;
  | 
| 
sl@0
 | 
    38  | 
  | 
| 
sl@0
 | 
    39  | 
typedef CIniSecIterImplX<TDesC8,TPtrC8,CIniSection8,CIniDocument8,CIniKey8> CIniSecIterTmpl8;
  | 
| 
sl@0
 | 
    40  | 
typedef CIniSecIterImplX<TDesC16,TPtrC16,CIniSection16,CIniDocument16,CIniKey16> CIniSecIterTmpl16;
  | 
| 
sl@0
 | 
    41  | 
  | 
| 
sl@0
 | 
    42  | 
typedef CIniDocumentTmplX<TDesC8,TPtrC8,CIniSection8,TLex8,TPtr8,HBufC8,CIniLine8,CIniKey8> CIniDocumentTmpl8;
  | 
| 
sl@0
 | 
    43  | 
typedef CIniDocumentTmplX<TDesC16,TPtrC16,CIniSection16,TLex16,TPtr16,HBufC16,CIniLine16,CIniKey16> CIniDocumentTmpl16;
  | 
| 
sl@0
 | 
    44  | 
  | 
| 
sl@0
 | 
    45  | 
typedef TBuf8<6> TPattern8;
  | 
| 
sl@0
 | 
    46  | 
typedef TBuf16<6> TPattern16;
  | 
| 
sl@0
 | 
    47  | 
  | 
| 
sl@0
 | 
    48  | 
typedef CIniFileImplX<TDesC8,TPtrC8,HBufC8,TLex8,TPtr8,TPattern8,CIniLine8> CIniFileTmpl8;
  | 
| 
sl@0
 | 
    49  | 
typedef CIniFileImplX<TDesC16,TPtrC16,HBufC16,TLex16,TPtr16,TPattern16,CIniLine16> CIniFileTmpl16;
  | 
| 
sl@0
 | 
    50  | 
  | 
| 
sl@0
 | 
    51  | 
//8 bit light
  | 
| 
sl@0
 | 
    52  | 
NONSHARABLE_CLASS(CIniFile8Impl): public CBase
  | 
| 
sl@0
 | 
    53  | 
	{
 | 
| 
sl@0
 | 
    54  | 
public:
  | 
| 
sl@0
 | 
    55  | 
	static CIniFile8Impl* NewL(RFs& aFs,const TDesC& aFileName);
  | 
| 
sl@0
 | 
    56  | 
	~CIniFile8Impl(){delete iTempImpl;}
 | 
| 
sl@0
 | 
    57  | 
	TInt FindVar(const TDesC8& aSection,const TDesC8& aKey,TPtrC8& aValue);
  | 
| 
sl@0
 | 
    58  | 
private:
  | 
| 
sl@0
 | 
    59  | 
	CIniFile8Impl(){}
 | 
| 
sl@0
 | 
    60  | 
	void ConstructL(RFs& aFs,const TDesC& aFileName);
  | 
| 
sl@0
 | 
    61  | 
	CIniFileTmpl8* iTempImpl;	
  | 
| 
sl@0
 | 
    62  | 
	};
  | 
| 
sl@0
 | 
    63  | 
	
  | 
| 
sl@0
 | 
    64  | 
//16 bit light	
  | 
| 
sl@0
 | 
    65  | 
NONSHARABLE_CLASS(CIniFile16Impl): public CBase
  | 
| 
sl@0
 | 
    66  | 
	{
 | 
| 
sl@0
 | 
    67  | 
public:
  | 
| 
sl@0
 | 
    68  | 
	static CIniFile16Impl* NewL(RFs& aFs,const TDesC& aFileName,TBool aConvert8To16=EFalse);
  | 
| 
sl@0
 | 
    69  | 
	~CIniFile16Impl(){delete iTempImpl;}
 | 
| 
sl@0
 | 
    70  | 
	TInt FindVar(const TDesC16& aSection,const TDesC16& aKey,TPtrC16& aValue);
  | 
| 
sl@0
 | 
    71  | 
private:
  | 
| 
sl@0
 | 
    72  | 
	CIniFile16Impl(){}
 | 
| 
sl@0
 | 
    73  | 
	void ConstructL(RFs& aFs,const TDesC& aFileName,TBool aConvert8To16);
  | 
| 
sl@0
 | 
    74  | 
	CIniFileTmpl16* iTempImpl;	
  | 
| 
sl@0
 | 
    75  | 
	};
  | 
| 
sl@0
 | 
    76  | 
	
  | 
| 
sl@0
 | 
    77  | 
//8 bit
  | 
| 
sl@0
 | 
    78  | 
NONSHARABLE_CLASS(CIniSecIter8Impl): public CBase
  | 
| 
sl@0
 | 
    79  | 
{
 | 
| 
sl@0
 | 
    80  | 
public:
  | 
| 
sl@0
 | 
    81  | 
	static CIniSecIter8Impl* NewL(const TDesC8& aSectionName,const CIniDocument8* aIniDocument);
  | 
| 
sl@0
 | 
    82  | 
	TBool Next(TPtrC8& aKeyName,TPtrC8& aKeyValue);
  | 
| 
sl@0
 | 
    83  | 
	void Reset();
  | 
| 
sl@0
 | 
    84  | 
	TBool End(){return iTempImpl->End();}
 | 
| 
sl@0
 | 
    85  | 
	~CIniSecIter8Impl(){delete iTempImpl;}
 | 
| 
sl@0
 | 
    86  | 
private:
  | 
| 
sl@0
 | 
    87  | 
	CIniSecIter8Impl(){}
 | 
| 
sl@0
 | 
    88  | 
	void ConstructL(const TDesC8& aSectionName,const CIniDocument8* aIniDocument);
  | 
| 
sl@0
 | 
    89  | 
private:	
  | 
| 
sl@0
 | 
    90  | 
	CIniSecIterTmpl8* iTempImpl;
  | 
| 
sl@0
 | 
    91  | 
};
  | 
| 
sl@0
 | 
    92  | 
  | 
| 
sl@0
 | 
    93  | 
//16 bit
  | 
| 
sl@0
 | 
    94  | 
NONSHARABLE_CLASS(CIniSecIter16Impl): public CBase
  | 
| 
sl@0
 | 
    95  | 
{
 | 
| 
sl@0
 | 
    96  | 
public:
  | 
| 
sl@0
 | 
    97  | 
	static CIniSecIter16Impl* NewL(const TDesC16& aSectionName,const CIniDocument16* aIniDocument);
  | 
| 
sl@0
 | 
    98  | 
	TBool Next(TPtrC16& aKeyName,TPtrC16& aKeyValue);
  | 
| 
sl@0
 | 
    99  | 
	void Reset();
  | 
| 
sl@0
 | 
   100  | 
	TBool End(){return iTempImpl->End();}
 | 
| 
sl@0
 | 
   101  | 
	~CIniSecIter16Impl(){delete iTempImpl;}	
 | 
| 
sl@0
 | 
   102  | 
private:
  | 
| 
sl@0
 | 
   103  | 
	CIniSecIter16Impl(){}
 | 
| 
sl@0
 | 
   104  | 
	void ConstructL(const TDesC16& aSectionName,const CIniDocument16* aIniDocument);
  | 
| 
sl@0
 | 
   105  | 
private:	
  | 
| 
sl@0
 | 
   106  | 
	CIniSecIterTmpl16* iTempImpl;	
  | 
| 
sl@0
 | 
   107  | 
};
  | 
| 
sl@0
 | 
   108  | 
  | 
| 
sl@0
 | 
   109  | 
//8 bit
  | 
| 
sl@0
 | 
   110  | 
NONSHARABLE_CLASS(CIniDocument8Impl): public CBase
  | 
| 
sl@0
 | 
   111  | 
{
 | 
| 
sl@0
 | 
   112  | 
public:
  | 
| 
sl@0
 | 
   113  | 
	static CIniDocument8Impl* NewL(RFs& aFs,const TDesC& aFileName);
  | 
| 
sl@0
 | 
   114  | 
	~CIniDocument8Impl();
  | 
| 
sl@0
 | 
   115  | 
	void FlushL(const TDesC& aFileName);
  | 
| 
sl@0
 | 
   116  | 
	
  | 
| 
sl@0
 | 
   117  | 
	TInt GetSectionList(RArray<TPtrC8>& aSectionList) const;
  | 
| 
sl@0
 | 
   118  | 
	void GetKeyValueL(const TDesC8& aSectionName,const TDesC8& aKeyName,TPtrC8& aKeyValue) const;
  | 
| 
sl@0
 | 
   119  | 
	CIniSection8* SectionL(const TDesC8& aSectionName) const;
  | 
| 
sl@0
 | 
   120  | 
	
  | 
| 
sl@0
 | 
   121  | 
	void AddSectionL(const TDesC8& aSectionName);
  | 
| 
sl@0
 | 
   122  | 
	void RemoveSectionL(const TDesC8& aSectionName);
  | 
| 
sl@0
 | 
   123  | 
	void SetKeyL(const TDesC8& aSectionName,const TDesC8& aKeyName,const TDesC8& aKeyValue);
  | 
| 
sl@0
 | 
   124  | 
	void RemoveKeyL(const TDesC8& aSectionName,const TDesC8& aKeyName);
  | 
| 
sl@0
 | 
   125  | 
	TBool CompareDocs(CIniDocument8Impl& aDoc);
  | 
| 
sl@0
 | 
   126  | 
private:
  | 
| 
sl@0
 | 
   127  | 
	CIniDocument8Impl(){}
 | 
| 
sl@0
 | 
   128  | 
	void ConstructL(RFs& aFs,const TDesC& aFileName);
  | 
| 
sl@0
 | 
   129  | 
private:
  | 
| 
sl@0
 | 
   130  | 
	CIniDocumentTmpl8* iTempImpl;
  | 
| 
sl@0
 | 
   131  | 
	
  | 
| 
sl@0
 | 
   132  | 
};
  | 
| 
sl@0
 | 
   133  | 
  | 
| 
sl@0
 | 
   134  | 
//16 bit
  | 
| 
sl@0
 | 
   135  | 
NONSHARABLE_CLASS(CIniDocument16Impl): public CBase
  | 
| 
sl@0
 | 
   136  | 
{
 | 
| 
sl@0
 | 
   137  | 
public:
  | 
| 
sl@0
 | 
   138  | 
	static CIniDocument16Impl* NewL(RFs& aFs,const TDesC& aFileName);
  | 
| 
sl@0
 | 
   139  | 
	~CIniDocument16Impl();
  | 
| 
sl@0
 | 
   140  | 
	void FlushL(const TDesC& aFileName);
  | 
| 
sl@0
 | 
   141  | 
	
  | 
| 
sl@0
 | 
   142  | 
	TInt GetSectionList(RArray<TPtrC16>& aSectionList) const;
  | 
| 
sl@0
 | 
   143  | 
	void GetKeyValueL(const TDesC16& aSectionName,const TDesC16& aKeyName,TPtrC16& aKeyValue) const;
  | 
| 
sl@0
 | 
   144  | 
	CIniSection16* SectionL(const TDesC16& aSectionName) const;
  | 
| 
sl@0
 | 
   145  | 
  | 
| 
sl@0
 | 
   146  | 
	void AddSectionL(const TDesC16& aSectionName);
  | 
| 
sl@0
 | 
   147  | 
	void RemoveSectionL(const TDesC16& aSectionName);
  | 
| 
sl@0
 | 
   148  | 
	void SetKeyL(const TDesC16& aSectionName,const TDesC16& aKeyName,const TDesC16& aKeyValue);
  | 
| 
sl@0
 | 
   149  | 
	void RemoveKeyL(const TDesC16& aSectionName,const TDesC16& aKeyName);
  | 
| 
sl@0
 | 
   150  | 
	TBool CompareDocs(CIniDocument16Impl& aDoc);
  | 
| 
sl@0
 | 
   151  | 
private:
  | 
| 
sl@0
 | 
   152  | 
	CIniDocument16Impl(){}
 | 
| 
sl@0
 | 
   153  | 
	void ConstructL(RFs& aFs,const TDesC& aFileName);	
  | 
| 
sl@0
 | 
   154  | 
private:
  | 
| 
sl@0
 | 
   155  | 
	CIniDocumentTmpl16* iTempImpl;
  | 
| 
sl@0
 | 
   156  | 
};
  | 
| 
sl@0
 | 
   157  | 
  | 
| 
sl@0
 | 
   158  | 
}//namespace BSUL
  | 
| 
sl@0
 | 
   159  | 
  | 
| 
sl@0
 | 
   160  | 
#endif//__INIPARSERIMPL_H__
  |