File indexing completed on 2025-01-12 03:46:27
0001 /* 0002 * Copyright (C) 2010 Parker Coates <coates@kde.org> 0003 * 0004 * This program is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU General Public License as 0006 * published by the Free Software Foundation; either version 2 of 0007 * the License, or (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0016 * 0017 */ 0018 0019 #ifndef KCARDDECK_H 0020 #define KCARDDECK_H 0021 0022 // own 0023 #include "kabstractcarddeck.h" 0024 #include "libkcardgame_export.h" 0025 0026 class LIBKCARDGAME_EXPORT KCardDeck : public KAbstractCardDeck 0027 { 0028 public: 0029 enum Color { Black = 0, Red }; 0030 0031 enum Suit { Clubs = 0, Diamonds, Hearts, Spades }; 0032 0033 enum Rank { Ace = 1, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King }; 0034 0035 static QList<Suit> standardSuits(); 0036 static QList<Rank> standardRanks(); 0037 static quint32 getId(Suit suit, Rank rank, int number); 0038 static QList<quint32> generateIdList(int copies = 1, const QList<Suit> &suits = standardSuits(), const QList<Rank> &ranks = standardRanks()); 0039 0040 explicit KCardDeck(const KCardTheme &theme = KCardTheme(), QObject *parent = nullptr); 0041 virtual ~KCardDeck(); 0042 0043 int rankFromId(quint32 id) const override; 0044 int suitFromId(quint32 id) const override; 0045 int colorFromId(quint32 id) const override; 0046 0047 protected: 0048 QString elementName(quint32 id, bool faceUp = true) const override; 0049 0050 private: 0051 class KStandardCardDeckPrivate *const d; 0052 }; 0053 0054 #endif