mirror of
https://gitlab.com/rnger/amath
synced 2025-10-06 02:49:59 +00:00
137 lines
2.7 KiB
Groff
137 lines
2.7 KiB
Groff
.TH "StandardPreferences" 3 "Fri Jan 20 2017" "Version 1.6.0" "amath" \" -*- nroff -*-
|
|
.ad l
|
|
.nh
|
|
.SH NAME
|
|
StandardPreferences \-
|
|
.SH SYNOPSIS
|
|
.br
|
|
.PP
|
|
.PP
|
|
\fC#include <preferences_stdc\&.h>\fP
|
|
.PP
|
|
Inherits \fBPreferencesBase\fP\&.
|
|
.SS "Public Member Functions"
|
|
|
|
.in +1c
|
|
.ti -1c
|
|
.RI "virtual \fBbool\fP \fBLoad\fP ()"
|
|
.br
|
|
.ti -1c
|
|
.RI "virtual \fBbool\fP \fBKeep\fP ()"
|
|
.br
|
|
.ti -1c
|
|
.RI "virtual \fBbool\fP \fBSave\fP ()"
|
|
.br
|
|
.in -1c
|
|
.SS "Private Member Functions"
|
|
|
|
.in +1c
|
|
.ti -1c
|
|
.RI "\fBbool\fP \fBSavePrefs\fP (const char *file)"
|
|
.br
|
|
.in -1c
|
|
.SS "Additional Inherited Members"
|
|
.SH "Detailed Description"
|
|
.PP
|
|
Definition at line 32 of file preferences_stdc\&.h\&.
|
|
.SH "Member Function Documentation"
|
|
.PP
|
|
.SS "\fBbool\fP StandardPreferences::Keep ()\fC [virtual]\fP"
|
|
|
|
.PP
|
|
Implements \fBPreferencesBase\fP\&.
|
|
.PP
|
|
Definition at line 76 of file preferences_stdc\&.cpp\&.
|
|
.PP
|
|
References SavePrefs(), and tempname\&.
|
|
.PP
|
|
.nf
|
|
77 {
|
|
78 return SavePrefs(tempname);
|
|
79 }
|
|
.fi
|
|
.SS "\fBbool\fP StandardPreferences::Load ()\fC [virtual]\fP"
|
|
|
|
.PP
|
|
Implements \fBPreferencesBase\fP\&.
|
|
.PP
|
|
Definition at line 44 of file preferences_stdc\&.cpp\&.
|
|
.PP
|
|
References CharBuffer::Append(), CharBuffer::CharBuffer(), CharBuffer::Empty(), CharBuffer::EnsureSize(), CharBuffer::GetString(), PreferencesBase::SetPrefs(), and tempname\&.
|
|
.PP
|
|
.nf
|
|
45 {
|
|
46 #ifdef UNIX
|
|
47 FILE *file = fopen(tempname, "r");
|
|
48 if (!file) {
|
|
49 return false;
|
|
50 }
|
|
51
|
|
52 CharBuffer *text = new CharBuffer();
|
|
53 text->Empty();
|
|
54
|
|
55 const int bufsize = 64;
|
|
56 char* buf = new char[bufsize];
|
|
57 char* c;
|
|
58 int s = 1;
|
|
59
|
|
60 do {
|
|
61 c = fgets(buf, bufsize, file);
|
|
62 if (c != NULL) {
|
|
63 text->EnsureSize(s++);
|
|
64 text->Append(c);
|
|
65 }
|
|
66 } while (c != NULL);
|
|
67
|
|
68 delete [] buf;
|
|
69 fclose(file);
|
|
70 SetPrefs(text->GetString());
|
|
71 delete text;
|
|
72 #endif
|
|
73 return true;
|
|
74 }
|
|
.fi
|
|
.SS "\fBbool\fP StandardPreferences::Save ()\fC [virtual]\fP"
|
|
|
|
.PP
|
|
Implements \fBPreferencesBase\fP\&.
|
|
.PP
|
|
Definition at line 81 of file preferences_stdc\&.cpp\&.
|
|
.PP
|
|
References permname, and SavePrefs()\&.
|
|
.PP
|
|
.nf
|
|
82 {
|
|
83 return SavePrefs(permname);
|
|
84 }
|
|
.fi
|
|
.SS "\fBbool\fP StandardPreferences::SavePrefs (const char * file)\fC [private]\fP"
|
|
|
|
.PP
|
|
Definition at line 86 of file preferences_stdc\&.cpp\&.
|
|
.PP
|
|
References PreferencesBase::GetDescription()\&.
|
|
.PP
|
|
Referenced by Keep(), and Save()\&.
|
|
.PP
|
|
.nf
|
|
87 {
|
|
88 #ifdef UNIX
|
|
89 FILE *file = fopen(name, "w");
|
|
90 if (!file) {
|
|
91 return false;
|
|
92 }
|
|
93
|
|
94 char *out = GetDescription();
|
|
95 fputs(out, file);
|
|
96 fclose(file);
|
|
97 #endif
|
|
98 return true;
|
|
99 }
|
|
.fi
|
|
|
|
|
|
.SH "Author"
|
|
.PP
|
|
Generated automatically by Doxygen for amath from the source code\&.
|