Permalink
Browse files

Classier enums

  • Loading branch information...
1 parent e9aba41 commit 83e5a4a7108b14beb61142d253e4ad87da13efa0 @TimePath TimePath committed with Kangz Jan 16, 2016
Showing with 3,886 additions and 3,922 deletions.
  1. +9 −9 daemon/src/common/Color.cpp
  2. +4 −4 daemon/src/common/Color.h
  3. +55 −52 daemon/src/common/FileSystem.cpp
  4. +1 −1 daemon/src/common/FileSystem.h
  5. +2 −2 daemon/src/common/IPC/CommonSyscalls.h
  6. +17 −17 daemon/src/common/IPC/Primitives.cpp
  7. +1 −1 daemon/src/common/IPC/Primitives.h
  8. +8 −8 daemon/src/common/Log.cpp
  9. +10 −10 daemon/src/common/Log.h
  10. +19 −0 daemon/src/common/Util.h
  11. +4 −4 daemon/src/common/cm/cm_load.cpp
  12. +2 −2 daemon/src/common/cm/cm_local.h
  13. +3 −5 daemon/src/common/cm/cm_patch.cpp
  14. +5 −5 daemon/src/common/cm/cm_plane.cpp
  15. +8 −8 daemon/src/common/cm/cm_polylib.cpp
  16. +22 −22 daemon/src/common/cm/cm_trace.cpp
  17. +3 −5 daemon/src/common/cm/cm_trisoup.cpp
  18. +1 −1 daemon/src/engine/botlib/bot_debug.h
  19. +12 −12 daemon/src/engine/botlib/bot_load.cpp
  20. +1 −1 daemon/src/engine/botlib/bot_local.cpp
  21. +2 −2 daemon/src/engine/botlib/bot_nav.cpp
  22. +1 −1 daemon/src/engine/botlib/bot_nav_edit.cpp
  23. +7 −7 daemon/src/engine/botlib/bot_types.h
  24. +6 −6 daemon/src/engine/botlib/nav.h
  25. +8 −8 daemon/src/engine/client/cg_api.h
  26. +1 −1 daemon/src/engine/client/cg_msgdef.h
  27. +6 −6 daemon/src/engine/client/cl_avi.cpp
  28. +25 −25 daemon/src/engine/client/cl_cgame.cpp
  29. +24 −24 daemon/src/engine/client/cl_cin.cpp
  30. +9 −9 daemon/src/engine/client/cl_console.cpp
  31. +27 −27 daemon/src/engine/client/cl_input.cpp
  32. +275 −275 daemon/src/engine/client/cl_keys.cpp
  33. +114 −114 daemon/src/engine/client/cl_main.cpp
  34. +13 −13 daemon/src/engine/client/cl_parse.cpp
  35. +13 −13 daemon/src/engine/client/cl_scrn.cpp
  36. +4 −4 daemon/src/engine/client/client.h
  37. +5 −5 daemon/src/engine/client/dl_main.cpp
  38. +1 −1 daemon/src/engine/client/keys.h
  39. +4 −4 daemon/src/engine/framework/BaseCommands.cpp
  40. +2 −2 daemon/src/engine/framework/CommonVMServices.cpp
  41. +1 −1 daemon/src/engine/framework/CrashDump.cpp
  42. +2 −1 daemon/src/engine/framework/VirtualMachine.h
  43. +33 −33 daemon/src/engine/qcommon/common.cpp
  44. +27 −27 daemon/src/engine/qcommon/files.cpp
  45. +4 −4 daemon/src/engine/qcommon/logging.h
  46. +10 −10 daemon/src/engine/qcommon/msg.cpp
  47. +18 −18 daemon/src/engine/qcommon/net_chan.cpp
  48. +38 −38 daemon/src/engine/qcommon/net_ip.cpp
  49. +1 −1 daemon/src/engine/qcommon/parse.cpp
  50. +20 −20 daemon/src/engine/qcommon/q_shared.cpp
  51. +15 −15 daemon/src/engine/qcommon/q_shared.h
  52. +1 −1 daemon/src/engine/qcommon/q_unicode.cpp
  53. +12 −12 daemon/src/engine/qcommon/qcommon.h
  54. +2 −2 daemon/src/engine/qcommon/qfiles.h
  55. +22 −22 daemon/src/engine/renderer/gl_shader.cpp
  56. +18 −18 daemon/src/engine/renderer/gl_shader.h
  57. +99 −99 daemon/src/engine/renderer/tr_animation.cpp
  58. +152 −152 daemon/src/engine/renderer/tr_backend.cpp
  59. +252 −252 daemon/src/engine/renderer/tr_bsp.cpp
  60. +48 −48 daemon/src/engine/renderer/tr_cmds.cpp
  61. +6 −6 daemon/src/engine/renderer/tr_curve.cpp
  62. +11 −11 daemon/src/engine/renderer/tr_decals.cpp
  63. +30 −33 daemon/src/engine/renderer/tr_fbo.cpp
  64. +11 −11 daemon/src/engine/renderer/tr_font.cpp
  65. +125 −126 daemon/src/engine/renderer/tr_image.cpp
  66. +12 −12 daemon/src/engine/renderer/tr_image_dds.cpp
  67. +4 −4 daemon/src/engine/renderer/tr_image_jpg.cpp
  68. +1 −1 daemon/src/engine/renderer/tr_image_ktx.cpp
  69. +6 −6 daemon/src/engine/renderer/tr_image_png.cpp
  70. +8 −8 daemon/src/engine/renderer/tr_image_tga.cpp
  71. +72 −72 daemon/src/engine/renderer/tr_init.cpp
  72. +39 −39 daemon/src/engine/renderer/tr_light.cpp
  73. +69 −69 daemon/src/engine/renderer/tr_local.h
  74. +72 −72 daemon/src/engine/renderer/tr_main.cpp
  75. +14 −14 daemon/src/engine/renderer/tr_marks.cpp
  76. +21 −22 daemon/src/engine/renderer/tr_mesh.cpp
  77. +28 −28 daemon/src/engine/renderer/tr_model.cpp
  78. +36 −36 daemon/src/engine/renderer/tr_model_iqm.cpp
  79. +20 −20 daemon/src/engine/renderer/tr_model_md3.cpp
  80. +43 −43 daemon/src/engine/renderer/tr_model_md5.cpp
  81. +3 −3 daemon/src/engine/renderer/tr_model_skel.cpp
  82. +3 −3 daemon/src/engine/renderer/tr_public.h
  83. +13 −13 daemon/src/engine/renderer/tr_scene.cpp
  84. +110 −110 daemon/src/engine/renderer/tr_shade.cpp
  85. +98 −98 daemon/src/engine/renderer/tr_shade_calc.cpp
  86. +550 −597 daemon/src/engine/renderer/tr_shader.cpp
  87. +11 −11 daemon/src/engine/renderer/tr_skin.cpp
  88. +14 −12 daemon/src/engine/renderer/tr_sky.cpp
  89. +9 −9 daemon/src/engine/renderer/tr_surface.cpp
  90. +12 −14 daemon/src/engine/renderer/tr_types.h
  91. +39 −39 daemon/src/engine/renderer/tr_vbo.cpp
  92. +16 −16 daemon/src/engine/renderer/tr_world.cpp
  93. +2 −2 daemon/src/engine/server/server.h
  94. +6 −6 daemon/src/engine/server/sv_bot.cpp
  95. +7 −7 daemon/src/engine/server/sv_ccmds.cpp
  96. +34 −34 daemon/src/engine/server/sv_client.cpp
  97. +25 −25 daemon/src/engine/server/sv_init.cpp
  98. +31 −31 daemon/src/engine/server/sv_main.cpp
  99. +20 −20 daemon/src/engine/server/sv_sgame.cpp
  100. +13 −13 daemon/src/engine/server/sv_snapshot.cpp
  101. +3 −3 daemon/src/engine/sys/con_curses.cpp
  102. +3 −3 daemon/src/engine/sys/con_tty.cpp
  103. +97 −98 daemon/src/engine/sys/sdl_glimp.cpp
  104. +72 −72 daemon/src/engine/sys/sdl_input.cpp
  105. +2 −2 daemon/src/shared/CommonProxies.cpp
  106. +2 −2 src/cgame/cg_animation.cpp
  107. +2 −2 src/cgame/cg_api.cpp
  108. +5 −5 src/cgame/cg_beacon.cpp
  109. +15 −15 src/cgame/cg_buildable.cpp
  110. +2 −2 src/cgame/cg_drawtools.cpp
  111. +44 −44 src/cgame/cg_ents.cpp
  112. +45 −45 src/cgame/cg_event.cpp
  113. +1 −1 src/cgame/cg_gameinfo.cpp
  114. +1 −1 src/cgame/cg_local.h
  115. +4 −4 src/cgame/cg_main.cpp
  116. +1 −1 src/cgame/cg_parseutils.cpp
  117. +4 −4 src/cgame/cg_particles.cpp
  118. +16 −16 src/cgame/cg_players.cpp
  119. +11 −11 src/cgame/cg_predict.cpp
  120. +33 −33 src/cgame/cg_rocket.cpp
  121. +11 −11 src/cgame/cg_rocket_datasource.cpp
  122. +19 −19 src/cgame/cg_rocket_draw.cpp
  123. +6 −6 src/cgame/cg_servercmds.cpp
  124. +1 −1 src/cgame/cg_snapshot.cpp
  125. +1 −1 src/cgame/cg_trails.cpp
  126. +1 −1 src/cgame/cg_tutorial.cpp
  127. +13 −13 src/cgame/cg_weapons.cpp
  128. +4 −4 src/cgame/rocket/rocket.cpp
  129. +3 −3 src/cgame/rocket/rocketChatField.h
  130. +1 −1 src/cgame/rocket/rocketFocusManager.h
  131. +4 −4 src/cgame/rocket/rocket_element.cpp
  132. +15 −15 src/sgame/Beacon.cpp
  133. +3 −3 src/sgame/components/HealthComponent.cpp
  134. +10 −10 src/sgame/sg_active.cpp
  135. +5 −5 src/sgame/sg_admin.cpp
  136. +2 −2 src/sgame/sg_api.cpp
  137. +4 −4 src/sgame/sg_bot.cpp
  138. +1 −1 src/sgame/sg_bot_ai.cpp
  139. +2 −5 src/sgame/sg_bot_nav.cpp
  140. +4 −4 src/sgame/sg_bot_parse.cpp
  141. +4 −3 src/sgame/sg_bot_parse.h
  142. +22 −22 src/sgame/sg_bot_util.cpp
  143. +1 −1 src/sgame/sg_bot_util.h
  144. +38 −38 src/sgame/sg_buildable.cpp
  145. +2 −2 src/sgame/sg_buildpoints.cpp
  146. +5 −5 src/sgame/sg_client.cpp
  147. +3 −3 src/sgame/sg_cm_world.cpp
  148. +26 −26 src/sgame/sg_cmds.cpp
  149. +4 −4 src/sgame/sg_combat.cpp
  150. +3 −3 src/sgame/sg_entities.cpp
  151. +10 −10 src/sgame/sg_main.cpp
  152. +2 −2 src/sgame/sg_maprotation.cpp
  153. +6 −6 src/sgame/sg_missile.cpp
  154. +4 −4 src/sgame/sg_momentum.cpp
  155. +5 −5 src/sgame/sg_physics.cpp
  156. +1 −1 src/sgame/sg_public.h
  157. +1 −1 src/sgame/sg_spawn.cpp
  158. +3 −3 src/sgame/sg_spawn_afx.cpp
  159. +1 −1 src/sgame/sg_spawn_fx.cpp
  160. +4 −4 src/sgame/sg_spawn_gfx.cpp
  161. +40 −40 src/sgame/sg_spawn_mover.cpp
  162. +1 −1 src/sgame/sg_spawn_position.cpp
  163. +1 −1 src/sgame/sg_spawn_sensor.cpp
  164. +2 −2 src/sgame/sg_team.cpp
  165. +3 −3 src/sgame/sg_utils.cpp
  166. +9 −9 src/sgame/sg_weapon.cpp
  167. +31 −31 src/shared/bg_misc.cpp
  168. +9 −9 src/shared/bg_parse.cpp
  169. +3 −3 src/shared/bg_pmove.cpp
  170. +9 −9 src/shared/bg_teamprogress.cpp
  171. +1 −1 src/shared/bg_utilities.cpp
  172. +6 −6 src/shared/bg_voice.cpp
