NetMauMau 0.24.4
Client API
Utilities

Utilities and helper functions and macros. More...

Detailed Description

Utilities and helper functions and macros.

This are several utilities and helper functions and macros to ease the use of the NetMauMau client API

Classes

struct  CARDCONFIG
 Structure containing the configuration of initial cards and decks. More...
 
struct  NetMauMau::Common::cardGreaterThan< T >
 Functor to compare cards. More...
 
struct  NetMauMau::Common::cardLessThan< T >
 Functor to compare cards. More...
 
struct  NetMauMau::Common::equalTo< CardType, Tp >
 Generic equality functor. More...
 

Macros

#define MAKE_VERSION(maj, min)
 
#define MAKE_VERSION_REL(maj, min, rel)
 
#define VERSION_MAJ(v)
 
#define VERSION_MIN(v)
 
#define VERSION_REL(v)
 

Variables

const std::string NetMauMau::Common::DefaultPlayerImage
 std::string containing the default player image in PNG format
 

Server query methods

static uint32_t NetMauMau::Client::AbstractClientV05::getClientProtocolVersion ()
 Returns the version of the client's implemented protocol.
 
static uint32_t NetMauMau::Client::AbstractClientV05::getClientLibraryVersion ()
 Returns the version of the client library.
 
static uint32_t NetMauMau::Client::AbstractClientV05::parseProtocolVersion (const std::string &version)
 Parses a version string and returns the resulting protocol version.
 
static bool NetMauMau::Client::AbstractClientV05::isPlayerImageUploadable (const unsigned char *pngData, std::size_t pngDataLen)
 Checks if an player image is uploadable to the server.
 
static uint16_t NetMauMau::Client::AbstractClientV05::getDefaultPort ()
 Gets the default port of the server.
 
static const char * NetMauMau::Client::AbstractClientV05::getDefaultAIName ()
 Gets the compiled in default AI player name.
 
CAPABILITIES NetMauMau::Client::AbstractClientV05::capabilities (timeval *timeout=NULL) throw (NetMauMau::Common::Exception::SocketException)
 Returns the server capabilities.
 
PLAYERINFOS NetMauMau::Client::AbstractClientV05::playerList (bool playerPNG, timeval *timeout=NULL) throw (NetMauMau::Common::Exception::SocketException)
 Returns the list of currently registered player names.
 
PLAYERLIST NetMauMau::Client::AbstractClientV05::playerList (timeval *timeout=NULL) throw (NetMauMau::Common::Exception::SocketException)
 Returns the list of currently registered player names.
 
std::string NetMauMau::Client::AbstractClientV05::getPlayerName () const
 Gets the player's name.
 

Server query methods

static bool NetMauMau::Client::AbstractClientV11::isPlayerImageUploadable (const unsigned char *pngData, std::size_t pngDataLen, const IBase64 *base64)
 Checks if an player image is uploadable to the server.
 

Card SUIT helpers

const std::string * NetMauMau::Common::getSuitSymbols ()
 Get an array of the four SUIT symbols.
 
std::string NetMauMau::Common::ansiSuit (const std::string &suit)
 Converts a SUIT symbol to a ANSI color representation.
 
NetMauMau::Common::ICard::SUIT NetMauMau::Common::symbolToSuit (const std::string &symbol)
 Converts a symbol to a NetMauMau::Common::ICard::SUIT.
 
std::string NetMauMau::Common::suitToSymbol (NetMauMau::Common::ICard::SUIT suit, bool ansi, bool endansi=false)
 Converts a NetMauMau::Common::ICard::SUIT to a symbol.
 

Card description

bool NetMauMau::Common::parseCardDesc (const std::string &desc, NetMauMau::Common::ICard::SUIT *suit, NetMauMau::Common::ICard::RANK *rank)
 Parses a textual description.
 
std::string NetMauMau::Common::createCardDesc (NetMauMau::Common::ICard::SUIT suite, NetMauMau::Common::ICard::RANK rank, bool ansi)
 Creates a card description.
 

Sorting cards

unsigned int NetMauMau::Common::suitOrderPosition (NetMauMau::Common::ICard::SUIT suit)
 Gets an ordinal number for a SUIT.
 
unsigned int NetMauMau::Common::rankOrderPosition (NetMauMau::Common::ICard::RANK rank)
 Gets an ordinal number for a RANK.
 
