Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions Source/include/mafianet/aliases.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2019, SLikeSoft UG (haftungsbeschraenkt)
*
* This source code is licensed under the MIT-style license found in the license.txt
* file in the root directory of this source tree.
*/

/// \file aliases.h
/// \brief Canonical MafiaNet type aliases over the legacy RakNet names.
///
/// The library lives in the `MafiaNet` namespace, but many public types still
/// carry their historical RakNet names. This header introduces clean, canonical
/// aliases so callers can write idiomatic MafiaNet code:
/// \code
/// MafiaNet::PeerInterface* peer = MafiaNet::PeerInterface::GetInstance();
/// \endcode
///
/// These are `using` aliases (not subclasses): each canonical name denotes the
/// exact same type as its legacy counterpart, so the two interoperate freely.
///
/// \note Aliases only — the legacy declarations are intentionally left untouched
/// and un-deprecated. A `[[deprecated]]` pass is a separate, later task.

#pragma once

#include "mafianet/peerinterface.h" // RakPeerInterface
#include "mafianet/types.h" // RakNetGUID, UNASSIGNED_RAKNET_GUID
#include "mafianet/statistics.h" // RakNetStatistics

namespace MafiaNet {

/// Canonical name for the main entry point, RakPeerInterface.
using PeerInterface = RakPeerInterface;

/// Canonical name for a peer's globally unique identifier, RakNetGUID.
using Guid = RakNetGUID;

/// Canonical name for the connection statistics struct, RakNetStatistics.
using Statistics = RakNetStatistics;

/// Canonical name for the unassigned-GUID sentinel, UNASSIGNED_RAKNET_GUID.
/// Bound by reference so it remains the same object as the legacy sentinel.
inline const Guid& UnassignedGuid = UNASSIGNED_RAKNET_GUID;

} // namespace MafiaNet
1 change: 1 addition & 0 deletions Source/include/mafianet/mafianet.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
#include "mafianet/BitStream.h" // binary serialization
#include "mafianet/GetTime.h" // MafiaNet::GetTime / TimeMS
#include "mafianet/guid_util.h" // MafiaNet::to_string / connected_address
#include "mafianet/aliases.h" // canonical aliases: PeerInterface, Guid, Statistics
Loading