File indexing completed on 2024-05-12 03:50:17

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2014 Abhinav Gangwar <abhgang@gmail.com>
0004 //
0005 
0006 #ifndef MARBLE_GEODATASCHEMA_H
0007 #define MARBLE_GEODATASCHEMA_H
0008 
0009 // Qt
0010 #include <QHash>
0011 #include <QList>
0012 
0013 // Marble
0014 #include "GeoDataObject.h"
0015 #include "geodata_export.h"
0016 
0017 class QDataStream;
0018 
0019 namespace Marble
0020 {
0021 
0022 class GeoDataSchemaPrivate;
0023 class GeoDataSimpleField;
0024 
0025 /**
0026  */
0027 class GEODATA_EXPORT GeoDataSchema : public GeoDataObject
0028 {
0029 public:
0030     GeoDataSchema();
0031     explicit GeoDataSchema( const QHash<QString, GeoDataSimpleField>& simpleFields );
0032     GeoDataSchema( const GeoDataSchema& other );
0033     GeoDataSchema& operator=( const GeoDataSchema& other );
0034     bool operator==( const GeoDataSchema& other ) const;
0035     bool operator!=( const GeoDataSchema& other ) const;
0036     ~GeoDataSchema() override;
0037 
0038     /*
0039      * @brief Returns the name attribute of schema
0040      */
0041     QString schemaName() const;
0042 
0043     /*
0044      * @brief Sets the name attribute of the schema
0045      * @param name  The name to be set
0046      */
0047     void setSchemaName( const QString& name );
0048 
0049     /*
0050      * @brief Returns the SimpleField child of schema
0051      * @param name  The value of name attribute of SimpleField which is to be returned
0052      */
0053     GeoDataSimpleField& simpleField( const QString &name ) const;
0054 
0055     /*
0056      * @brief Adds a SimpleField to schema
0057      * @param value  The SimpleField to be added
0058      */
0059     void addSimpleField( const GeoDataSimpleField& value );
0060 
0061     /*
0062      * @brief dump a vector containing all simple fields of schema
0063      */
0064     QList<GeoDataSimpleField> simpleFields() const;
0065 
0066     const char* nodeType() const override;
0067 
0068     void pack( QDataStream& stream ) const override;
0069 
0070     void unpack( QDataStream& stream ) override;
0071 
0072 private:
0073     GeoDataSchemaPrivate * const d;
0074 
0075 };
0076 
0077 }
0078 
0079 #endif  // MARBLE_GEODATASCHEMA_H