bool NetMauMau::Common::cardEqual (const NetMauMau::Common::ICard *lhs, const NetMauMau::Common::ICard *rhs)
 Checks if two cards are equal.
 
bool NetMauMau::Common::cardLess (const NetMauMau::Common::ICard *lhs, const NetMauMau::Common::ICard *rhs)
 Checks if a card comes before another.
 
bool NetMauMau::Common::cardGreater (const NetMauMau::Common::ICard *lhs, const NetMauMau::Common::ICard *rhs)
 Checks if a card comes before another.
 

Identifying and finding cards

bool NetMauMau::Common::isSuit (const NetMauMau::Common::ICard *card, NetMauMau::Common::ICard::SUIT suit)
 Checks if the a card is of SUIT.
 
bool NetMauMau::Common::isRank (const NetMauMau::Common::ICard *card, NetMauMau::Common::ICard::RANK rank)
 Checks if the a card is of RANK.
 
template<typename Tp, typename Iterator>
Iterator::value_type NetMauMau::Common::find (const Tp &arg, Iterator first, Iterator last)
 Generic find function.
 
template<typename Iterator>
Iterator::value_type NetMauMau::Common::findSuit (NetMauMau::Common::ICard::SUIT suit, Iterator first, Iterator last)
 Finds the first card of a given SUIT.
 
template<typename Iterator>
Iterator::value_type NetMauMau::Common::findRank (NetMauMau::Common::ICard::RANK rank, Iterator first, Iterator last)
 Finds the first card of a given RANK.
 
template<typename Iterator>
Iterator::value_type NetMauMau::Common::findCard (typename Iterator::value_type card, Iterator first, Iterator last)
 Finds the first card equal to a given card.
 

Miscellaneous functions

NetMauMau::Common::ICardNetMauMau::Common::getIllegalCard ()
 Gets an illegal card card to trigger special actions.
 
CARDCONFIG NetMauMau::Common::getCardConfig (std::size_t players, std::size_t initialCardCount=5, std::size_t decks=1)
 Determines reasonable amounts of initial cards and card decks.
 
const char * NetMauMau::Common::getServerExe ()
 Gets the executable name of the server.
 
std::size_t NetMauMau::Common::getCardPoints (NetMauMau::Common::ICard::RANK rank)
 Gets the points of a RANK.
 

Global compare and relational operators

bool operator== (const NetMauMau::Common::ICard &card, NetMauMau::Common::ICard::RANK rank)
 Compares a card against a rank.
 
bool operator!= (const NetMauMau::Common::ICard &card, NetMauMau::Common::ICard::RANK rank)
 Compares a card against a rank.
 
bool operator== (const NetMauMau::Common::ICard &card, NetMauMau::Common::ICard::SUIT suit)
 Compares a card against a suit.
 
bool operator!= (const NetMauMau::Common::ICard &card, NetMauMau::Common::ICard::SUIT suit)
 Compares a card against a suit.
 
bool operator== (const NetMauMau::Common::ICard &lhs, const NetMauMau::Common::ICard &rhs)
 Compares cards.
 
bool operator!= (const NetMauMau::Common::ICard &lhs, const NetMauMau::Common::ICard &rhs)
 Compares cards.
 
bool operator< (const NetMauMau::Common::ICard &lhs, const NetMauMau::Common::ICard &rhs)
 Compares cards.
 
bool operator> (const NetMauMau::Common::ICard &lhs, const NetMauMau::Common::ICard &rhs)
 Compares cards.
 
bool operator== (const NetMauMau::Common::ICard *card, NetMauMau::Common::ICard::RANK rank)
 Compares a card against a rank.
 
bool operator!= (const NetMauMau::Common::ICard *card, NetMauMau::Common::ICard::RANK rank)
 Compares a card against a rank.
 
bool operator== (const NetMauMau::Common::ICard *card, NetMauMau::Common::ICard::SUIT suit)
 Compares a card against a suit.
 
bool operator!= (const NetMauMau::Common::ICard *card, NetMauMau::Common::ICard::SUIT suit)
 Compares a card against a suit.
 

Macro Definition Documentation

◆ MAKE_VERSION

#define MAKE_VERSION ( maj,
min )

#include <iconnection.h>

