Permalink
Browse files

using typedef = using

use `using` over `typedef` throughout the engine
  • Loading branch information...
1 parent ed12fc0 commit e9aba4134bf0387ae3c15fc1ce9baf9a76456b61 @TimePath TimePath committed with Kangz Jan 15, 2016
Showing with 1,350 additions and 1,584 deletions.
  1. +3 −3 daemon/src/common/Color.h
  2. +4 −4 daemon/src/common/Command.h
  3. +4 −4 daemon/src/common/Cvar.h
  4. +2 −2 daemon/src/common/DisjointSets.h
  5. +2 −4 daemon/src/common/Endian.h
  6. +3 −3 daemon/src/common/FileSystem.cpp
  7. +5 −5 daemon/src/common/FileSystem.h
  8. +6 −6 daemon/src/common/IPC/Channel.h
  9. +4 −4 daemon/src/common/IPC/CommandBuffer.h
  10. +7 −7 daemon/src/common/IPC/Common.h
  11. +83 −127 daemon/src/common/IPC/CommonSyscalls.h
  12. +3 −3 daemon/src/common/Optional.h
  13. +1 −1 daemon/src/common/String.h
  14. +1 −1 daemon/src/common/System.cpp
  15. +9 −9 daemon/src/common/System.h
  16. +1 −1 daemon/src/common/Util.h
  17. +36 −36 daemon/src/common/cm/cm_local.h
  18. +2 −2 daemon/src/common/cm/cm_patch.cpp
  19. +6 −6 daemon/src/common/cm/cm_patch.h
  20. +2 −2 daemon/src/common/cm/cm_polylib.h
  21. +6 −6 daemon/src/common/math/Vector.h
  22. +2 −2 daemon/src/engine/audio/SoundCodec.cpp
  23. +4 −4 daemon/src/engine/botlib/bot_debug.h
  24. +6 −6 daemon/src/engine/botlib/bot_local.h
  25. +10 −10 daemon/src/engine/botlib/bot_types.h
  26. +12 −12 daemon/src/engine/client/cg_api.h
  27. +244 −370 daemon/src/engine/client/cg_msgdef.h
  28. +4 −4 daemon/src/engine/client/cin_ogm.cpp
  29. +4 −4 daemon/src/engine/client/cl_avi.cpp
  30. +2 −2 daemon/src/engine/client/cl_cgame.cpp
  31. +6 −6 daemon/src/engine/client/cl_cin.cpp
  32. +6 −6 daemon/src/engine/client/cl_irc.cpp
  33. +4 −4 daemon/src/engine/client/cl_keys.cpp
  34. +4 −4 daemon/src/engine/client/cl_main.cpp
  35. +22 −22 daemon/src/engine/client/client.h
  36. +2 −2 daemon/src/engine/client/keycodes.h
  37. +2 −2 daemon/src/engine/client/keys.h
  38. +1 −1 daemon/src/engine/framework/CommandSystem.cpp
  39. +1 −1 daemon/src/engine/framework/CvarSystem.cpp
  40. +1 −1 daemon/src/engine/framework/Resource.h
  41. +2 −2 daemon/src/engine/qcommon/cmd.cpp
  42. +7 −9 daemon/src/engine/qcommon/common.cpp
  43. +1 −1 daemon/src/engine/qcommon/crypto.h
  44. +4 −4 daemon/src/engine/qcommon/cvar.h
  45. +10 −10 daemon/src/engine/qcommon/logging.h
  46. +4 −4 daemon/src/engine/qcommon/md5.cpp
  47. +4 −4 daemon/src/engine/qcommon/msg.cpp
  48. +7 −7 daemon/src/engine/qcommon/net_chan.cpp
  49. +5 −5 daemon/src/engine/qcommon/net_ip.cpp
  50. +26 −26 daemon/src/engine/qcommon/parse.cpp
  51. +1 −1 daemon/src/engine/qcommon/q_math.cpp
  52. +97 −97 daemon/src/engine/qcommon/q_shared.h
  53. +41 −41 daemon/src/engine/qcommon/qcommon.h
  54. +78 −78 daemon/src/engine/qcommon/qfiles.h
  55. +2 −2 daemon/src/engine/qcommon/unicode_data.h
  56. +3 −5 daemon/src/engine/renderer/tr_decals.cpp
  57. +3 −3 daemon/src/engine/renderer/tr_flares.cpp
  58. +2 −2 daemon/src/engine/renderer/tr_font.cpp
  59. +4 −4 daemon/src/engine/renderer/tr_image.cpp
  60. +8 −8 daemon/src/engine/renderer/tr_image_dds.cpp
  61. +3 −3 daemon/src/engine/renderer/tr_image_jpg.cpp
  62. +2 −2 daemon/src/engine/renderer/tr_image_ktx.cpp
  63. +2 −2 daemon/src/engine/renderer/tr_init.cpp
  64. +341 −352 daemon/src/engine/renderer/tr_local.h
  65. +1 −2 daemon/src/engine/renderer/tr_main.cpp
  66. +6 −6 daemon/src/engine/renderer/tr_public.h
  67. +3 −4 daemon/src/engine/renderer/tr_shader.cpp
  68. +37 −37 daemon/src/engine/renderer/tr_types.h
  69. +24 −24 daemon/src/engine/server/server.h
  70. +4 −4 daemon/src/engine/server/sg_api.h
  71. +81 −126 daemon/src/engine/server/sg_msgdef.h
  72. +2 −2 daemon/src/engine/server/sv_client.cpp
  73. +2 −2 daemon/src/engine/server/sv_snapshot.cpp
  74. +2 −2 daemon/src/engine/sys/sdl_glimp.cpp
  75. +2 −2 daemon/src/engine/sys/sdl_input.cpp
  76. +2 −2 daemon/src/shared/CommonProxies.cpp
