1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/boardsupport/emulator/emulatorbsp/win_drive/settings_manager.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,93 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Definitions of the classes responsible for the settings handling in the .ini file
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 +*/
1.24 +
1.25 +#ifndef SETTINGS_MANAGER_H
1.26 +#define SETTINGS_MANAGER_H
1.27 +
1.28 +#include "common.h"
1.29 +
1.30 +#define WIN32_LEAN_AND_MEAN
1.31 +#pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
1.32 +#include <windows.h>
1.33 +#pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union
1.34 +
1.35 +
1.36 +//-----------------------------------------------------------------------------
1.37 +
1.38 +/** This class is the interface to the various settings from ini file */
1.39 +class TSettingsManager
1.40 +{
1.41 + public:
1.42 +
1.43 + static TSettingsManager* Create(TInt aEpocDrvNumber);
1.44 +
1.45 + //-- API for the particular user of this class
1.46 + TUint32 MediaSectorSize() const;
1.47 + TUint32 MediaSizeInSectors() const;
1.48 + TBool WinDeviceName(char* apszName, TUint aBufLen) const;
1.49 + TBool IsReadOnly() const;
1.50 +
1.51 + TUint32 TMediaType_Override() const;
1.52 + void MediaAtt_OverrideMasks(TUint32 &aAndMask, TUint32 &aOrMask) const;
1.53 + void DriveAtt_OverrideMasks(TUint32 &aAndMask, TUint32 &aOrMask) const;
1.54 +
1.55 + protected:
1.56 +
1.57 + TSettingsManager(const char* apFileName, TInt aEpocDrvNumber);
1.58 +
1.59 + TSettingsManager();
1.60 + TSettingsManager(const TSettingsManager&);
1.61 + TSettingsManager& operator=(const TSettingsManager&);
1.62 +
1.63 + //-- low-level API, for internal use only
1.64 + DWORD ReadString (const char* aAppName, const char* aKeyName, const char* aStrDefault, char* aStrDest, DWORD aSize) const;
1.65 + int ReadInt (const char* aAppName, const char* aKeyName, int aDefaultIntVal) const;
1.66 + TBool ReadBool(const char* aAppName, const char* aKeyName, int aDefaultBoolVal) const;
1.67 + TBool ReadUintFromHex(const char* aAppName, const char* aKeyName, TUint32& aVal) const;
1.68 +
1.69 + inline const char* IniFileName() const {return iIniFileName;}
1.70 + inline const char* DriveSection() const {return iDrvSectionName;}
1.71 +
1.72 +
1.73 + private:
1.74 +
1.75 + char iIniFileName[KMaxFileName];
1.76 + char iDrvSectionName[20];
1.77 +
1.78 +};
1.79 +
1.80 +
1.81 +//-----------------------------------------------------------------------------
1.82 +
1.83 +#endif //SETTINGS_MANAGER_H
1.84 +
1.85 +
1.86 +
1.87 +
1.88 +
1.89 +
1.90 +
1.91 +
1.92 +
1.93 +
1.94 +
1.95 +
1.96 +