os/boardsupport/emulator/emulatorbsp/win_drive/settings_manager.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 // Definitions of the classes responsible for the settings handling in the .ini file
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20 */
    21 
    22 #ifndef SETTINGS_MANAGER_H
    23 #define SETTINGS_MANAGER_H
    24 
    25 #include "common.h"
    26 
    27 #define WIN32_LEAN_AND_MEAN
    28 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
    29 #include <windows.h>
    30 #pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union
    31 
    32 
    33 //-----------------------------------------------------------------------------
    34 
    35 /** This class is the interface to the various settings from ini file */
    36 class TSettingsManager
    37 {
    38  public:
    39     
    40     static TSettingsManager* Create(TInt aEpocDrvNumber);
    41 
    42     //-- API for the particular user of this class
    43     TUint32 MediaSectorSize() const;
    44     TUint32 MediaSizeInSectors() const;
    45     TBool   WinDeviceName(char* apszName, TUint aBufLen) const;
    46     TBool   IsReadOnly() const;
    47 
    48     TUint32 TMediaType_Override() const;
    49     void    MediaAtt_OverrideMasks(TUint32 &aAndMask, TUint32 &aOrMask) const;
    50     void    DriveAtt_OverrideMasks(TUint32 &aAndMask, TUint32 &aOrMask) const;
    51 
    52  protected:
    53 
    54     TSettingsManager(const char* apFileName, TInt aEpocDrvNumber);
    55 
    56     TSettingsManager();
    57     TSettingsManager(const TSettingsManager&);
    58     TSettingsManager& operator=(const TSettingsManager&);
    59 
    60     //-- low-level API, for internal use only
    61     DWORD   ReadString (const char* aAppName, const char* aKeyName, const char* aStrDefault, char* aStrDest, DWORD aSize) const;
    62     int     ReadInt (const char* aAppName, const char* aKeyName, int aDefaultIntVal) const;
    63     TBool   ReadBool(const char* aAppName, const char* aKeyName, int  aDefaultBoolVal) const;
    64     TBool   ReadUintFromHex(const char* aAppName, const char* aKeyName, TUint32& aVal) const;
    65 
    66     inline const char* IniFileName() const {return iIniFileName;}
    67     inline const char* DriveSection() const {return iDrvSectionName;}
    68 
    69 
    70  private:
    71     
    72     char iIniFileName[KMaxFileName];
    73     char iDrvSectionName[20];
    74 
    75 };
    76 
    77 
    78 //-----------------------------------------------------------------------------
    79 
    80 #endif //SETTINGS_MANAGER_H
    81 
    82 
    83 
    84 
    85 
    86 
    87 
    88 
    89 
    90 
    91 
    92 
    93