aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/src/lib/JEDI-SDL/SDL/Pas/userpreferences.pas
blob: aed326d1854da339b1037bf6deb2970b7696c17a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
unit userpreferences;
{
  $Id: userpreferences.pas,v 1.1 2004/09/30 22:35:47 savage Exp $
  
}
{******************************************************************************}
{                                                                              }
{          JEDI-SDL : Pascal units for SDL - Simple DirectMedia Layer          }
{                 Base Class for User Preferences                              }
{                                                                              }
{ The initial developer of this Pascal code was :                              }
{ Dominqiue Louis <Dominique@SavageSoftware.com.au>                            }
{                                                                              }
{ Portions created by Dominqiue Louis are                                      }
{ Copyright (C) 2000 - 2001 Dominqiue Louis.                                   }
{                                                                              }
{                                                                              }
{ Contributor(s)                                                               }
{ --------------                                                               }
{                                                                              }
{                                                                              }
{ Obtained through:                                                            }
{ Joint Endeavour of Delphi Innovators ( Project JEDI )                        }
{                                                                              }
{ You may retrieve the latest version of this file at the Project              }
{ JEDI home page, located at http://delphi-jedi.org                            }
{                                                                              }
{ The contents of this file are used with permission, subject to               }
{ the Mozilla Public License Version 1.1 (the "License"); you may              }
{ not use this file except in compliance with the License. You may             }
{ obtain a copy of the License at                                              }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an                  }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or               }
{ implied. See the License for the specific language governing                 }
{ rights and limitations under the License.                                    }
{                                                                              }
{ Description                                                                  }
{ -----------                                                                  }
{                                                                              }
{                                                                              }
{                                                                              }
{                                                                              }
{                                                                              }
{                                                                              }
{                                                                              }
{ Requires                                                                     }
{ --------                                                                     }
{   The SDL Runtime libraris on Win32  : SDL.dll on Linux : libSDL.so          }
{   They are available from...                                                 }
{   http://www.libsdl.org .                                                    }
{                                                                              }
{ Programming Notes                                                            }
{ -----------------                                                            }
{                                                                              }
{                                                                              }
{                                                                              }
{                                                                              }
{ Revision History                                                             }
{ ----------------                                                             }
{   September   23 2004 - DL : Initial Creation                                }
{
  $Log: userpreferences.pas,v $
  Revision 1.1  2004/09/30 22:35:47  savage
  Changes, enhancements and additions as required to get SoAoS working.


}
{******************************************************************************}

interface

uses
  Classes;

type
  TUserPreferences = class
  private
    FAutoSave: Boolean;
    procedure CheckAutoSave;
  protected
    function GetDefaultBoolean( const Index : Integer ) : Boolean; virtual; abstract;
    function GetBoolean( const Index : Integer ) : Boolean; virtual; abstract;
    procedure SetBoolean( const Index : Integer; const Value : Boolean ); virtual;
    function GetDefaultDateTime( const Index : Integer ) : TDateTime; virtual; abstract;
    function GetDateTime( const Index : Integer ) : TDateTime; virtual; abstract;
    procedure SetDateTime( const Index : Integer; const Value : TDateTime ); virtual;
    function GetDefaultInteger( const Index : Integer ) : Integer; virtual; abstract;
    function GetInteger( const Index : Integer ) : Integer; virtual; abstract;
    procedure SetInteger( const Index : Integer; const Value : Integer ); virtual;
    function GetDefaultFloat( const Index : Integer ) : single; virtual; abstract;
    function GetFloat( const Index : Integer ) : single; virtual; abstract;
    procedure SetFloat( const Index : Integer; const Value : single ); virtual;
    function GetDefaultString( const Index : Integer ) : string; virtual; abstract;
    function GetString( const Index : Integer ) : string; virtual; abstract;
    procedure SetString( const Index : Integer; const Value : string ); virtual;
    function GetDefaultBinaryStream( const Index : Integer ) : TStream; virtual; abstract;
    function GetBinaryStream( const Index : Integer ) : TStream; virtual; abstract;
    procedure SetBinaryStream( const Index : Integer; const Value : TStream ); virtual;
  public
    procedure Update; virtual; abstract;
    constructor Create; virtual;
    destructor Destroy; override;
    property AutoSave : Boolean read FAutoSave write FAutoSave;
  end;

implementation

{ TUserPreferences }
procedure TUserPreferences.CheckAutoSave;
begin
  if FAutoSave then
    Update;
end;

constructor TUserPreferences.Create;
begin
  inherited;
  FAutoSave := false;
end;

destructor TUserPreferences.Destroy;
begin

  inherited;
end;

procedure TUserPreferences.SetBinaryStream( const Index : Integer; const Value : TStream );
begin
  CheckAutoSave;
end;

procedure TUserPreferences.SetBoolean(const Index: Integer; const Value: Boolean);
begin
  CheckAutoSave;
end;

procedure TUserPreferences.SetDateTime(const Index: Integer; const Value: TDateTime);
begin
  CheckAutoSave;
end;

procedure TUserPreferences.SetFloat(const Index: Integer; const Value: single);
begin
  CheckAutoSave;
end;

procedure TUserPreferences.SetInteger(const Index, Value: Integer);
begin
  CheckAutoSave;
end;

procedure TUserPreferences.SetString(const Index: Integer; const Value: string);
begin
  CheckAutoSave;
end;

end.