Computes the corresponding version number integer to an usigned 32 bit integer

Parameters
majthe major of the version number
minthe minor of the version number
Since
0.8

Referenced by NetMauMau::Client::AbstractClientV05::getClientProtocolVersion(), and NetMauMau::Client::AbstractClientV05::parseProtocolVersion().

◆ MAKE_VERSION_REL

#define MAKE_VERSION_REL ( maj,
min,
rel )

#include <iconnection.h>

Computes the corresponding version number integer to an usigned 32 bit integer

Note
Release version differ only for security and bugfix releases which are NEITHER adding new features NOR changing the protocol.
Parameters
majthe major of the version number
minthe minor of the version number
relthe release of the version number
Since
0.17.0

Referenced by NetMauMau::Client::AbstractClientV05::getClientLibraryVersion(), and NetMauMau::Client::AbstractClientV05::parseProtocolVersion().

◆ VERSION_MAJ

#define VERSION_MAJ ( v)

#include <iconnection.h>

Gets the major number of the version as unsigned 16 bit integer

Parameters
vthe version number
Since
0.17.0

◆ VERSION_MIN

#define VERSION_MIN ( v)

#include <iconnection.h>

Gets the minor number of the version as unsigned 16 bit integer

Parameters
vthe version number
Since
0.17.0

◆ VERSION_REL

#define VERSION_REL ( v)

#include <iconnection.h>

Gets the release number of the version as unsigned 16 bit integer

Parameters
vthe version number
Since
0.17.0

Function Documentation

◆ ansiSuit()

std::string NetMauMau::Common::ansiSuit ( const std::string & suit)

#include <cardtools.h>

Converts a SUIT symbol to a ANSI color representation.

Parameters
suitthe SUIT symbol
Returns
a SUIT symbol in ANSI color representation

References suitToSymbol(), and symbolToSuit().

◆ capabilities()

Connection::CAPABILITIES AbstractClientV05::capabilities ( timeval * timeout = NULL)
throw (NetMauMau::Common::Exception::SocketException )

#include <abstractclient.h>

Returns the server capabilities.

Parameters
timeoutthe time to wait for a connection, if NULL there will be no timeout
Exceptions
Common::Exception::SocketExceptionif the connection failed
Client::Exception::CapabilitiesExceptionif the capabilities cannot get retrieved
Client::Exception::TimeoutExceptionif the connection attempt timed out
Returns
the server capabilities

◆ cardEqual()

bool NetMauMau::Common::cardEqual ( const NetMauMau::Common::ICard * lhs,
const NetMauMau::Common::ICard * rhs )

#include <cardtools.h>

Checks if two cards are equal.

Deprecated
use the generic NetMauMau::Common::equalTo instead
Parameters
lhsa card
rhsa card
Returns
true if the cards are equal, false otherwise

◆ cardGreater()

bool NetMauMau::Common::cardGreater ( const NetMauMau::Common::ICard * lhs,
const NetMauMau::Common::ICard * rhs )

#include <cardtools.h>

Checks if a card comes before another.

Useful for sorting with rank first than suit

Deprecated
use the compare operators (see Utilities)
Parameters
lhsa card
rhsa card
Returns
true if lhs comes before rhs, false otherwise
Since
0.3

◆ cardLess()

bool NetMauMau::Common::cardLess ( const NetMauMau::Common::ICard * lhs,
const NetMauMau::Common::ICard * rhs )

#include <cardtools.h>

Checks if a card comes before another.

Useful for sorting with suit first than rank

Deprecated
use the compare operators (see Utilities)
Parameters
lhsa card
rhsa card
Returns
true if lhs comes before rhs, false otherwise

◆ createCardDesc()

std::string NetMauMau::Common::createCardDesc ( NetMauMau::Common::ICard::SUIT suite,
NetMauMau::Common::ICard::RANK rank,
bool ansi )

#include <cardtools.h>

Creates a card description.

Parameters
suitethe SUIT
rankthe RANK
ansiif true create a ANSI color representation
Returns
the card description

References NetMauMau::Common::ICard::ACE, NetMauMau::Common::ICard::EIGHT, NetMauMau::Common::ICard::JACK, NetMauMau::Common::ICard::KING, NetMauMau::Common::ICard::NINE, NetMauMau::Common::ICard::QUEEN, NetMauMau::Common::ICard::SEVEN, suitToSymbol(), and NetMauMau::Common::ICard::TEN.

