[nostalgia] Update nested namespaces for C++17

This commit is contained in:
Gary Talent 2019-08-03 22:43:17 -05:00
parent 8cd38dccbf
commit 32b345ed0b
21 changed files with 27 additions and 70 deletions

View File

@ -7,8 +7,7 @@
*/ */
#include "bounds.hpp" #include "bounds.hpp"
namespace nostalgia { namespace nostalgia::common {
namespace common {
Bounds::Bounds(int x, int y, int w, int h) { Bounds::Bounds(int x, int y, int w, int h) {
this->x = x; this->x = x;
@ -42,4 +41,3 @@ Point Bounds::pt2() {
} }
} }
}

View File

@ -9,8 +9,7 @@
#include "point.hpp" #include "point.hpp"
namespace nostalgia { namespace nostalgia::common {
namespace common {
class Bounds { class Bounds {
public: public:
@ -48,4 +47,3 @@ ox::Error model(T *io, Bounds *obj) {
} }
} }
}

View File

@ -7,8 +7,7 @@
*/ */
#include "point.hpp" #include "point.hpp"
namespace nostalgia { namespace nostalgia::common {
namespace common {
Point::Point() { Point::Point() {
} }
@ -122,4 +121,3 @@ Point Point::operator/=(int i) {
} }
} }
}

View File

@ -10,8 +10,7 @@
#include <ox/std/error.hpp> #include <ox/std/error.hpp>
namespace nostalgia { namespace nostalgia::common {
namespace common {
class Point { class Point {
public: public:
@ -68,4 +67,3 @@ ox::Error model(T *io, Point *obj) {
} }
} }
}

View File

@ -8,8 +8,7 @@
#pragma once #pragma once
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
enum { enum {
JSON_ERR_FIELD_MISSING = 1, JSON_ERR_FIELD_MISSING = 1,
@ -17,4 +16,3 @@ enum {
}; };
} }
}

View File

@ -8,8 +8,7 @@
#include "json_read.hpp" #include "json_read.hpp"
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
JsonReader::JsonReader(QJsonObject &obj): m_src(obj) { JsonReader::JsonReader(QJsonObject &obj): m_src(obj) {
} }
@ -86,4 +85,3 @@ ox::Error JsonReader::field(QJsonValueRef src, QString *dest) {
} }
}

View File

@ -14,8 +14,7 @@
#include <ox/fs/fs.hpp> #include <ox/fs/fs.hpp>
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
class OxFSFile { class OxFSFile {
private: private:
@ -82,4 +81,3 @@ class OxFSModel: public QAbstractItemModel {
}; };
} }
}

View File

@ -8,8 +8,7 @@
#include "plugin.hpp" #include "plugin.hpp"
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
QVector<WizardMaker> Plugin::newWizards(const Context*) { QVector<WizardMaker> Plugin::newWizards(const Context*) {
return {}; return {};
@ -24,4 +23,3 @@ QWidget *Plugin::makeEditor(QString, const Context*) {
} }
} }
}

View File

@ -19,8 +19,7 @@
#include "project.hpp" #include "project.hpp"
#include "wizard.hpp" #include "wizard.hpp"
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
struct Context { struct Context {
QWidget *tabParent = nullptr; QWidget *tabParent = nullptr;
@ -46,7 +45,6 @@ class Plugin {
}; };
}
} }
#define PluginInterface_iid "net.drinkingtea.nostalgia.studio.Plugin" #define PluginInterface_iid "net.drinkingtea.nostalgia.studio.Plugin"

View File

@ -15,8 +15,7 @@
#include <ox/fs/fs.hpp> #include <ox/fs/fs.hpp>
#include <ox/mc/mc.hpp> #include <ox/mc/mc.hpp>
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
class Project: public QObject { class Project: public QObject {
Q_OBJECT Q_OBJECT
@ -75,4 +74,3 @@ ox::Error Project::writeObj(QString path, T *obj) const {
} }
} }
}

View File

@ -18,8 +18,7 @@
#include "plugin.hpp" #include "plugin.hpp"
#include "wizard.hpp" #include "wizard.hpp"
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
using std::function; using std::function;
@ -343,4 +342,3 @@ void Wizard::accept() {
} }
} }
}

View File

@ -19,8 +19,7 @@
#include <QVector> #include <QVector>
#include <QWizard> #include <QWizard>
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
struct WizardMaker { struct WizardMaker {
QString name; QString name;
@ -132,4 +131,3 @@ class Wizard: public QWizard {
}; };
} }
}

View File

@ -29,8 +29,7 @@
#include "mainwindow.hpp" #include "mainwindow.hpp"
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
const QString MainWindow::StateFilePath = "studio_state.json"; const QString MainWindow::StateFilePath = "studio_state.json";
@ -375,4 +374,3 @@ void MainWindow::refreshProjectExplorer(QString path) {
} }
} }
}

