SmartFoxServer 2X C++ API
Sfs2X::Requests::FindRoomsRequest Class Reference

Search Rooms in the system by matching their variables and properties against a MatchExpression More...

#include <FindRoomsRequest.h>

Inherits Sfs2X::Requests::BaseRequest.

Public Member Functions

 FindRoomsRequest (boost::shared_ptr< MatchExpression > expr)
 FindRoomsRequest(boost::shared_ptr<MatchExpression>, string, long int) More...
 
 FindRoomsRequest (boost::shared_ptr< MatchExpression > expr, string groupId)
 FindRoomsRequest(boost::shared_ptr<MatchExpression>, string, long int) More...
 
 FindRoomsRequest (boost::shared_ptr< MatchExpression > expr, string groupId, long int limit)
 Constructor More...
 

Detailed Description

Search Rooms in the system by matching their variables and properties against a MatchExpression

Constructor & Destructor Documentation

◆ FindRoomsRequest() [1/3]

Sfs2X::Requests::FindRoomsRequest::FindRoomsRequest ( boost::shared_ptr< MatchExpression expr)

◆ FindRoomsRequest() [2/3]

Sfs2X::Requests::FindRoomsRequest::FindRoomsRequest ( boost::shared_ptr< MatchExpression expr,
string  groupId 
)

◆ FindRoomsRequest() [3/3]

Sfs2X::Requests::FindRoomsRequest::FindRoomsRequest ( boost::shared_ptr< MatchExpression expr,
string  groupId,
long int  limit 
)

Constructor

Parameters
exprthe match expression
groupIdthe id of the Room Group where to perform the search, if null the search will be Zone-wide (default)
limitthe number of results wanted. Zero means no limit, we will get all results (default)
ptrSmartFox->AddEventListener(SFSEvent::ROOM_FIND_RESULT, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnRoomFindResult, (unsigned long long)this));
// Search for all Rooms whose 'country' Room Variable == 'Sweden'
boost::shared_ptr<MatchExpression> expr (new MatchExpression("country", NumberMatch::EQUALS, "Sweden"));
// Send request
boost::shared_ptr<IRequest> request (new FindRoomRequest(expr));
ptrSmartFox->Send(request);
static void OnRoomFindResult(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
void CMyClass::OnRoomFindResult(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
CMyClass* ptrMyClass = (CMyClass*)ptrContext;
// Rooms found
boost::shared_ptr<map<string, boost::shared_ptr<void>>> ptrEventParams = ptrEvent->Params();
boost::shared_ptr<void> ptrEventParamValueRooms = (*ptrEventParams)["rooms"];
boost::shared_ptr<vector<boost::shared_ptr<Room>> ptrNotifiedRooms = ((boost::static_pointer_cast<vector<boost::shared_ptr<Room>>)(ptrEventParamValueRooms));
}
See also
Core.SFSEvent.ROOM_FIND_RESULT, MatchExpression, RoomProperties