#include <iostream>
#include <map>
#include <string>

struct PlayerClass
{
    std::string const name;

    unsigned Str, Dex, Int;

    PlayerClass( std::string const& name ):
        name{name} {}

    PlayerClass& operator=(PlayerClass const&) = delete; // Keine Zuweisung (geht sowieso nicht)
};

#include <vector>
#include <algorithm>
#include <functional>
#include <stdexcept>

std::istream& operator>>( std::istream& is, PlayerClass& plcl )
{
    static std::vector<std::ctype_base::mask> equals_mask;
    if( equals_mask.empty() )
    {
        equals_mask.assign( std::ctype<char>::classic_table(), std::ctype<char>::classic_table() + std::ctype<char>::table_size);
        equals_mask['='] |= std::ctype_base::space;
    }

    auto old_loc = is.imbue( std::locale{is.getloc(), new std::ctype<char>{equals_mask.data()} } );

    std::string attr_str;
    unsigned attr_val;
    while( is >> attr_str >> attr_val )
    {
        std::transform( std::begin(attr_str), std::end(attr_str), std::begin(attr_str), std::bind( std::tolower<char>, std::placeholders::_1, old_loc ) ); /// Den String komplett ohne Großbuchstaben machen

             if( attr_str == "str" ) plcl.Str = attr_val;
        else if( attr_str == "dex" ) plcl.Dex = attr_val;
        else if( attr_str == "int" ) plcl.Int = attr_val;
        else
            throw std::logic_error("Invalid attribute while parsing PlayerClass!");
    }

    is.imbue( old_loc );

    return is;
}

#include <sstream>

int main()
{
    std::istringstream stream("Str=12 \n Dex=17 \n Int=4");
    PlayerClass test("Schurke");
    stream >> test;

    std::cout << "Str: " << test.Str << " Dex: " << test.Dex << " Int: " << test.Int;
}