@@ -88,7 +88,7 @@ int StrlenNocolor( const char *string )
int len = 0;
for ( const auto& token : Parser( string ) )
{
- if ( token.Type() == Token::CHARACTER || token.Type() == Token::ESCAPE )
+ if ( token.Type() == Token::TokenType::CHARACTER || token.Type() == Token::TokenType::ESCAPE )
{
len++;
}
@@ -103,11 +103,11 @@ char *StripColors( char *string )
for ( const auto& token : Parser( string ) )
{
- if ( token.Type() == Token::CHARACTER )
+ if ( token.Type() == Token::TokenType::CHARACTER )
{
output.append( token.Begin(), token.Size() );
}
- else if ( token.Type() == Token::ESCAPE )
+ else if ( token.Type() == Token::TokenType::ESCAPE )
{
output.push_back(Constants::ESCAPE);
}
@@ -124,7 +124,7 @@ void StripColors( const char *in, char *out, int len )
for ( const auto& token : Parser( in ) )
{
- if ( token.Type() == Token::CHARACTER )
+ if ( token.Type() == Token::TokenType::CHARACTER )
{
if ( len < token.Size() )
{
@@ -135,7 +135,7 @@ void StripColors( const char *in, char *out, int len )
out += token.Size();
len -= token.Size();
}
- else if ( token.Type() == Token::ESCAPE )
+ else if ( token.Type() == Token::TokenType::ESCAPE )
{
if ( len < 1 )
{
@@ -154,11 +154,11 @@ std::string StripColors( const std::string& input )
for ( const auto& token : Parser( input.c_str() ) )
{
- if ( token.Type() == Token::CHARACTER )
+ if ( token.Type() == Token::TokenType::CHARACTER )
{
output.append( token.Begin(), token.Size() );
}
- else if ( token.Type() == Token::ESCAPE )
+ else if ( token.Type() == Token::TokenType::ESCAPE )
{
output.push_back(Constants::ESCAPE);
}
@@ -253,7 +253,7 @@ TokenIterator::value_type TokenIterator::NextToken(const char* input)
{
if ( input[1] == Constants::ESCAPE )
{
- return value_type( input, input+2, value_type::ESCAPE );
+ return value_type( input, input+2, value_type::TokenType::ESCAPE );
}
else if ( input[1] == Constants::NULL_COLOR )
{
@@ -295,7 +295,7 @@ TokenIterator::value_type TokenIterator::NextToken(const char* input)
}
}
- return value_type( input, input + Q_UTF8_Width( input ), value_type::CHARACTER );
+ return value_type( input, input + Q_UTF8_Width( input ), value_type::TokenType::CHARACTER );
}
} // namespace Color
@@ -371,7 +371,7 @@ extern Color LtOrange;
class Token
{
public:
- enum TokenType {
+ enum class TokenType {
INVALID, // Invalid/empty token
CHARACTER, // A character
ESCAPE, // Color escape
@@ -407,7 +407,7 @@ class Token
Token( const char* begin, const char* end, const ::Color::Color& color )
: begin( begin ),
end( end ),
- type( COLOR ),
+ type( TokenType::COLOR ),
color( color )
{}
@@ -455,14 +455,14 @@ class Token
*/
explicit operator bool() const
{
- return type != INVALID && begin && begin < end;
+ return type != TokenType::INVALID && begin && begin < end;
}
private:
const char* begin = nullptr;
const char* end = nullptr;
- TokenType type = INVALID;
+ TokenType type = TokenType::INVALID;
::Color::Color color;
};
Oops, something went wrong.

0 comments on commit 83e5a4a

Please sign in to comment.