forked from qt-creator/qt-creator
Utils: Introduce a Storage class
... mapping Keys (currently QString) to Data (currently QVariant), i.e. effectively an oddly named QVariantMap. Plan is to 1. make QVariantMap using loading/saving related functions to use Storage instead of QVariant map, 2. replace QString by a UTF-8 container (QByteArray for starters) 3. add/remove parts of the map interface so that neither decoration of string literals in user code are needed, nor that unnecessary allocations happen. Long term Storage could cover some of the current JSON uses, with Storage's implementation possibly switching over to something based on JSON (or CBOR?) directly, to be closer what we typically send over the wire. Change-Id: Ic33b8e95fed5268d6298b5391ff42cbb582b56c4 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -161,6 +161,7 @@ add_qtc_library(Utils
|
||||
sortfiltermodel.h
|
||||
span.h
|
||||
statuslabel.cpp statuslabel.h
|
||||
storage.cpp storage.h
|
||||
stringtable.cpp stringtable.h
|
||||
stringutils.cpp stringutils.h
|
||||
styleanimator.cpp styleanimator.h
|
||||
|
9
src/libs/utils/storage.cpp
Normal file
9
src/libs/utils/storage.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// Copyright (C) 2017 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "storage.h"
|
||||
|
||||
|
||||
namespace Utils {
|
||||
|
||||
} // Utils
|
14
src/libs/utils/storage.h
Normal file
14
src/libs/utils/storage.h
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QVariantMap>
|
||||
|
||||
namespace Utils {
|
||||
|
||||
using Key = QString;
|
||||
using Data = QVariant;
|
||||
using Storage = QMap<Key, Data>;
|
||||
|
||||
} // Utils
|
@@ -293,6 +293,8 @@ Project {
|
||||
"../3rdparty/span/span.hpp",
|
||||
"statuslabel.cpp",
|
||||
"statuslabel.h",
|
||||
"storage.cpp",
|
||||
"storage.h",
|
||||
"stringtable.cpp",
|
||||
"stringtable.h",
|
||||
"stringutils.cpp",
|
||||
|
Reference in New Issue
Block a user