traceservices/tracefw/ulogger/src/sysconfig/sysconfigimpl.h
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // ULogger sys config
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21  @prototype
       
    22 */
       
    23 
       
    24 
       
    25 #ifndef SYSCONFIGIMPL_H
       
    26 #define SYSCONFIGIMPL_H
       
    27 
       
    28 #include <e32cmn.h>		 
       
    29 #include <f32file.h>	 
       
    30 #include "uloggersysconfig.h"
       
    31 #include <bsul/inifile.h>
       
    32 #include "uloggershared.h"
       
    33 
       
    34 
       
    35 
       
    36 namespace Ulogger
       
    37 {
       
    38 	
       
    39 NONSHARABLE_CLASS(CConfigSettingsImpl) : public CBase
       
    40 {
       
    41 public:
       
    42 	/**Standard Symbian OS construction method.*/
       
    43 	static CConfigSettingsImpl* NewL();
       
    44 
       
    45 	TBool Next(TPtrC8& aSetting,TPtrC8& aSettingValue);
       
    46 	
       
    47 	void Reset();
       
    48 	/**Destructor.*/
       
    49 	~CConfigSettingsImpl();
       
    50 private:
       
    51 	friend class CConfigImpl;
       
    52 	CConfigSettingsImpl();
       
    53 	BSUL::CIniSecIter8* iIniSecIter;
       
    54 };
       
    55 
       
    56 
       
    57 NONSHARABLE_CLASS(CConfigImpl) : public CBase
       
    58 	{
       
    59 public:
       
    60 	static CConfigImpl* NewL(RHeap* aHeap,TFileName& aFilename);
       
    61 	~CConfigImpl();
       
    62 	
       
    63 	// Allow Objects to register for configuration change notifications
       
    64 	
       
    65 	//Get operation									 
       
    66 	TInt GetKeyValue(const TDesC8& aSectionName,const TDesC8& aKey,TPtrC8& aValue);
       
    67 	TInt GetSection(const TDesC8& aSectionName,CConfigSettingsIter& aSection);	
       
    68 	TInt GetKeyCount(const TDesC8& aSectionName,TPtrC8& aLastKey);
       
    69 	
       
    70 	//modify operation	
       
    71 	TInt SetKeyValue(const TDesC8& aSectionName,const TDesC8& aKey, const TDesC8& aValue);
       
    72 	TInt RemoveKey(const TDesC8& aSectionName,const TDesC8& aKeyName);
       
    73 	TInt RemoveSection(const TDesC8& aSectionName);
       
    74 
       
    75 	//utils
       
    76 	TInt GetPointerToKeyName(const TDesC8& aSectionName,const TDesC8& aKeyName,TPtrC8& aKeyPointer);
       
    77 	TInt CheckValueExist(const TDesC8& aSectionName,const TDesC8& aValue,TInt& aKeyCount);
       
    78 	
       
    79 	TInt PersistIniFile();
       
    80 	TInt GenerateInternalKey(const TDesC8& aSection,TBuf8<15>& aKeyName);	
       
    81 	void GetSystemDrive(TDriveName& aSystemDrive);
       
    82 	
       
    83 private:
       
    84 	CConfigImpl(RHeap* aHeap,TFileName& aFileName) : 
       
    85 		iHeap(aHeap),iFileName(aFileName) {}
       
    86 	void ConstructL();	
       
    87 	void LoadConfigFileL();
       
    88 	void GetConfigFileName(TFileName& aFileName);
       
    89 	
       
    90 private:	
       
    91 	/** Mutex for controlling write access */
       
    92 	RMutex iWriteMutex;
       
    93 	/** Pointer to private heap */
       
    94 	RHeap* iHeap;
       
    95 	/** Handle to file server */
       
    96 	RFs iFs;
       
    97 	/** Ini-file parser */
       
    98 	BSUL::CIniDocument8* iIniFileDocument;
       
    99 	
       
   100 	TFileName iFileName;
       
   101 	};
       
   102 
       
   103 	
       
   104 }
       
   105 #endif // SYSCONFIGIMPL_H
       
   106