#include "keymap.h" /* static void PrintKeymapForCode(GdkKeymap *keymap, guint keycode) { GdkKeymapKey *maps; guint *keyvals; gint count; if (!gdk_keymap_get_entries_for_keycode(keymap, keycode, &maps, &keyvals, &count)) return; for (int i = 0; i < count; i++) { if (maps[i].level > 0 || maps[i].group > 1) continue; printf(" i=%d, keycode=%d, keyval=%d (%c), level=%d, group=%d\n", i, maps[i].keycode, keyvals[i], keyvals[i], maps[i].level, maps[i].group); } g_free(keyvals); g_free(maps); } */ int dummytest_keymap(){ std::wcout<< " dummytest_keymap is available\n"; return 0; } bool write_US_ToVector( v_str_3D &vec,std::string language, const char* text) { // _S2 relative path !! std::string FullPathName = "/usr/share/X11/xkb/symbols/" + language; const char* path = FullPathName.c_str(); FILE* fp = fopen((path), "r"); if ( !fp) { wprintf(L"could not open file!"); return 1; } // create 1D-vector of the complete line v_str_1D Vector_completeUS; if( CreateCompleteRow_US(Vector_completeUS,fp , text, language)) { wprintf(L"ERROR: can't Create complete row US \n"); return 1; } // split contents of 1D Vector to 3D vector if( Split_US_To_3D_Vector( vec,Vector_completeUS)) { wprintf(L"ERROR: can't Split USto 3D-Vector \n"); return 1; } wprintf(L"\n ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); wprintf(L" +++++++ dimensions of Vector after write_US_ToVector (languages..characters..shiftstates)\t\t %li..%li..%li\n", vec.size(), vec[0].size(),vec[0][0].size()); //test_single(vec); fclose(fp); return 0; } bool write_US_ToVector_dw( v_dw_3D &vec,std::string language, const char* text) { // _S2 relative path !! std::string FullPathName = "/usr/share/X11/xkb/symbols/" + language; const char* path = FullPathName.c_str(); FILE* fp = fopen((path), "r"); if ( !fp) { wprintf(L"could not open file!"); return 1; } // create 1D-vector of the complete line v_str_1D Vector_completeUS; if( CreateCompleteRow_US(Vector_completeUS,fp , text, language)) { wprintf(L"ERROR: can't Create complete row US \n"); return 1; } // split contents of 1D Vector to 3D vector if( Split_US_To_3D_Vector_dw( vec,Vector_completeUS)) { wprintf(L"ERROR: can't Split USto 3D-Vector \n"); return 1; } wprintf(L"\n ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); wprintf(L" +++++++ dimensions of Vector after write_US_ToVector_dw (languages..characters..shiftstates)\t\t %li..%li..%li\n", vec.size(), vec[0].size(),vec[0][0].size()); test_single_dw(vec); fclose(fp); return 0; } bool CreateCompleteRow_US(v_str_1D &complete_List, FILE* fp, const char* text, std::string language) { // in the Configuration file we find the appopriate paragraph between "xkb_symbol " and the next xkb_symbol // and then copy all rows starting with "key <" to a v1D-Vector int buffer_size = 512; char buffer[buffer_size]; bool print_OK = false; const char* key = "key <"; std::string str_txt(text); std::string xbk_mark = "xkb_symbol"; // _S2 TODO define folder to store File in std::ofstream KeyboardFile("File_" + language + ".txt"); printf("Keyboard %s\n", text); KeyboardFile << "Keyboard" << text << "\n"; if (fp) { while (fgets(buffer, buffer_size, fp) != NULL) { std::string str_buf(buffer); // stop when finding the mark xkb_symbol if (std::string(str_buf).find(xbk_mark) != std::string::npos) print_OK = false; // start when finding the mark xkb_symbol + correct layout if ((std::string(str_buf).find(str_txt) != std::string::npos)) print_OK = true; // as long as we are in the same xkb_symbol layout block and find "key <" we push the whole line into a 1D-vector if ((print_OK) && (std::string(str_buf).find(key) != std::string::npos)) { printf("%s", buffer); complete_List.push_back(buffer); KeyboardFile << buffer; } } } if (complete_List.size() <1) { wprintf(L"ERROR: can't Create complete row US \n"); return 1; } return 0; } bool Split_US_To_3D_Vector(v_str_3D &all_US,v_str_1D completeList) { // 1: take the whole line of the 1D-Vector and remove unwanted characters. // 2: seperate the name e.g. key from the shiftstates // 3: push Names/Shiftstates to shift_states and then shiftstates to All_US, our 3D-Vector holding all Elements std::vector delim{' ', '[', ']', '}', ';', '\t', '\n'}; char split_bracel = '{'; char split_char_komma = ','; std::string empty = "--"; v_str_1D tokens; v_str_2D shift_states; // loop through the whole vector for (int k = 0; k < (int)completeList.size() - 1; k++) { // remove all unwanted char for (int i = 0; i < (int) delim.size(); i++) { completeList[k].erase(remove(completeList[k].begin(), completeList[k].end(), delim[i]), completeList[k].end()); } // only lines with ("key<.. are of interest if (completeList[k].find("key<") != std::string::npos) { //split off the key names std::istringstream split1(completeList[k]); for (std::string each; std::getline(split1, each, split_bracel); tokens.push_back(each)); // replace keys names with number ( with 29,...) int Keycde = replace_PosKey_with_Keycode(tokens[0]); tokens[0] = std::to_string(Keycde); // seperate rest of the vector to its elements and push to 'tokens' std::istringstream split(tokens[1]); tokens.pop_back(); for (std::string each; std::getline(split, each, split_char_komma); tokens.push_back(each)); // _S2 do we still need that?? // at the moment we only use the first 4 shiftstates (non-shift+shift) so get rid of all others //int surplus = tokens.size() - shift_state_count -1; int surplus = tokens.size() - 4 -1; for ( int j=0; j < surplus; j++) { tokens.pop_back(); } // now push result to shift_states shift_states.push_back(tokens); tokens.clear(); } } all_US.push_back(shift_states); if ( all_US.size() ==0) { wprintf(L"ERROR: Can't split US to 3D-Vector\n"); return 1; } return 0; } std::wstring replaceNamesWithCharacter(std::wstring tok_wstr){ std::wstring tok_wstr_out; //Names of Characters we use: std::wstring UsableCharacters[10][2] = { {L"exclam", L"!"} , {L"at", L"@"} , {L"numbersign", L"#"} , {L"dollar", L"$"} , {L"percent", L"%"} , {L"dead_circumflex", L"^"} , {L"ampersand", L"&"} , {L"asterisk", L"*"} , {L"parenleft", L"("} , {L"parenright", L")"} }; int size_arr = sizeof(UsableCharacters)/sizeof(UsableCharacters[0]); for ( int i =0; i< size_arr;i++) { if (tok_wstr == UsableCharacters[i][0]) { tok_wstr_out = UsableCharacters[i][1]; return UsableCharacters[i][1]; } } return tok_wstr; } bool Split_US_To_3D_Vector_dw(v_dw_3D &all_US,v_str_1D completeList) { // 1: take the whole line of the 1D-Vector and remove unwanted characters. // 2: seperate the name e.g. key from the shiftstates // 3: convert to DWORD // 4: push Names/Shiftstates to shift_states and then shiftstates to All_US, our 3D-Vector holding all Elements std::vector delim{' ', '[', ']', '}', ';', '\t', '\n'}; char split_bracel = '{'; char split_char_komma = ','; int ValueInvalid = 32; // _S2 do we use space, 0, FFFF for a char we cannot use ?? int Keycde; v_str_1D tokens; v_dw_1D tokens_dw; v_dw_2D shift_states_dw; KMX_DWORD tokens_int; std::wstring tok_wstr; // loop through the whole vector for (int k = 0; k < (int)completeList.size() - 1; k++) { // remove all unwanted char for (int i = 0; i < (int) delim.size(); i++) { completeList[k].erase(remove(completeList[k].begin(), completeList[k].end(), delim[i]), completeList[k].end()); } // only lines with ("key<.. are of interest if (completeList[k].find("key<") != std::string::npos) { //split off the key names std::istringstream split1(completeList[k]); for (std::string each; std::getline(split1, each, split_bracel); tokens.push_back(each)); // replace keys names with Keycode ( with 29,...) Keycde = replace_PosKey_with_Keycode(tokens[0]); tokens[0] = std::to_string(Keycde); // seperate rest of the vector to its elements and push to 'tokens' std::istringstream split(tokens[1]); tokens.pop_back(); for (std::string each; std::getline(split, each, split_char_komma); tokens.push_back(each)); // now convert all to KMX_DWORD and fill tokens_dw tokens_dw.push_back((KMX_DWORD) Keycde); for ( int i = 1; i< tokens.size();i++) { // check if a name can be replaced with a single character tok_wstr = replaceNamesWithCharacter( wstring_from_string(tokens[i])); // for single char: copy value of char if ( tok_wstr.size() == 1) { tokens_int = (KMX_DWORD) ( *tok_wstr.c_str() ); } else { tokens_int = ValueInvalid; } tokens_dw.push_back(tokens_int); } wprintf(L" Keyval %i: %i (%c) --- %i (%c) \n", tokens_dw[0],tokens_dw[1],tokens_dw[1], tokens_dw[2], tokens_dw[2]); // now push result to shift_states shift_states_dw.push_back(tokens_dw); tokens_dw.clear(); tokens.clear(); } } all_US.push_back(shift_states_dw); if ( all_US.size() ==0) { wprintf(L"ERROR: Can't split US to 3D-Vector\n"); return 1; } return 0; } int replace_PosKey_with_Keycode(std::string in) { int out=0; if ( in == "key") out = 49; // TOASK correct ??? else if ( in == "key") out = 10; else if ( in == "key") out = 11; else if ( in == "key") out = 12; else if ( in == "key") out = 13; else if ( in == "key") out = 14; else if ( in == "key") out = 15; else if ( in == "key") out = 16; else if ( in == "key") out = 17; else if ( in == "key") out = 18; else if ( in == "key") out = 19; else if ( in == "key") out = 20; else if ( in == "key") out = 21; else if ( in == "key") out = 24; else if ( in == "key") out = 25; else if ( in == "key") out = 26; else if ( in == "key") out = 27; else if ( in == "key") out = 28; else if ( in == "key") out = 29; else if ( in == "key") out = 30; else if ( in == "key") out = 31; else if ( in == "key") out = 32; else if ( in == "key") out = 33; else if ( in == "key") out = 34; else if ( in == "key") out = 35; else if ( in == "key") out = 38; else if ( in == "key") out = 39; else if ( in == "key") out = 40; else if ( in == "key") out = 41; else if ( in == "key") out = 42; else if ( in == "key") out = 43; else if ( in == "key") out = 44; else if ( in == "key") out = 45; else if ( in == "key") out = 46; else if ( in == "key") out = 47; else if ( in == "key") out = 48; else if ( in == "key") out = 49; else if ( in == "key") out = 52; else if ( in == "key") out = 53; else if ( in == "key") out = 54; else if ( in == "key") out = 55; else if ( in == "key") out = 56; else if ( in == "key") out = 57; else if ( in == "key") out = 58; else if ( in == "key") out = 59; else if ( in == "key") out = 60; else if ( in == "key") out = 61; else if ( in == "key") out = 51; else if ( in == "key") out = 94; return out; } bool append_other_ToVector(v_str_3D &All_Vector,GdkKeymap * keymap) { // create a 2D vector all filled with "--" and push to 3D-Vector v_str_2D Other_Vector2D = create_empty_2D(All_Vector[0].size(),All_Vector[0][0].size()); if (Other_Vector2D.size()==0) { wprintf(L"ERROR: create empty 2D-Vector failed"); return 1; } All_Vector.push_back(Other_Vector2D); wprintf(L" +++++++ dimensions of Vector after append_other_ToVector\t\t\t\t\t\t %li..%li..%li\n", All_Vector.size(), All_Vector[0].size(),All_Vector[0][0].size()); wprintf(L" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"); if (All_Vector.size() < 2) { wprintf(L"ERROR: creation of 3D-Vector failed"); return 1; } for(int i =0; i< (int) All_Vector[1].size();i++) { // get key name US stored in [0][i][0] and copy to name in "other"-block[1][i][0] All_Vector[1][i][0] = All_Vector[0][i][0]; // get Keyvals of this key and copy to unshifted/shifted in "other"-block[1][i][1] / block[1][i][2] All_Vector[1][i][0+1] = GetKeyvalsFromKeymap(keymap,stoi(All_Vector[1][i][0]),0); //shift state: unshifted:0 All_Vector[1][i][1+1] = GetKeyvalsFromKeymap(keymap,stoi(All_Vector[1][i][0]),1); //shift state: shifted:1 //wprintf(L" Keycodes US : %d (US):%s, %s ---- (other):%s, %s \n",stoi(All_Vector[1][i][0]),All_Vector[0][i][1].c_str(),All_Vector[0][i][2].c_str(),All_Vector[1][i][1].c_str(),All_Vector[1][i][2].c_str()); //wprintf(L" Keycodes ->Other:-: %d (US):%s, %s ,%s, %s \n\n",stoi(All_Vector[1][i][0]),All_Vector[1][i][1].c_str(),All_Vector[1][i][2].c_str(),All_Vector[1][i][3].c_str(),All_Vector[1][i][4].c_str()); } return 0; } bool append_other_ToVector_dw(v_dw_3D &All_Vector,GdkKeymap * keymap) { // create a 2D vector all filled with "--" and push to 3D-Vector v_dw_2D Other_Vector2D = create_empty_2D_dw(All_Vector[0].size(),All_Vector[0][0].size()); if (Other_Vector2D.size()==0) { wprintf(L"ERROR: create empty 2D-Vector failed"); return 1; } All_Vector.push_back(Other_Vector2D); wprintf(L" +++++++ dimensions of Vector after append_other_ToVector_dw\t\t\t\t\t\t %li..%li..%li\n", All_Vector.size(), All_Vector[0].size(),All_Vector[0][0].size()); wprintf(L" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n"); if (All_Vector.size() < 2) { wprintf(L"ERROR: creation of 3D-Vector failed"); return 1; } for(int i =0; i< (int) All_Vector[1].size();i++) { // get key name US stored in [0][i][0] and copy to name in "other"-block[1][i][0] All_Vector[1][i][0] = All_Vector[0][i][0]; // get Keyvals of this key and copy to unshifted/shifted in "other"-block[1][i][1] / block[1][i][2] All_Vector[1][i][0+1] = GetKeyvalsFromKeymap(keymap,(All_Vector[1][i][0]),0); //shift state: unshifted:0 All_Vector[1][i][1+1] = GetKeyvalsFromKeymap(keymap,(All_Vector[1][i][0]),1); //shift state: shifted:1 //wprintf(L" Keycodes US dw : %d (US): -- %i (%c) -- %i (%c) ---- (other): %i (%c) -- %i(%c) \n",(All_Vector[1][i][0]),All_Vector[0][i][1],All_Vector[0][i][1],All_Vector[0][i][2],All_Vector[0][i][2],All_Vector[1][i][1] ,All_Vector[1][i][1],All_Vector[1][i][2],All_Vector[1][i][2]); //wprintf(L" Keycodes ->Other dw:-: %d (US): -- %i (%c) -- %i (%c) \n\n",(All_Vector[1][i][0]),All_Vector[1][i][1],All_Vector[1][i][1],All_Vector[1][i][2],All_Vector[1][i][2]); } return 0; } v_str_2D create_empty_2D( int dim_rows,int dim_shifts) { std::string empty = "--"; v_str_1D shifts; v_str_2D all_2D; for ( int i=0; i< dim_rows;i++) { for ( int j=0; j< dim_shifts;j++) { shifts.push_back(empty); } all_2D.push_back(shifts); shifts.clear(); } return all_2D; } v_dw_2D create_empty_2D_dw( int dim_rows,int dim_shifts) { KMX_DWORD empty = 32; v_dw_1D shifts; v_dw_2D all_2D; for ( int i=0; i< dim_rows;i++) { for ( int j=0; j< dim_shifts;j++) { shifts.push_back(empty); } all_2D.push_back(shifts); shifts.clear(); } return all_2D; } int GetKeyvalsFromKeymap(GdkKeymap *keymap, guint keycode, int shift_state_pos) { GdkKeymapKey *maps; guint *keyvals; gint count; int out; if (!gdk_keymap_get_entries_for_keycode(keymap, keycode, &maps, &keyvals, &count)) return 0; //if(!gdk_wayland_keymap_get_entries_for_keycode(keymap, keycode, &maps, &keyvals, &count)) // return 0; if (!(shift_state_pos < count)) return 0; out = keyvals[shift_state_pos]; //wprintf(L" GetKeyvalsFromKeymap: in %i -- out : %i \n", (int)keycode, out); // _S2 if out of range of what ( ascii??) return 0 or other value ? if (out > 255) out = 0; g_free(keyvals); g_free(maps); return out; } bool test(v_str_3D &V) { std::string extra = " "; wprintf(L"+++++++ dimensions of whole Vector in test()\t\t %li..%li..%li\n", V.size(), V[0].size(),V[0][0].size()); wprintf(L"\n+++++++++ print some characters of US and Other ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); for ( int k=0; k<(int)V[0].size(); k++) { if(V[0][k][2] != V[1][k][2] ) extra = " *** "; else extra = " "; if (V[0].size()>0) { //wprintf(L" row (US) ...... %s .. %s .. %s .. %s .. %s --- ", V[0][k][0].c_str(), V[0][k][1].c_str() , V[0][k][2].c_str() , V[0][k][3].c_str() , V[0][k][4].c_str() ); //wprintf(L" \n"); //wprintf(L" row (Other)..... %s .. %s .. %s .. %s .. %s %s \n", V[1][k][0].c_str(), V[1][k][1].c_str() , V[1][k][2].c_str() , V[1][k][3].c_str() , V[1][k][4].c_str() , extra.c_str()); //wprintf(L" \n"); } } wprintf(L" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); return true; } bool test_single(v_str_3D &V) { std::string extra = " "; //wprintf(L" +++++++ dimensions of single Vector in test()\t\t %li..%li..%li\n", V.size(), V[0].size(),V[0][0].size()); //wprintf(L"\n+++++++++ print characters of SINGLE +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); for ( int k=0; k<(int)V[0].size(); k++) { if (V[0].size()>0) { //wprintf(L" row 1 (US) ...... %s .. %s .. %s .. %s .. %s --- \n", V[0][k][0].c_str(), V[0][k][1].c_str() , V[0][k][2].c_str() , V[0][k][3].c_str() , V[0][k][4].c_str() ); } } wprintf(L" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); return true; } bool test_dw(v_dw_3D &V) { std::string extra = " "; wprintf(L" +++++++ dimensions of whole Vector in test_dw()\t\t\t\t\t\t\t %li..%li..%li\n", V.size(), V[0].size(),V[0][0].size()); wprintf(L"\n+++++++++ print some characters of US and Other +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); for ( int k=0; k<(int)V[0].size(); k++) { if(V[0][k][2] != V[1][k][2] ) extra = " *** "; else extra = " "; if (V[0].size()>0) { //wprintf(L" row (US) ...... %i .. %i (%c) .. %i (%c) .. --- ",V[0][k][0] , V[0][k][1] , V[0][k][1] , V[0][k][2] , V[0][k][2] ); //wprintf(L" \n"); //wprintf(L" row (Other)..... %i .. %i (%c) .. %i (%c) .. %s \n", V[1][k][0] , V[1][k][1], V[1][k][1] , V[1][k][2], V[1][k][2] , extra.c_str()); //wprintf(L" \n"); } } wprintf(L"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); return true; } bool test_single_dw(v_dw_3D &V) { std::string extra = " "; wprintf(L" +++++++ dimensions of single Vector in test_single_dw()\t\t\t\t\t\t %li..%li..%li\n", V.size(), V[0].size(),V[0][0].size()); wprintf(L"\n +++++++++ print characters of SINGLE DW ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); for ( int k=0; k<(int)V[0].size(); k++) { if (V[0].size()>0) { wprintf(L" row (US) ...... %i .. %i (%c) .. %i (%c) ........ \n", V[0][k][0] , V[0][k][1] ,V[0][k][1] , V[0][k][2], V[0][k][2] ); } } wprintf(L" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"); return true; } // _S2 unused /* bool extract_difference( v_str_3D &All_Vector) { // TODO define which Folder; find better name std::ofstream Map_File("Map_US.txt"); std::string diff =" "; std::wstring diff_w = L" "; wprintf(L"-----------------------------------------------------------------------------------------------------------------------------------------------\n"); std::wcout << "Nr of " << "\tCharacter US"<< "\tCharacter US"<<"\t\tCharacter Other"<<"\t Character Other"<< "\tdifference\n"; std::wcout << "Key: " << "\t(no shift) " << "\t(shift) "<< "\t\t(no shift)" << "\t (shift)\n" ; wprintf(L"-----------------------------------------------------------------------------------------------------------------------------------------------\n"); Map_File <<"--------------------------------------------------------------------------------------------------------------------------------------------\n"; Map_File << "Nr of " << "\tCharacter US"<< "\t Character US"<<"\t\tCharacter Other"<<"\t Character Other"<< "\tdifference\n"; Map_File << "Key: " << "\t(no shift) " << "\t (shift) "<< "\t\t (no shift)" << "\t (shift)\n" ; Map_File <<"--------------------------------------------------------------------------------------------------------------------------------------------\n"; for ( int k=0; k<(int)All_Vector[0].size(); k++) { if (All_Vector[0][k][1] == All_Vector[1][k][1]) { diff = " "; diff_w = L" "; } else { diff = "*** "; diff_w = L"*** "; } wprintf(L" %d\t%s\t\t%s\t\t|\t%s\t\t %s\t\t\t%S\n", stoi(All_Vector[1][k][0]), All_Vector[0][k][1].c_str(), All_Vector[0][k][2].c_str(), All_Vector[1][k][1].c_str(), All_Vector[1][k][2].c_str(), diff_w.c_str()); Map_File << All_Vector[0][k][0] << " \t"<<+(*(All_Vector[0][k][1].c_str()))<< "\t("<< All_Vector[0][k][1] <<")"< Other: %d (US): %s, %s ---- (other):%s, %s \n",stoi(All_Vector[1][i][0]),All_Vector[0][i][1].c_str(),All_Vector[0][i][2].c_str(),All_Vector[1][i][1].c_str(),All_Vector[1][i][2].c_str()); return All_Vector[1][i][j] ; } } } std::cout << "US -> Other: (" << in << ": no match)\n"; return "-"; } std::string get_US_Char_FromOther(std::string in , v_str_3D &All_Vector) { std::string diff; // find correct row of char in other for( int i=0; i< (int)All_Vector[1].size();i++) { for( int j=1; j< (int)All_Vector[1][0].size();j++) { if ( All_Vector[1][i][j] == in ) { if ( All_Vector[0][i][j] != All_Vector[1][i][j]) diff =" ** "; std::cout << "Other -> US: "<< std::setw(5)< US: (" << in << ": no match)\n"; return "-"; } std::string getKeyNrOf_USChar(std::string in , v_str_3D &All_Vector) { // find correct row of char in US for( int i=0; i< (int)All_Vector[0].size();i++) { for( int j=1; j< (int)All_Vector[0][0].size();j++) { if ( All_Vector[0][i][j] == in ) { std::cout << "KeyNr of US char: \t"<< All_Vector[0][i][j] << " -> " << All_Vector[0][i][0] <<"\n"; return All_Vector[0][i][0] ; } } } return "-"; } std::string getKeyNrOf_OtherChar(std::string in , v_str_3D &All_Vector) { // find correct row of char in US for( int i=0; i< (int)All_Vector[1].size();i++) { for( int j=1; j< (int)All_Vector[1][0].size();j++) { if ( All_Vector[1][i][j] == in ) { std::cout << "KeyNr of Other char : \t"<< All_Vector[1][i][j] << " -> " << All_Vector[1][i][0] <<"\n"; return All_Vector[1][i][0] ; } } } return "-"; } void test_in_out(v_str_3D &All_Vector) { std::string diff; printf("-----------------------------------------------------------------------------------------------------------------------------------------------\n"); //checks mapping between US and other std::string a = get_Other_Char_FromUS( "z", All_Vector); std::string aa = get_Other_Char_FromUS( "Z", All_Vector); std::string aaa = get_Other_Char_FromUS( "y", All_Vector); std::string aaaa = get_Other_Char_FromUS( "Y", All_Vector); std::string b = get_US_Char_FromOther( "z", All_Vector); std::string bb = get_US_Char_FromOther( "Z", All_Vector); std::string bbb = get_US_Char_FromOther( "y", All_Vector); std::string bbbb = get_US_Char_FromOther( "Y", All_Vector); std::string c = getKeyNrOf_OtherChar( "z", All_Vector); std::string cc = getKeyNrOf_OtherChar( "Z", All_Vector); std::string ccc = getKeyNrOf_OtherChar( "y", All_Vector); std::string cccc = getKeyNrOf_OtherChar( "Y", All_Vector); std::string d = getKeyNrOf_USChar( "z", All_Vector); std::string dd = getKeyNrOf_USChar( "Z", All_Vector); std::string ddd = getKeyNrOf_USChar( "y", All_Vector); std::string dddd = getKeyNrOf_USChar( "Y", All_Vector); std::cout << "get_Other_Char_FromUS z-Z-y-Y: " << ".." << a<< ".." <