◆ find()

template<typename Tp, typename Iterator>
Iterator::value_type NetMauMau::Common::find ( const Tp & arg,
Iterator first,
Iterator last )
inline

#include <cardtools.h>

Generic find function.

Search for the first occurrence of a card

Template Parameters
TpNetMauMau::Common::ICard::SUIT, NetMauMau::Common::ICard::RANK or pointer to NetMauMau::Common::ICard type
Iteratoriterator type to a collection of NetMauMau::Common::ICard type pointers
Parameters
argNetMauMau::Common::ICard::SUIT, NetMauMau::Common::ICard::RANK or pointer to NetMauMau::Common::ICard type
firstiterator to begin of the range to search for
lastiterator to end of the range to search for
Returns
a NetMauMau::Common::ICard type pointer, or NULL if nothing was found
Since
0.21.0

Referenced by findCard(), findRank(), and findSuit().

◆ findCard()

template<typename Iterator>
Iterator::value_type NetMauMau::Common::findCard ( typename Iterator::value_type card,
Iterator first,
Iterator last )

#include <cardtools.h>

Finds the first card equal to a given card.

Template Parameters
Iteratoran iterator
Deprecated
use the generic NetMauMau::Common::find instead
Parameters
cardthe card to find
firstiterator to the first card
lastiterator to the last card
Returns
the card if found 0L otherwise

References find().

◆ findRank()

template<typename Iterator>
Iterator::value_type NetMauMau::Common::findRank ( NetMauMau::Common::ICard::RANK rank,
Iterator first,
Iterator last )

#include <cardtools.h>

Finds the first card of a given RANK.

Template Parameters
Iteratoran iterator
Deprecated
use the generic NetMauMau::Common::find instead
Parameters
rankthe RANK to find
firstiterator to the first card
lastiterator to the last card
Returns
the card if found 0L otherwise

References find().

◆ findSuit()

template<typename Iterator>
Iterator::value_type NetMauMau::Common::findSuit ( NetMauMau::Common::ICard::SUIT suit,
Iterator first,
Iterator last )

#include <cardtools.h>

Finds the first card of a given SUIT.

Template Parameters
Iteratoran iterator
Deprecated
use the generic NetMauMau::Common::find instead
Parameters
suitthe SUIT to find
firstiterator to the first card
lastiterator to the last card
Returns
the card if found 0L otherwise

References find().

◆ getCardConfig()

NetMauMau::Common::CARDCONFIG NetMauMau::Common::getCardConfig ( std::size_t players,
std::size_t initialCardCount = 5,
std::size_t decks = 1 )

#include <cardtools.h>

Determines reasonable amounts of initial cards and card decks.

This function calculates reasonable values based on the amount of players, initialCardCount and decks.

This function can be used by clients to avoid the server adjusting the given parameters.

Parameters
playersthe amount of players
initialCardCountthe desired amount of initial cards
decksthe desired amount of card decks
See also
CARDCONFIG
Returns
structure containing the reasonable values
Since
0.19.1

◆ getCardPoints()

std::size_t NetMauMau::Common::getCardPoints ( NetMauMau::Common::ICard::RANK rank)

#include <cardtools.h>

Gets the points of a RANK.

Rank Points
Seven 1
Eight 2
Nine 3
Ten 4
Queen 5
King 6
Ace 11
Jack 20
See also
Common::ICard::getPoints
Parameters
rankthe RANK
Returns
the points of a RANK

References NetMauMau::Common::ICard::ACE, NetMauMau::Common::ICard::EIGHT, NetMauMau::Common::ICard::JACK, NetMauMau::Common::ICard::KING, NetMauMau::Common::ICard::NINE, NetMauMau::Common::ICard::QUEEN, NetMauMau::Common::ICard::RANK_ILLEGAL, NetMauMau::Common::ICard::SEVEN, and NetMauMau::Common::ICard::TEN.

◆ getClientLibraryVersion()

uint32_t AbstractClientV05::getClientLibraryVersion ( )
static

#include <abstractclient.h>

Returns the version of the client library.

Returns
the library version
Since
0.17.0

References MAKE_VERSION_REL.

