QtProtobuf  0.6
Protobuf plugin to generate Qt classes
qprotobufserializer.h
1 /*
2  * MIT License
3  *
4  * Copyright (c) 2019 Alexey Edelev <semlanik@gmail.com>
5  *
6  * This file is part of QtProtobuf project https://git.semlanik.org/semlanik/qtprotobuf
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy of this
9  * software and associated documentation files (the "Software"), to deal in the Software
10  * without restriction, including without limitation the rights to use, copy, modify,
11  * merge, publish, distribute, sublicense, and/or sell copies of the Software, and
12  * to permit persons to whom the Software is furnished to do so, subject to the following
13  * conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in all copies
16  * or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
19  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
20  * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
21  * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  */
25 
26 #pragma once //QProtobufSerializer
27 
28 #include "qabstractprotobufserializer.h"
29 #include "qtprotobufglobal.h"
30 
31 namespace QtProtobuf {
32 
33 class QProtobufSerializerPrivate;
38 class Q_PROTOBUF_EXPORT QProtobufSerializer : public QAbstractProtobufSerializer
39 {
40 public:
43 
44 protected:
45  QByteArray serializeMessage(const QObject *object, const QProtobufMetaObject &metaObject) const override;
46  void deserializeMessage(QObject *object, const QProtobufMetaObject &metaObject, const QByteArray &data) const override;
47 
48  QByteArray serializeObject(const QObject *object, const QProtobufMetaObject &metaObject, const QProtobufMetaProperty &metaProperty) const override;
49  void deserializeObject(QObject *object, const QProtobufMetaObject &metaObject, QProtobufSelfcheckIterator &it) const override;
50 
51  QByteArray serializeListObject(const QObject *object, const QProtobufMetaObject &metaObject, const QProtobufMetaProperty &metaProperty) const override;
52  bool deserializeListObject(QObject *object, const QProtobufMetaObject &metaObject, QProtobufSelfcheckIterator &it) const override;
53 
54  QByteArray serializeMapPair(const QVariant &key, const QVariant &value, const QProtobufMetaProperty &metaProperty) const override;
55  bool deserializeMapPair(QVariant &key, QVariant &value, QProtobufSelfcheckIterator &it) const override;
56 
57  QByteArray serializeEnum(int64 value, const QMetaEnum &metaEnum, const QtProtobuf::QProtobufMetaProperty &metaProperty) const override;
58  QByteArray serializeEnumList(const QList<int64> &value, const QMetaEnum &metaEnum, const QtProtobuf::QProtobufMetaProperty &metaProperty) const override;
59 
60  void deserializeEnum(int64 &value, const QMetaEnum &metaEnum, QProtobufSelfcheckIterator &it) const override;
61  void deserializeEnumList(QList<int64> &value, const QMetaEnum &metaEnum, QProtobufSelfcheckIterator &it) const override;
62 
63  std::unique_ptr<QProtobufSerializerPrivate> dPtr;
64 };
65 
66 }
The QAbstractProtobufSerializer class is interface that represents basic functions for serialization/...
Definition: qabstractprotobufserializer.h:72
Definition: qprotobufmetaproperty.h:41
The QProtobufSelfcheckIterator class.
Definition: qprotobufselfcheckiterator.h:40
The QProtobufSerializer class.
Definition: qprotobufserializer.h:39