File indexing completed on 2024-05-12 11:50:11

0001 /*
0002     This file is part of kholidays library.
0003 
0004     SPDX-FileCopyrightText: 2005, 2006 Allen Winter <winter@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #include "zodiac.h"
0010 
0011 #include <QCoreApplication>
0012 #include <QDate>
0013 
0014 #include <cstdlib>
0015 #include <iostream>
0016 
0017 using namespace KHolidays;
0018 using namespace std;
0019 
0020 int main(int argc, char **argv)
0021 {
0022     QCoreApplication app(argc, argv);
0023 
0024     Zodiac::ZodiacSigns sign;
0025     QString pStr;
0026 
0027     int year = 2004;
0028     int days = (QDate::isLeapYear(year) ? 366 : 355);
0029 
0030     Zodiac zd(Zodiac::Tropical);
0031     QDate qd(year, 1, 1);
0032     for (int i = 1; i <= days; ++i) {
0033         sign = zd.signAtDate(qd);
0034         pStr = zd.signName(sign);
0035         if (!pStr.isNull()) {
0036             cout << qd.toString(Qt::TextDate).toLocal8Bit().constData() << ": " //
0037                  << pStr.toLocal8Bit().constData() //
0038                  << " [" << qPrintable(zd.signSymbol(sign)) << "]" //
0039                  << endl;
0040         }
0041         qd = qd.addDays(1);
0042     }
0043 
0044     Zodiac zd2(Zodiac::Sidereal);
0045     QDate qd2(year, 1, 1);
0046     for (int i = 1; i <= days; ++i) {
0047         sign = zd2.signAtDate(qd2);
0048         pStr = zd2.signName(sign);
0049         if (!pStr.isNull()) {
0050             cout << qd2.toString(Qt::TextDate).toLocal8Bit().constData() << ": " //
0051                  << pStr.toLocal8Bit().constData() //
0052                  << " [" << qPrintable(zd2.signSymbol(sign)) << "]" //
0053                  << endl;
0054         }
0055         qd2 = qd2.addDays(1);
0056     }
0057 }