From fd29e49f55e2a1c419378d92366b05367f2cdc07 Mon Sep 17 00:00:00 2001 From: S David <2100425+s-daveb@users.noreply.github.com> Date: Sat, 11 May 2024 09:04:41 -0400 Subject: [PATCH] QJsonModel enum flags defined and renamed for consistency --- CMakeLists.txt | 2 +- include/QJsonModel.hpp | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ace63ba..7a16754 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ disable_tests_if_subproject() #git_setup_submodules() project(QJsonModel - VERSION 0.0.5 + VERSION 0.0.6 LANGUAGES C CXX # Save this for later: # HOMEPAGE_URL diff --git a/include/QJsonModel.hpp b/include/QJsonModel.hpp index aebad88..7f229dc 100644 --- a/include/QJsonModel.hpp +++ b/include/QJsonModel.hpp @@ -45,31 +45,35 @@ class QJsonModel : public QAbstractItemModel { public: // clang-format off enum FieldPermissions : unsigned char { - ReadOnly = 0b0000, - WritableValue = 0b0001, - WritableKey = 0b0010 - }; // clang-format on + kReadOnly = 0b0000, + kWritableValue = 0b0001, + kWritableKey = 0b0010 + }; + enum ErrorFlag : bool { + kSuccess = false, + kError = true, + }; + // clang-format on explicit QJsonModel( QObject* parent = nullptr, - FieldPermissions permissions = WritableValue + FieldPermissions permissions = kWritableValue ); QJsonModel( const QString& fileName, QObject* parent = nullptr, - FieldPermissions permissions = WritableValue + FieldPermissions permissions = kWritableValue ); QJsonModel( QIODevice* device, QObject* parent = nullptr, - FieldPermissions permissions = WritableValue + FieldPermissions permissions = kWritableValue ); QJsonModel( const QByteArray& json, QObject* parent = nullptr, - FieldPermissions permissions = WritableValue + FieldPermissions permissions = kWritableValue ); ~QJsonModel() override; - using ErrorFlag = bool; ErrorFlag load(const QString& fileName); ErrorFlag load(QIODevice* file); ErrorFlag loadJson(const QByteArray& json);