LCOV - code coverage report
Current view: top level - eq/fabric - eventType.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 32 38 84.2 %
Date: 2017-12-16 05:07:20 Functions: 4 6 66.7 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2016, Stefan.Eilemann@epfl.ch
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #include "eventType.h"
      19             : #include "types.h"
      20             : #include <iostream>
      21             : 
      22             : namespace eq
      23             : {
      24             : namespace fabric
      25             : {
      26             : namespace
      27             : {
      28             : /** String representation of event types. */
      29          20 : class EventTypeNames
      30             : {
      31             : public:
      32          20 :     EventTypeNames()
      33          20 :     {
      34          20 :         _names[EVENT_WINDOW_EXPOSE] = "window expose";
      35          20 :         _names[EVENT_WINDOW_RESIZE] = "window resize";
      36          20 :         _names[EVENT_WINDOW_CLOSE] = "window close";
      37          20 :         _names[EVENT_WINDOW_HIDE] = "window show";
      38          20 :         _names[EVENT_WINDOW_SHOW] = "window hide";
      39          20 :         _names[EVENT_WINDOW_SCREENSAVER] = "window screensaver";
      40          20 :         _names[EVENT_CHANNEL_POINTER_MOTION] = "pointer motion";
      41          20 :         _names[EVENT_CHANNEL_POINTER_BUTTON_PRESS] = "pointer button press";
      42          20 :         _names[EVENT_CHANNEL_POINTER_BUTTON_RELEASE] = "pointer button release";
      43          20 :         _names[EVENT_CHANNEL_POINTER_WHEEL] = "pointer wheel";
      44          20 :         _names[EVENT_WINDOW_POINTER_WHEEL] = "pointer wheel";
      45          20 :         _names[EVENT_WINDOW_POINTER_MOTION] = "window pointer motion";
      46             :         _names[EVENT_WINDOW_POINTER_BUTTON_PRESS] =
      47          20 :             "window pointer button press";
      48             :         _names[EVENT_WINDOW_POINTER_BUTTON_RELEASE] =
      49          20 :             "window pointer button release";
      50          20 :         _names[EVENT_KEY_PRESS] = "key press";
      51          20 :         _names[EVENT_KEY_RELEASE] = "key release";
      52          20 :         _names[EVENT_CHANNEL_RESIZE] = "channel resize";
      53          20 :         _names[EVENT_STATISTIC] = "statistic";
      54          20 :         _names[EVENT_VIEW_RESIZE] = "view resize";
      55          20 :         _names[EVENT_EXIT] = "exit";
      56          20 :         _names[EVENT_MAGELLAN_AXIS] = "magellan axis";
      57          20 :         _names[EVENT_MAGELLAN_BUTTON] = "magellan button";
      58          20 :         _names[EVENT_NODE_TIMEOUT] = "node timed out";
      59          20 :         _names[EVENT_OBSERVER_MOTION] = "observer motion";
      60          20 :         _names[EVENT_UNKNOWN] = "unknown";
      61          20 :         _names[EVENT_USER] = "user-specific";
      62          20 :     }
      63             : 
      64           0 :     const std::string& operator[](const EventType type) const
      65             :     {
      66           0 :         return _names[type];
      67             :     }
      68             : 
      69             : private:
      70             :     std::string _names[EVENT_ALL];
      71             : };
      72          20 : static EventTypeNames _eventTypeNames;
      73             : }
      74             : 
      75             : namespace eventTypes
      76             : {
      77           0 : std::ostream& operator<<(std::ostream& os, const EventType& type)
      78             : {
      79           0 :     if (type >= EVENT_ALL)
      80           0 :         return os << "user event (" << unsigned(type) << ')';
      81           0 :     return os << _eventTypeNames[type] << " (" << unsigned(type) << ')';
      82             : }
      83             : }
      84             : }
      85          60 : }

Generated by: LCOV version 1.11