<commit_before>/*********************************************************************************
 *
 * Inviwo - Interactive Visualization Workshop
 *
 * Copyright (c) 2016-2018 Inviwo Foundation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *********************************************************************************/

#ifndef IVW_KEYBOARDKEYS_H
#define IVW_KEYBOARDKEYS_H

#include <inviwo/core/common/inviwocoredefine.h>
#include <inviwo/core/util/ostreamjoiner.h>

#include <flags/flags.h>

#include <iterator>
#include <ostream>

namespace inviwo {

enum class KeyModifier {
    None = 0,
    Control = 1 << 0,
    Shift = 1 << 1,
    Alt = 1 << 2,
    Super = 1 << 3,
    Menu = 1 << 4,
    Meta = 1 << 5
};
ALLOW_FLAGS_FOR_ENUM(KeyModifier)
using KeyModifiers = flags::flags<KeyModifier>;

template <class Elem, class Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& ss, KeyModifier m) {
    switch (m) {
        case KeyModifier::None:
            ss << "None";
            break;
        case KeyModifier::Control:
            ss << "Control";
            break;
        case KeyModifier::Shift:
            ss << "Shift";
            break;
        case KeyModifier::Alt:
            ss << "Alt";
            break;
        case KeyModifier::Super:
            ss << "Super";
            break;
        case KeyModifier::Menu:
            ss << "Menu";
            break;
        case KeyModifier::Meta:
            ss << "Meta";
            break;
        default:
            break;
    }
    return ss;
}
template <class Elem, class Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& ss,
                                             KeyModifiers ms) {
    std::copy(ms.begin(), ms.end(), util::make_ostream_joiner(ss, "+"));
    return ss;
}

enum class KeyState {
    Press = 1 << 0,
    Release = 1 << 1,
};
ALLOW_FLAGS_FOR_ENUM(KeyState)
using KeyStates = flags::flags<KeyState>;

template <class Elem, class Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& ss, KeyState s) {
    switch (s) {
        case KeyState::Press:
            ss << "Press";
            break;
        case KeyState::Release:
            ss << "Release";
            break;
    }
    return ss;
}
template <class Elem, class Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& ss, KeyStates s) {
    std::copy(s.begin(), s.end(), util::make_ostream_joiner(ss, "+"));
    return ss;
}

enum class IvwKey {
    Undefined = -2,
    // key codes based on glfw
    Unknown = -1,

    /* Printable Keys */
    Space = 32,
    Exclam = 33,   /* ! */
    QuoteDbl = 34, /* " */
    NumberSign = 35,
    Dollar = 36,     /* $ */
    Percent = 37,    /* % */
    Ampersand = 38,  /* @ */
    Apostrophe = 39, /* ' */
    ParenLeft = 40,  /* ( */
    ParenRight = 41, /* ) */
    Asterisk = 42,   /* * */
    Plus = 43,       /* + */
    Comma = 44,      /* , */
    Minus = 45,      /* - */
    Period = 46,     /* . */
    Slash = 47,      /* / */
    Num0 = 48,
    Num1 = 49,
    Num2 = 50,
    Num3 = 51,
    Num4 = 52,
    Num5 = 53,
    Num6 = 54,
    Num7 = 55,
    Num8 = 56,
    Num9 = 57,
    Colon = 58,     /* : */
    Semicolon = 59, /* ; */
    Less = 60,      /* < */
    Equal = 61,     /* = */
    Greater = 62,   /* > */
    Question = 63,  /* ? */
    A = 65,
    B = 66,
    C = 67,
    D = 68,
    E = 69,
    F = 70,
    G = 71,
    H = 72,
    I = 73,
    J = 74,
    K = 75,
    L = 76,
    M = 77,
    N = 78,
    O = 79,
    P = 80,
    Q = 81,
    R = 82,
    S = 83,
    T = 84,
    U = 85,
    V = 86,
    W = 87,
    X = 88,
    Y = 89,
    Z = 90,
    BracketLeft = 91,  // [
    Backslash = 92,    // \ 
    BracketRight = 93, // ]
    GraveAccent = 96,  // `
    AsciiCircum = 94,  // °
    Underscore = 95,   // _
    BraceLeft = 123,   // { 0x7b
    Bar = 124,         // | 0x7c
    BraceRight = 125,  // } 0x7d
    AsciiTilde = 126,  // ~ 0x7e
    World1 = 161,      // non-US #1
    World2 = 162,      // non-US #2

