Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / server / src / shard_unifier_service / character_sync.h
blobd903645cb64dd745dddbd2be2f318f9176937224
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include "nel/misc/types_nl.h"
18 #include "nel/misc/singleton.h"
19 #include "nel/misc/speaker_listener.h"
21 #ifndef CHARACTER_SYNCH_H
22 #define CHARACTER_SYNCH_H
24 namespace CHARSYNC
29 class ICharacterSync;
31 /** Callback interface to implement and register in the
32 * entity character synchronizer to receive character update events.
34 class ICharacterSyncCb : public NLMISC::CListener<ICharacterSync>
36 public:
38 /** Callback called when the name of a character have been changed */
39 virtual void onCharacterNameUpdated(uint32 charId, const std::string &oldName, const std::string &newName) =0;
41 /** Callback called when a character is deleted/removed */
42 virtual void onBeforeCharacterDelete(uint32 charId) =0;
47 /** Local interface for the character synchronizer */
48 class ICharacterSync
49 : public NLMISC::CManualSingleton<ICharacterSync>,
50 public NLMISC::CSpeaker<ICharacterSyncCb>
52 public:
53 /** Get the name of a user */
54 virtual std::string getUserName(uint32 userId) =0;
55 /** Get the name of a character */
56 virtual ucstring getCharacterName(uint32 charId) =0;
57 /// Try to find a shard id from a name and session id. Return 0 if not found
58 virtual uint32 findCharId(const std::string &charName, uint32 homeSessionId) =0;
59 /// Try to find a shard id from a name without session id, return 0 if 0 or more than one match.
60 virtual uint32 findCharId(const std::string &charName) =0;
62 };
64 } // namespace ENTITYLOC
66 #endif // CHARACTER_SYNCH_H