Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 17, 2016, 6:41:22 PM (9 years ago)
Author:
landauf
Message:

merged remaining commits from cpp11_v2 to cpp11_v3 (for some reason they were not merged in the first attempt)

Location:
code/branches/cpp11_v3
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v3

  • code/branches/cpp11_v3/src/libraries/core/CorePrereqs.h

    r11054 r11068  
    3838#include "OrxonoxConfig.h"
    3939#include <boost/version.hpp>
     40#include <string>
    4041
    4142//-----------------------------------------------------------------------
  • code/branches/cpp11_v3/src/libraries/core/XMLPort.h

    r11054 r11068  
    324324    {
    325325    public:
    326         enum ParseResult
     326        enum class ParseResult
    327327        {
    328             PR_not_started,
    329             PR_finished,
    330             PR_waiting_for_default_values
     328            not_started,
     329            finished,
     330            waiting_for_default_values
    331331        };
    332332
    333333        public:
    334334            XMLPortParamContainer()
    335                 { this->parseResult_ = PR_not_started; }
     335                { this->parseResult_ = ParseResult::not_started; }
    336336            virtual ~XMLPortParamContainer() = default;
    337337
     
    415415                            this->loadexecutor_->parse(object, attributeValue, &error, ",");
    416416                            if (!error || (mode  == XMLPort::ExpandObject))
    417                                 this->parseResult_ = PR_finished;
     417                                this->parseResult_ = ParseResult::finished;
    418418                            else
    419                                 this->parseResult_ = PR_waiting_for_default_values;
     419                                this->parseResult_ = ParseResult::waiting_for_default_values;
    420420                        }
    421421                        else if (mode == XMLPort::ExpandObject)
    422                             this->parseResult_ = PR_finished;
     422                            this->parseResult_ = ParseResult::finished;
    423423                        else
    424                             this->parseResult_ = PR_waiting_for_default_values;
     424                            this->parseResult_ = ParseResult::waiting_for_default_values;
    425425                    }
    426426                    catch (ticpp::Exception& ex)
     
    449449            XMLPortParamContainer& portIfWaitingForDefaultValues(const ParseResult& result, const ParseParams& params)
    450450            {
    451                 if (result == PR_waiting_for_default_values)
     451                if (result == ParseResult::waiting_for_default_values)
    452452                    return this->port(this->owner_, params);
    453453                else
  • code/branches/cpp11_v3/src/libraries/core/command/ConsoleCommand.h

    r11054 r11068  
    6060    }
    6161
    62     namespace AccessLevel
     62    /**
     63        @brief Possible access levels: A command can only be executed if the program is in the state which is requested by the access level.
     64    */
     65    enum class AccessLevel
    6366    {
    64         /**
    65             @brief Possible access levels: A command can only be executed if the program is in the state which is requested by the access level.
    66         */
    67         enum Enum
    68         {
    69             All,
    70             Standalone,
    71             Master,
    72             Server,
    73             Client,
    74             Online,
    75             Offline,
    76             None
    77         };
    78     }
     67        All,
     68        Standalone,
     69        Master,
     70        Server,
     71        Client,
     72        Online,
     73        Offline,
     74        None
     75    };
    7976
    8077    /**
     
    249246
    250247                    /// Changes the access level of the command.
    251                     inline ConsoleCommandManipulator& accessLevel(AccessLevel::Enum level)
     248                    inline ConsoleCommandManipulator& accessLevel(AccessLevel level)
    252249                        { if (this->command_) { this->command_->accessLevel(level); } return *this; }
    253250
     
    332329
    333330            /// Changes the access level of the command.
    334             inline ConsoleCommand& accessLevel(AccessLevel::Enum level)
     331            inline ConsoleCommand& accessLevel(AccessLevel level)
    335332                { this->accessLevel_ = level; return *this; }
    336333            /// Returns the access level of the command.
    337             inline AccessLevel::Enum getAccessLevel() const
     334            inline AccessLevel getAccessLevel() const
    338335                { return this->accessLevel_; }
    339336
     
    394391            bool bActive_;                                                  ///< True if the command should be active (it can still be inactive, for example if the function is missing)
    395392            bool bHidden_;                                                  ///< True if the command is hidden (it is still executable, but not visible in the list of available commands)
    396             AccessLevel::Enum accessLevel_;                                 ///< The access level (the state of the game in which you can access the command)
     393            AccessLevel accessLevel_;                                       ///< The access level (the state of the game in which you can access the command)
    397394            std::string baseName_;                                          ///< The name that was first assigned to the command
    398395            std::vector<CommandName> names_;                                ///< All names and aliases of this command
  • code/branches/cpp11_v3/src/libraries/core/command/Executor.h

    r11054 r11068  
    147147                { return this->functor_->hasReturnvalue(); }
    148148            /// Returns the type of the wrapped function (static or member).
    149             inline Functor::Type::Enum getType() const
     149            inline Functor::Type getType() const
    150150                { return this->functor_->getType(); }
    151151            /// Returns the name of the type of a parameter with given index (the first parameter has index 0).
  • code/branches/cpp11_v3/src/libraries/core/command/Functor.h

    r11054 r11068  
    176176    {
    177177        public:
    178             struct Type
    179             {
    180                 /// Defines the type of a function (static or member)
    181                 enum Enum
    182                 {
    183                     Static,
    184                     Member
    185                 };
     178            /// Defines the type of a function (static or member)
     179            enum class Type
     180            {
     181                Static,
     182                Member
    186183            };
    187184
     
    196193
    197194            /// Returns the type of the function: static or member.
    198             virtual Type::Enum getType() const = 0;
     195            virtual Type getType() const = 0;
    199196            /// Returns the number of parameters of the function.
    200197            virtual unsigned int getParamCount() const = 0;
     
    262259
    263260            // see Functor::getType()
    264             virtual inline Functor::Type::Enum getType() const override
     261            virtual inline Functor::Type getType() const override
    265262                { return Functor::Type::Member; }
    266263
     
    339336
    340337            // see Functor::getType()
    341             virtual inline Functor::Type::Enum getType() const override
     338            virtual inline Functor::Type getType() const override
    342339                { return Functor::Type::Static; }
    343340
  • code/branches/cpp11_v3/src/libraries/core/command/IOConsolePOSIX.cc

    r11054 r11068  
    4646    IOConsole* IOConsole::singletonPtr_s = nullptr;
    4747
    48     namespace EscapeMode
    49     {
    50         enum Value
    51         {
    52             None,
    53             First,
    54             Second
    55         };
    56     }
     48    enum class EscapeMode
     49    {
     50        None,
     51        First,
     52        Second
     53    };
    5754
    5855    IOConsole::IOConsole()
     
    9087        std::cout.flush();
    9188        if (!this->origCout_.str().empty())
    92             this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
     89            this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout);
    9390        // Erase input and status lines
    9491        this->cout_ << "\033[1G\033[J";
     
    111108        unsigned char c;
    112109        std::string escapeSequence;
    113         EscapeMode::Value escapeMode = EscapeMode::None;
     110        EscapeMode escapeMode = EscapeMode::None;
    114111        while (std::cin.good())
    115112        {
     
    231228        if (!this->origCout_.str().empty())
    232229        {
    233             this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
     230            this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout);
    234231            this->origCout_.str("");
    235232        }
     
    241238        switch (type)
    242239        {
    243             case Shell::Message:
    244             case Shell::DebugOutput:     this->cout_ << "\033[0m"; break;
    245 
    246             case Shell::UserError:       this->cout_ << "\033[91m"; break;
    247             case Shell::UserWarning:     this->cout_ << "\033[93m"; break;
    248             case Shell::UserStatus:      this->cout_ << "\033[92m"; break;
    249             case Shell::UserInfo:        this->cout_ << "\033[96m"; break;
    250 
    251             case Shell::InternalError:   this->cout_ << "\033[31m"; break;
    252             case Shell::InternalWarning: this->cout_ << "\033[33m"; break;
    253             case Shell::InternalStatus:  this->cout_ << "\033[32m"; break;
    254             case Shell::InternalInfo:    this->cout_ << "\033[36m"; break;
    255 
    256             case Shell::Verbose:         this->cout_ << "\033[94m"; break;
    257             case Shell::VerboseMore:     this->cout_ << "\033[34m"; break;
    258             case Shell::VerboseUltra:    this->cout_ << "\033[34m"; break;
    259 
    260             case Shell::Command:         this->cout_ << "\033[95m"; break;
    261             case Shell::Hint:            this->cout_ << "\033[35m"; break;
    262 
    263             default:                     this->cout_ << "\033[37m"; break;
     240            case Shell::LineType::Message:
     241            case Shell::LineType::DebugOutput:     this->cout_ << "\033[0m"; break;
     242
     243            case Shell::LineType::UserError:       this->cout_ << "\033[91m"; break;
     244            case Shell::LineType::UserWarning:     this->cout_ << "\033[93m"; break;
     245            case Shell::LineType::UserStatus:      this->cout_ << "\033[92m"; break;
     246            case Shell::LineType::UserInfo:        this->cout_ << "\033[96m"; break;
     247
     248            case Shell::LineType::InternalError:   this->cout_ << "\033[31m"; break;
     249            case Shell::LineType::InternalWarning: this->cout_ << "\033[33m"; break;
     250            case Shell::LineType::InternalStatus:  this->cout_ << "\033[32m"; break;
     251            case Shell::LineType::InternalInfo:    this->cout_ << "\033[36m"; break;
     252
     253            case Shell::LineType::Verbose:         this->cout_ << "\033[94m"; break;
     254            case Shell::LineType::VerboseMore:     this->cout_ << "\033[34m"; break;
     255            case Shell::LineType::VerboseUltra:    this->cout_ << "\033[34m"; break;
     256
     257            case Shell::LineType::Command:         this->cout_ << "\033[95m"; break;
     258            case Shell::LineType::Hint:            this->cout_ << "\033[35m"; break;
     259
     260            default:                               this->cout_ << "\033[37m"; break;
    264261        }
    265262
     
    384381    void IOConsole::executed()
    385382    {
    386         this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::Command);
     383        this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::LineType::Command);
    387384    }
    388385
  • code/branches/cpp11_v3/src/libraries/core/command/IOConsoleWindows.cc

    r11054 r11068  
    9797        std::cout.flush();
    9898        if (!this->origCout_.str().empty())
    99             this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
     99            this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout);
    100100
    101101        this->shell_->unregisterListener(this);
     
    190190        if (!this->origCout_.str().empty())
    191191        {
    192             this->shell_->addOutput(this->origCout_.str(), Shell::Cout);
     192            this->shell_->addOutput(this->origCout_.str(), Shell::LineType::Cout);
    193193            this->origCout_.str("");
    194194        }
     
    202202        switch (type)
    203203        {
    204             case Shell::Message:
    205             case Shell::DebugOutput:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    206 
    207             case Shell::UserError:       colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | 0              ; break;
    208             case Shell::UserWarning:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
    209             case Shell::UserStatus:      colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | 0              ; break;
    210             case Shell::UserInfo:        colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    211 
    212             case Shell::InternalError:   colour = 0                    | FOREGROUND_RED | 0                | 0              ; break;
    213             case Shell::InternalWarning: colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
    214             case Shell::InternalStatus:  colour = 0                    | 0              | FOREGROUND_GREEN | 0              ; break;
    215             case Shell::InternalInfo:    colour = 0                    | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    216 
    217             case Shell::Verbose:         colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
    218             case Shell::VerboseMore:     colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
    219             case Shell::VerboseUltra:    colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
    220 
    221             case Shell::Command:         colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
    222             case Shell::Hint:            colour = 0                    | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
    223 
    224             default:                     colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     204            case Shell::LineType::Message:
     205            case Shell::LineType::DebugOutput:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     206
     207            case Shell::LineType::UserError:       colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | 0              ; break;
     208            case Shell::LineType::UserWarning:     colour = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
     209            case Shell::LineType::UserStatus:      colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | 0              ; break;
     210            case Shell::LineType::UserInfo:        colour = FOREGROUND_INTENSITY | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     211
     212            case Shell::LineType::InternalError:   colour = 0                    | FOREGROUND_RED | 0                | 0              ; break;
     213            case Shell::LineType::InternalWarning: colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | 0              ; break;
     214            case Shell::LineType::InternalStatus:  colour = 0                    | 0              | FOREGROUND_GREEN | 0              ; break;
     215            case Shell::LineType::InternalInfo:    colour = 0                    | 0              | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
     216
     217            case Shell::LineType::Verbose:         colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
     218            case Shell::LineType::VerboseMore:     colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
     219            case Shell::LineType::VerboseUltra:    colour = FOREGROUND_INTENSITY | 0              | 0                | FOREGROUND_BLUE; break;
     220
     221            case Shell::LineType::Command:         colour = FOREGROUND_INTENSITY | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
     222            case Shell::LineType::Hint:            colour = 0                    | FOREGROUND_RED | 0                | FOREGROUND_BLUE; break;
     223
     224            default:                               colour = 0                    | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; break;
    225225        }
    226226
     
    331331    void IOConsole::executed()
    332332    {
    333         this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::Command);
     333        this->shell_->addOutput(this->promptString_ + this->shell_->getInput(), Shell::LineType::Command);
    334334    }
    335335
  • code/branches/cpp11_v3/src/libraries/core/command/Shell.cc

    r11054 r11068  
    268268    {
    269269        // yes it was - push the new line to the list
    270         this->outputLines_.push_front(std::make_pair(line, static_cast<LineType>(type)));
     270        this->outputLines_.push_front(std::make_pair(line, type));
    271271
    272272        // adjust the scroll position if needed
     
    381381        const std::string& result = CommandExecutor::query(this->inputBuffer_->get(), &error);
    382382        if (error)
    383             this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", UserError);
     383            this->addOutput("Error: Can't execute \"" + this->inputBuffer_->get() + "\", " + CommandExecutor::getErrorDescription(error) + ". (Shell)", LineType::UserError);
    384384        else if (result != "")
    385             this->addOutput(result, Result);
     385            this->addOutput(result, LineType::Result);
    386386
    387387        this->clearInput();
     
    392392    {
    393393        this->inputBuffer_->set(CommandExecutor::evaluate(this->inputBuffer_->get()).complete());
    394         this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), Hint);
     394        this->addOutput(CommandExecutor::evaluate(this->inputBuffer_->get()).hint(), LineType::Hint);
    395395
    396396        this->inputChanged();
  • code/branches/cpp11_v3/src/libraries/core/command/Shell.h

    r11054 r11068  
    8888        public:
    8989            /// Defines the type of a line of text in the Shell - some types depend on the output level, others are of internal use.
    90             enum LineType
     90            enum class LineType
    9191            {
    9292                DebugOutput     = debug_output,
     
    133133            LineList::const_iterator getEndIterator() const;
    134134
    135             void addOutput(const std::string& text, LineType type = DebugOutput);
    136             void addLine(const std::string& line, LineType type = DebugOutput);
     135            void addOutput(const std::string& text, LineType type = LineType::DebugOutput);
     136            void addLine(const std::string& line, LineType type = LineType::DebugOutput);
    137137            void clearOutput();
    138138
  • code/branches/cpp11_v3/src/libraries/core/config/ConfigFileSection.h

    r9684 r11068  
    3939#include <string>
    4040#include <list>
     41#include "util/StringUtils.h"
    4142#include "ConfigFileEntry.h"
    4243
  • code/branches/cpp11_v3/src/libraries/network/Connection.cc

    r11054 r11068  
    8181  {
    8282//     this->overallMutex_->lock();
    83     outgoingEvent outEvent = { peerID, outgoingEventType::disconnectPeer, nullptr, 0 };
     83    outgoingEvent outEvent = { peerID, OutgoingEventType::disconnectPeer, nullptr, 0 };
    8484   
    8585    this->outgoingEventsMutex_->lock();
     
    9191  void Connection::disconnectPeers()
    9292  {
    93     outgoingEvent outEvent = { 0, outgoingEventType::disconnectPeers, nullptr, 0 };
     93    outgoingEvent outEvent = { 0, OutgoingEventType::disconnectPeers, nullptr, 0 };
    9494   
    9595    this->outgoingEventsMutex_->lock();
     
    101101  {
    102102//     this->overallMutex_->lock();
    103     outgoingEvent outEvent = { peerID, outgoingEventType::sendPacket, packet, channelID };
     103    outgoingEvent outEvent = { peerID, OutgoingEventType::sendPacket, packet, channelID };
    104104   
    105105    this->outgoingEventsMutex_->lock();
     
    112112  {
    113113//     this->overallMutex_->lock();
    114     outgoingEvent outEvent = { 0, outgoingEventType::broadcastPacket, packet, channelID };
     114    outgoingEvent outEvent = { 0, OutgoingEventType::broadcastPacket, packet, channelID };
    115115   
    116116    this->outgoingEventsMutex_->lock();
     
    197197    switch( event.type )
    198198    {
    199       case outgoingEventType::sendPacket:
     199      case OutgoingEventType::sendPacket:
    200200        // check whether the peer is still/already in the peer list
    201201        if( this->peerMap_.find(event.peerID) != this->peerMap_.end() )
     
    211211        }
    212212        break;
    213       case outgoingEventType::disconnectPeer:
     213      case OutgoingEventType::disconnectPeer:
    214214        if( this->peerMap_.find(event.peerID) != this->peerMap_.end() )
    215215        {
     
    223223        }
    224224        break;
    225       case outgoingEventType::disconnectPeers:
     225      case OutgoingEventType::disconnectPeers:
    226226        disconnectPeersInternal();
    227227        break;
    228       case outgoingEventType::broadcastPacket:
     228      case OutgoingEventType::broadcastPacket:
    229229        enet_host_broadcast( this->host_, event.channelID, event.packet );
    230230        break;
     
    271271      switch( inEvent.type )
    272272      {
    273         case incomingEventType::peerConnect:
     273        case IncomingEventType::peerConnect:
    274274          addPeer(inEvent.peerID);
    275275          break;
    276         case incomingEventType::peerDisconnect:
     276        case IncomingEventType::peerDisconnect:
    277277          removePeer(inEvent.peerID);
    278278          break;
    279         case incomingEventType::receivePacket:
     279        case IncomingEventType::receivePacket:
    280280          processPacket(inEvent.packet);
    281281          break;
     
    322322   
    323323    // create new peerEvent and return it
    324     incomingEvent inEvent = { peerID, incomingEventType::peerConnect, nullptr };
     324    incomingEvent inEvent = { peerID, IncomingEventType::peerConnect, nullptr };
    325325    return inEvent;
    326326  }
     
    337337   
    338338    // create new peerEvent and return it
    339     incomingEvent inEvent = { peerID, incomingEventType::peerDisconnect, nullptr };
     339    incomingEvent inEvent = { peerID, IncomingEventType::peerDisconnect, nullptr };
    340340    return inEvent;
    341341  }
     
    351351   
    352352    // create new peerEvent and return it
    353     incomingEvent inEvent = { peerID, incomingEventType::receivePacket, p };
     353    incomingEvent inEvent = { peerID, IncomingEventType::receivePacket, p };
    354354    return inEvent;
    355355  }
  • code/branches/cpp11_v3/src/libraries/network/Connection.h

    r11054 r11068  
    6060  const unsigned int NETWORK_MAX_QUEUE_PROCESS_TIME = 5;
    6161 
    62   namespace incomingEventType
     62  enum class IncomingEventType
    6363  {
    64     enum Value
    65     {
    66       receivePacket   = 1,  // incoming packet
    67       peerConnect     = 2,  // incoming connect request
    68       peerDisconnect  = 3   // incoming disconnect request
    69     };
    70    
    71   }
     64    receivePacket   = 1,  // incoming packet
     65    peerConnect     = 2,  // incoming connect request
     66    peerDisconnect  = 3   // incoming disconnect request
     67  };
    7268 
    73   namespace outgoingEventType
     69  enum class OutgoingEventType
    7470  {
    75     enum Value
    76     {
    77       sendPacket      = 1,  // outgoing packet
    78       broadcastPacket = 2,  // outgoing broadcast packet
    79       disconnectPeer  = 3,  // outgoing disconnect request
    80       disconnectPeers = 4   // outgoing disconnect request
    81     };
    82    
    83   }
     71    sendPacket      = 1,  // outgoing packet
     72    broadcastPacket = 2,  // outgoing broadcast packet
     73    disconnectPeer  = 3,  // outgoing disconnect request
     74    disconnectPeers = 4   // outgoing disconnect request
     75  };
    8476 
    8577  struct _NetworkExport incomingEvent
    8678  {
    87     uint32_t                  peerID;
    88     incomingEventType::Value type;
    89     packet::Packet*           packet;
     79    uint32_t          peerID;
     80    IncomingEventType type;
     81    packet::Packet*   packet;
    9082  };
    9183 
    9284  struct _NetworkExport outgoingEvent
    9385  {
    94     uint32_t                  peerID;
    95     outgoingEventType::Value type;
    96     ENetPacket*               packet;
    97     ENetChannelID             channelID;
     86    uint32_t          peerID;
     87    OutgoingEventType type;
     88    ENetPacket*       packet;
     89    ENetChannelID     channelID;
    9890  };
    9991 
  • code/branches/cpp11_v3/src/libraries/network/NetworkPrereqs.h

    r11054 r11068  
    8989    namespace PacketFlag
    9090    {
    91       enum Value
    92       {
    93         Reliable    = 1,
    94         Unsequenced = 2,
    95         NoAllocate  = 4
    96       };
     91      static constexpr uint32_t Reliable    = 1;
     92      static constexpr uint32_t Unsequenced = 2;
     93      static constexpr uint32_t NoAllocate  = 4;
    9794    }
    9895  }
     
    10198  {
    10299    typedef int Type;
    103     static const Type NETWORK_FUNCTION = 6;
     100    static constexpr Type NETWORK_FUNCTION = 6;
    104101  }
    105102}
  • code/branches/cpp11_v3/src/libraries/network/packet/Acknowledgement.cc

    r8858 r11068  
    3838#define PACKET_FLAGS_ACK    0
    3939#define _PACKETID           0
    40 #define _ACKID              _PACKETID + sizeof(packet::Type::Value)
     40#define _ACKID              _PACKETID + sizeof(packet::Type)
    4141
    4242Acknowledgement::Acknowledgement( unsigned int id, unsigned int peerID )
     
    4545  flags_ = flags_ | PACKET_FLAGS_ACK;
    4646  data_=new uint8_t[ getSize() ];
    47   *(Type::Value *)(data_ + _PACKETID ) = Type::Acknowledgement;
     47  *(Type *)(data_ + _PACKETID ) = Type::Acknowledgement;
    4848  *(uint32_t *)(data_ + _ACKID ) = id;
    4949  peerID_=peerID;
  • code/branches/cpp11_v3/src/libraries/network/packet/Chat.cc

    r8858 r11068  
    4040/* Some lengths */
    4141#define _PACKETID         0
    42 #define _SOURCEID         _PACKETID + sizeof(Type::Value)
     42#define _SOURCEID         _PACKETID + sizeof(Type)
    4343#define _TARGETID         _SOURCEID + sizeof(uint32_t)
    4444#define _MESSAGELENGTH    _TARGETID + sizeof(uint32_t)
     
    5757  data_=new unsigned char[ getSize() ];
    5858
    59   *(Type::Value *)(data_ + _PACKETID ) = Type::Chat;
     59  *(Type *)(data_ + _PACKETID ) = Type::Chat;
    6060  *(unsigned int *)(data_ + _SOURCEID ) = sourceID;
    6161  *(unsigned int *)(data_ + _TARGETID ) = targetID;
  • code/branches/cpp11_v3/src/libraries/network/packet/ClassID.cc

    r11054 r11068  
    7070  //set the appropriate packet id
    7171  assert(this->data_);
    72   *(Type::Value *)(this->data_ + _PACKETID ) = Type::ClassID;
     72  *(Type *)(this->data_ + _PACKETID ) = Type::ClassID;
    7373
    7474  uint8_t *temp=data_+sizeof(uint32_t);
  • code/branches/cpp11_v3/src/libraries/network/packet/DeleteObjects.cc

    r8858 r11068  
    3939#define PACKET_FLAG_DELETE  PacketFlag::Reliable
    4040#define _PACKETID           0
    41 #define _QUANTITY           _PACKETID + sizeof(Type::Value)
     41#define _QUANTITY           _PACKETID + sizeof(Type)
    4242#define _OBJECTIDS          _QUANTITY + sizeof(uint32_t)
    4343
     
    6363    return false;
    6464  orxout(verbose, context::packets) << "sending DeleteObjects: ";
    65   unsigned int size = sizeof(Type::Value) + sizeof(uint32_t)*(number+1);
     65  unsigned int size = sizeof(Type) + sizeof(uint32_t)*(number+1);
    6666  data_ = new uint8_t[size];
    6767  uint8_t *tdata = data_;
    68   *reinterpret_cast<Type::Value*>(tdata) = Type::DeleteObjects;
    69   tdata += sizeof(Type::Value);
     68  *reinterpret_cast<Type*>(tdata) = Type::DeleteObjects;
     69  tdata += sizeof(Type);
    7070  *(uint32_t *)tdata = number;
    7171  tdata += sizeof(uint32_t);
  • code/branches/cpp11_v3/src/libraries/network/packet/FunctionCalls.cc

    r10624 r11068  
    9696  assert(this->functionCalls_.size());
    9797  data_=new uint8_t[ currentSize_ ];
    98   *(Type::Value *)(data_ + _PACKETID ) = Type::FunctionCalls; // Set the Packet ID
     98  *(Type *)(data_ + _PACKETID ) = Type::FunctionCalls; // Set the Packet ID
    9999  *(uint32_t*)(data_+sizeof(uint32_t)) = this->functionCalls_.size(); // set nrOfCalls
    100100  *(uint32_t*)(data_+2*sizeof(uint32_t)) = this->minGamestateID_; // set minGamestateID_
  • code/branches/cpp11_v3/src/libraries/network/packet/FunctionIDs.cc

    r11054 r11068  
    7171  //set the appropriate packet id
    7272  assert(this->data_);
    73   *(Type::Value *)(this->data_ + _PACKETID ) = Type::FunctionIDs;
     73  *(Type *)(this->data_ + _PACKETID ) = Type::FunctionIDs;
    7474
    7575  uint8_t *temp=data_+sizeof(uint32_t);
  • code/branches/cpp11_v3/src/libraries/network/packet/Gamestate.h

    r11054 r11068  
    5656    GamestateHeader(){ data_=nullptr; }
    5757    GamestateHeader(uint8_t* data)
    58       { assert(data); data_ = data; *(uint32_t*)data_ = Type::Gamestate; }
     58      { assert(data); data_ = data; *(Type*)data_ = Type::Gamestate; }
    5959    /*GamestateHeader(uint8_t* data, GamestateHeader* h)
    6060      { assert(data); data_=data; memcpy(data_, h->data_, getSize()); }*/
    6161    void setData(uint8_t* data)
    62       { assert(data); data_ = data; *(uint32_t*)data_ = Type::Gamestate; }
     62      { assert(data); data_ = data; *(Type*)data_ = Type::Gamestate; }
    6363    static inline uint32_t getSize()
    6464      { return 21; }
  • code/branches/cpp11_v3/src/libraries/network/packet/Packet.cc

    r11054 r11068  
    157157  }
    158158#ifndef NDEBUG
    159   switch( *(Type::Value *)(data_ + _PACKETID) )
     159  switch( *(Type *)(data_ + _PACKETID) )
    160160  {
    161161    case Type::Acknowledgement:
     
    191191//     peerID = NETWORK_PEER_ID_SERVER;
    192192  Packet *p = nullptr;
    193 //   orxout(verbose_ultra, context::packets) << "packet type: " << *(Type::Value *)&data[_PACKETID] << endl;
    194   switch( *(Type::Value *)(data + _PACKETID) )
     193//   orxout(verbose_ultra, context::packets) << "packet type: " << *(Type *)&data[_PACKETID] << endl;
     194  switch( *(Type *)(data + _PACKETID) )
    195195  {
    196196    case Type::Acknowledgement:
  • code/branches/cpp11_v3/src/libraries/network/packet/Packet.h

    r8327 r11068  
    3838{
    3939
    40 namespace Direction
     40enum class Direction
    4141{
    42   enum Value
    43   {
    44     Incoming,
    45     Outgoing,
    46     Bidirectional
    47   };
    48 }
    49 namespace Type
     42  Incoming,
     43  Outgoing,
     44  Bidirectional
     45};
     46enum class Type : uint8_t
    5047{
    51   enum Value
    52   {
    53     Acknowledgement,
    54     Chat,
    55     ClassID,
    56     DeleteObjects,
    57     FunctionIDs,
    58     FunctionCalls,
    59     Gamestate,
    60     Welcome
    61   };
    62 }
     48  Acknowledgement,
     49  Chat,
     50  ClassID,
     51  DeleteObjects,
     52  FunctionIDs,
     53  FunctionCalls,
     54  Gamestate,
     55  Welcome
     56};
    6357
    6458/**
     
    9892    unsigned int peerID_;
    9993    uint32_t requiredGamestateID_;
    100     Direction::Value packetDirection_;
     94    Direction packetDirection_;
    10195    /** Pointer to the data. Be careful when deleting it because it might
    10296        point to a location that was allocated by ENet.
  • code/branches/cpp11_v3/src/libraries/network/packet/Welcome.cc

    r8858 r11068  
    4141#define PACKET_FLAGS_CLASSID  PacketFlag::Reliable
    4242#define _PACKETID             0
    43 #define _CLIENTID             _PACKETID + sizeof(Type::Value)
     43#define _CLIENTID             _PACKETID + sizeof(Type)
    4444#define _ENDIANTEST           _CLIENTID + sizeof(uint32_t)
    4545
     
    5151  data_=new uint8_t[ getSize() ];
    5252  assert(data_);
    53   *(packet::Type::Value *)(data_ + _PACKETID ) = packet::Type::Welcome;
     53  *(packet::Type *)(data_ + _PACKETID ) = packet::Type::Welcome;
    5454  *(uint32_t *)(data_ + _CLIENTID ) = static_cast<uint32_t>(clientID);
    5555  *(uint32_t *)(data_ + _ENDIANTEST ) = 0xFEDC4321;
     
    7070
    7171unsigned int Welcome::getSize() const{
    72   return sizeof(packet::Type::Value) + 2*sizeof(uint32_t);
     72  return sizeof(packet::Type) + 2*sizeof(uint32_t);
    7373}
    7474
  • code/branches/cpp11_v3/src/libraries/network/synchronisable/Synchronisable.h

    r11054 r11068  
    3838#include <queue>
    3939#include <set>
     40#include <type_traits>
    4041
    4142#include "util/mbool.h"
     
    203204  };
    204205
    205   template <class T> void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
    206   {
     206  namespace detail
     207  {
     208    template <class T, bool = std::is_enum<T>::value>
     209    struct UnderlyingType;
     210    template <class T>
     211    struct UnderlyingType<T, true> { typedef typename std::underlying_type<T>::type type; };
     212    template <class T>
     213    struct UnderlyingType<T, false> { typedef T type; };
     214  }
     215
     216  template <class T>
     217  void Synchronisable::registerVariable(T& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
     218  {
     219    typedef typename detail::UnderlyingType<T>::type UnderlyingType;
    207220    if (bidirectional)
    208221    {
    209       syncList_.push_back(new SynchronisableVariableBidirectional<T>(variable, mode, cb));
     222      syncList_.push_back(new SynchronisableVariableBidirectional<UnderlyingType>(reinterpret_cast<UnderlyingType&>(variable), mode, cb));
    210223      this->dataSize_ += syncList_.back()->getSize(state_);
    211224    }
    212225    else
    213226    {
    214       syncList_.push_back(new SynchronisableVariable<T>(variable, mode, cb));
     227      syncList_.push_back(new SynchronisableVariable<UnderlyingType>(reinterpret_cast<UnderlyingType&>(variable), mode, cb));
    215228      if ( this->state_ == mode )
    216229        this->dataSize_ += syncList_.back()->getSize(state_);
     
    218231  }
    219232 
    220   template <class T> void Synchronisable::unregisterVariable(T& variable)
     233  template <class T>
     234  void Synchronisable::unregisterVariable(T& variable)
    221235  {
    222236    std::vector<SynchronisableVariableBase*>::iterator it = syncList_.begin();
     
    238252  }
    239253
    240   template <class T> void Synchronisable::registerVariable( std::set<T>& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
    241   {
     254  template <class T>
     255  void Synchronisable::registerVariable( std::set<T>& variable, uint8_t mode, NetworkCallbackBase *cb, bool bidirectional)
     256  {
     257    typedef typename detail::UnderlyingType<T>::type UnderlyingType;
    242258    SynchronisableVariableBase* sv;
    243259    if (bidirectional)
    244       sv = new SynchronisableVariableBidirectional<std::set<T>>(variable, mode, cb);
     260      sv = new SynchronisableVariableBidirectional<std::set<UnderlyingType>>(reinterpret_cast<std::set<UnderlyingType>&>(variable), mode, cb);
    245261    else
    246       sv = new SynchronisableVariable<std::set<T>>(variable, mode, cb);
     262      sv = new SynchronisableVariable<std::set<UnderlyingType>>(reinterpret_cast<std::set<UnderlyingType>&>(variable), mode, cb);
    247263    syncList_.push_back(sv);
    248264    stringList_.push_back(sv);
  • code/branches/cpp11_v3/src/libraries/util/Math.h

    r11054 r11068  
    4747#include <cstdlib>
    4848#include <random>
     49#include <type_traits>
    4950
    5051#include <OgreMath.h>
     
    178179        @c Vector3 you get <tt>Vector3(0, 0, 0)</tt>.
    179180    */
    180     template <typename T>
    181     inline T zeroise()
     181    template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, T>::type
     182    inline /*T*/ zeroise()
    182183    {
    183184        // If you reach this code, you abused zeroise()!
    184185        static_assert(sizeof(T) != sizeof(T), "No template specialization available for T");
     186    }
     187    /// Implementation for enum classes: uses the underlying type to create a zero value.
     188    template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, T>::type
     189    inline /*T*/ zeroise()
     190    {
     191        return static_cast<T>(zeroise<typename std::underlying_type<T>::type>());
    185192    }
    186193
  • code/branches/cpp11_v3/src/libraries/util/MultiType.cc

    r9550 r11068  
    4343        @param type The type
    4444    */
    45     bool MultiType::convert(Type::Enum type)
     45    bool MultiType::convert(Type type)
    4646    {
    4747        switch (type)
     
    106106    std::string MultiType::getTypename() const
    107107    {
    108         Type::Enum type = (this->value_) ? this->value_->type_ : Type::Null;
     108        Type type = (this->value_) ? this->value_->type_ : Type::Null;
    109109
    110110        switch (type)
  • code/branches/cpp11_v3/src/libraries/util/MultiType.h

    r11054 r11068  
    132132        template <typename T> friend class MT_Value;
    133133
    134         struct Type
     134        /**
     135            @brief Enum of all possible types of a MultiType.
     136        */
     137        enum class Type : uint8_t
    135138        {
    136             /**
    137                 @brief Enum of all possible types of a MultiType.
    138             */
    139             enum Enum
    140             {
    141                 Null,
    142                 Char,
    143                 UnsignedChar,
    144                 Short,
    145                 UnsignedShort,
    146                 Int,
    147                 UnsignedInt,
    148                 Long,
    149                 UnsignedLong,
    150                 LongLong,
    151                 UnsignedLongLong,
    152                 Float,
    153                 Double,
    154                 LongDouble,
    155                 Bool,
    156                 VoidPointer,
    157                 String,
    158                 Vector2,
    159                 Vector3,
    160                 Vector4,
    161                 ColourValue,
    162                 Quaternion,
    163                 Radian,
    164                 Degree
    165             };
     139            Null,
     140            Char,
     141            UnsignedChar,
     142            Short,
     143            UnsignedShort,
     144            Int,
     145            UnsignedInt,
     146            Long,
     147            UnsignedLong,
     148            LongLong,
     149            UnsignedLongLong,
     150            Float,
     151            Double,
     152            LongDouble,
     153            Bool,
     154            VoidPointer,
     155            String,
     156            Vector2,
     157            Vector3,
     158            Vector4,
     159            ColourValue,
     160            Quaternion,
     161            Radian,
     162            Degree
    166163        };
    167164
     
    174171        {
    175172        public:
    176             inline MT_ValueBase(void* data, Type::Enum type) : type_(type), bLastConversionSuccessful(true), data_(data) {}
     173            inline MT_ValueBase(void* data, Type type) : type_(type), bLastConversionSuccessful(true), data_(data) {}
    177174            virtual inline ~MT_ValueBase() {}
    178175
     
    182179
    183180            /// Returns the type of the current value.
    184             inline const Type::Enum& getType() const { return this->type_; }
    185             /// Returns true if the type of the stored value is T.
    186             template <typename T> inline bool isType() const { return false; }
     181            inline const Type& getType() const { return this->type_; }
     182
     183            /// Returns true if the type of the stored value is T. Note: the actual implementations for all supported types are defined outside of the class.
     184            template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, bool>::type
     185            inline /*bool*/ isType() const
     186            {
     187                // If you reach this code, you used MultiType with an unsupported type T
     188                static_assert(sizeof(T) != sizeof(T), "No template specialization available for T");
     189                return false;
     190            }
     191            /// Implementation for enum classes: Returns true if the type of the stored value is the underlying type of T.
     192            template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, bool>::type
     193            inline /*bool*/ isType() const
     194            {
     195                return this->isType<typename std::underlying_type<T>::type>();
     196            }
    187197
    188198            /// Checks whether the value is a default one.
     
    215225            virtual bool setValue(const MultiType& other)            = 0;
    216226
     227            template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, bool>::type
     228            inline /*bool*/ setValue(const T& value)
     229            {
     230                // If you reach this code, you used MultiType with an unsupported type T
     231                static_assert(sizeof(T) != sizeof(T), "No template specialization available for T");
     232                return false;
     233            }
     234            template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, bool>::type
     235            inline /*bool*/ setValue(const T& value)
     236            {
     237                typedef typename std::underlying_type<T>::type UnderlyingType;
     238                return this->setValue(reinterpret_cast<const UnderlyingType&>(value));
     239            }
     240
    217241            virtual bool getValue(char*                 value) const = 0;
    218242            virtual bool getValue(unsigned char*        value) const = 0;
     
    239263            virtual bool getValue(orxonox::Degree*      value) const = 0;
    240264
     265            template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value, bool>::type
     266            inline /*bool*/ getValue(T* value) const
     267            {
     268                // If you reach this code, you used MultiType with an unsupported type T
     269                static_assert(sizeof(T) != sizeof(T), "No template specialization available for T");
     270                return false;
     271            }
     272            template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value, bool>::type
     273            inline /*bool*/ getValue(T* value) const
     274            {
     275                typedef typename std::underlying_type<T>::type UnderlyingType;
     276                return this->getValue(reinterpret_cast<UnderlyingType*>(value));
     277            }
     278
    241279            template <typename T> T get() const
    242280            {
     
    257295            virtual uint8_t getSize() const = 0;
    258296
    259             Type::Enum type_;               ///< The type of the current value
     297            Type type_;                     ///< The type of the current value
    260298            bool bLastConversionSuccessful; ///< True if the last conversion was successful
    261299            void* data_;                    ///< For direct access to the value if the type is known
     
    354392            template <typename T> inline bool getValue(T* value) const { if (this->value_) { return this->value_->getValue(value); } return false; }
    355393
    356             /// Returns the current value, converted to the requested type. This base implementation works only for pointers. All other supported types are
    357             /// implemented in  specialized functions at the bottom of this file.
    358             template <typename T> inline T get() const { return static_cast<T>(this->get<void*>()); }
     394            /// Returns the current value, converted to the requested type.
     395            template <typename T> /* for normal types */ typename std::enable_if<!std::is_pointer<T>::value, T>::type
     396            inline /*T*/ get() const { return (this->value_ ? this->value_->get<T>() : NilValue<T>()); }
     397            /// Returns the current value, converted to a pointer of the requested type.
     398            template <typename T> /* for pointers */ typename std::enable_if<std::is_pointer<T>::value, T>::type
     399            inline /*T*/ get() const { return this->value_ ? static_cast<T>(this->value_->get<void*>()) : nullptr; }
    359400
    360401
     
    365406            inline void exportData(uint8_t*& mem) const
    366407            {
    367                 assert(sizeof(Type::Enum) <= 8);
    368                 *static_cast<uint8_t*>(mem) = this->getType();
     408                assert(sizeof(Type) <= 8);
     409                *static_cast<uint8_t*>(mem) = static_cast<uint8_t>(this->getType());
    369410                mem += sizeof(uint8_t);
    370411                this->value_->exportData(mem);
     
    373414            inline void importData(uint8_t*& mem)
    374415            {
    375                 assert(sizeof(Type::Enum) <= 8);
    376                 this->setType(static_cast<Type::Enum>(*static_cast<uint8_t*>(mem)));
     416                assert(sizeof(Type) <= 8);
     417                this->setType(static_cast<Type>(*static_cast<uint8_t*>(mem)));
    377418                mem += sizeof(uint8_t);
    378419                this->value_->importData(mem);
     
    414455
    415456            /// Resets the value and changes the internal type to the given type.
    416             inline void setType(Type::Enum type) { this->reset(); this->convert(type); this->resetValue(); }
     457            inline void setType(Type type) { this->reset(); this->convert(type); this->resetValue(); }
    417458            /// Returns the current type.
    418             inline Type::Enum getType() const { return (this->value_) ? this->value_->type_ : Type::Null; }
     459            inline Type getType() const { return (this->value_) ? this->value_->type_ : Type::Null; }
    419460            /// Converts the current value to the given type.
    420             bool convert(Type::Enum type);
     461            bool convert(Type type);
    421462
    422463            /// Changes the value container.
     
    428469            }
    429470            /// Creates a new value container (works only with specialized types).
    430             template <typename T> inline void createNewValueContainer(const T& value)
     471            template <typename T> /* for normal classes */ typename std::enable_if<!std::is_enum<T>::value>::type
     472            inline /*void*/ createNewValueContainer(const T& value)
    431473            {
    432474                // If you reach this code, you used MultiType with an unsupported type T
    433475                static_assert(sizeof(T) != sizeof(T), "No template specialization available for T");
     476            }
     477            /// Creates a new value container (implementation for enum classes that must be cast to the underlying type).
     478            template <typename T> /* for enum classes */ typename std::enable_if<std::is_enum<T>::value>::type
     479            inline /*void*/ createNewValueContainer(const T& value)
     480            {
     481                typedef typename std::underlying_type<T>::type UnderlyingType;
     482                this->createNewValueContainer<UnderlyingType>(reinterpret_cast<const UnderlyingType&>(value));
    434483            }
    435484
     
    475524    template <> inline bool MultiType::isType<void>() const { return this->null(); }
    476525    template <> inline bool MultiType::convert<void>() { this->reset(); return true; }
    477 
    478     template <> inline char                 MultiType::get() const { return (this->value_ ? this->value_->get<char>()                 : 0); }
    479     template <> inline unsigned char        MultiType::get() const { return (this->value_ ? this->value_->get<unsigned char>()        : 0); }
    480     template <> inline short                MultiType::get() const { return (this->value_ ? this->value_->get<short>()                : 0); }
    481     template <> inline unsigned short       MultiType::get() const { return (this->value_ ? this->value_->get<unsigned short>()       : 0); }
    482     template <> inline int                  MultiType::get() const { return (this->value_ ? this->value_->get<int>()                  : 0); }
    483     template <> inline unsigned int         MultiType::get() const { return (this->value_ ? this->value_->get<unsigned int>()         : 0); }
    484     template <> inline long                 MultiType::get() const { return (this->value_ ? this->value_->get<long>()                 : 0); }
    485     template <> inline unsigned long        MultiType::get() const { return (this->value_ ? this->value_->get<unsigned long>()        : 0); }
    486     template <> inline long long            MultiType::get() const { return (this->value_ ? this->value_->get<long long>()            : 0); }
    487     template <> inline unsigned long long   MultiType::get() const { return (this->value_ ? this->value_->get<unsigned long long>()   : 0); }
    488     template <> inline float                MultiType::get() const { return (this->value_ ? this->value_->get<float>()                : 0); }
    489     template <> inline double               MultiType::get() const { return (this->value_ ? this->value_->get<double>()               : 0); }
    490     template <> inline long double          MultiType::get() const { return (this->value_ ? this->value_->get<long double>()          : 0); }
    491     template <> inline bool                 MultiType::get() const { return (this->value_ ? this->value_->get<bool>()                 : 0); }
    492     template <> inline void*                MultiType::get() const { return (this->value_ ? this->value_->get<void*>()                : nullptr); }
    493     template <> inline std::string          MultiType::get() const { return (this->value_ ? this->value_->get<std::string>()          : NilValue<std::string>()); }
    494     template <> inline orxonox::Vector2     MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector2>()     : NilValue<orxonox::Vector2>()); }
    495     template <> inline orxonox::Vector3     MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector3>()     : NilValue<orxonox::Vector3>()); }
    496     template <> inline orxonox::Vector4     MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Vector4>()     : NilValue<orxonox::Vector4>()); }
    497     template <> inline orxonox::ColourValue MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::ColourValue>() : NilValue<orxonox::ColourValue>()); }
    498     template <> inline orxonox::Quaternion  MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Quaternion>()  : NilValue<orxonox::Quaternion>()); }
    499     template <> inline orxonox::Radian      MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Radian>()      : NilValue<orxonox::Radian>()); }
    500     template <> inline orxonox::Degree      MultiType::get() const { return (this->value_ ? this->value_->get<orxonox::Degree>()      : NilValue<orxonox::Degree>()); }
    501526
    502527    template <> _UtilExport void MultiType::createNewValueContainer(const char& value);
  • code/branches/cpp11_v3/src/libraries/util/MultiTypeValue.h

    r11054 r11068  
    5555    public:
    5656        /// Constructor: Assigns the value and the type identifier.
    57         MT_Value(const T& value, MultiType::Type::Enum type) : MT_ValueBase(&this->value_, type), value_(value) {}
     57        MT_Value(const T& value, MultiType::Type type) : MT_ValueBase(&this->value_, type), value_(value) {}
    5858
    5959        /// Creates a copy of itself.
  • code/branches/cpp11_v3/src/libraries/util/SubString.cc

    r11054 r11068  
    265265        bool inSafemode = false;
    266266
    267         if(start_state != SL_NORMAL && tokens.size() > 0)
     267        if(start_state != SPLIT_LINE_STATE::NORMAL && tokens.size() > 0)
    268268        {
    269269            token = tokens[tokens.size()-1];
    270270            tokens.pop_back();
    271271        }
    272         if(start_state != SL_NORMAL && bTokenInSafemode.size() > 0)
     272        if(start_state != SPLIT_LINE_STATE::NORMAL && bTokenInSafemode.size() > 0)
    273273        {
    274274            inSafemode = bTokenInSafemode[bTokenInSafemode.size()-1];
     
    280280            switch(state)
    281281            {
    282             case SL_NORMAL:
     282            case SPLIT_LINE_STATE::NORMAL:
    283283                if(line[i] == escapeChar)
    284284                {
    285                     state = SL_ESCAPE;
     285                    state = SPLIT_LINE_STATE::ESCAPE;
    286286                    if (!bRemoveEscapeChar)
    287287                        token += line[i];
     
    290290                else if(line[i] == safemodeChar)
    291291                {
    292                     state = SL_SAFEMODE;
     292                    state = SPLIT_LINE_STATE::SAFEMODE;
    293293                    inSafemode = true;
    294294                    if (!bRemoveSafemodeChar)
     
    298298                else if(line[i] == openparenthesisChar)
    299299                {
    300                     state = SL_PARENTHESES;
     300                    state = SPLIT_LINE_STATE::PARENTHESES;
    301301                    inSafemode = true;
    302302                    if (!bRemoveParenthesisChars)
     
    318318                    }
    319319                    token += line[i];       // EAT
    320                     state = SL_COMMENT;
     320                    state = SPLIT_LINE_STATE::COMMENT;
    321321                }
    322322                else if(delimiters.find(line[i]) != std::string::npos)
     
    334334                        inSafemode = false;
    335335                    }
    336                     state = SL_NORMAL;
     336                    state = SPLIT_LINE_STATE::NORMAL;
    337337                }
    338338                else
     
    353353                }
    354354                break;
    355             case SL_ESCAPE:
     355            case SPLIT_LINE_STATE::ESCAPE:
    356356                if (!bRemoveSafemodeChar)
    357357                    token += line[i];
     
    368368                    else token += line[i];  // EAT
    369369                }
    370                 state = SL_NORMAL;
    371                 break;
    372             case SL_SAFEMODE:
     370                state = SPLIT_LINE_STATE::NORMAL;
     371                break;
     372            case SPLIT_LINE_STATE::SAFEMODE:
    373373                if(line[i] == safemodeChar)
    374374                {
    375                     state = SL_NORMAL;
     375                    state = SPLIT_LINE_STATE::NORMAL;
    376376                    if (!bRemoveSafemodeChar)
    377377                        token += line[i];
     
    379379                else if(line[i] == escapeChar)
    380380                {
    381                     state = SL_SAFEESCAPE;
     381                    state = SPLIT_LINE_STATE::SAFEESCAPE;
    382382                }
    383383                else
     
    387387                break;
    388388
    389             case SL_SAFEESCAPE:
     389            case SPLIT_LINE_STATE::SAFEESCAPE:
    390390                if(line[i] == 'n') token += '\n';
    391391                else if(line[i] == 't') token += '\t';
     
    397397                else if(line[i] == '?') token += '\?';
    398398                else token += line[i];  // EAT
    399                 state = SL_SAFEMODE;
    400                 break;
    401 
    402             case SL_PARENTHESES:
     399                state = SPLIT_LINE_STATE::SAFEMODE;
     400                break;
     401
     402            case SPLIT_LINE_STATE::PARENTHESES:
    403403                if(line[i] == closeparenthesisChar)
    404404                {
    405                     state = SL_NORMAL;
     405                    state = SPLIT_LINE_STATE::NORMAL;
    406406                    if (!bRemoveParenthesisChars)
    407407                        token += line[i];
     
    409409                else if(line[i] == escapeChar)
    410410                {
    411                     state = SL_PARENTHESESESCAPE;
     411                    state = SPLIT_LINE_STATE::PARENTHESESESCAPE;
    412412                }
    413413                else
     
    417417                break;
    418418
    419             case SL_PARENTHESESESCAPE:
     419            case SPLIT_LINE_STATE::PARENTHESESESCAPE:
    420420                if(line[i] == 'n') token += '\n';
    421421                else if(line[i] == 't') token += '\t';
     
    427427                else if(line[i] == '?') token += '\?';
    428428                else token += line[i];  // EAT
    429                 state = SL_PARENTHESES;
    430                 break;
    431 
    432             case SL_COMMENT:
     429                state = SPLIT_LINE_STATE::PARENTHESES;
     430                break;
     431
     432            case SPLIT_LINE_STATE::COMMENT:
    433433                if(line[i] == '\n')
    434434                {
     
    441441                        inSafemode = false;
    442442                    }
    443                     state = SL_NORMAL;
     443                    state = SPLIT_LINE_STATE::NORMAL;
    444444                }
    445445                else
  • code/branches/cpp11_v3/src/libraries/util/SubString.h

    r9550 r11068  
    102102    {
    103103        /// An enumerator for the internal state of the parser
    104         enum SPLIT_LINE_STATE
     104        enum class SPLIT_LINE_STATE
    105105        {
    106             SL_NORMAL,            //!< Normal state
    107             SL_ESCAPE,            //!< After an escape character
    108             SL_SAFEMODE,          //!< In safe mode (usually between quotation marks).
    109             SL_SAFEESCAPE,        //!< In safe mode with the internal escape character, that escapes even the savemode character.
    110             SL_COMMENT,           //!< In Comment mode.
    111             SL_PARENTHESES,       //!< Between parentheses (usually '{' and '}')
    112             SL_PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing parenthesis character.
     106            NORMAL,            //!< Normal state
     107            ESCAPE,            //!< After an escape character
     108            SAFEMODE,          //!< In safe mode (usually between quotation marks).
     109            SAFEESCAPE,        //!< In safe mode with the internal escape character, that escapes even the savemode character.
     110            COMMENT,           //!< In Comment mode.
     111            PARENTHESES,       //!< Between parentheses (usually '{' and '}')
     112            PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing parenthesis character.
    113113        };
    114114
     
    204204                                          bool bRemoveParenthesisChars = true,
    205205                                          char commentChar = '\0',
    206                                           SPLIT_LINE_STATE start_state = SL_NORMAL);
     206                                          SPLIT_LINE_STATE start_state = SPLIT_LINE_STATE::NORMAL);
    207207
    208208        std::vector<std::string>  tokens_;              ///< The tokens after splitting the input line
  • code/branches/cpp11_v3/src/libraries/util/UtilPrereqs.h

    r11054 r11068  
    3737
    3838#include "OrxonoxConfig.h"
     39#include <string>
    3940
    4041//-----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.