From c1a24e9dc38e105d8b21ef132f7ec79b9d41f99d Mon Sep 17 00:00:00 2001 From: Philipp Reh Date: Sat, 1 Aug 2009 15:29:41 +0200 Subject: [PATCH] =?utf8?q?Added=20translation=20of=20=E3=83=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- kana2romaji.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/kana2romaji.cpp b/kana2romaji.cpp index 17c9aea..646e47c 100644 --- a/kana2romaji.cpp +++ b/kana2romaji.cpp @@ -331,6 +331,8 @@ void initRomaji() { romaji["−"] = "-"; romaji["―"] = "-"; romaji[" "] = " "; + + romaji["ー"] = "\3"; } void remove_quote_1( @@ -359,7 +361,7 @@ void kana2romaji(const string& kana, string& rom) { if (trans == romaji.end()) { rom += ch; if (ch.size() > 1) - cout << "Don't know how to translate '" << ch << "' in '" << kana << "' to romaji." << endl; + cout << "Don't know how to translate '" << ch << "' in '" << kana << "' to romaji.\n"; } else rom += trans->second; @@ -431,4 +433,15 @@ void kana2romaji(const string& kana, string& rom) { --pos; } } + else if (rom[pos] == '\3') + { + if(pos == 0) + { + cout << "ー is the first letter of a word. Don't know how to translate this.\n"; + rom.erase(pos); + --pos; + } + else + rom[pos] = rom[pos-1]; + } } -- 2.30.2