initial port for Cevo game in C++ (libs)

This commit is contained in:
Geoffray Levasseur committed 2026-10-22 17:20:45 +02:00
commit 8436242032
375 files changed
+46282

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
#pragma once
#include <QDate>
#include <QPixmap>
#include <QString>
namespace Cevo {
// Equivalent of ApplicationInfo.pas's TApplicationInfo, trimmed to the
// fields actually used by the ported dialogs (FormAbout): no registry-key
// persistence (Windows-only in the original, out of scope here).
struct ApplicationInfo {
QString appName;
int versionMajor = 1;
int versionMinor = 0;
int versionBugFix = 0;
QString versionSuffix; // alpha, beta, RC1, RC2, ...
QString authorsName;
QString emailContact;
QString companyName;
QString companyHomePage;
QString homePage;
QString description;
QDate releaseDate;
QString license;
QPixmap icon;
QString version() const
{
QString result = QString::number(versionMajor) + '.' + QString::number(versionMinor);
if (!versionSuffix.isEmpty())
result += ' ' + versionSuffix;
else
result += '.' + QString::number(versionBugFix);
return result;
}
};
} // namespace Cevo
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include <QColor>
#include <QPushButton>
namespace Cevo {
// Minimal equivalent of Lazarus's TColorBox for editing a single color
// value (used by FormItem for dtColor fields): shows the current color as
// a flat swatch, opens a QColorDialog on click.
class ColorButton : public QPushButton {
Q_OBJECT
public:
explicit ColorButton(QWidget *parent = nullptr);
QColor color() const { return m_color; }
void setColor(const QColor &color);
signals:
void colorChanged(const QColor &color);
private slots:
void pickColor();
private:
void updateSwatch();
QColor m_color = Qt::white;
};
} // namespace Cevo
+38
View File
@@ -0,0 +1,38 @@
#pragma once
#include <QObject>
#include <QString>
namespace Cevo {
// Equivalent of DataFile.pas's TDataFile: a base for serializable data
// objects (subclasses implement the actual load/save logic).
class DataFile : public QObject {
Q_OBJECT
public:
explicit DataFile(QObject *parent = nullptr);
virtual QString fileExt() const { return QStringLiteral(".dat"); }
// Equivalent of GetFileName: a human-readable type name (used to build
// the default file name), NOT the stored path - see fileName()/setFileName().
virtual QString fileTypeName() const;
virtual QString fileFilter() const;
virtual void assign(const DataFile &source);
virtual void loadFromFile(const QString &newFileName);
virtual void saveToFile(const QString &newFileName);
QString fileName() const { return m_fileName; }
void setFileName(const QString &value) { m_fileName = value; }
bool modified() const { return m_modified; }
void setModified(bool value);
signals:
void modifiedChanged();
private:
QString m_fileName;
bool m_modified = false;
};
} // namespace Cevo
+44
View File
@@ -0,0 +1,44 @@
#pragma once
#include <QDateTime>
#include <QList>
#include <QMutex>
#include <QObject>
#include <QString>
namespace Cevo {
struct DebugLogItem {
QDateTime time;
QString group;
QString text;
};
// Equivalent of DebugLog.pas's TDebugLog: a thread-safe, capped, optionally
// file-backed log.
class DebugLog : public QObject {
Q_OBJECT
public:
explicit DebugLog(QObject *parent = nullptr);
void add(QString text, QString group = QString());
void writeToFile(QString text) const;
QList<DebugLogItem> items() const;
int maxCount() const { return m_maxCount; }
void setMaxCount(int value);
QString fileName = QStringLiteral("DebugLog.txt");
bool writeToFileEnable = false;
signals:
void newItem(const DebugLogItem &item);
private:
mutable QMutex m_lock;
QList<DebugLogItem> m_items;
int m_maxCount = 100;
};
} // namespace Cevo
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include <QDateTime>
namespace Cevo {
// Equivalent of Common.Delay.pas's TDelay: a simple one-shot countdown.
class Delay {
public:
void start();
void stop();
bool isEnabled() const { return m_enabled; }
// NOTE: matches the original's TDelay.SetEnabled, which ignores its
// argument and always enables - kept as-is (transcribed literally).
void setEnabled(bool value);
bool isOverflowed() const;
bool isRunning() const;
int durationMs = 1000;
private:
QDateTime m_startTime;
bool m_enabled = false;
};
} // namespace Cevo
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include <QDialog>
namespace Cevo {
// Base for all ported Common/Forms dialogs (equivalent of FormEx.pas's
// TFormEx). Deliberately a thin stub for now: the original bundles
// persistent window geometry, theming, translation and DPI-scaling as
// cross-cutting base-class behavior (PersistentForm/ThemeManager/
// Translator/ScaleDPI) - none of that is implemented here yet, this is just
// the extension point to plug it into later without having to touch every
// derived dialog again.
class FormBase : public QDialog {
Q_OBJECT
public:
explicit FormBase(QWidget *parent = nullptr);
};
} // namespace Cevo
+35
View File
@@ -0,0 +1,35 @@
#pragma once
#include <QPoint>
#include <QRect>
#include <QVector>
namespace Cevo {
// Equivalent of Geometric.pas. AddPoint/SubPoint/ComparePoint/RectEquals
// are NOT ported: QPoint/QRect already provide operator+/-/== directly.
struct Vector {
QPoint position;
QPoint direction;
double length() const;
double angle() const;
void setLength(double value);
static Vector create(QPoint p1, QPoint p2);
};
int distance(QPoint p1, QPoint p2);
double dot(QPoint p1, QPoint p2);
// Minimum distance between line segment vw and point p; intersect receives
// the closest point on the segment.
int pointToLineDistance(QPoint p, QPoint v, QPoint w, QPoint &intersect);
QPoint rotatePoint(QPoint center, QPoint p, double angle);
QVector<QPoint> rotatePoints(QPoint center, const QVector<QPoint> &points, double angle);
bool lineIntersect(QPoint lineAP1, QPoint lineAP2, QPoint lineBP1, QPoint lineBP2, QPoint &intersection);
double arcTan2Point(QPoint point);
double arcTanPoint(QPoint point);
QRect rectEnlarge(QRect rect, int value);
QRect shiftRect(QRect rect, QPoint delta);
} // namespace Cevo
+193
View File
@@ -0,0 +1,193 @@
#pragma once
#include <QColor>
#include <QMetaType>
#include <QString>
#include <QStringList>
#include <QVariant>
#include <QVector>
#include <algorithm>
#include <type_traits>
namespace Cevo {
// Equivalent of ItemList.pas's TDataType.
enum class DataType { None, String, Boolean, Integer, Float, Color, Time, Date, DateTime, Enumeration, Reference };
QString dataTypeStr(DataType dataType);
// Equivalent of ItemList.pas's TItemField (a value type here - the original
// needed a class only because of Object Pascal's TObjectList<T> plumbing).
struct ItemField {
QString sysName;
QString name;
int index = 0;
DataType dataType = DataType::None;
QStringList enumStates;
int visibleIfIndex = 0; // >0: only visible if field[visibleIfIndex]'s enum selection is > 0
};
// Equivalent of ItemList.pas's TItemFields.
class ItemFields : public QVector<ItemField> {
public:
ItemField &addField(int index, const QString &sysName, const QString &name, DataType dataType);
const ItemField *searchByIndex(int index) const;
};
class BaseItemList;
// Equivalent of ItemList.pas's TItem. XML load/save (LoadFromNode/
// SaveToNode in the original) is NOT ported: not used by any of the ported
// Common/Forms dialogs.
class Item {
public:
virtual ~Item() = default;
int id = 0;
QString name;
virtual ItemFields getFields() const; // base: just the "Name" field
const ItemField *getField(int index) const;
virtual QVariant getValue(int index) const;
virtual void setValue(int index, const QVariant &value);
int getValueInt(int index) const { return getValue(index).toInt(); }
QString getValueString(int index) const { return getValue(index).toString(); }
QColor getValueColor(int index) const { return getValue(index).value<QColor>(); }
bool getValueBool(int index) const { return getValue(index).toBool(); }
int getValueEnum(int index) const { return getValue(index).toInt(); }
Item *getValueReference(int index) const { return getValue(index).value<Item *>(); }
QString getValueAsText(int index) const;
void setValueInt(int index, int value) { setValue(index, value); }
void setValueString(int index, const QString &value) { setValue(index, value); }
void setValueColor(int index, const QColor &value) { setValue(index, QVariant::fromValue(value)); }
void setValueBool(int index, bool value) { setValue(index, value); }
void setValueEnum(int index, int value) { setValue(index, value); }
void setValueReference(int index, Item *value) { setValue(index, QVariant::fromValue(value)); }
virtual void assign(const Item &source);
virtual bool compare(const Item &other) const;
virtual QString className() const; // TItem.GetClassName
virtual BaseItemList *getReferenceList(int index) const { Q_UNUSED(index); return nullptr; }
};
// Equivalent of ItemList.pas's TBaseItemList: a type-erased view onto an
// ItemList<T> so UI code (FormItem/FormList) doesn't need to know T. Unlike
// the original (which needed a closure-based adapter because Object Pascal
// generics have no common runtime base), this is just a plain abstract
// interface - ItemList<T> below implements it directly.
class BaseItemList {
public:
virtual ~BaseItemList() = default;
virtual QString name() const = 0;
virtual int count() const = 0;
virtual Item *at(int index) const = 0;
virtual int add(Item *value) = 0; // takes ownership, returns the new index
virtual int remove(Item *value) = 0; // deletes value, returns its former index (-1 if not found)
virtual Item *createItem(const QString &name = QString()) const = 0; // does NOT add to the list
virtual QString getNextAvailableName(const QString &name) const = 0;
virtual ItemFields getItemFields() const = 0;
virtual Item *findById(int id) const = 0;
};
// Equivalent of ItemList.pas's TItemList<T>.
template <typename T>
class ItemList : public BaseItemList {
static_assert(std::is_base_of<Item, T>::value, "T must derive from Cevo::Item");
public:
~ItemList() override { qDeleteAll(m_items); }
QString name() const override { return T().className(); }
int count() const override { return m_items.count(); }
Item *at(int index) const override { return m_items.at(index); }
T *itemAt(int index) const { return m_items.at(index); }
int add(Item *value) override
{
auto *item = static_cast<T *>(value);
item->id = nextId();
m_items.append(item);
return m_items.size() - 1;
}
T *addItem(const QString &itemName = QString())
{
T *item = createTypedItem(itemName);
item->id = nextId();
m_items.append(item);
return item;
}
int remove(Item *value) override
{
const int index = m_items.indexOf(static_cast<T *>(value));
if (index >= 0)
delete m_items.takeAt(index);
return index;
}
T *createTypedItem(const QString &itemName) const
{
T *item = new T();
item->name = itemName;
return item;
}
Item *createItem(const QString &itemName) const override { return createTypedItem(itemName); }
QString getNextAvailableName(const QString &baseName) const override
{
QString candidate = baseName + QStringLiteral(" 1");
while (findByName(candidate))
candidate = incrementName(candidate);
return candidate;
}
ItemFields getItemFields() const override { return T().getFields(); }
Item *findById(int itemId) const override
{
for (T *item : m_items)
if (item->id == itemId)
return item;
return nullptr;
}
T *findByName(const QString &itemName) const
{
for (T *item : m_items)
if (item->name == itemName)
return item;
return nullptr;
}
private:
static QString incrementName(const QString &itemName)
{
const int i = itemName.lastIndexOf(' ');
if (i >= 0) {
bool ok = false;
const int num = itemName.mid(i + 1).toInt(&ok);
if (ok)
return itemName.left(i).trimmed() + ' ' + QString::number(num + 1);
}
return itemName + QStringLiteral(" 2");
}
int nextId()
{
int maxId = 0;
for (T *item : m_items)
maxId = std::max(maxId, item->id);
return maxId + 1;
}
QVector<T *> m_items;
};
} // namespace Cevo
Q_DECLARE_METATYPE(Cevo::Item *)
+44
View File
@@ -0,0 +1,44 @@
#pragma once
#include <QPainter>
#include <QPicture>
#include <QPointF>
#include <QTransform>
namespace Cevo {
// Equivalent of MetaCanvas.pas's TMetaCanvas (+ its ~15 TCanvasObject
// subclasses): a "recorded, replayable, zoomable/movable" canvas. Backed by
// Qt's own QPicture, which already records and replays arbitrary QPainter
// commands - so drawing uses Qt's native QPainter API (painter()) rather
// than reimplementing a parallel set of Do*/TCanvasXxx wrapper classes.
// zoom()/move() accumulate into a QTransform applied at drawTo() time,
// instead of mutating each recorded primitive's stored geometry in place
// (the original's approach, which loses precision over repeated Zoom
// calls).
//
// Usage: draw via painter(), call finishRecording() once done, then
// zoom()/move()/drawTo() any number of times; reset() clears everything to
// record again.
class MetaCanvas {
public:
MetaCanvas();
QPainter &painter() { return m_painter; }
void finishRecording();
void zoom(double factor);
void move(QPointF delta);
void reset();
// Replays every recorded command onto `target`, with the accumulated
// zoom/move transform applied.
void drawTo(QPainter &target) const;
private:
QPicture m_picture;
QPainter m_painter;
QTransform m_transform;
};
} // namespace Cevo
+40
View File
@@ -0,0 +1,40 @@
#pragma once
#include <QRect>
#include <QString>
class QWidget;
namespace Cevo {
// Equivalent of PersistentForm.pas's TPersistentForm: window geometry
// persistence across sessions. Re-architected around Qt's native
// QWidget::save/restoreGeometry() + QSettings instead of the original's
// Windows-Registry-based TRect/WindowState bookkeeping - restoreGeometry()
// already clamps off-screen geometry to the current screen layout, which
// covers what CheckEntireVisible/CheckPartVisible did by hand. The
// original's recursive per-control persistence (TListView column widths,
// TPanel docked size) is NOT ported: LCL-specific widget introspection with
// no current consumer. Add a narrower, Qt-idiomatic equivalent (e.g.
// persisting a specific QTreeWidget's column widths) once a concrete form
// actually needs it.
class PersistentForm {
public:
// settingsGroup: QSettings group this form's state is stored under
// (e.g. "Forms/MainWindow") - assumes the application has already set
// QCoreApplication::setOrganizationName()/setApplicationName().
explicit PersistentForm(QString settingsGroup);
void load(QWidget *form, bool defaultMaximized = false, bool defaultFullScreen = false);
void save(QWidget *form) const;
bool isFullScreen() const { return m_fullScreen; }
void setFullScreen(QWidget *form, bool state);
private:
QString m_settingsGroup;
QRect m_restoredGeometry;
bool m_fullScreen = false;
};
} // namespace Cevo
+105
View File
@@ -0,0 +1,105 @@
#pragma once
#include <QMutex>
#include <QVector>
#include <QWaitCondition>
#include <stdexcept>
namespace Cevo {
// Equivalent of Pool.pas's TPool: a simple object pool (Acquire/Release).
// Override newItemObject() to customize item construction. NOT thread-safe
// by itself (matches the original) - see ThreadedPool below for that.
template <typename T>
class Pool {
public:
virtual ~Pool() { setTotalCount(0); }
int totalCount() const { return m_items.size(); }
void setTotalCount(int value)
{
if (value > m_items.size()) {
for (int i = m_items.size(); i < value; ++i) {
T *item = newItemObject();
m_items.append(item);
m_freeItems.append(item);
}
} else {
for (int i = m_items.size() - 1; i >= value; --i) {
T *item = m_items.at(i);
const int freeIndex = m_freeItems.indexOf(item);
if (freeIndex < 0)
throw std::logic_error("Pool: shrinking below a still-acquired item");
m_freeItems.removeAt(freeIndex);
m_items.removeAt(i);
delete item;
}
}
}
int usedCount() const { return m_items.size() - m_freeItems.size(); }
// NOTE: unlike the original (which busy-waits forever if empty, a
// same-thread deadlock risk since nothing else runs to free an item),
// this throws immediately - see ThreadedPool for the genuinely
// multi-threaded blocking-wait behavior.
virtual T *acquire()
{
if (m_freeItems.isEmpty())
throw std::runtime_error("Object pool is empty");
return m_freeItems.takeLast();
}
virtual void release(T *item)
{
if (!m_items.contains(item))
throw std::invalid_argument("Unknown object for release from pool");
m_freeItems.append(item);
}
protected:
virtual T *newItemObject() { return new T(); }
QVector<T *> m_items; // owns all
QVector<T *> m_freeItems; // non-owning subset
};
// Equivalent of Pool.pas's TThreadedPool: acquire() blocks (instead of
// throwing) while the pool has capacity but no free item, waking up once
// another thread calls release() - replaces the original's Sleep(1)
// busy-polling loop with a QWaitCondition.
template <typename T>
class ThreadedPool : public Pool<T> {
public:
int totalCount() const { QMutexLocker locker(&m_lock); return Pool<T>::totalCount(); }
void setTotalCount(int value)
{
QMutexLocker locker(&m_lock);
Pool<T>::setTotalCount(value);
}
int usedCount() const { QMutexLocker locker(&m_lock); return Pool<T>::usedCount(); }
T *acquire() override
{
QMutexLocker locker(&m_lock);
if (Pool<T>::totalCount() == 0)
throw std::runtime_error("Object pool is empty");
while (Pool<T>::m_freeItems.isEmpty())
m_releaseWait.wait(&m_lock);
return Pool<T>::m_freeItems.takeLast();
}
void release(T *item) override
{
QMutexLocker locker(&m_lock);
Pool<T>::release(item);
m_releaseWait.wakeOne();
}
private:
mutable QMutex m_lock;
QWaitCondition m_releaseWait;
};
} // namespace Cevo
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <QString>
#include <array>
namespace Cevo {
struct PrefixMultiplierItem {
QString shortText;
QString fullText;
double value;
};
using PrefixMultiplierDef = std::array<PrefixMultiplierItem, 17>;
extern const PrefixMultiplierDef BasePrefixMultipliers;
extern const PrefixMultiplierDef TimePrefixMultipliers;
double truncateDigits(double value, int digits = 3);
// Formats value scaled to the closest prefix in prefixMultipliers (e.g. "1.2 k" + unitText).
QString formatWithPrefix(double value, const PrefixMultiplierDef &prefixMultipliers, const QString &unitText,
int digits = 3);
} // namespace Cevo
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include <QPoint>
#include <QString>
#include <QVector>
namespace Cevo {
// Equivalent of StringTable.pas's TStringTable: a resizable 2D string grid.
class StringTable {
public:
QString cell(int x, int y) const { return m_cells.at(y).at(x); }
void setCell(int x, int y, const QString &value) { m_cells[y][x] = value; }
int colCount() const { return m_size.x(); }
void setColCount(int value) { setSize(QPoint(value, rowCount())); }
int rowCount() const { return m_size.y(); }
void setRowCount(int value) { setSize(QPoint(colCount(), value)); }
QPoint size() const { return m_size; }
void setSize(QPoint value);
private:
QVector<QVector<QString>> m_cells;
QPoint m_size;
};
} // namespace Cevo
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include <QMutex>
namespace Cevo {
// Equivalent of SyncCounter.pas's TSyncCounter: a thread-safe counter/ID allocator.
class SyncCounter {
public:
int allocate();
bool currentEqualTo(int value) const;
void increment();
// NOTE: matches the original, which copies Top/Current without locking.
void assign(const SyncCounter &source);
private:
mutable QMutex m_lock;
int m_top = 0;
int m_current = 0;
};
} // namespace Cevo
+59
View File
@@ -0,0 +1,59 @@
#pragma once
#include <QStringList>
#include <memory>
#include <vector>
class QTreeWidget;
namespace Cevo {
// Equivalent of Table.pas's TTableFormat/TTableFormats.
enum class TableFormat { Excel, Plain, Csv, Html, ListView, MediaWiki, Xml, Json };
QString tableFormatText(TableFormat format);
QString tableFormatExt(TableFormat format);
// Equivalent of Table.pas's TRow.
struct Row {
QStringList cells;
void addCell(const QString &text) { cells.append(text); }
};
// Equivalent of Table.pas's TTable: a generic string table with multi-format
// export/import. JSON (QJsonDocument) and XML (QDomDocument) use Qt's own
// parsers/serializers instead of the original's hand-rolled, line-based
// ones (the original's JSON "parser" assumes exactly one "key": "value" per
// line and no nesting; its HTML/JSON output also did not escape cell
// content at all, which is fixed here).
class Table {
public:
QString title;
QStringList columns;
std::vector<std::unique_ptr<Row>> rows;
bool firstRowIsHeader = false;
void clear();
Row &addRow();
QString outputTabs() const;
QString outputPlain() const;
QString outputCsv() const;
QString outputXml() const;
QString outputHtml() const;
QString outputMediaWiki() const;
QString outputJson() const;
void populateTreeWidget(QTreeWidget *tree) const;
QString output(TableFormat format) const;
void setInputCsv(const QString &text);
void setInputMediaWiki(const QString &text);
void setInputJson(const QString &text);
void setInputXml(const QString &text);
void setInput(TableFormat format, const QString &text);
static QList<TableFormat> inputFormats();
};
} // namespace Cevo
+46
View File
@@ -0,0 +1,46 @@
#pragma once
#include <QString>
#include <memory>
#include <vector>
namespace Cevo {
enum class TestResult { None, Passed, Failed };
QString testResultText(TestResult result);
// Equivalent of TestCase.pas's TTestCase: a single named test, logging its
// own output and result as it runs.
class TestCase {
public:
virtual ~TestCase() = default;
QString name;
TestResult testResult = TestResult::None;
QString log;
virtual void initialize() { testResult = TestResult::None; }
virtual void run() {}
virtual void finalize() {}
void evaluate(bool passed) { testResult = passed ? TestResult::Passed : TestResult::Failed; }
void pass() { testResult = TestResult::Passed; }
void fail() { testResult = TestResult::Failed; }
};
// Equivalent of TestCase.pas's TTestCases: an owning collection of test
// cases, run in sequence.
class TestCases {
public:
TestCase *addNew(const QString &name, std::unique_ptr<TestCase> testCase);
void run();
int count() const { return static_cast<int>(m_items.size()); }
TestCase *at(int index) const { return m_items.at(static_cast<size_t>(index)).get(); }
private:
std::vector<std::unique_ptr<TestCase>> m_items;
};
} // namespace Cevo
+29
View File
@@ -0,0 +1,29 @@
#pragma once
#include <functional>
namespace Cevo {
// Equivalent of Threading.pas's free functions (RunInThread/
// RunInThreadAsync/Synchronize). The TVirtualThread/TListedThread/
// TTermThread/TThreadList class hierarchy is NOT ported: it exists only to
// let a worker thread find "its own" wrapper object (via a global,
// mutex-guarded ThreadList keyed by TThreadID) so Synchronize() can call
// back into it - QThread + Qt::BlockingQueuedConnection already solve this
// natively, with no registry needed.
// Runs `method` on a new thread, blocking the caller until it finishes
// (pumping the Qt event loop meanwhile if called from the main thread).
// Re-throws whatever `method` threw.
void runInThread(const std::function<void()> &method);
// Runs `method` on a new thread without blocking; if given, `callback` runs
// (on that same worker thread) once `method` returns.
void runInThreadAsync(const std::function<void()> &method, const std::function<void()> &callback = {});
// Equivalent of TThread.Synchronize from a worker thread: runs `method` on
// the main/GUI thread, blocking the caller until it completes. Runs
// `method` directly, with no thread hop, if already on the main thread.
void synchronizeToMainThread(const std::function<void()> &method);
} // namespace Cevo
+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <QDateTime>
#include <QDomDocument>
#include <QString>
namespace Cevo {
// Equivalent of XML.pas's node read/write helpers (each value is stored as
// a named child element's text content). XMLTimeToDateTime/
// DateTimeToXMLTime (+ their GetTimeZoneBias/LeftCutString helpers) are NOT
// ported: QDateTime already parses/formats ISO 8601 (incl. timezone offset
// and fractional seconds) natively and more robustly than the original's
// hand-rolled parser.
void writeInteger(QDomElement &node, const QString &name, int value);
void writeInt64(QDomElement &node, const QString &name, qint64 value);
void writeBoolean(QDomElement &node, const QString &name, bool value);
void writeString(QDomElement &node, const QString &name, const QString &value);
void writeDateTime(QDomElement &node, const QString &name, const QDateTime &value);
void writeDouble(QDomElement &node, const QString &name, double value);
int readInteger(const QDomElement &node, const QString &name, int defaultValue);
qint64 readInt64(const QDomElement &node, const QString &name, qint64 defaultValue);
bool readBoolean(const QDomElement &node, const QString &name, bool defaultValue);
QString readString(const QDomElement &node, const QString &name, const QString &defaultValue);
QDateTime readDateTime(const QDomElement &node, const QString &name, const QDateTime &defaultValue);
double readDouble(const QDomElement &node, const QString &name, double defaultValue);
// Parses fileName into a QDomDocument; throws std::runtime_error on failure.
QDomDocument readXmlFile(const QString &fileName);
} // namespace Cevo