home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / profile.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.7 KB  |  98 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. // profile.h : Profile DataBase
  20. //
  21.  
  22. #ifndef _PROFILE_H
  23. #define _PROFILE_H
  24.  
  25. // NOTE: magic name must be kept in sync with ns/modules/libreg/src/reg.h
  26. #define ASW_MAGIC_PROFILE_NAME "User1"
  27. // Obsoleted Directory constants due to runtime directory assignment
  28.  
  29. #ifdef XP_WIN32
  30.     #define HPROFILE HKEY
  31.     #define HUSER    CString
  32. #else
  33. #ifdef XP_MAC
  34.     #define HPROFILE FSSpec&   // Or would the LFile be the right one?
  35.     #define HUSER    short
  36. #else
  37.     #define HPROFILE CString
  38.     #define HUSER    CString
  39. #endif
  40. #endif
  41.  
  42. #define UPGRADE_MOVE   0
  43. #define UPGRADE_COPY   1
  44. #define UPGRADE_IGNORE 2
  45.  
  46. class CUserProfileDB
  47. {
  48.  
  49. public:
  50.             CUserProfileDB();
  51.             ~CUserProfileDB();
  52.  
  53.     int        AddNewProfile( 
  54.                 HUSER hUser, 
  55.                 CString  csProfileDirectory, 
  56.                 int      iUpgradeOption );
  57.  
  58.     void        GetUserProfile( HUSER hUser );
  59.  
  60.     int         DeleteUserProfile( HUSER hUser );
  61.  
  62.     char *         GetUserProfileValue( 
  63.                 HUSER hUser, CString csName );
  64.  
  65.     int         SetUserProfileValue( 
  66.                 HUSER hUser, CString csName,
  67.                 CString csValue );
  68.  
  69.     static BOOL         AssignProfileDirectoryName(HUSER hUser, CString &csUserDirectory);
  70.  
  71.     void         GetUserProfilesList( CStringList *cslProfiles );
  72.  
  73. // Macintosh interfaces don't make sense on Windows
  74. //    short        CountProfiles();
  75. //    short        GetNextProfileID();
  76. //    short        GetLastProfileID();
  77. //    void        SetLastProfileID( HUSER hUser );
  78. //    BOOL        GetProfileName( HUSER hUser, CString *name );
  79. //    void        SetProfileName( HUSER hUser, const CString *name );
  80. //    BOOL        GetProfileAlias( HUSER hUser );
  81.  
  82. private:
  83.     int         BuildDirectoryPath( const char *path );
  84.  
  85.     HPROFILE    OpenUserProfileDB();
  86.     int        CloseUserProfileDB();
  87.  
  88.     HPROFILE        m_hProfileDB;         // handle to the profile DB
  89.     CStringList *   m_cslProfiles;        // list of all user profiles in the DB
  90.  
  91.     HUSER          m_hUser;              // handle to the current profile
  92.     CString        m_csUserAddr;         // Current profile email name
  93.     CString        m_csProfileDirectory; // Current profile directory
  94.  
  95. };
  96.  
  97. #endif
  98.