diff options
Diffstat (limited to 'general/Ini.cpp')
| -rw-r--r-- | general/Ini.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/general/Ini.cpp b/general/Ini.cpp index 5748a206..df2b74a0 100644 --- a/general/Ini.cpp +++ b/general/Ini.cpp @@ -4,7 +4,7 @@ // Author: Ben Boeckel // Modified by: Ben Boeckel // Created: Fri May 4 23:27:37 2007 -// Copyright: ©2007 Nerdy Productions +// Copyright: ©2007-2008 Ben Boeckel and Nerdy Productions // Licence: // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -27,16 +27,16 @@ PokeGen::Ini::Ini(const QString& fname) load(fname); } -void PokeGen::Ini::load(const QString& fname) +void PokeGen::Ini::load(const QString& fname) throw(Exception) { QFile fin(fname); if (!fin.exists()) - throw("Ini: file does not exist"); + throw(OpenException("Ini", fname)); load(fin); fin.close(); } -void PokeGen::Ini::load(QFile& fin) +void PokeGen::Ini::load(QFile& fin) throw(InvalidException) { QTextStream file(&fin); QString line = file.readLine(); @@ -48,25 +48,25 @@ void PokeGen::Ini::load(QFile& fin) { pos = line.indexOf('='); if (pos == -1) - throw("Ini: invalid file"); + throw(InvalidException("Ini", fin.fileName())); field = line.mid(0, pos - 1); value = line.mid(pos + 1, line.length() - pos); if (field.isEmpty()) - throw("Ini: invalid line"); + throw(InvalidException("Ini", fin.fileName())); fields[field] = value; line = file.readLine(); } } -void PokeGen::Ini::save(const QString& fname) const +void PokeGen::Ini::save(const QString& fname) const throw(Exception) { QStringList path = fname.split(QDir::separator(), QString::SkipEmptyParts); path.removeLast(); if (!QDir().mkpath(path.join("/"))) - throw("Ini: unable to create path"); + throw(DirException("Ini", path.join("/"))); QFile fout(fname); if (!fout.open(QIODevice::WriteOnly)) - throw("Ini: unable to open file"); + throw(OpenException("Ini", fname)); save(fout); fout.close(); } |
