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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2014 Abhinav Gangwar <abhgang@gmail.com>
0004 //
0005 
0006 #ifndef MARBLE_GEODATASIMPLEFIELD_H
0007 #define MARBLE_GEODATASIMPLEFIELD_H
0008 
0009 #include "geodata_export.h"
0010 #include "GeoDocument.h"
0011 
0012 class QDataStream;
0013 class QString;
0014 
0015 namespace Marble
0016 {
0017 
0018 class GeoDataSimpleFieldPrivate;
0019 
0020 /**
0021  */
0022 class GEODATA_EXPORT GeoDataSimpleField : public GeoNode
0023 {
0024 public:
0025     GeoDataSimpleField();
0026     GeoDataSimpleField( const GeoDataSimpleField& other );
0027     bool operator==( const GeoDataSimpleField& other ) const;
0028     bool operator!=( const GeoDataSimpleField& other ) const;
0029     ~GeoDataSimpleField() override;
0030 
0031     /*
0032      * @brief Enum for different values of type attribute of SimpleField
0033      */
0034     enum SimpleFieldType {
0035         String,
0036         Int,
0037         UInt,
0038         Short,
0039         UShort,
0040         Float,
0041         Double,
0042         Bool
0043     };
0044 
0045     /*
0046      * @brief Return the value of type attribute of simple field
0047      */
0048     SimpleFieldType type() const;
0049 
0050     /*
0051      * @brief Sets the value of type attribute
0052      * @param type  The of type attribute
0053      */
0054     void setType(SimpleFieldType type);
0055 
0056     /*
0057      * @brief Returns the value of name attribute of simple field
0058      */
0059     QString name() const;
0060 
0061     /*
0062      * @brief Set the value of name attribute of SimpleField
0063      * @param value  The value to be set as name attribute
0064      */
0065     void setName( const QString& value );
0066 
0067     /*
0068      * @brief Returns the value of displayField child element of SimpleField tag
0069      */
0070     QString displayName() const;
0071 
0072     /*
0073      * @brief Set the value for displayName tag
0074      * @param displayName  The value to be set for displayName tag
0075      */
0076     void setDisplayName( const QString& displayName );
0077 
0078     /*
0079      * @brief The assignment operator
0080      * @param rhs  The object to be duplicated
0081      */
0082     GeoDataSimpleField& operator=( const GeoDataSimpleField& rhs );
0083 
0084     /*
0085      * @brief Provides information for downcasting a GeoNode
0086      */
0087     const char* nodeType() const override;
0088 
0089     /*
0090      * @brief Serialize SimpleField to a stream
0091      * @param stream  The stream
0092      */
0093     virtual void pack( QDataStream& stream ) const;
0094 
0095     /*
0096      * @brief Unserialize SimpleField from a stream
0097      * @param stream  The stream
0098      */
0099     virtual void unpack( QDataStream& stream );
0100 
0101 private:
0102     GeoDataSimpleFieldPrivate * const d;
0103 
0104 };
0105 
0106 }
0107 
0108 #endif // MARBLE_GEODATASIMPLEFIELD_H