@@ -71,7 +71,7 @@ template<>
*
* Requirements for AdaptedType:
* static bool is_color = true;
- * typedef (unspecified) component_type; // See ColorComponentTraits
+ * using component_type = (unspecified); // See ColorComponentTraits
* static component_type component_max = (unspecified); // See ColorComponentTraits
* component_type Red() const; // Red component
* component_type Green() const; // Green component
@@ -308,8 +308,8 @@ class BasicColor
};
-typedef BasicColor<float> Color;
-typedef BasicColor<uint8_t> Color32Bit;
+using Color = BasicColor<float>;
+using Color32Bit = BasicColor<uint8_t>;
/*
* Blend two colors.
@@ -102,8 +102,8 @@ namespace Cmd {
};
// A completion result is a list of (result, short description)
- typedef std::pair<std::string, std::string> CompletionItem;
- typedef std::vector<CompletionItem> CompletionResult;
+ using CompletionItem = std::pair<std::string, std::string>;
+ using CompletionResult = std::vector<CompletionItem>;
CompletionResult FilterCompletion(Str::StringRef prefix, std::initializer_list<CompletionItem> list);
void AddToCompletion(CompletionResult& res, Str::StringRef prefix, std::initializer_list<CompletionItem> list);
@@ -176,8 +176,8 @@ namespace Cmd {
class LambdaCmd : public StaticCmd {
public:
- typedef std::function<void(const Args&)> RunFn;
- typedef std::function<CompletionResult(int, const Args&, Str::StringRef)> CompleteFn;
+ using RunFn = std::function<void(const Args&)>;
+ using CompleteFn = std::function<CompletionResult(int, const Args&, Str::StringRef)>;
LambdaCmd(std::string name, std::string description, RunFn run, CompleteFn complete = NoopComplete);
LambdaCmd(std::string name, int flags, std::string description, RunFn run, CompleteFn complete = NoopComplete);
@@ -98,7 +98,7 @@ namespace Cvar {
*/
template<typename T> class Cvar : public CvarProxy{
public:
- typedef T value_type;
+ using value_type = T;
// See the comment near the extension classes about that double constructor.
Cvar(std::string name, std::string description, int flags, value_type defaultValue);
@@ -150,7 +150,7 @@ namespace Cvar {
*/
template<typename Base> class Callback : public Base {
public:
- typedef typename Base::value_type value_type;
+ using value_type = typename Base::value_type;
template <typename ... Args>
Callback(std::string name, std::string description, int flags, value_type defaultValue, std::function<void(value_type)> callback, Args&& ... args);
@@ -170,7 +170,7 @@ namespace Cvar {
template<typename Base> class Modified : public Base {
public:
- typedef typename Base::value_type value_type;
+ using value_type = typename Base::value_type;
template<typename ... Args>
Modified(std::string name, std::string description, int flags, value_type defaultValue, Args ... args);
@@ -192,7 +192,7 @@ namespace Cvar {
template<typename Base> class Range : public Base {
public:
- typedef typename Base::value_type value_type;
+ using value_type = typename Base::value_type;
template<typename ... Args>
Range(std::string name, std::string description, int flags, value_type defaultValue, value_type min, value_type max, Args ... args);
@@ -36,8 +36,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
template<typename Element> class DisjointSets {
public:
- typedef std::unordered_set<Element> set_type;
- typedef typename std::unordered_map<Element, set_type>::const_iterator iter_type;
+ using set_type = std::unordered_set<Element>;
+ using iter_type = typename std::unordered_map<Element, set_type>::const_iterator;
DisjointSets()
: totalSize(0)
@@ -151,14 +151,12 @@ inline int64_t Swap64(int64_t x)
inline float SwapFloat(float x)
{
- typedef union
+ union
{
float f;
int i;
unsigned int ui;
- } floatint_t;
-
- floatint_t fi;
+ } fi;
fi.f = x;
fi.i = Swap32(fi.i);
return fi.f;
@@ -234,11 +234,11 @@ inline int my_fseek(FILE* fd, offset_t off, int whence)
#endif
}
#ifdef _WIN32
-typedef struct _stati64 my_stat_t;
+using my_stat_t = struct _stati64;
#elif defined(__APPLE__) || defined(__native_client__)
-typedef struct stat my_stat_t;
+using my_stat_t = struct stat;
#elif defined(__linux__)
-typedef struct stat64 my_stat_t;
+using my_stat_t = struct stat64;
#endif
inline int my_fstat(int fd, my_stat_t* st)
{
@@ -40,7 +40,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace FS {
// File offset type. Using 64bit to allow large files.
-typedef int64_t offset_t;
+using offset_t = int64_t;
// Special value to indicate the function should throw a system_error instead
// of returning an error code. This avoids the need to have 2 overloads for each
@@ -456,11 +456,11 @@ namespace HomePath {
// List all files in the given subdirectory, optionally recursing into subdirectories
// Directory names are returned with a trailing slash to differentiate them from files
#ifdef BUILD_VM
- typedef std::vector<std::string> DirectoryRange;
- typedef std::vector<std::string> RecursiveDirectoryRange;
+ using DirectoryRange = std::vector<std::string>;
+ using RecursiveDirectoryRange = std::vector<std::string>;
#else
- typedef RawPath::DirectoryRange DirectoryRange;
- typedef RawPath::RecursiveDirectoryRange RecursiveDirectoryRange;
+ using DirectoryRange = RawPath::DirectoryRange;
+ using RecursiveDirectoryRange = RawPath::RecursiveDirectoryRange;
#endif
DirectoryRange ListFiles(Str::StringRef path, std::error_code& err = throws());
RecursiveDirectoryRange ListFilesRecursive(Str::StringRef path, std::error_code& err = throws());
@@ -138,7 +138,7 @@ namespace IPC {
// Implementations of SendMsg for Message and SyncMessage
template<typename Func, typename Id, typename... MsgArgs, typename... Args> void SendMsg(Channel& channel, Func&&, Message<Id, MsgArgs...>, Args&&... args)
{
- typedef Message<Id, MsgArgs...> Message;
+ using Message = Message<Id, MsgArgs...>;
static_assert(sizeof...(Args) == std::tuple_size<typename Message::Inputs>::value, "Incorrect number of arguments for IPC::SendMsg");
if (!channel.canSendAsyncMsg)
@@ -151,7 +151,7 @@ namespace IPC {
}
template<typename Func, typename Msg, typename Reply, typename... Args> void SendMsg(Channel& channel, Func&& messageHandler, SyncMessage<Msg, Reply>, Args&&... args)
{
- typedef SyncMessage<Msg, Reply> Message;
+ using Message = SyncMessage<Msg, Reply>;
static_assert(sizeof...(Args) == std::tuple_size<typename Message::Inputs>::value + std::tuple_size<typename Message::Outputs>::value, "Incorrect number of arguments for IPC::SendMsg");
if (!channel.canSendSyncMsg)
@@ -177,17 +177,17 @@ namespace IPC {
// Map a tuple to get the actual types returned by SerializeTraits::Read instead of the declared types
template<typename T> struct MapTupleHelper {
- typedef decltype(Util::SerializeTraits<T>::Read(std::declval<Util::Reader&>())) type;
+ using type = decltype(Util::SerializeTraits<T>::Read(std::declval<Util::Reader&>()));
};
template<typename T> struct MapTuple {};
template<typename... T> struct MapTuple<std::tuple<T...>> {
- typedef std::tuple<typename MapTupleHelper<T>::type...> type;
+ using type = std::tuple<typename MapTupleHelper<T>::type...>;
};
// Implementations of HandleMsg for Message and SyncMessage
template<typename Func, typename Id, typename... MsgArgs> void HandleMsg(Channel& channel, Message<Id, MsgArgs...>, Util::Reader reader, Func&& func)
{
- typedef Message<Id, MsgArgs...> Message;
+ using Message = Message<Id, MsgArgs...>;
typename MapTuple<typename Message::Inputs>::type inputs;
reader.FillTuple<0>(Util::TypeListFromTuple<typename Message::Inputs>(), inputs);
@@ -203,7 +203,7 @@ namespace IPC {
}
template<typename Func, typename Msg, typename Reply> void HandleMsg(Channel& channel, SyncMessage<Msg, Reply>, Util::Reader reader, Func&& func)
{
- typedef SyncMessage<Msg, Reply> Message;
+ using Message = SyncMessage<Msg, Reply>;
typename MapTuple<typename Message::Inputs>::type inputs;
typename Message::Outputs outputs;
@@ -122,13 +122,13 @@ namespace IPC {
COMMAND_BUFFER_CONSUME,
};
- typedef IPC::SyncMessage<
+ using CommandBufferLocateMsg = IPC::SyncMessage<
IPC::Message<IPC::Id<VM::COMMAND_BUFFER, COMMAND_BUFFER_LOCATE>, IPC::SharedMemory>
- > CommandBufferLocateMsg;
+ >;
- typedef IPC::SyncMessage<
+ using CommandBufferConsumeMsg = IPC::SyncMessage<
IPC::Message<IPC::Id<VM::COMMAND_BUFFER, COMMAND_BUFFER_CONSUME>>
- > CommandBufferConsumeMsg;
+ >;
} // namespace IPC
@@ -90,29 +90,29 @@ namespace IPC {
* Asynchronous message which does not wait for a reply, the argument types
* can be any serializable type, you can declare a message type like so:
*
- * typedef IPC::Message<IPC::Id<MY_MODULE, MY_METHOD>, std::string, int, bool> MyMethodMsg;
+ * using MyMethodMsg = IPC::Message<IPC::Id<MY_MODULE, MY_METHOD>, std::string, int, bool>;
*/
template<typename Id, typename... T> struct Message {
enum {
id = Id::value
};
- typedef std::tuple<T...> Inputs;
+ using Inputs = std::tuple<T...>;
};
// Reply class which should only be used for the second parameter of SyncMessage
template<typename... T> struct Reply {
- typedef std::tuple<T...> Outputs;
+ using Outputs = std::tuple<T...>;
};
/*
* Synchronous message which waits for a reply. The reply can contain data. Both
* the input and output types can be any serializable type, you can declare a
* synchronous message type like so:
*
- * typedef IPC::SyncMessage<
+ * using MyMethodMsg = IPC::SyncMessage<
* Message<IPC::Id<MY_MODULE, MY_METHOD>, std::string, int, bool>,
* IPC::Reply<std::string>
- * > MyMethodMsg;
+ * >;
*
* You can skip the Reply part if there is no return value, this is useful for
* messages whose invocation will contain other sync messages, such as most
@@ -122,8 +122,8 @@ namespace IPC {
enum {
id = Msg::id
};
- typedef typename Msg::Inputs Inputs;
- typedef typename Reply::Outputs Outputs;
+ using Inputs = typename Msg::Inputs;
+ using Outputs = typename Reply::Outputs;
};
} // namespace IPC
Oops, something went wrong.

0 comments on commit e9aba41

Please sign in to comment.