    /* Function Keys */
    Escape = 256,
    Enter = 257,
    Tab = 258,
    Backspace = 259,
    Insert = 260,
    Delete = 261,
    Right = 262,
    Left = 263,
    Down = 264,
    Up = 265,
    PageUp = 266,
    PageDown = 267,
    Home = 268,
    End = 269,<commit_msg>Tools: formatting<commit_after>/*********************************************************************************
 *
 * Inviwo - Interactive Visualization Workshop
 *
 * Copyright (c) 2016-2018 Inviwo Foundation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 * list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *********************************************************************************/

#ifndef IVW_KEYBOARDKEYS_H
#define IVW_KEYBOARDKEYS_H

#include <inviwo/core/common/inviwocoredefine.h>
#include <inviwo/core/util/ostreamjoiner.h>

#include <flags/flags.h>

#include <iterator>
#include <ostream>

namespace inviwo {

enum class KeyModifier {
    None = 0,
    Control = 1 << 0,
    Shift = 1 << 1,
    Alt = 1 << 2,
    Super = 1 << 3,
    Menu = 1 << 4,
    Meta = 1 << 5
};
ALLOW_FLAGS_FOR_ENUM(KeyModifier)
using KeyModifiers = flags::flags<KeyModifier>;

template <class Elem, class Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& ss, KeyModifier m) {
    switch (m) {
        case KeyModifier::None:
            ss << "None";
            break;
        case KeyModifier::Control:
            ss << "Control";
            break;
        case KeyModifier::Shift:
            ss << "Shift";
            break;
        case KeyModifier::Alt:
            ss << "Alt";
            break;
        case KeyModifier::Super:
            ss << "Super";
            break;
        case KeyModifier::Menu:
            ss << "Menu";
            break;
        case KeyModifier::Meta:
            ss << "Meta";
            break;
        default:
            break;
    }
    return ss;
}
template <class Elem, class Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& ss,
                                             KeyModifiers ms) {
    std::copy(ms.begin(), ms.end(), util::make_ostream_joiner(ss, "+"));
    return ss;
}

enum class KeyState {
    Press = 1 << 0,
    Release = 1 << 1,
};
ALLOW_FLAGS_FOR_ENUM(KeyState)
using KeyStates = flags::flags<KeyState>;

template <class Elem, class Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& ss, KeyState s) {
    switch (s) {
        case KeyState::Press:
            ss << "Press";
            break;
        case KeyState::Release:
            ss << "Release";
            break;
    }
    return ss;
}
template <class Elem, class Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& ss, KeyStates s) {
    std::copy(s.begin(), s.end(), util::make_ostream_joiner(ss, "+"));
    return ss;
}

enum class IvwKey {
    Undefined = -2,
    // key codes based on glfw
    Unknown = -1,

    /* Printable Keys */
    Space = 32,
    Exclam = 33,   /* ! */
    QuoteDbl = 34, /* " */
    NumberSign = 35,
    Dollar = 36,     /* $ */
    Percent = 37,    /* % */
    Ampersand = 38,  /* @ */
    Apostrophe = 39, /* ' */
    ParenLeft = 40,  /* ( */
    ParenRight = 41, /* ) */
    Asterisk = 42,   /* * */
    Plus = 43,       /* + */
    Comma = 44,      /* , */
    Minus = 45,      /* - */
    Period = 46,     /* . */
    Slash = 47,      /* / */
    Num0 = 48,
    Num1 = 49,
    Num2 = 50,
    Num3 = 51,
    Num4 = 52,
    Num5 = 53,
    Num6 = 54,
    Num7 = 55,
    Num8 = 56,
    Num9 = 57,
    Colon = 58,     /* : */
    Semicolon = 59, /* ; */
    Less = 60,      /* < */
    Equal = 61,     /* = */
    Greater = 62,   /* > */
    Question = 63,  /* ? */
    A = 65,
    B = 66,
    C = 67,
    D = 68,
    E = 69,
    F = 70,
    G = 71,
    H = 72,
    I = 73,
    J = 74,
    K = 75,
    L = 76,
    M = 77,
    N = 78,
    O = 79,
    P = 80,
    Q = 81,
    R = 82,
    S = 83,
    T = 84,
    U = 85,
    V = 86,
    W = 87,
    X = 88,
    Y = 89,
    Z = 90,
    BracketLeft = 91,
    Backslash = 92,
    BracketRight = 93,
    GraveAccent = 96,  // `
    AsciiCircum = 94,  // °
    Underscore = 95,   // _
    BraceLeft = 123,   // { 0x7b
    Bar = 124,         // | 0x7c
    BraceRight = 125,  // } 0x7d
    AsciiTilde = 126,  // ~ 0x7e
    World1 = 161,      // non-US #1
    World2 = 162,      // non-US #2

    /* Function Keys */
    Escape = 256,
    Enter = 257,
    Tab = 258,
    Backspace = 259,
    Insert = 260,
    Delete = 261,
    Right = 262,
    Left = 263,
    Down = 264,
    Up = 265,
    PageUp = 266,
    PageDown = 267,
    Home = 268,
    End = 269,
{'fraction_non_alphanumeric': 0.1528345477163675, 'fraction_numerical': 0.04247378709792074, 'mean_word_length': 2.1056843267108167, 'pattern_counts': {'":': 0, '<': 127, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5661642', 'n_tokens_mistral': 4103, 'n_tokens_neox': 3558, 'n_words': 1120}