File: kcarddeck.h

package info (click to toggle)
kpat 4%3A4.13.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,984 kB
  • ctags: 1,520
  • sloc: cpp: 15,530; xml: 16; makefile: 9; sh: 2
file content (81 lines) | stat: -rw-r--r-- 2,064 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 *  Copyright (C) 2010 Parker Coates <coates@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) any later version.
 *
 *  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/>.
 *
 */

#ifndef KCARDDECK_H
#define KCARDDECK_H

#include "kabstractcarddeck.h"
#include "libkcardgame_export.h"


class LIBKCARDGAME_EXPORT KCardDeck : public KAbstractCardDeck
{
public:
    enum Color
    {
        Black = 0,
        Red
    };

    enum Suit
    {
        Clubs = 0,
        Diamonds,
        Hearts,
        Spades
    };

    enum Rank
    {
        Ace = 1,
        Two,
        Three,
        Four,
        Five,
        Six,
        Seven,
        Eight,
        Nine,
        Ten,
        Jack,
        Queen,
        King
    };

    static QList<Suit> standardSuits();
    static QList<Rank> standardRanks();
    static quint32 getId( Suit suit, Rank rank, int number );
    static QList<quint32> generateIdList( int copies = 1,
                                          const QList<Suit> & suits = standardSuits(),
                                          const QList<Rank> & ranks = standardRanks() );

    explicit KCardDeck( const KCardTheme & theme = KCardTheme(), QObject * parent = 0 );
    virtual ~KCardDeck();

    virtual int rankFromId( quint32 id ) const;
    virtual int suitFromId( quint32 id ) const;
    virtual int colorFromId( quint32 id ) const;

protected:
    virtual QString elementName( quint32 id, bool faceUp = true ) const;

private:
    class KStandardCardDeckPrivate * const d;
};

#endif