From f7a42de9bfd6e34f1dc46da433d3f45976b1cd0e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 15 Feb 2017 16:21:06 +0100 Subject: PropertyParser to properly parse different property types. --- common/CMakeLists.txt | 2 ++ common/domain/applicationdomaintype.cpp | 1 + common/propertyparser.cpp | 29 +++++++++++++++++++++++++++++ common/propertyparser.h | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 common/propertyparser.cpp create mode 100644 common/propertyparser.h (limited to 'common') diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 92da470..ec437ed 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -60,6 +60,7 @@ set(command_SRCS resourceconfig.cpp configstore.cpp resultset.cpp + domain/propertyregistry.cpp domain/applicationdomaintype.cpp domain/contact.cpp domain/event.cpp @@ -81,6 +82,7 @@ set(command_SRCS notification.cpp commandprocessor.cpp inspector.cpp + propertyparser.cpp ${storage_SRCS}) add_library(${PROJECT_NAME} SHARED ${command_SRCS}) diff --git a/common/domain/applicationdomaintype.cpp b/common/domain/applicationdomaintype.cpp index 4bd17fe..49bfb5f 100644 --- a/common/domain/applicationdomaintype.cpp +++ b/common/domain/applicationdomaintype.cpp @@ -62,6 +62,7 @@ SINK_REGISTER_PROPERTY(Folder, Name); SINK_REGISTER_PROPERTY(Folder, Icon); SINK_REGISTER_PROPERTY(Folder, SpecialPurpose); SINK_REGISTER_PROPERTY(Folder, Enabled); +SINK_REGISTER_PROPERTY(Folder, Parent); static const int foo = [] { QMetaType::registerEqualsComparator(); diff --git a/common/propertyparser.cpp b/common/propertyparser.cpp new file mode 100644 index 0000000..c638594 --- /dev/null +++ b/common/propertyparser.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2017 Christian Mollekopf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ +#include "propertyparser.h" + +#include "domain/propertyregistry.h" + +using namespace Sink; + +QVariant PropertyParser::parse(const QByteArray &type, const QByteArray &property, const QString &value) +{ + return Private::PropertyRegistry::instance().parse(type, property, value); +} diff --git a/common/propertyparser.h b/common/propertyparser.h new file mode 100644 index 0000000..f5bda85 --- /dev/null +++ b/common/propertyparser.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017 Christian Mollekopf + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) version 3, or any + * later version accepted by the membership of KDE e.V. (or its + * successor approved by the membership of KDE e.V.), which shall + * act as a proxy defined in Section 6 of version 3 of the license. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ +#pragma once + +#include "sink_export.h" +#include + +namespace Sink { + +class SINK_EXPORT PropertyParser { +public: + static QVariant parse(const QByteArray &type, const QByteArray &property, const QString &value); +}; + +} + -- cgit v1.2.3