[nostalgia/studio] Cleanup
This commit is contained in:
@@ -32,7 +32,8 @@ enum class ProjectEvent {
|
||||
FileUpdated,
|
||||
};
|
||||
|
||||
[[nodiscard]] QString filePathToName(QString path, QString prefix, QString suffix);
|
||||
[[nodiscard]]
|
||||
QString filePathToName(const QString &path, const QString &prefix, const QString &suffix);
|
||||
|
||||
class NOSTALGIASTUDIO_EXPORT Project: public QObject {
|
||||
Q_OBJECT
|
||||
@@ -42,42 +43,40 @@ class NOSTALGIASTUDIO_EXPORT Project: public QObject {
|
||||
mutable std::unique_ptr<ox::FileSystem> m_fs;
|
||||
|
||||
public:
|
||||
explicit Project(QString path);
|
||||
explicit Project(const QString &path);
|
||||
|
||||
~Project() override;
|
||||
~Project() override = default;
|
||||
|
||||
void create();
|
||||
|
||||
ox::FileSystem *romFs();
|
||||
|
||||
void mkdir(QString path) const;
|
||||
void mkdir(const QString &path) const;
|
||||
|
||||
/**
|
||||
* Writes a MetalClaw object to the project at the given path.
|
||||
*/
|
||||
template<typename T>
|
||||
void writeObj(QString path, T *obj) const;
|
||||
void writeObj(const QString &path, T *obj) const;
|
||||
|
||||
template<typename T>
|
||||
std::unique_ptr<T> loadObj(QString path) const;
|
||||
std::unique_ptr<T> loadObj(const QString &path) const;
|
||||
|
||||
ox::FileStat stat(QString path) const;
|
||||
ox::FileStat stat(const QString &path) const;
|
||||
|
||||
bool exists(QString path) const;
|
||||
|
||||
void subscribe(ProjectEvent e, QObject *tgt, const char *slot) const;
|
||||
bool exists(const QString& path) const;
|
||||
|
||||
template<typename Functor>
|
||||
void subscribe(ProjectEvent e, QObject *tgt, Functor &&slot) const;
|
||||
|
||||
private:
|
||||
void writeBuff(QString path, uint8_t *buff, size_t buffLen) const;
|
||||
void writeBuff(const QString &path, uint8_t *buff, size_t buffLen) const;
|
||||
|
||||
ox::Buffer loadBuff(QString path) const;
|
||||
ox::Buffer loadBuff(const QString &path) const;
|
||||
|
||||
void lsProcDir(QStringList *paths, QString path) const;
|
||||
void lsProcDir(QStringList *paths, const QString &path) const;
|
||||
|
||||
QStringList listFiles(QString path = "") const;
|
||||
QStringList listFiles(const QString &path = "") const;
|
||||
|
||||
signals:
|
||||
void fileEvent(ProjectEvent, QString path) const;
|
||||
@@ -92,7 +91,7 @@ class NOSTALGIASTUDIO_EXPORT Project: public QObject {
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void Project::writeObj(QString path, T *obj) const {
|
||||
void Project::writeObj(const QString &path, T *obj) const {
|
||||
// write MetalClaw
|
||||
oxRequireMT(buff, ox::writeClaw(obj, ox::ClawFormat::Metal));
|
||||
// write to FS
|
||||
@@ -112,7 +111,7 @@ void Project::writeObj(QString path, T *obj) const {
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::unique_ptr<T> Project::loadObj(QString path) const {
|
||||
std::unique_ptr<T> Project::loadObj(const QString &path) const {
|
||||
auto obj = std::make_unique<T>();
|
||||
auto buff = loadBuff(path);
|
||||
oxThrowError(ox::readClaw<T>(buff.data(), buff.size(), obj.get()));
|
||||
|
||||
Reference in New Issue
Block a user