Last active
June 6, 2016 00:13
-
-
Save dvtate/61b5900cc0dc206467a567c0c2bcbd87 to your computer and use it in GitHub Desktop.
runic transliteration program for tokipona written in C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<boost/algorithm/string/replace.hpp> //boost::replace_all() | |
std::string texttorunes(std::string); | |
std::string runestotext(std::string); | |
std::string textinput; | |
int main(){ | |
std::cout <<"Toki Pona Runes tool\n\n"; | |
std::cout <<"Latin -> Runic:\n"; | |
std::getline(std::cin,textinput); | |
std::cout <<"==> " <<texttorunes(textinput) <<std::endl; | |
std::cout <<"\nRunic -> Latin:\n"; | |
std::getline(std::cin,textinput); | |
std::cout <<"==> " <<runestotext(textinput) <<std::endl; | |
return 0; | |
} | |
std::string texttorunes(std::string text){ | |
boost::replace_all(text, "p", "ᛈ"); | |
boost::replace_all(text, "t", "ᛏ"); | |
boost::replace_all(text, "k", "ᚲ"); | |
boost::replace_all(text, "s", "ᛊ"); | |
boost::replace_all(text, "m", "ᛗ"); | |
boost::replace_all(text, "n", "ᚾ"); | |
boost::replace_all(text, "l", "ᛚ"); | |
boost::replace_all(text, "j", "ᛃ"); | |
boost::replace_all(text, "w", "ᚹ"); | |
boost::replace_all(text, "a", "ᚨ"); | |
boost::replace_all(text, "e", "ᛖ"); | |
boost::replace_all(text, "i", "ᛁ"); | |
boost::replace_all(text, "o", "ᛟ"); | |
boost::replace_all(text, "u", "ᚢ"); | |
boost::replace_all(text, ".", "᛫"); | |
return text; | |
} | |
std::string runestotext(std::string text){ | |
boost::replace_all(text, "ᛈ", "p"); | |
boost::replace_all(text, "ᛏ", "t"); | |
boost::replace_all(text, "ᚲ", "k"); | |
boost::replace_all(text, "ᛊ", "s"); | |
boost::replace_all(text, "ᛗ", "m"); | |
boost::replace_all(text, "ᚾ", "n"); | |
boost::replace_all(text, "ᛚ", "l"); | |
boost::replace_all(text, "ᛃ", "j"); | |
boost::replace_all(text, "ᚹ", "w"); | |
boost::replace_all(text, "ᚨ", "a"); | |
boost::replace_all(text, "ᛖ", "e"); | |
boost::replace_all(text, "ᛁ", "i"); | |
boost::replace_all(text, "ᛟ", "o"); | |
boost::replace_all(text, "ᚢ", "u"); | |
boost::replace_all(text, "᛫", "."); | |
return text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment