Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 29, 2015, 5:36:14 PM (9 years ago)
Author:
landauf
Message:

using some constexpr

Location:
code/branches/cpp11_v2/src/libraries
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/core/CorePrereqs.h

    r10624 r10994  
    6868namespace orxonox
    6969{
    70     static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
     70    static constexpr uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);
    7171}
    7272
     
    8282
    8383        //!A list of available scopes for the Scope template.
    84         static const Value ROOT = 1;
    85         static const Value GRAPHICS = 2;
     84        static constexpr Value ROOT = 1;
     85        static constexpr Value GRAPHICS = 2;
    8686    }
    8787
     
    9090        typedef int Type;
    9191
    92         static const Type STATIC_INITIALIZATION_HANDLER = 1;
    93         static const Type IDENTIFIER = 2;
    94         static const Type SCOPED_SINGLETON_WRAPPER = 3;
    95         static const Type COMMAND_LINE_ARGUMENT = 4;
    96         static const Type CONSOLE_COMMAND = 5;
     92        static constexpr Type STATIC_INITIALIZATION_HANDLER = 1;
     93        static constexpr Type IDENTIFIER = 2;
     94        static constexpr Type SCOPED_SINGLETON_WRAPPER = 3;
     95        static constexpr Type COMMAND_LINE_ARGUMENT = 4;
     96        static constexpr Type CONSOLE_COMMAND = 5;
    9797    }
    9898
  • code/branches/cpp11_v2/src/libraries/core/command/CommandExecutor.h

    r10992 r10994  
    118118            static CommandEvaluation evaluate(const std::string& command);
    119119
    120             static const int Success = 0;       ///< Error code for "success" (or no error)
    121             static const int Inexistent = 1;    ///< Error code if the command doesn't exist
    122             static const int Incomplete = 2;    ///< Error code if the command needs more arguments
    123             static const int Deactivated = 3;   ///< Error code if the command is not active
    124             static const int Denied = 4;        ///< Error code if the command needs a different access level
    125             static const int Error = 5;         ///< Error code if the command returned an error
     120            static constexpr int Success = 0;       ///< Error code for "success" (or no error)
     121            static constexpr int Inexistent = 1;    ///< Error code if the command doesn't exist
     122            static constexpr int Incomplete = 2;    ///< Error code if the command needs more arguments
     123            static constexpr int Deactivated = 3;   ///< Error code if the command is not active
     124            static constexpr int Denied = 4;        ///< Error code if the command needs a different access level
     125            static constexpr int Error = 5;         ///< Error code if the command returned an error
    126126
    127127            static std::string getErrorDescription(int error);
  • code/branches/cpp11_v2/src/libraries/core/command/IRC.cc

    r10768 r10994  
    4444namespace orxonox
    4545{
    46     static const unsigned int IRC_TCL_THREADID  = 1421421421;   ///< The ID of the thread in TclThreadManager that is used for the IRC connection
     46    static constexpr unsigned int IRC_TCL_THREADID  = 1421421421;   ///< The ID of the thread in TclThreadManager that is used for the IRC connection
    4747
    4848    SetConsoleCommand("IRC", "say",  &IRC::say);
  • code/branches/cpp11_v2/src/libraries/core/input/InputPrereqs.h

    r8729 r10994  
    454454        OrxEnumConstructors(InputStatePriority);
    455455
    456         static const int Empty        = -1;
    457         static const int Dynamic      = 0;
    458 
    459         static const int HighPriority = 1000;
    460         static const int Console      = HighPriority + 0;
    461         static const int Calibrator   = HighPriority + 1;
    462         static const int Detector     = HighPriority + 2;
     456        static constexpr int Empty        = -1;
     457        static constexpr int Dynamic      = 0;
     458
     459        static constexpr int HighPriority = 1000;
     460        static constexpr int Console      = HighPriority + 0;
     461        static constexpr int Calibrator   = HighPriority + 1;
     462        static constexpr int Detector     = HighPriority + 2;
    463463    };
    464464}
  • code/branches/cpp11_v2/src/libraries/network/NetworkFunction.h

    r10845 r10994  
    4545
    4646#if defined(ORXONOX_COMPILER_GCC) && defined(ORXONOX_ARCH_32)
    47 static const unsigned int MAX_FUNCTION_POINTER_SIZE = 8;
     47static constexpr unsigned int MAX_FUNCTION_POINTER_SIZE = 8;
    4848#else
    49 static const unsigned int MAX_FUNCTION_POINTER_SIZE = 16;
     49static constexpr unsigned int MAX_FUNCTION_POINTER_SIZE = 16;
    5050#endif //ORXONOX_COMPILER_GCC
    51 static const unsigned int MAX_FUNCTION_POINTER_INTS = (MAX_FUNCTION_POINTER_SIZE-1)/4+1;
     51static constexpr unsigned int MAX_FUNCTION_POINTER_INTS = (MAX_FUNCTION_POINTER_SIZE-1)/4+1;
    5252
    5353struct _NetworkExport NetworkFunctionPointer {
  • code/branches/cpp11_v2/src/libraries/network/NetworkPrereqs.h

    r10624 r10994  
    6767namespace orxonox
    6868{
    69   static const unsigned int GAMESTATEID_INITIAL       = static_cast<unsigned int>(-1);
     69  static constexpr unsigned int GAMESTATEID_INITIAL       = static_cast<unsigned int>(-1);
    7070  extern const char* LAN_DISCOVERY_MESSAGE;
    7171  extern const char* LAN_DISCOVERY_ACK;
    72   static const unsigned int LAN_DISCOVERY_PORT          = 55558;
    73   static const unsigned int NETWORK_PEER_ID_SERVER      = 0;
    74   static const unsigned int NETWORK_PEER_ID_BROADCAST   = static_cast<unsigned int>(-1);
    75   static const unsigned int NETWORK_PEER_ID_UNKNOWN     = static_cast<unsigned int>(-2);
    76   static const unsigned int NETWORK_CHANNEL_DEFAULT     = 0;
    77   static const unsigned int NETWORK_CHANNEL_UNRELIABLE  = 1;
    78   static const unsigned int NETWORK_CHANNEL_COUNT       = 2;
     72  static constexpr unsigned int LAN_DISCOVERY_PORT          = 55558;
     73  static constexpr unsigned int NETWORK_PEER_ID_SERVER      = 0;
     74  static constexpr unsigned int NETWORK_PEER_ID_BROADCAST   = static_cast<unsigned int>(-1);
     75  static constexpr unsigned int NETWORK_PEER_ID_UNKNOWN     = static_cast<unsigned int>(-2);
     76  static constexpr unsigned int NETWORK_CHANNEL_DEFAULT     = 0;
     77  static constexpr unsigned int NETWORK_CHANNEL_UNRELIABLE  = 1;
     78  static constexpr unsigned int NETWORK_CHANNEL_COUNT       = 2;
    7979}
    8080
  • code/branches/cpp11_v2/src/libraries/network/TrafficControl.cc

    r10775 r10994  
    3838namespace orxonox {
    3939
    40   static const unsigned int SCHED_PRIORITY_OFFSET = static_cast<unsigned int>(-1);
     40  static constexpr unsigned int SCHED_PRIORITY_OFFSET = static_cast<unsigned int>(-1);
    4141  namespace arg = std::placeholders;
    4242
  • code/branches/cpp11_v2/src/libraries/network/packet/Gamestate.h

    r10817 r10994  
    4848{
    4949   
    50 static const uint8_t GAMESTATE_MODE_SERVER = 0x1;
    51 static const uint8_t GAMESTATE_MODE_CLIENT = 0x2;
     50static constexpr uint8_t GAMESTATE_MODE_SERVER = 0x1;
     51static constexpr uint8_t GAMESTATE_MODE_CLIENT = 0x2;
    5252
    5353class _NetworkExport GamestateHeader
  • code/branches/cpp11_v2/src/libraries/util/output/LogWriter.cc

    r10989 r10994  
    4444namespace orxonox
    4545{
    46     static const int MAX_ARCHIVED_FILES = 9;
     46    static constexpr int MAX_ARCHIVED_FILES = 9;
    4747
    4848    /**
  • code/branches/cpp11_v2/src/libraries/util/output/OutputDefinitions.h

    r10624 r10994  
    132132    namespace context
    133133    {
    134         static const OutputContextMask all       = 0xFFFFFFFFFFFFFFFFull; ///< Context mask, all bits set to 1
    135         static const OutputContextMask none      = 0x0000000000000000ull; ///< Context mask, all bits set to 0
     134        static constexpr OutputContextMask all       = 0xFFFFFFFFFFFFFFFFull; ///< Context mask, all bits set to 1
     135        static constexpr OutputContextMask none      = 0x0000000000000000ull; ///< Context mask, all bits set to 0
    136136
    137         static const OutputContextSubID no_subcontext = 0; ///< Used as ID for contexts which are not sub-contexts
     137        static constexpr OutputContextSubID no_subcontext = 0; ///< Used as ID for contexts which are not sub-contexts
    138138
    139139        namespace
Note: See TracChangeset for help on using the changeset viewer.