Riportate modifiche per membro _write_protect e relativi metodi.

git-svn-id: svn://10.65.10.50/trunk@6031 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1998-01-26 10:29:26 +00:00
parent d123edcf34
commit fb4851514a
2 changed files with 19 additions and 7 deletions

View File

@ -98,7 +98,10 @@ void TConfig::_write_paragraph(
void TConfig::_write_file()
{
ifstream in(_file);
if (_write_protected)
return;
ifstream in(_file);
TFilename temp;
temp.temp("cnf");
ofstream out(temp);
@ -537,7 +540,8 @@ void TConfig::init(
_file = fn;
_paragraph = pa;
_dirty = FALSE;
_write_protected = FALSE;
if (!fexist(_file))
{
if (warning)
@ -547,12 +551,12 @@ void TConfig::init(
}
if (_paragraph.blank())
{
{
TFilename name;
HINSTANCE HInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
GetModuleFileName(HInstance, name.get_buffer(), name.size());
_paragraph = name.name();
_paragraph.cut(2);
_paragraph.cut(2);
_paragraph.lower();
}
@ -606,8 +610,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
case CONFIG_DITTA:
_file = firm2dir(prefix().get_codditta());
_file.add("prassid.ini");
if (!fexist(_file))
fcopy("prassid.ini", _file);
if (!fexist(_file))
fcopy("prassid.ini", _file);
break;
case CONFIG_STUDIO:
case CONFIG_USER:

View File

@ -56,6 +56,8 @@ class TConfig : public TObject
TFilename _file;
// @cmember:(INTERNAL) Indica se il paragrafo e' stato modificato (TRUE se esiste)
bool _dirty;
// @cmember:(INTERNAL) Indica se proteggere il TConfig da scrittura
bool _write_protected;
// @cmember:(INTERNAL) Indica se il paragrafo e' presente (TRUE se esiste)
bool _ispresent;
// @cmember:(INTERNAL) Nome del paragrafo attivo
@ -144,7 +146,13 @@ public:
// @cmember Ritorna il nome del file di configurazione
const TFilename& name() const { return _file; }
// @cmember Setta il valore del flag di protezione da scrittura
void write_protect(const bool b = TRUE) { _write_protected = b; }
// @cmember Ritorna il valore del flag di protezione da scrittura
const bool is_write_protected() const { return _write_protected; }
// @cmember Costruttore (il paragrafo iniziale e' il modulo corrente
// salvo diversa indicazione)
TConfig(int which_config = CONFIG_GENERAL, const char* paragraph = NULL);