◆ getClientProtocolVersion()

uint32_t AbstractClientV05::getClientProtocolVersion ( )
static

#include <abstractclient.h>

Returns the version of the client's implemented protocol.

You can retrieve major and minor version as following:

uint16_t major = static_cast<uint16_t>(AbstractClient::getClientProtocolVersion() >> 16);
uint16_t minor = static_cast<uint16_t>(AbstractClient::getClientProtocolVersion());
static uint32_t getClientProtocolVersion()
Returns the version of the client's implemented protocol.
Definition abstractclient.cpp:779
Returns
the protocol version

References MAKE_VERSION.

◆ getDefaultAIName()

const char * AbstractClientV05::getDefaultAIName ( )
static

#include <abstractclient.h>

Gets the compiled in default AI player name.

Returns
the compiled in default AI player name

◆ getDefaultPort()

uint16_t AbstractClientV05::getDefaultPort ( )
static

#include <abstractclient.h>

Gets the default port of the server.

Returns
the default port of the server

◆ getIllegalCard()

NetMauMau::Common::ICard * NetMauMau::Common::getIllegalCard ( )

#include <cardtools.h>

Gets an illegal card card to trigger special actions.

See also
NetMauMau::Client::AbstractClient::playCard()
Returns
an illegal card card

◆ getPlayerName()

std::string AbstractClientV05::getPlayerName ( ) const

#include <abstractclient.h>

Gets the player's name.

Returns
the player's name

◆ getServerExe()

const char * NetMauMau::Common::getServerExe ( )

#include <cardtools.h>

Gets the executable name of the server.

Note
on non-Windows systems it returns the full path to the executable
Returns
the executable name of the server

◆ getSuitSymbols()

const std::string * NetMauMau::Common::getSuitSymbols ( )

#include <cardtools.h>

Get an array of the four SUIT symbols.

Returns
the four SUIT symbols

◆ isPlayerImageUploadable() [1/2]

bool AbstractClientV05::isPlayerImageUploadable ( const unsigned char * pngData,
std::size_t pngDataLen )
static

#include <abstractclient.h>

Checks if an player image is uploadable to the server.

Note
it is possible that the server rejects the image anyway if configured to use a different (smaller) maximum file size than this client
Parameters
pngDatathe image data
pngDataLenlength of the image data
Returns
true if the file will most probably accepted by the server, false otherwise
Since
0.5

Referenced by NetMauMau::Client::AbstractClientV11::isPlayerImageUploadable().

◆ isPlayerImageUploadable() [2/2]

bool AbstractClientV11::isPlayerImageUploadable ( const unsigned char * pngData,
std::size_t pngDataLen,
const IBase64 * base64 )
static

#include <abstractclient.h>

Checks if an player image is uploadable to the server.

Note
it is possible that the server rejects the image anyway if configured to use a different (smaller) maximum file size than this client
Parameters
pngDatathe image data
pngDataLenlength of the image data
Returns
true if the file will most probably accepted by the server, false otherwise
Since
0.5
Parameters
base64interface to a custom implementation of IBase64
Deprecated
use AbstractClientV05::isPlayerImageUploadable(const unsigned char *, std::size_t) instead
Since
0.11

References NetMauMau::Client::AbstractClientV05::isPlayerImageUploadable().

◆ isRank()

bool NetMauMau::Common::isRank ( const NetMauMau::Common::ICard * card,
NetMauMau::Common::ICard::RANK rank )

#include <cardtools.h>

Checks if the a card is of RANK.

Parameters
cardthe card to check
rankthe RANK to check for
Deprecated
use the generic NetMauMau::Common::equalTo instead
Returns
true if the card is of RANK

◆ isSuit()

bool NetMauMau::Common::isSuit ( const NetMauMau::Common::ICard * card,
NetMauMau::Common::ICard::SUIT suit )

#include <cardtools.h>

Checks if the a card is of SUIT.

Parameters
cardthe card to check
suitthe SUIT to check for
Deprecated
use the generic NetMauMau::Common::equalTo instead
Returns
true if the card is of SUIT

◆ operator!=() [1/5]

bool operator!= ( const NetMauMau::Common::ICard & card,
NetMauMau::Common::ICard::RANK rank )
related

Compares a card against a rank.

