ReactOS 0.4.15-dev-7928-g68a8619
CardCount Class Reference

#include <cardcount.h>

Collaboration diagram for CardCount:

Public Member Functions

 CardCount ()
 
 CardCount (const CardStack &cs)
 
void Init (const CardStack &cs)
 
void Clear ()
 
void Add (const CardStack &cs)
 
void Sub (const CardStack &cs)
 
void Dec (size_t index)
 
int operator[] (size_t index) const
 
CardCountoperator= (const CardStack &cs)
 
CardCountoperator+= (const CardStack &cs)
 

Private Attributes

int count [13]
 

Detailed Description

Definition at line 4 of file cardcount.h.

Constructor & Destructor Documentation

◆ CardCount() [1/2]

CardCount::CardCount ( )

Definition at line 25 of file cardcount.cpp.

26{
27 Clear();
28}
void Clear()
Definition: cardcount.cpp:35

◆ CardCount() [2/2]

CardCount::CardCount ( const CardStack cs)

Definition at line 30 of file cardcount.cpp.

31{
32 Init(cs);
33}
#define cs
Definition: i386-dis.c:442

Member Function Documentation

◆ Add()

void CardCount::Add ( const CardStack cs)

Definition at line 41 of file cardcount.cpp.

42{
43 for(int i = 0; i < cs.NumCards(); i++)
44 {
45 Card card = cs[i];
46
47 int val = card.LoVal();
48 count[val - 1]++;
49 }
50}
Definition: card.h:28
int LoVal() const
Definition: card.h:59
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLfloat * val
Definition: glext.h:7180
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by Init().

◆ Clear()

void CardCount::Clear ( )

Definition at line 35 of file cardcount.cpp.

36{
37 for(int i = 0; i < 13; i++)
38 count[i] = 0;
39}

Referenced by CardCount(), and Init().

◆ Dec()

void CardCount::Dec ( size_t  index)

Definition at line 82 of file cardcount.cpp.

83{
84 if(index < 1) return;
85 else if(index > 14) return; //if out of range
86 else if(index == 14) index = 1; //if a "ace-high"
87
88 index -= 1;
89
90 if(count[index] > 0)
91 count[index]--;
92}
#define index(s, c)
Definition: various.h:29
GLuint index
Definition: glext.h:6031

◆ Init()

void CardCount::Init ( const CardStack cs)

Definition at line 64 of file cardcount.cpp.

65{
66 Clear();
67 Add(cs);
68}
void Add(const CardStack &cs)
Definition: cardcount.cpp:41

◆ operator+=()

CardCount & CardCount::operator+= ( const CardStack cs)

◆ operator=()

CardCount & CardCount::operator= ( const CardStack cs)

◆ operator[]()

int CardCount::operator[] ( size_t  index) const

Definition at line 70 of file cardcount.cpp.

71{
72 if(index < 1) return 0;
73 else if(index > 14) return 0; //if out of range
74 else if(index == 14) index = 1; //if a "ace-high"
75
76 return count[index - 1];
77}

◆ Sub()

void CardCount::Sub ( const CardStack cs)

Definition at line 52 of file cardcount.cpp.

53{
54 for(int i = 0; i < cs.NumCards(); i++)
55 {
56 Card card = cs[i];
57 int val = card.LoVal();
58
59 if(count[val - 1] > 0)
60 count[val - 1]--;
61 }
62}

Member Data Documentation

◆ count

int CardCount::count[13]
private

Definition at line 23 of file cardcount.h.


The documentation for this class was generated from the following files: