Photon C++ Client API  4.1.15.3
Public Member Functions | List of all members
Room Class Reference
Inheritance diagram for Room:
Inheritance graph
[legend]
Collaboration diagram for Room:
Collaboration graph
[legend]

Public Member Functions

virtual ~Room (void)
 
 Room (const Room &toCopy)
 
virtual Roomoperator= (const Room &toCopy)
 
const Common::JStringgetName (void) const
 
virtual nByte getPlayerCount (void) const
 
nByte getMaxPlayers (void) const
 
bool getIsOpen (void) const
 
nByte getDirectMode (void) const
 
const Common::HashtablegetCustomProperties (void) const
 
bool operator== (const Room &room) const
 
virtual Common::JStringtoString (Common::JString &retStr, bool withTypes=false) const
 
virtual Common::JString toString (bool withTypes, bool withCustomProperties) const
 
- Public Member Functions inherited from Base
virtual ~Base (void)
 
- Public Member Functions inherited from ToString
virtual ~ToString (void)
 
virtual JString typeToString (void) const
 
JString toString (bool withTypes=false) const
 

Additional Inherited Members

- Static Public Member Functions inherited from Base
static void setListener (const BaseListener *baseListener)
 
static int getDebugOutputLevel (void)
 
static bool setDebugOutputLevel (int debugLevel)
 
static const LogFormatOptionsgetLogFormatOptions (void)
 
static void setLogFormatOptions (const LogFormatOptions &options)
 

Detailed Description

Each visible room inside the list of rooms in a lobby of type LobbyType::DEFAULT is represented by an instance of this class.

The information that is available through the various getters is regularly updated by the server as long as the client is inside the lobby. It is not updated and information will become outdated while the client is inside of a room.

See also
MutableRoom, Client::getRoomList()

Constructor & Destructor Documentation

§ ~Room()

~Room ( void  )
virtual

Destructor.

§ Room()

Room ( const Room toCopy)

Copy-Constructor: Creates a new instance that is a deep copy of the argument instance.

Parameters
toCopyThe instance to copy.

Member Function Documentation

§ operator=()

Room & operator= ( const Room toCopy)
virtual

operator=.

Makes a deep copy of its right operand into its left operand.

This overwrites old data in the left operand.

Reimplemented in MutableRoom.

§ getName()

const JString & getName ( void  ) const
Returns
the name of the room

A rooms name is a unique identifier (per region and virtual appid) for a room/match.

It can be set set by the client on room creation as parameter of Client::opCreateRoom() or Client::opJoinOrCreateRoom().

The name can't be changed once the room is created.

§ getPlayerCount()

nByte getPlayerCount ( void  ) const
virtual
Returns
the count of players that are currently inside this room

Reimplemented in MutableRoom.

§ getMaxPlayers()

nByte getMaxPlayers ( void  ) const
Returns
the limit of players for this room. If a room is full (getPlayerCount() == getMaxPlayers()), joining this room will fail.

§ getIsOpen()

bool getIsOpen ( void  ) const
Returns
'true' if the room can be joined, 'false' otherwise.

This does not affect listing in a lobby but joining a room will fail if it is not open.

If it is not open, then a room is excluded from random matchmaking.

Due to racing conditions, found matches might become closed even while you join them. Simply find another room in this scenario.

§ getDirectMode()

nByte getDirectMode ( void  ) const
Returns
one of the values in DirectMode

This returns DirectMode::NONE, unless the client that created the room has set something else through RoomOptions::setDirectMode()

§ getCustomProperties()

const Hashtable & getCustomProperties ( void  ) const
Returns
the custom properties of this room

Read-only cache for those custom properties of a room, which have been included in the list of properties to show in lobby (see RoomOptions::setPropsListedInLobby() and MutableRoom::setPropsListedInLobby()).

A client can change the custom properties of the currently joined room through class MutableRoom. The initial custom properties of a room can be set through class RoomOptions.

§ operator==()

bool operator== ( const Room room) const

operator==.

Returns
true, if both operands are equal, false otherwise.

Two Room instances are considered equal, if getName() returns equal values for both of them.

§ toString() [1/2]

JString & toString ( Common::JString retStr,
bool  withTypes = false 
) const
virtual
Remarks
The cost of this function depends a lot on implementation details of the implementing subclasses, but for container classes this function can become quite expensive, if the instance contains huge amounts of data, as its cost for many container class implementations increases disproportionately high to the size of the payload.
Parameters
retStrreference to a string, to store the return-value in; the information, which is generated by this function, will be attached at the end of any eventually existing previous content of the string
withTypesset to true, to include type information in the generated string
Returns
a JString representation of the instance and its contents for debugging purposes.

Implements ToString.

§ toString() [2/2]

JString toString ( bool  withTypes,
bool  withCustomProperties 
) const
virtual

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

Parameters
withTypesset to true, to include type information in the generated string
withCustomPropertiesset to true, to include the custom properties in the generated string