Parameters
cardcard to compare to
rankrank to compare to
Returns
false if equal, true otherwise
Since
0.20.2

References getRank().

◆ operator!=() [2/5]

bool operator!= ( const NetMauMau::Common::ICard & card,
NetMauMau::Common::ICard::SUIT suit )
related

Compares a card against a suit.

Parameters
cardcard to compare to
suitsuit to compare to
Returns
false if equal, true otherwise
Since
0.20.2

References getSuit().

◆ operator!=() [3/5]

bool operator!= ( const NetMauMau::Common::ICard & lhs,
const NetMauMau::Common::ICard & rhs )
related

Compares cards.

Parameters
lhsleft card
rhsright card
Returns
false if equal, true otherwise
Since
0.20.2

◆ operator!=() [4/5]

bool operator!= ( const NetMauMau::Common::ICard * card,
NetMauMau::Common::ICard::RANK rank )
related

Compares a card against a rank.

Parameters
cardcard to compare to
rankrank to compare to
Returns
false if equal, true otherwise
Since
0.20.2

◆ operator!=() [5/5]

bool operator!= ( const NetMauMau::Common::ICard * card,
NetMauMau::Common::ICard::SUIT suit )
related

Compares a card against a suit.

Parameters
cardcard to compare to
suitsuit to compare to
Returns
false if equal, true otherwise
Since
0.20.2

◆ operator<()

bool operator< ( const NetMauMau::Common::ICard & lhs,
const NetMauMau::Common::ICard & rhs )
related

Compares cards.

Parameters
lhsleft card
rhsright card
Returns
true if lesser, false otherwise
Since
0.20.2

References getRank(), getSuit(), operator<(), NetMauMau::Common::rankOrderPosition(), and NetMauMau::Common::suitOrderPosition().

Referenced by operator<().

◆ operator==() [1/5]

bool operator== ( const NetMauMau::Common::ICard & card,
NetMauMau::Common::ICard::RANK rank )
related

Compares a card against a rank.

Parameters
cardcard to compare to
rankrank to compare to
Returns
true if equal, false otherwise
Since
0.20.2

References getRank().

◆ operator==() [2/5]

bool operator== ( const NetMauMau::Common::ICard & card,
NetMauMau::Common::ICard::SUIT suit )
related

Compares a card against a suit.

Parameters
cardcard to compare to
suitsuit to compare to
Returns
true if equal, false otherwise
Since
0.20.2

References getSuit().

◆ operator==() [3/5]

bool operator== ( const NetMauMau::Common::ICard & lhs,
const NetMauMau::Common::ICard & rhs )
related

Compares cards.

Parameters
lhsleft card
rhsright card
Returns
true if equal, false otherwise
Since
0.20.2

References getRank(), and getSuit().

◆ operator==() [4/5]

bool operator== ( const NetMauMau::Common::ICard * card,
NetMauMau::Common::ICard::RANK rank )
related

Compares a card against a rank.

Parameters
cardcard to compare to
rankrank to compare to
Returns
true if equal, false otherwise
Since
0.20.2

◆ operator==() [5/5]

bool operator== ( const NetMauMau::Common::ICard * card,
NetMauMau::Common::ICard::SUIT suit )
related

Compares a card against a suit.

Parameters
cardcard to compare to
suitsuit to compare to
Returns
true if equal, false otherwise
Since
0.20.2

◆ operator>()

bool operator> ( const NetMauMau::Common::ICard & lhs,
const NetMauMau::Common::ICard & rhs )
related

Compares cards.

Parameters
lhsleft card
rhsright card
Returns
true if greater, false otherwise
Since
0.20.2

References getRank(), getSuit(), operator>(), NetMauMau::Common::rankOrderPosition(), and NetMauMau::Common::suitOrderPosition().

Referenced by operator>().

◆ parseCardDesc()

bool NetMauMau::Common::parseCardDesc ( const std::string & desc,
NetMauMau::Common::ICard::SUIT * suit,
NetMauMau::Common::ICard::RANK * rank )

#include <cardtools.h>

Parses a textual description.

Parses a textual description and stores the suit and the rank into the pointers, which cannot be null.

Parameters
[in]descthe textual description of the card
[out]suitpointer to store the resulting SUIT
[out]rankpointer to store the resulting RANK
Returns
true if the parsing was successful, false otherwise

