Analizo
view release on metacpan or search on metacpan
t/samples/kdelibs/daterange.cpp view on Meta::CPAN
/*
**ANALIZO NOTE**
This file was copied from kdelibs project for testing analizo features.
The original file was copied as-is to create automated tests on analizo side
fixing the bug below.
- https://github.com/analizo/analizo/issues/148
GitHub kdelibs repository:
- https://github.com/KDE/kdelibs.git
Original file was copied from the commit 668ef94b2b from kdelibs git repository
and it is located inside kdelibs repository on the path below.
- nepomuk/utils/daterange.cpp
Link to the original file on GitHub:
- https://github.com/KDE/kdelibs/blob/668ef94b2b861f7ec4aa20941bcb6493bc4367be/nepomuk/utils/daterange.cpp
*/
/*
Copyright (c) 2009-2010 Sebastian Trueg <trueg@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "daterange.h"
#include "kglobal.h"
#include "klocale.h"
#include "kcalendarsystem.h"
#include <QtCore/QSharedData>
#include <QtCore/QDebug>
class DateRange::Private : public QSharedData
{
public:
QDate m_start;
QDate m_end;
};
DateRange::DateRange( const QDate& s,
const QDate& e )
: d(new Private())
{
d->m_start = s;
d->m_end = e;
}
DateRange::DateRange( const DateRange& other )
{
d = other.d;
}
DateRange::~DateRange()
{
}
DateRange& DateRange::operator=( const DateRange& other )
{
d = other.d;
return *this;
}
QDate DateRange::start() const
{
return d->m_start;
}
QDate DateRange::end() const
{
return d->m_end;
}
bool DateRange::isValid() const
{
return KGlobal::locale()->calendar()->isValid(d->m_start) && KGlobal::locale()->calendar()->isValid(d->m_end) && d->m_start <= d->m_end;
}
( run in 0.544 second using v1.01-cache-2.11-cpan-5b529ec07f3 )