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_GEODATATIMESPAN_H
0007 #define MARBLE_GEODATATIMESPAN_H
0008 
0009 #include "GeoDataTimePrimitive.h"
0010 
0011 #include "geodata_export.h"
0012 
0013 namespace Marble
0014 {
0015 
0016 class GeoDataTimeStamp;
0017 class GeoDataTimeSpanPrivate;
0018 
0019 /**
0020  */
0021 class GEODATA_EXPORT GeoDataTimeSpan : public GeoDataTimePrimitive
0022 {
0023   public:
0024 
0025     GeoDataTimeSpan();
0026     GeoDataTimeSpan( const GeoDataTimeSpan& other );
0027     ~GeoDataTimeSpan() override;
0028 
0029     /**
0030     * @brief assignment operator
0031     */
0032     GeoDataTimeSpan& operator=( const GeoDataTimeSpan& other );
0033 
0034     /**
0035      * @brief equality operators
0036      */
0037     bool operator==( const GeoDataTimeSpan& other ) const;
0038     bool operator!=( const GeoDataTimeSpan& other ) const;
0039 
0040     /// Provides type information for downcasting a GeoNode
0041     const char* nodeType() const override;
0042 
0043     /**
0044     * @brief return the beginning instant of a timespan
0045     */
0046     const GeoDataTimeStamp & begin() const;
0047     GeoDataTimeStamp & begin();
0048 
0049     /**
0050     * @brief Set the beginning instant of a timespan
0051     * @param begin the beginning instant of a timespan
0052     */
0053     void setBegin( const GeoDataTimeStamp& begin );
0054     
0055     /**
0056     * @brief return the ending instant of a timespan
0057     */
0058     const GeoDataTimeStamp & end() const;
0059     GeoDataTimeStamp & end();
0060 
0061     /**
0062     * @brief Set the ending instant of a timespan
0063     * @param end the ending instant of a timespan
0064     */
0065     void setEnd( const GeoDataTimeStamp& end );
0066 
0067     /**
0068      * @return True iff either of begin or end is valid, or if begin and end are both valid and begin is <= end
0069      */
0070     bool isValid() const;
0071 
0072     /**
0073      * @brief Serialize the timespan to a stream
0074      * @param  stream  the stream
0075      */
0076     void pack( QDataStream& stream ) const override;
0077 
0078     /**
0079      * @brief  Unserialize the timespan from a stream
0080      * @param  stream  the stream
0081      */
0082     void unpack( QDataStream& stream ) override;
0083 
0084   private:
0085     GeoDataTimeSpanPrivate * const d;
0086 };
0087 
0088 }
0089 
0090 #endif //MARBLE_GEODATATIMESPAN_H