summaryrefslogtreecommitdiffstats
path: root/src/tools/tqsettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/tqsettings.cpp')
-rw-r--r--src/tools/tqsettings.cpp166
1 files changed, 83 insertions, 83 deletions
diff --git a/src/tools/tqsettings.cpp b/src/tools/tqsettings.cpp
index 18638b571..2f846731d 100644
--- a/src/tools/tqsettings.cpp
+++ b/src/tools/tqsettings.cpp
@@ -327,7 +327,7 @@ static void closelock( HANDLE fd )
TQSettingsGroup::TQSettingsGroup()
- : modified(FALSE)
+ : modified(false)
{
}
@@ -408,10 +408,10 @@ void TQSettingsHeading::parseLine(TQTextStream &stream)
TQString key, value;
key = line.left(i);
value = "";
- bool esc=TRUE;
+ bool esc=true;
i++;
while (esc) {
- esc = FALSE;
+ esc = false;
for ( ; i < (int)line.length(); i++ ) {
if ( esc ) {
if ( line[i] == 'n' )
@@ -420,9 +420,9 @@ void TQSettingsHeading::parseLine(TQTextStream &stream)
value = TQString::null; // escaped empty string
else
value.append(line[i]);
- esc = FALSE;
+ esc = false;
} else if ( line[i] == '\\' )
- esc = TRUE;
+ esc = true;
else
value.append(line[i]);
}
@@ -460,7 +460,7 @@ void TQSettingsHeading::parseLine(TQTextStream &stream)
#endif
TQSettingsPrivate::TQSettingsPrivate( TQSettings::Format format )
- : groupDirty( TRUE ), modified(FALSE), globalScope(TRUE)
+ : groupDirty( true ), modified(false), globalScope(true)
{
#if defined(TQ_WS_WIN) || defined(Q_OS_MAC)
if ( format != TQSettings::Ini )
@@ -486,21 +486,21 @@ TQSettingsPrivate::TQSettingsPrivate( TQSettings::Format format )
#ifdef TQ_WS_WIN
#ifdef Q_OS_TEMP
TCHAR path[MAX_PATH];
- SHGetSpecialFolderPath( 0, path, CSIDL_APPDATA, FALSE );
+ SHGetSpecialFolderPath( 0, path, CSIDL_APPDATA, false );
appSettings = TQString::fromUcs2( path );
- SHGetSpecialFolderPath( 0, path, CSIDL_COMMON_APPDATA, FALSE );
+ SHGetSpecialFolderPath( 0, path, CSIDL_COMMON_APPDATA, false );
defPath = TQString::fromUcs2( path );
#else
TQLibrary library( "shell32" );
- library.setAutoUnload( FALSE );
+ library.setAutoUnload( false );
QT_WA( {
typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPTSTR, int, BOOL);
GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve( "SHGetSpecialFolderPathW" );
if ( SHGetSpecialFolderPath ) {
TCHAR path[MAX_PATH];
- SHGetSpecialFolderPath( 0, path, CSIDL_APPDATA, FALSE );
+ SHGetSpecialFolderPath( 0, path, CSIDL_APPDATA, false );
appSettings = TQString::fromUcs2( (ushort*)path );
- SHGetSpecialFolderPath( 0, path, CSIDL_COMMON_APPDATA, FALSE );
+ SHGetSpecialFolderPath( 0, path, CSIDL_COMMON_APPDATA, false );
defPath = TQString::fromUcs2( (ushort*)path );
}
} , {
@@ -508,9 +508,9 @@ TQSettingsPrivate::TQSettingsPrivate( TQSettings::Format format )
GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve( "SHGetSpecialFolderPathA" );
if ( SHGetSpecialFolderPath ) {
char path[MAX_PATH];
- SHGetSpecialFolderPath( 0, path, CSIDL_APPDATA, FALSE );
+ SHGetSpecialFolderPath( 0, path, CSIDL_APPDATA, false );
appSettings = TQString::fromLocal8Bit( path );
- SHGetSpecialFolderPath( 0, path, CSIDL_COMMON_APPDATA, FALSE );
+ SHGetSpecialFolderPath( 0, path, CSIDL_COMMON_APPDATA, false );
defPath = TQString::fromLocal8Bit( path );
}
} );
@@ -586,7 +586,7 @@ void TQSettingsPrivate::removeGroup(const TQString &key)
{
TQSettingsHeading hd;
TQSettingsGroup grp;
- bool found = FALSE;
+ bool found = false;
TQMap<TQString,TQSettingsHeading>::Iterator headingsit = headings.find(heading);
if (headingsit != headings.end())
@@ -610,11 +610,11 @@ void TQSettingsPrivate::removeGroup(const TQString &key)
grpit = hd.find(group);
if (grpit != hd.end()) {
- found = TRUE;
+ found = true;
grp = *grpit;
}
} else if (hd.count() != 0) {
- found = TRUE;
+ found = true;
grp = *grpit;
}
@@ -631,7 +631,7 @@ void TQSettingsPrivate::removeGroup(const TQString &key)
else
headings.remove(heading);
- modified = TRUE;
+ modified = true;
}
}
@@ -667,12 +667,12 @@ void TQSettingsPrivate::writeGroup(const TQString &key, const TQString &value)
} else if (hd.count() != 0)
grp = *grpit;
- grp.modified = TRUE;
+ grp.modified = true;
grp.replace(key, value);
hd.replace(group, grp);
headings.replace(heading, hd);
- modified = TRUE;
+ modified = true;
}
@@ -698,8 +698,8 @@ TQDateTime TQSettingsPrivate::modificationTime()
bool qt_verify_key( const TQString &key )
{
if ( key.isEmpty() || key[0] != '/' || key.contains( TQRegExp(TQString::fromLatin1("[=\\r\\n]")) ) )
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
static TQString groupKey( const TQString &group, const TQString &key )
@@ -746,7 +746,7 @@ static TQString groupKey( const TQString &group, const TQString &key )
\code
TQSettings settings;
settings.insertSearchPath( TQSettings::Windows, "/MyCompany" );
- settings.writeEntry( "/MyApplication/Tip of the day", TRUE );
+ settings.writeEntry( "/MyApplication/Tip of the day", true );
\endcode
The code above will write the subkey "Tip of the day" into the \e
first of the registry folders listed below that is found and for
@@ -956,7 +956,7 @@ TQSettings::~TQSettings()
/*! \internal
Writes all modifications to the settings to disk. If any errors are
- encountered, this function returns FALSE, otherwise it will return TRUE.
+ encountered, this function returns false, otherwise it will return true.
*/
bool TQSettings::sync()
{
@@ -966,9 +966,9 @@ bool TQSettings::sync()
#endif
if (! d->modified)
// fake success
- return TRUE;
+ return true;
- bool success = TRUE;
+ bool success = true;
TQMap<TQString,TQSettingsHeading>::Iterator it = d->headings.begin();
while (it != d->headings.end()) {
@@ -1011,7 +1011,7 @@ bool TQSettings::sync()
tqWarning("TQSettings::sync: filename is null/empty");
#endif // QT_CHECK_STATE
- success = FALSE;
+ success = false;
continue;
}
@@ -1027,7 +1027,7 @@ bool TQSettings::sync()
file.name().latin1());
#endif // QT_CHECK_STATE
- success = FALSE;
+ success = false;
continue;
}
@@ -1067,22 +1067,22 @@ bool TQSettings::sync()
tqWarning("TQSettings::sync: error at end of write");
#endif // QT_CHECK_STATE
- success = FALSE;
+ success = false;
}
file.close();
if ( success ) {
- TQDir dir( TQFileInfo( file ).dir( TRUE ) );
+ TQDir dir( TQFileInfo( file ).dir( true ) );
if ( ( dir.exists( filename ) && !dir.remove( filename ) ) ||
- !dir.rename( file.name(), filename, TRUE ) ) {
+ !dir.rename( file.name(), filename, true ) ) {
#ifdef QT_CHECK_STATE
tqWarning( "TQSettings::sync: error writing file '%s'",
TQFile::encodeName( filename ).data() );
#endif // QT_CHECK_STATE
- success = FALSE;
+ success = false;
}
}
@@ -1094,7 +1094,7 @@ bool TQSettings::sync()
#endif
}
- d->modified = FALSE;
+ d->modified = false;
return success;
}
@@ -1105,7 +1105,7 @@ bool TQSettings::sync()
Reads the entry specified by \a key, and returns a bool, or the
default value, \a def, if the entry couldn't be read.
- If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE
+ If \a ok is non-null, *ok is set to true if the key was read, false
otherwise.
\sa readEntry(), readNumEntry(), readDoubleEntry(), writeEntry(), removeEntry()
@@ -1122,7 +1122,7 @@ bool TQSettings::readBoolEntry(const TQString &key, bool def, bool *ok )
tqWarning( "TQSettings::readBoolEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
if ( ok )
- *ok = FALSE;
+ *ok = false;
return def;
}
@@ -1135,19 +1135,19 @@ bool TQSettings::readBoolEntry(const TQString &key, bool def, bool *ok )
TQString value = readEntry( key, ( def ? "true" : "false" ), ok );
if (value.lower() == "true")
- return TRUE;
+ return true;
else if (value.lower() == "false")
- return FALSE;
+ return false;
else if (value == "1")
- return TRUE;
+ return true;
else if (value == "0")
- return FALSE;
+ return false;
if (! value.isEmpty())
tqWarning("TQSettings::readBoolEntry: '%s' is not 'true' or 'false'",
value.latin1());
if ( ok )
- *ok = FALSE;
+ *ok = false;
return def;
}
@@ -1157,7 +1157,7 @@ bool TQSettings::readBoolEntry(const TQString &key, bool def, bool *ok )
Reads the entry specified by \a key, and returns a double, or the
default value, \a def, if the entry couldn't be read.
- If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE
+ If \a ok is non-null, *ok is set to true if the key was read, false
otherwise.
\sa readEntry(), readNumEntry(), readBoolEntry(), writeEntry(), removeEntry()
@@ -1174,7 +1174,7 @@ double TQSettings::readDoubleEntry(const TQString &key, double def, bool *ok )
tqWarning( "TQSettings::readDoubleEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
if ( ok )
- *ok = FALSE;
+ *ok = false;
return def;
}
@@ -1193,7 +1193,7 @@ double TQSettings::readDoubleEntry(const TQString &key, double def, bool *ok )
tqWarning( "TQSettings::readDoubleEntry: '%s' is not a number",
value.latin1() );
if ( ok )
- *ok = FALSE;
+ *ok = false;
return def;
}
@@ -1203,7 +1203,7 @@ double TQSettings::readDoubleEntry(const TQString &key, double def, bool *ok )
Reads the entry specified by \a key, and returns an integer, or the
default value, \a def, if the entry couldn't be read.
- If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE
+ If \a ok is non-null, *ok is set to true if the key was read, false
otherwise.
\sa readEntry(), readDoubleEntry(), readBoolEntry(), writeEntry(), removeEntry()
@@ -1220,7 +1220,7 @@ int TQSettings::readNumEntry(const TQString &key, int def, bool *ok )
tqWarning( "TQSettings::readNumEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
if ( ok )
- *ok = FALSE;
+ *ok = false;
return def;
}
@@ -1238,7 +1238,7 @@ int TQSettings::readNumEntry(const TQString &key, int def, bool *ok )
tqWarning( "TQSettings::readNumEntry: '%s' is not a number",
value.latin1() );
if ( ok )
- *ok = FALSE;
+ *ok = false;
return def;
}
@@ -1248,7 +1248,7 @@ int TQSettings::readNumEntry(const TQString &key, int def, bool *ok )
Reads the entry specified by \a key, and returns a TQString, or the
default value, \a def, if the entry couldn't be read.
- If \a ok is non-null, *ok is set to TRUE if the key was read, FALSE
+ If \a ok is non-null, *ok is set to true if the key was read, false
otherwise.
\sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), writeEntry(), removeEntry()
@@ -1265,7 +1265,7 @@ TQString TQSettings::readEntry(const TQString &key, const TQString &def, bool *o
tqWarning( "TQSettings::readEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
if ( ok )
- *ok = FALSE;
+ *ok = false;
return def;
}
@@ -1276,7 +1276,7 @@ TQString TQSettings::readEntry(const TQString &key, const TQString &def, bool *o
#endif
if ( ok ) // no, everything is not ok
- *ok = FALSE;
+ *ok = false;
TQString realkey;
@@ -1289,7 +1289,7 @@ TQString TQSettings::readEntry(const TQString &key, const TQString &def, bool *o
tqWarning("TQSettings::readEntry: invalid key '%s'", grp_key.latin1());
#endif // QT_CHECK_STATE
if ( ok )
- *ok = FALSE;
+ *ok = false;
return def;
}
@@ -1318,7 +1318,7 @@ TQString TQSettings::readEntry(const TQString &key, const TQString &def, bool *o
if ( it != end ) {
// found the value we needed
retval = *it;
- if ( ok ) *ok = TRUE;
+ if ( ok ) *ok = true;
}
return retval;
}
@@ -1330,8 +1330,8 @@ TQString TQSettings::readEntry(const TQString &key, const TQString &def, bool *o
created if it doesn't exist. Any previous value is overwritten by \a
value.
- If an error occurs the settings are left unchanged and FALSE is
- returned; otherwise TRUE is returned.
+ If an error occurs the settings are left unchanged and false is
+ returned; otherwise true is returned.
\warning On certain platforms, keys are required to contain at least
two components (e.g., "/foo/bar"). This limitation does not apply to
@@ -1346,7 +1346,7 @@ bool TQSettings::writeEntry(const TQString &key, bool value)
#if defined(QT_CHECK_STATE)
tqWarning( "TQSettings::writeEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
- return FALSE;
+ return false;
}
#if defined(TQ_WS_WIN) || defined(Q_OS_MAC)
@@ -1365,8 +1365,8 @@ bool TQSettings::writeEntry(const TQString &key, bool value)
created if it doesn't exist. Any previous value is overwritten by \a
value.
- If an error occurs the settings are left unchanged and FALSE is
- returned; otherwise TRUE is returned.
+ If an error occurs the settings are left unchanged and false is
+ returned; otherwise true is returned.
\sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry()
*/
@@ -1377,7 +1377,7 @@ bool TQSettings::writeEntry(const TQString &key, double value)
#if defined(QT_CHECK_STATE)
tqWarning( "TQSettings::writeEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
- return FALSE;
+ return false;
}
#if defined(TQ_WS_WIN) || defined(Q_OS_MAC)
@@ -1395,8 +1395,8 @@ bool TQSettings::writeEntry(const TQString &key, double value)
created if it doesn't exist. Any previous value is overwritten by \a
value.
- If an error occurs the settings are left unchanged and FALSE is
- returned; otherwise TRUE is returned.
+ If an error occurs the settings are left unchanged and false is
+ returned; otherwise true is returned.
\sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry()
*/
@@ -1407,7 +1407,7 @@ bool TQSettings::writeEntry(const TQString &key, int value)
#if defined(QT_CHECK_STATE)
tqWarning( "TQSettings::writeEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
- return FALSE;
+ return false;
}
#if defined(TQ_WS_WIN) || defined(Q_OS_MAC)
@@ -1430,7 +1430,7 @@ bool TQSettings::writeEntry(const TQString &key, int value)
writeEntry (const TQString &, bool) overload for this code:
writeEntry ("/foo/bar", "baz")
- If an error occurs, this functions returns FALSE and the object is left
+ If an error occurs, this functions returns false and the object is left
unchanged.
\sa readEntry(), removeEntry()
@@ -1448,8 +1448,8 @@ bool TQSettings::writeEntry(const TQString &key, const char *value)
value. If \a value is an empty string or a null string the key's
value will be an empty string.
- If an error occurs the settings are left unchanged and FALSE is
- returned; otherwise TRUE is returned.
+ If an error occurs the settings are left unchanged and false is
+ returned; otherwise true is returned.
\sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry()
*/
@@ -1460,7 +1460,7 @@ bool TQSettings::writeEntry(const TQString &key, const TQString &value)
#if defined(QT_CHECK_STATE)
tqWarning( "TQSettings::writeEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
- return FALSE;
+ return false;
}
#if defined(TQ_WS_WIN) || defined(Q_OS_MAC)
@@ -1480,7 +1480,7 @@ bool TQSettings::writeEntry(const TQString &key, const TQString &value)
tqWarning("TQSettings::writeEntry: invalid key '%s'", grp_key.latin1());
#endif // QT_CHECK_STATE
- return FALSE;
+ return false;
}
if (list.count() == 2) {
@@ -1503,7 +1503,7 @@ bool TQSettings::writeEntry(const TQString &key, const TQString &value)
}
d->writeGroup(realkey, value);
- return TRUE;
+ return true;
}
@@ -1523,7 +1523,7 @@ bool TQSettings::removeEntry(const TQString &key)
#if defined(QT_CHECK_STATE)
tqWarning( "TQSettings::removeEntry: Invalid key: '%s'", grp_key.isNull() ? "(null)" : grp_key.latin1() );
#endif
- return FALSE;
+ return false;
}
#if defined(TQ_WS_WIN) || defined(Q_OS_MAC)
@@ -1541,7 +1541,7 @@ bool TQSettings::removeEntry(const TQString &key)
tqWarning("TQSettings::removeEntry: invalid key '%s'", grp_key.latin1());
#endif // QT_CHECK_STATE
- return FALSE;
+ return false;
}
if (list.count() == 2) {
@@ -1564,7 +1564,7 @@ bool TQSettings::removeEntry(const TQString &key)
}
d->removeGroup(realkey);
- return TRUE;
+ return true;
}
@@ -1859,8 +1859,8 @@ TQDateTime TQSettings::lastModificationTime( const TQString &key )
that do not take a \a separator argument.
- If an error occurs the settings are left unchanged and FALSE is
- returned; otherwise returns TRUE.
+ If an error occurs the settings are left unchanged and false is
+ returned; otherwise returns true.
\sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry(), TQStringList::join()
*/
@@ -1878,8 +1878,8 @@ bool TQSettings::writeEntry(const TQString &key, const TQStringList &value,
is created if it doesn't exist. Any previous value is overwritten
by \a value.
- If an error occurs the settings are left unchanged and FALSE is
- returned; otherwise returns TRUE.
+ If an error occurs the settings are left unchanged and false is
+ returned; otherwise returns true.
\sa readListEntry(), readNumEntry(), readDoubleEntry(), readBoolEntry(), removeEntry()
*/
@@ -1906,8 +1906,8 @@ bool TQSettings::writeEntry(const TQString &key, const TQStringList &value)
Reads the entry specified by \a key as a string. The \a separator
is used to create a TQStringList by calling TQStringList::split(\a
- separator, entry). If \a ok is not 0: \a *ok is set to TRUE
- if the key was read, otherwise \a *ok is set to FALSE.
+ separator, entry). If \a ok is not 0: \a *ok is set to true
+ if the key was read, otherwise \a *ok is set to false.
\warning As the documentation states, TQStringList::split() will
omit empty strings from the list. Because of this, it is
@@ -1944,8 +1944,8 @@ TQStringList TQSettings::readListEntry(const TQString &key, const TQChar &separa
/*!
\fn TQStringList TQSettings::readListEntry(const TQString &key, bool *ok ) const
Reads the entry specified by \a key as a string. If \a ok is not
- 0, \a *ok is set to TRUE if the key was read, otherwise \a *ok is
- set to FALSE.
+ 0, \a *ok is set to true if the key was read, otherwise \a *ok is
+ set to false.
Note that if you want to iterate over the list, you should iterate
over a copy, e.g.
@@ -1971,7 +1971,7 @@ TQStringList TQSettings::readListEntry(const TQString &key, bool *ok )
return TQStringList();
TQStringList l;
TQString s;
- bool esc=FALSE;
+ bool esc=false;
for (int i=0; i<(int)value.length(); i++) {
if ( esc ) {
if ( value[i] == 'e' ) { // end-of-string
@@ -1982,9 +1982,9 @@ TQStringList TQSettings::readListEntry(const TQString &key, bool *ok )
} else {
s.append(value[i]);
}
- esc=FALSE;
+ esc=false;
} else if ( value[i] == '^' ) {
- esc = TRUE;
+ esc = true;
} else {
s.append(value[i]);
if ( i == (int)value.length()-1 )
@@ -2072,7 +2072,7 @@ void TQSettings::setPath( const TQString &domain, const TQString &product, Scope
void TQSettings::beginGroup( const TQString &group )
{
d->groupStack.push( group );
- d->groupDirty = TRUE;
+ d->groupDirty = true;
}
/*!
@@ -2089,7 +2089,7 @@ void TQSettings::beginGroup( const TQString &group )
void TQSettings::endGroup()
{
d->groupStack.pop();
- d->groupDirty = TRUE;
+ d->groupDirty = true;
}
/*!
@@ -2098,7 +2098,7 @@ void TQSettings::endGroup()
void TQSettings::resetGroup()
{
d->groupStack.clear();
- d->groupDirty = FALSE;
+ d->groupDirty = false;
d->groupPrefix = TQString::null;
}
@@ -2110,7 +2110,7 @@ void TQSettings::resetGroup()
TQString TQSettings::group() const
{
if ( d->groupDirty ) {
- d->groupDirty = FALSE;
+ d->groupDirty = false;
d->groupPrefix = TQString::null;
TQValueStack<TQString>::Iterator it = d->groupStack.begin();