References NetMauMau::Common::ICard::ACE, NetMauMau::Common::ICard::JACK, NetMauMau::Common::ICard::KING, NetMauMau::Common::ICard::QUEEN, NetMauMau::Common::ICard::RANK_ILLEGAL, NetMauMau::Common::ICard::SUIT_ILLEGAL, and symbolToSuit().

◆ parseProtocolVersion()

uint32_t AbstractClientV05::parseProtocolVersion ( const std::string & version)
static

#include <abstractclient.h>

Parses a version string and returns the resulting protocol version.

Parameters
versionthe protocol version as string
Returns
the protocol version
Since
0.3

References MAKE_VERSION, and MAKE_VERSION_REL.

◆ playerList() [1/2]

Connection::PLAYERINFOS AbstractClientV05::playerList ( bool playerPNG,
timeval * timeout = NULL )
throw (NetMauMau::Common::Exception::SocketException )

#include <abstractclient.h>

Returns the list of currently registered player names.

Note
The image data returned in NetMauMau::Client::AbstractClient::PLAYERLIST must be freed by the user
delete [] x->pngData
Parameters
playerPNGtrue if the player images should get retrieved
timeoutthe time to wait for a connection, if NULL there will be no timeout
Exceptions
Common::Exception::SocketExceptionif the connection failed
Client::Exception::PlayerlistExceptionif the player list cannot get retrieved
Client::Exception::TimeoutExceptionif the connection attempt timed out
Client::Exception::CapabilitiesExceptionif called within a running game
Returns
the list of currently registered player names
Since
0.4

Referenced by playerList().

◆ playerList() [2/2]

Connection::PLAYERLIST AbstractClientV05::playerList ( timeval * timeout = NULL)
throw (NetMauMau::Common::Exception::SocketException )

#include <abstractclient.h>

Returns the list of currently registered player names.

It does not retrieve the player images

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References playerList().

◆ rankOrderPosition()

unsigned int NetMauMau::Common::rankOrderPosition ( NetMauMau::Common::ICard::RANK rank)

◆ suitOrderPosition()

unsigned int NetMauMau::Common::suitOrderPosition ( NetMauMau::Common::ICard::SUIT suit)

#include <cardtools.h>

Gets an ordinal number for a SUIT.

The ordinals follow the Skat and Doppelkopf order
See here: http://i-p-c-s.org/faq/suit-ranking.php

Parameters
suitthe SUIT to get the ordinal for
Returns
ordinal number for a SUIT

References NetMauMau::Common::ICard::CLUBS, NetMauMau::Common::ICard::DIAMONDS, NetMauMau::Common::ICard::HEARTS, NetMauMau::Common::ICard::SPADES, and NetMauMau::Common::ICard::SUIT_ILLEGAL.

Referenced by NetMauMau::Common::ICard::operator<(), and NetMauMau::Common::ICard::operator>().

◆ suitToSymbol()

std::string NetMauMau::Common::suitToSymbol ( NetMauMau::Common::ICard::SUIT suit,
bool ansi,
bool endansi = false )

#include <cardtools.h>

Converts a NetMauMau::Common::ICard::SUIT to a symbol.

Parameters
suitthe SUIT to convert
ansiif true create a ANSI color representation
endansiif false (default) don't end the ANSI color codes
Returns
the SUIT symbol

References NetMauMau::Common::ICard::CLUBS, NetMauMau::Common::ICard::DIAMONDS, NetMauMau::Common::ICard::HEARTS, NetMauMau::Common::ICard::SPADES, and NetMauMau::Common::ICard::SUIT_ILLEGAL.

Referenced by ansiSuit(), and createCardDesc().

◆ symbolToSuit()

NetMauMau::Common::ICard::SUIT NetMauMau::Common::symbolToSuit ( const std::string & symbol)

#include <cardtools.h>

Converts a symbol to a NetMauMau::Common::ICard::SUIT.

Parameters
symbolthe symbol
Returns
the SUIT

References NetMauMau::Common::ICard::HEARTS.

Referenced by ansiSuit(), and parseCardDesc().

Variable Documentation

◆ DefaultPlayerImage

const std::string NetMauMau::Common::DefaultPlayerImage
extern

#include <defaultplayerimage.h>

std::string containing the default player image in PNG format

Since
0.11