title: Blocks nested too deeply
body: <p>I have some untypical problem. I make available to the user sendText() function. He can type e.g. </p>
  
  <pre><code>sendText( "mytext{newline}text{up}" )
  </code></pre>
  
  <p>{text} is a special key that user is allowed to send. There are a lot of special keys available.</p>
  
  <p>So my first step was to get the string between {} brackets and to create:</p>
  
  <pre><code>if( _specialKey == "newline" ) {
      // action for VK_RETURN
  } else if( _specialKey == "up" ) {
      // action for VK_UP
  } else .....
  </code></pre>
  
  <p>example:</p>
  
  <pre><code>if( specialKey == "n" ) {
      // enter click
      unsigned short key = VK_RETURN;
      inputs.push_back( keyDown( key ) );
      inputs.push_back( keyUp( key ) );
  
      return 2;
  } else if( specialKey == "n+" ) {
      // enter down
      inputs.push_back( keyDown( VK_RETURN ) );
  
      return 2;
  } else if( specialKey == "n-" ) {
      // enter up
      inputs.push_back( keyUp( VK_RETURN ) );
  
      return 2;
  } else if( specialKey == "t" ) {
      // tabulator click
      unsigned short key = VK_TAB;
      inputs.push_back( keyDown( key ) );
      inputs.push_back( keyUp( key ) );
  
      return 2;
  } else if( specialKey == "t+" ) {
      // tabulator down
      inputs.push_back( keyDown( VK_TAB ) );
  
      return 2;
  } else if( specialKey == "t-" ) {
      // tabulator up
      inputs.push_back( keyUp( VK_TAB ) );
  
      return 2;
  } else if( specialKey == "caps" ) {
      // caps lock click
      unsigned short key = VK_CAPITAL;
      inputs.push_back( keyDown( key ) );
      inputs.push_back( keyUp( key ) );
  
      return 2;
  } else if( specialKey == "caps+" ) {
      // caps lock down
      inputs.push_back( keyDown( VK_CAPITAL ) );
  
      return 2;
  } else if( specialKey == "caps-" ) {
      // caps lock up
      inputs.push_back( keyUp( VK_CAPITAL ) );
  
      return 2;
  } else if( specialKey == "ralt" ) {
      // right alt click
      unsigned short key = VK_RMENU;
      inputs.push_back( keyDown( key ) );
      inputs.push_back( keyUp( key ) );
  
      return 2;
  } else if( specialKey == "ralt+" ) {
      // right alt down
      inputs.push_back( keyDown( VK_RMENU ) );
  
      return 2;
  } else if( specialKey == "ralt-" ) {
      // right alt up
      inputs.push_back( keyUp( VK_RMENU ) );
  
      return 2;
  } else if( specialKey == "lalt" ) {
      // right alt click
      unsigned short key = VK_LMENU;
      inputs.push_back( keyDown( key ) );
      inputs.push_back( keyUp( key ) );
  
      return 2;
  } else if( specialKey == "lalt+" ) {
      // right alt down
      inputs.push_back( keyDown( VK_LMENU ) );
  
      return 2;
  } else if( specialKey == "lalt-" ) {
      // right alt up
      inputs.push_back( keyUp( VK_LMENU ) );
  
      return 2;
  } else if( specialKey == "rctrl" ) {
      // right alt click
      unsigned short key = VK_RCONTROL;
      inputs.push_back( keyDown( key ) );
      inputs.push_back( keyUp( key ) );
  
      return 2;
  } else if( specialKey == "rctrl+" ) {
      // right alt down
      inputs.push_back( keyDown( VK_RCONTROL ) );
  
      return 2;
  } else if( specialKey == "rctrl-" ) {
      // right alt up
      inputs.push_back( keyUp( VK_RCONTROL ) );
  
      return 2;
  } else if( specialKey == "lctrl" ) {
  </code></pre>
  
  <p>but the compiler said:</p>
  
  <pre><code>fatal error C1061: compiler limit : blocks nested too deeply
  </code></pre>
  
  <p>My first idea to solve it was to define a map that will store all special keys (as a string) that maps to some integer. Then I could do:</p>
  
  <pre><code>switch( map[key] ) {
      case 0:
      ...
  }
  </code></pre>
  
  <p>but I'm not sure if the compiler won't complain about it too. There's a lot of to change, so I don't want to change it for no results.</p>
  
  <p>Or maybe do you have some other better ideas?</p>
  
  <p>Thanks.</p>