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

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Harshit Jain <hjain.itbhu@gmail.com>
0004 //
0005 
0006 #ifndef MARBLE_GEODATATIMESTAMP_H
0007 #define MARBLE_GEODATATIMESTAMP_H
0008 
0009 #include "GeoDataTimePrimitive.h"
0010 
0011 #include "geodata_export.h"
0012 
0013 class QDateTime;
0014 
0015 namespace Marble
0016 {
0017 
0018 class GeoDataTimeStampPrivate;
0019 
0020 /**
0021  */
0022 class GEODATA_EXPORT GeoDataTimeStamp : public GeoDataTimePrimitive
0023 {
0024   public:
0025     enum TimeResolution {
0026         SecondResolution,
0027         DayResolution,
0028         MonthResolution,
0029         YearResolution
0030     };
0031 
0032     GeoDataTimeStamp();
0033     GeoDataTimeStamp( const GeoDataTimeStamp& other );
0034     ~GeoDataTimeStamp() override;
0035 
0036     /**
0037     * @brief assignment operator
0038     */
0039     GeoDataTimeStamp& operator=( const GeoDataTimeStamp& other );
0040 
0041     /**
0042      * @brief equality operators
0043      */
0044     bool operator==( const GeoDataTimeStamp& other ) const;
0045     bool operator!=( const GeoDataTimeStamp& other ) const;
0046 
0047 
0048     /// Provides type information for downcasting a GeoNode
0049     const char* nodeType() const override;
0050 
0051     /**
0052     * @brief return the when time of timestamp
0053     */
0054     QDateTime when() const;
0055  
0056     /**
0057     * @brief Set the when time of timestamp
0058     * @param when the when time of timestamp
0059     */
0060     void setWhen( const QDateTime& when );
0061     
0062     void setResolution( TimeResolution resolution );
0063 
0064     TimeResolution resolution() const;
0065 
0066     /**
0067      * @brief Serialize the timestamp to a stream
0068      * @param  stream  the stream
0069      */
0070     void pack( QDataStream& stream ) const override;
0071 
0072     /**
0073      * @brief  Unserialize the timestamp from a stream
0074      * @param  stream  the stream
0075      */
0076     void unpack( QDataStream& stream ) override;
0077 
0078   private:
0079     GeoDataTimeStampPrivate * const d;
0080 };
0081 
0082 }
0083 
0084 #endif