Skip to content

Commit

Permalink
QJsonModel enum flags defined and renamed for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
s-daveb committed May 11, 2024
1 parent 1742000 commit fd29e49
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <URL>
Expand Down
22 changes: 13 additions & 9 deletions include/QJsonModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fd29e49

Please sign in to comment.