View File

@ -27,8 +27,7 @@
#include "lib/plugin.hpp" #include "lib/plugin.hpp"
#include "lib/project.hpp" #include "lib/project.hpp"
namespace nostalgia { namespace nostalgia::studio {
namespace studio {
struct NostalgiaStudioState { struct NostalgiaStudioState {
QString projectPath; QString projectPath;
@ -145,4 +144,3 @@ class MainWindow: public QMainWindow {
}; };
} }
}

View File

@ -8,10 +8,8 @@
#include "consts.hpp" #include "consts.hpp"
namespace nostalgia { namespace nostalgia::world {
namespace world {
QString PATH_ZONES = "/World/Zones/"; QString PATH_ZONES = "/World/Zones/";
} }
}

View File

@ -10,10 +10,8 @@
#include <QString> #include <QString>
namespace nostalgia { namespace nostalgia::world {
namespace world {
extern QString PATH_ZONES; extern QString PATH_ZONES;
} }
}

View File

@ -11,8 +11,7 @@
#include "consts.hpp" #include "consts.hpp"
#include "newworldwizard.hpp" #include "newworldwizard.hpp"
namespace nostalgia { namespace nostalgia::world {
namespace world {
using namespace studio; using namespace studio;
@ -21,15 +20,14 @@ const QString NewWorldWizard::FIELD_WORLD_PATH = "World.WorldPath";
NewWorldWizard::NewWorldWizard(const Context *ctx) { NewWorldWizard::NewWorldWizard(const Context *ctx) {
addLineEdit(tr("&Name:"), FIELD_WORLD_PATH, "", [this, ctx](QString worldName) { addLineEdit(tr("&Name:"), FIELD_WORLD_PATH, "", [this, ctx](QString worldName) {
worldName = PATH_ZONES + worldName; worldName = PATH_ZONES + worldName;
if (ctx->project->stat(worldName).inode == 0) { auto [stat, err] = ctx->project->stat(worldName);
return 0; if (err) {
} else {
this->showValidationError(tr("World already exists: %1").arg(worldName)); this->showValidationError(tr("World already exists: %1").arg(worldName));
return 1; return 1;
} }
return 0;
} }
); );
} }
} }
}

View File

@ -12,8 +12,7 @@
#include <nostalgia/studio/studio.hpp> #include <nostalgia/studio/studio.hpp>
namespace nostalgia { namespace nostalgia::world {
namespace world {
struct NewWorldWizard: public studio::WizardFormPage { struct NewWorldWizard: public studio::WizardFormPage {
@ -24,4 +23,3 @@ struct NewWorldWizard: public studio::WizardFormPage {
}; };
} }
}

View File

@ -10,8 +10,7 @@
#include <nostalgia/studio/studio.hpp> #include <nostalgia/studio/studio.hpp>
namespace nostalgia { namespace nostalgia::world {
namespace world {
class WorldEditor: public QWidget { class WorldEditor: public QWidget {
@ -21,4 +20,3 @@ class WorldEditor: public QWidget {
}; };
} }
}

View File

@ -16,8 +16,7 @@
#include "worldstudioplugin.hpp" #include "worldstudioplugin.hpp"
namespace nostalgia { namespace nostalgia::world {
namespace world {
using namespace studio; using namespace studio;
@ -32,11 +31,10 @@ QVector<WizardMaker> WorldEditorPlugin::newWizards(const Context *ctx) {
qDebug() << "creating Region"; qDebug() << "creating Region";
auto path = PATH_ZONES + w->field(NewWorldWizard::FIELD_WORLD_PATH).toString(); auto path = PATH_ZONES + w->field(NewWorldWizard::FIELD_WORLD_PATH).toString();
Region rgn; Region rgn;
auto err = ctx->project->mkdir(PATH_ZONES); oxReturnError(ctx->project->mkdir(PATH_ZONES));
ctx->project->saveRomFs(); ctx->project->saveRomFs();
qDebug() << "err:" << err; oxReturnError(ctx->project->writeObj(path, &rgn));
err |= ctx->project->writeObj(path, &rgn); return OxError(0);
return err;
} }
} }
}; };
@ -51,4 +49,3 @@ QWidget *WorldEditorPlugin::makeEditor(QString path, const Context *ctx) {
} }
} }
}

View File

@ -12,8 +12,7 @@
#include <nostalgia/studio/studio.hpp> #include <nostalgia/studio/studio.hpp>
namespace nostalgia { namespace nostalgia::world {
namespace world {
class WorldEditorPlugin: public QObject, public studio::Plugin { class WorldEditorPlugin: public QObject, public studio::Plugin {
Q_OBJECT Q_OBJECT
@ -28,4 +27,3 @@ class WorldEditorPlugin: public QObject, public studio::Plugin {
}; };
} }
}