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
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 > |
std::iterator_traits< Iterator >
::value_type | NetMauMau::Common::find (Tp arg, Iterator first, Iterator last) |
| Generic find function.
|
template<typename Iterator > |
std::iterator_traits< 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 > |
std::iterator_traits< 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 > |
std::iterator_traits< Iterator >
::value_type | NetMauMau::Common::findCard (typename Iterator::value_type card, Iterator first, Iterator last) |
| Finds the first card equal to a given card.
|
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
#define MAKE_VERSION |
( |
|
maj, |
|
|
|
min |
|
) |
| |
Computes the corresponding version number integer to an usigned 32 bit integer
- Parameters
-
maj | the major of the version number |
min | the minor of the version number |
- Since
- 0.8
#define MAKE_VERSION_REL |
( |
|
maj, |
|
|
|
min, |
|
|
|
rel |
|
) |
| |
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
-
maj | the major of the version number |
min | the minor of the version number |
rel | the release of the version number |
- Since
- 0.17.0
Gets the major number of the version as unsigned 16 bit integer
- Parameters
-
- Since
- 0.17.0
Gets the minor number of the version as unsigned 16 bit integer
- Parameters
-
- Since
- 0.17.0
Gets the release number of the version as unsigned 16 bit integer
- Parameters
-
- Since
- 0.17.0
Function Documentation
std::string NetMauMau::Common::ansiSuit |
( |
const std::string & |
suit | ) |
|
Converts a SUIT
symbol to a ANSI color representation.
- Parameters
-
- Returns
- a
SUIT
symbol in ANSI color representation
Returns the server capabilities.
- Parameters
-
timeout | the time to wait for a connection, if NULL there will be no timeout |
- Exceptions
-
- Returns
- the server capabilities
Checks if a card comes before another.
Useful for sorting with rank first than suit
- Deprecated:
- use the compare operators (see Utilities)
- Parameters
-
- Returns
true
if lhs
comes before rhs
, false
otherwise
- Since
- 0.3
Checks if a card comes before another.
Useful for sorting with suit first than rank
- Deprecated:
- use the compare operators (see Utilities)
- Parameters
-
- Returns
true
if lhs
comes before rhs
, false
otherwise
Creates a card description.
- Parameters
-
suite | the SUIT |
rank | the RANK |
ansi | if true create a ANSI color representation |
- Returns
- the card description
template<typename Tp , typename Iterator >
std::iterator_traits<Iterator>::value_type NetMauMau::Common::find |
( |
Tp |
arg, |
|
|
Iterator |
first, |
|
|
Iterator |
last |
|
) |
| |
template<typename Iterator >
std::iterator_traits<Iterator>::value_type NetMauMau::Common::findCard |
( |
typename Iterator::value_type |
card, |
|
|
Iterator |
first, |
|
|
Iterator |
last |
|
) |
| |
|
inline |
Finds the first card equal to a given card.
- Template Parameters
-
- Deprecated:
- use the generic
NetMauMau::Common::find
instead
- Parameters
-
card | the card to find |
first | iterator to the first card |
last | iterator to the last card |
- Returns
- the card if found
0L
otherwise
template<typename Iterator >
Finds the first card of a given RANK
.
- Template Parameters
-
- Deprecated:
- use the generic
NetMauMau::Common::find
instead
- Parameters
-
rank | the RANK to find |
first | iterator to the first card |
last | iterator to the last card |
- Returns
- the card if found
0L
otherwise
template<typename Iterator >
Finds the first card of a given SUIT
.
- Template Parameters
-
- Deprecated:
- use the generic
NetMauMau::Common::find
instead
- Parameters
-
suit | the SUIT to find |
first | iterator to the first card |
last | iterator to the last card |
- Returns
- the card if found
0L
otherwise
NetMauMau::Common::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.
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
-
players | the amount of players |
initialCardCount | the desired amount of initial cards |
decks | the desired amount of card decks |
- See Also
- CARDCONFIG
- Returns
- structure containing the reasonable values
- Since
- 0.19.1
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
-
- Returns
- the points of a
RANK
uint32_t AbstractClientV05::getClientLibraryVersion |
( |
| ) |
|
|
static |
Returns the version of the client library.
- Returns
- the library version
- Since
- 0.17.0
uint32_t AbstractClientV05::getClientProtocolVersion |
( |
| ) |
|
|
static |
Returns the version of the client's implemented protocol.
You can retrieve major and minor version as following:
- Returns
- the protocol version
const char * AbstractClientV05::getDefaultAIName |
( |
| ) |
|
|
static |
Gets the compiled in default AI player name.
- Returns
- the compiled in default AI player name
uint16_t AbstractClientV05::getDefaultPort |
( |
| ) |
|
|
static |
Gets the default port of the server.
- Returns
- the default port of the server
std::string AbstractClientV05::getPlayerName |
( |
| ) |
const |
Gets the player's name.
- Returns
- the player's name
const char * NetMauMau::Common::getServerExe |
( |
| ) |
|
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
const std::string * NetMauMau::Common::getSuitSymbols |
( |
| ) |
|
Get an array of the four SUIT
symbols.
- Returns
- the four
SUIT
symbols
bool AbstractClientV05::isPlayerImageUploadable |
( |
const unsigned char * |
pngData, |
|
|
std::size_t |
pngDataLen |
|
) |
| |
|
static |
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
-
pngData | the image data |
pngDataLen | length of the image data |
- Returns
true
if the file will most probably accepted by the server, false
otherwise
- Since
- 0.5
bool AbstractClientV11::isPlayerImageUploadable |
( |
const unsigned char * |
pngData, |
|
|
std::size_t |
pngDataLen, |
|
|
const IBase64 * |
base64 |
|
) |
| |
|
static |
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
-
pngData | the image data |
pngDataLen | length of the image data |
- Returns
true
if the file will most probably accepted by the server, false
otherwise
- Since
- 0.5
- Parameters
-
base64 | interface to a custom implementation of IBase64 |
- Deprecated:
- use AbstractClientV05::isPlayerImageUploadable(const unsigned char *, std::size_t) instead
- Since
- 0.11
Checks if the a card is of RANK
.
- Parameters
-
card | the card to check |
rank | the RANK to check for |
- Deprecated:
- use the generic
NetMauMau::Common::equalTo
instead
- Returns
true
if the card is of RANK
Checks if the a card is of SUIT
.
- Parameters
-
card | the card to check |
suit | the SUIT to check for |
- Deprecated:
- use the generic
NetMauMau::Common::equalTo
instead
- Returns
true
if the card is of SUIT
Compares a card against a rank.
- Parameters
-
card | card to compare to |
rank | rank to compare to |
- Returns
false
if equal, true
otherwise
- Since
- 0.20.2
Compares a card against a suit.
- Parameters
-
card | card to compare to |
suit | suit to compare to |
- Returns
false
if equal, true
otherwise
- Since
- 0.20.2
Compares cards.
- Parameters
-
lhs | left card |
rhs | right card |
- Returns
false
if equal, true
otherwise
- Since
- 0.20.2
Compares a card against a rank.
- Parameters
-
card | card to compare to |
rank | rank to compare to |
- Returns
false
if equal, true
otherwise
- Since
- 0.20.2
Compares a card against a suit.
- Parameters
-
card | card to compare to |
suit | suit to compare to |
- Returns
false
if equal, true
otherwise
- Since
- 0.20.2
Compares cards.
- Parameters
-
lhs | left card |
rhs | right card |
- Returns
true
if lesser, false
otherwise
- Since
- 0.20.2
Compares a card against a rank.
- Parameters
-
card | card to compare to |
rank | rank to compare to |
- Returns
true
if equal, false
otherwise
- Since
- 0.20.2
Compares a card against a suit.
- Parameters
-
card | card to compare to |
suit | suit to compare to |
- Returns
true
if equal, false
otherwise
- Since
- 0.20.2
Compares cards.
- Parameters
-
lhs | left card |
rhs | right card |
- Returns
true
if equal, false
otherwise
- Since
- 0.20.2
Compares a card against a rank.
- Parameters
-
card | card to compare to |
rank | rank to compare to |
- Returns
true
if equal, false
otherwise
- Since
- 0.20.2
Compares a card against a suit.
- Parameters
-
card | card to compare to |
suit | suit to compare to |
- Returns
true
if equal, false
otherwise
- Since
- 0.20.2
Compares cards.
- Parameters
-
lhs | left card |
rhs | right card |
- Returns
true
if greater, false
otherwise
- Since
- 0.20.2
Parses a textual description.
Parses a textual description and stores the suit and the rank into the pointers, which cannot be null.
- Parameters
-
[in] | desc | the textual description of the card |
[out] | suit | pointer to store the resulting SUIT |
[out] | rank | pointer to store the resulting RANK |
- Returns
true
if the parsing was successful, false
otherwise
uint32_t AbstractClientV05::parseProtocolVersion |
( |
const std::string & |
version | ) |
|
|
static |
Parses a version string and returns the resulting protocol version.
- Parameters
-
version | the protocol version as string |
- Returns
- the protocol version
- Since
- 0.3
Returns the list of currently registered player names.
- Note
- The image data returned in
NetMauMau::Client::AbstractClient::PLAYERLIST
must be freed by the user
- Parameters
-
playerPNG | true if the player images should get retrieved |
timeout | the time to wait for a connection, if NULL there will be no timeout |
- Exceptions
-
- Returns
- the list of currently registered player names
- Since
- 0.4
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.
Gets an ordinal number for a RANK
.
- Parameters
-
rank | the RANK to get the ordinal for |
- Returns
- ordinal number for a
RANK
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
-
suit | the SUIT to get the ordinal for |
- Returns
- ordinal number for a
SUIT
Converts a NetMauMau::Common::ICard::SUIT to a symbol.
- Parameters
-
suit | the SUIT to convert |
ansi | if true create a ANSI color representation |
endansi | if false (default) don't end the ANSI color codes |
- Returns
- the
SUIT
symbol
Variable Documentation
const std::string NetMauMau::Common::DefaultPlayerImage |
std::string
containing the default player image in PNG format
- Since
- 0.11