[aquaskk-changes 265] CVS update: AquaSKK

Back to archive index

Tomotaka SUWA t-suw****@users*****
2006年 12月 8日 (金) 23:38:57 JST


Index: AquaSKK/AsciiConversionMode.cpp
diff -u AquaSKK/AsciiConversionMode.cpp:1.7 AquaSKK/AsciiConversionMode.cpp:1.7.2.1
--- AquaSKK/AsciiConversionMode.cpp:1.7	Mon Jun 12 23:14:48 2006
+++ AquaSKK/AsciiConversionMode.cpp	Fri Dec  8 23:38:57 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: AsciiConversionMode.cpp,v 1.7 2006/06/12 14:14:48 t-suwa Exp $
+  $Id: AsciiConversionMode.cpp,v 1.7.2.1 2006/12/08 14:38:57 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -252,11 +252,7 @@
 	    sendCurrentCandidateToServerToRegister();
 
 	    // „šû‚³‚ê‚È‚¢‚ªA‹­§“I‚ÉŠm’肳‚¹‚éB
-	    if(ClientConfiguration::theInstance().useNumericConversion()) {
-		parent->fix(numconv_.Apply(candidates[current_candidate_index]));
-	    } else {
-		parent->fix(candidates[current_candidate_index]);
-	    }
+	    parent->fix(convertNumeric(numconv_, candidates[current_candidate_index]));
 
 	    parent->setEnabledAsciiConversionMode(false);
 	    initialize();
@@ -316,10 +312,7 @@
     else if(status == STATUS_BLACK) {
 	// Œ»Ý‚ÌŒó•â‚ðŠm’肵‚Ä‚©‚çÅŒã‚Ì•¶Žš‚ðíœB
 	// ‚»‚µ‚ú‰»‚µ‚ďI—¹B
-	CppCFString str_to_fix(candidates[current_candidate_index]);
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    str_to_fix = numconv_.Apply(str_to_fix);
-	}
+	CppCFString str_to_fix(convertNumeric(numconv_, candidates[current_candidate_index]));
 	str_to_fix.eraseLast(1);
 
 	// ŽI‚É‘—M
@@ -410,11 +403,7 @@
 	sendCurrentCandidateToServerToRegister();
 	
 	// Œ»Ý‚ÌŒó•â‚ðŠm’èB
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    parent->fix(numconv_.Apply(candidates[current_candidate_index]));
-	} else {
-	    parent->fix(candidates[current_candidate_index]);
-	}
+	parent->fix(convertNumeric(numconv_, candidates[current_candidate_index]));
 	
 	if(status == STATUS_BLACK_WITH_WINDOW) {
 	    // ƒEƒCƒ“ƒhƒE‚ð•Â‚¶‚éB
@@ -553,10 +542,8 @@
 	return CppCFString().append(0x25bd).append(index);
     }
     else if(status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
-	CppCFString str = candidates[current_candidate_index];
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    str = numconv_.Apply(str);
-	}
+	CppCFString str(convertNumeric(numconv_, candidates[current_candidate_index]));
+
 	// ¥Œ»Ý‚ÌŒó•â
 	return CppCFString().append(0x25bc).append(str);
     }
@@ -574,19 +561,13 @@
 	result = index;
     }
     else if(status == STATUS_BLACK) {
-	result = candidates[current_candidate_index];
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    result = numconv_.Apply(candidates[current_candidate_index]);
-	}
+	result = convertNumeric(numconv_, candidates[current_candidate_index]);
 
 	// ŽI‚É‘—M
 	sendCurrentCandidateToServerToRegister();
     }
     else if(status == STATUS_BLACK_WITH_WINDOW) {
-	result = candidates[current_candidate_index];
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    result = numconv_.Apply(result);
-	}
+	result = convertNumeric(numconv_, candidates[current_candidate_index]);
 
 	// ŽI‚É‘—M
 	sendCurrentCandidateToServerToRegister();
@@ -629,11 +610,13 @@
     ::askServerTheCandidates(query, candidates);
 
     // ”’l•ÏŠ·‚ª—LŒø‚©H
-    if(ClientConfiguration::theInstance().useNumericConversion() && numconv_.Setup(index)) {
+    if(ClientConfiguration::theInstance().useNumericConversion() &&
+       numconv_.Setup(index.toStdString(kCFStringEncodingUTF8))) {
+	CppCFString normalized(numconv_.NormalizedKey().c_str(), kCFStringEncodingUTF8);
 	std::vector<CppCFString> result;
 	CppCFData cfdata;
 
-	cfdata.own(CppCFString().append('-').append(numconv_.NormalizedKey()).toCFData());
+	cfdata.own(CppCFString().append('-').append(normalized).toCFData());
 
 	::askServerTheCandidates(cfdata, result);
 
@@ -670,11 +653,7 @@
     std::vector<CppCFString> cands;
     std::vector<CppCFString>::const_iterator ite;
     for(ite = candidates.begin() + (show_cands_window_after_Nth_cand - 1); ite != candidates.end(); ++ ite) {
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    cands.push_back(numconv_.Apply(*ite));
-	} else {
-	    cands.push_back(*ite);
-	}
+	cands.push_back(convertNumeric(numconv_, *ite));
     }
     
     ::openCandidatesWindow(join(SKK_MSG_DELIMITER, cands),
Index: AquaSKK/ChangeLog
diff -u AquaSKK/ChangeLog:1.33.2.3 AquaSKK/ChangeLog:1.33.2.4
--- AquaSKK/ChangeLog:1.33.2.3	Sat Dec  2 16:54:13 2006
+++ AquaSKK/ChangeLog	Fri Dec  8 23:38:57 2006
@@ -1,3 +1,16 @@
+2006-12-08  Tomotaka SUWA  <t.suw****@mac*****>
+
+	* NumericConverter.*: UTF-8 ‰»BCppCFString ‚ð std::string ‚É’uŠ·B
+
+	* KanjiConversionMode.cpp (convertNumeric): V‹K’ljÁBCppCFString
+	Ì std::string •ÏŠ·‚È‚Ç‚ðs‚È‚¤ƒ†[ƒeƒBƒŠƒeƒBŠÖ”B
+
+	* AsciiConversionMode.cpp: convertNumeric ‚ðŽg‚¤‚悤‚ɕύXB
+
+	* Dictionary.h: SKK ƒGƒ“ƒgƒŠ‚𐳂µ‚­˜AŒ‹‚Å‚«‚Ä‚¢‚È‚¢•s‹ï‡‚ðC³B
+
+	* skkserv.cpp: Œó•â” 0 Œ‚Ì”»’èðŒ‚ðC³B
+
 2006-12-02  Tomotaka SUWA  <t.suw****@mac*****>
 
 	* Dictionary.h: SKK Ž«‘‘€ì—p‚̃†[ƒeƒBƒŠƒeƒBƒNƒ‰ƒX‚ðƒŠƒtƒ@ƒNƒ^ƒŠ
Index: AquaSKK/Dictionary.h
diff -u AquaSKK/Dictionary.h:1.4.2.2 AquaSKK/Dictionary.h:1.4.2.3
--- AquaSKK/Dictionary.h:1.4.2.2	Sat Dec  2 16:54:13 2006
+++ AquaSKK/Dictionary.h	Fri Dec  8 23:38:57 2006
@@ -1,5 +1,5 @@
 /* -*- C++ -*-
-  $Id: Dictionary.h,v 1.4.2.2 2006/12/02 07:54:13 t-suwa Exp $
+  $Id: Dictionary.h,v 1.4.2.3 2006/12/08 14:38:57 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -78,7 +78,7 @@
 
     template<typename T>
     std::string operator()(const std::string& seed, const T& obj) const {
-	return seed + delimiter_ + obj.Description();
+	return seed + obj.Description() + delimiter_;
     }
 };
 
@@ -89,7 +89,7 @@
 
     template<typename T>
     std::string operator()(const std::string& seed, const T& obj) const {
-	return seed + delimiter_ + obj.Word();
+	return seed + obj.Word() + delimiter_;
     }
 };
 
@@ -509,24 +509,28 @@
 
     std::string Candidate(char delimiter = '/') const {
 	std::string ret;
+
 	ret = std::accumulate(candidates_.begin(), candidates_.end(), ret, ConcatDescription(delimiter));
+	ret = std::accumulate(hints_.begin(), hints_.end(), ret, ConcatDescription(delimiter));
 
-	if(hints_.empty()) {
-	    return ret + delimiter;
+	if(ret.empty()) {
+	    ret = delimiter;
 	}
 
-	return std::accumulate(hints_.begin(), hints_.end(), ret, ConcatDescription(delimiter)) + delimiter;
+	return delimiter + ret;
     }
 
     std::string Join(char delimiter = '/') const {
 	std::string ret;
+
 	ret = std::accumulate(candidates_.begin(), candidates_.end(), ret, ConcatWord(delimiter));
+	ret = std::accumulate(hints_.begin(), hints_.end(), ret, ConcatWord(delimiter));
 
-	if(hints_.empty()) {
-	    return ret + delimiter;
+	if(ret.empty()) {
+	    ret = delimiter;
 	}
 
-	return std::accumulate(hints_.begin(), hints_.end(), ret, ConcatWord(delimiter)) + delimiter;
+	return delimiter + ret;
     }
 
     std::string Description() const {
Index: AquaSKK/DictionarySet.cpp
diff -u AquaSKK/DictionarySet.cpp:1.5.2.3 AquaSKK/DictionarySet.cpp:1.5.2.4
--- AquaSKK/DictionarySet.cpp:1.5.2.3	Sat Dec  2 16:54:13 2006
+++ AquaSKK/DictionarySet.cpp	Fri Dec  8 23:38:57 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: DictionarySet.cpp,v 1.5.2.3 2006/12/02 07:54:13 t-suwa Exp $
+  $Id: DictionarySet.cpp,v 1.5.2.4 2006/12/08 14:38:57 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -257,12 +257,8 @@
 	    continue;
 	}
 
-	// 分解
-	SKKEntry entry = SKKEntry::ParseOkuriNasi(key, result);
-
-	for(SKKCandidate cand = entry.First(); !cand.IsEmpty(); cand = entry.Next()) {
-	    match.Add(cand);
-	}
+	// 追加
+	match.Add(SKKEntry::ParseOkuriNasi(key, result));
     }
 
     return match.Join(result_delimiter);
Index: AquaSKK/Info-AquaSKKInputMethod.plist
diff -u AquaSKK/Info-AquaSKKInputMethod.plist:1.10.2.2 AquaSKK/Info-AquaSKKInputMethod.plist:1.10.2.3
--- AquaSKK/Info-AquaSKKInputMethod.plist:1.10.2.2	Tue Nov 28 23:36:08 2006
+++ AquaSKK/Info-AquaSKKInputMethod.plist	Fri Dec  8 23:38:57 2006
@@ -19,11 +19,11 @@
 	<key>CFBundlePackageType</key>
 	<string>thng</string>
 	<key>CFBundleShortVersionString</key>
-	<string>3.2 BETA</string>
+	<string>utf-8 1.1</string>
 	<key>CFBundleSignature</key>
 	<string>askk</string>
 	<key>CFBundleVersion</key>
-	<string>2006-11-28</string>
+	<string>2006-12-09</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 	<key>tsInputMethodIconFileKey</key>
Index: AquaSKK/Info-AquaSKKServer.plist
diff -u AquaSKK/Info-AquaSKKServer.plist:1.10.2.2 AquaSKK/Info-AquaSKKServer.plist:1.10.2.3
--- AquaSKK/Info-AquaSKKServer.plist:1.10.2.2	Tue Nov 28 23:36:08 2006
+++ AquaSKK/Info-AquaSKKServer.plist	Fri Dec  8 23:38:57 2006
@@ -19,11 +19,11 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>3.2 BETA</string>
+	<string>utf-8 1.1</string>
 	<key>CFBundleSignature</key>
 	<string>askk</string>
 	<key>CFBundleVersion</key>
-	<string>2006-11-28</string>
+	<string>2006-12-09</string>
 	<key>NSMainNibFile</key>
 	<string>Principal</string>
 	<key>NSPrincipalClass</key>
Index: AquaSKK/KanjiConversionMode.cpp
diff -u AquaSKK/KanjiConversionMode.cpp:1.8.2.1 AquaSKK/KanjiConversionMode.cpp:1.8.2.2
--- AquaSKK/KanjiConversionMode.cpp:1.8.2.1	Sat Dec  2 16:54:13 2006
+++ AquaSKK/KanjiConversionMode.cpp	Fri Dec  8 23:38:57 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: KanjiConversionMode.cpp,v 1.8.2.1 2006/12/02 07:54:13 t-suwa Exp $
+  $Id: KanjiConversionMode.cpp,v 1.8.2.2 2006/12/08 14:38:57 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -407,11 +407,7 @@
 	    sendCurrentCandidateToServerToRegister();
 
 	    // Šm’è
-	    if(ClientConfiguration::theInstance().useNumericConversion()) {
-		parent->fix(numconv_.Apply(candidates[current_candidate_index]));
-	    } else {
-		parent->fix(candidates[current_candidate_index]);
-	    }
+	    parent->fix(convertNumeric(numconv_, candidates[current_candidate_index]));
 
 	    initialize();
 	    return handleInput(skkchar); // Ä“Ë“ü
@@ -475,11 +471,7 @@
 	    sendCurrentCandidateToServerToRegister();
 
 	    // „§‚³‚ê‚È‚¢‚ªA‹­§“I‚ÉŠm’肳‚¹‚éB
-	    if(ClientConfiguration::theInstance().useNumericConversion()) {
-		parent->fix(numconv_.Apply(candidates[current_candidate_index]));
-	    } else {
-		parent->fix(candidates[current_candidate_index]);
-	    }
+	    parent->fix(convertNumeric(numconv_, candidates[current_candidate_index]));
 
 	    parent->setEnabledKanjiMode(false);
 	    initialize();
@@ -584,10 +576,7 @@
     else if (status == STATUS_BLACK) {
 	// Œ»Ý‚ÌŒó•â‚ðŠm’肵‚Ä‚©‚çÅŒã‚Ì•¶Žš‚ðíœB
 	// ‚»‚µ‚ú‰»‚µ‚ďI—¹B
-	CppCFString str_to_fix(candidates[current_candidate_index]);
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    str_to_fix = numconv_.Apply(str_to_fix);
-	}
+	CppCFString str_to_fix(convertNumeric(numconv_, candidates[current_candidate_index]));
 	str_to_fix.eraseLast(1);
 	
 	// ŽI‚É‘—M
@@ -693,11 +682,7 @@
 	sendCurrentCandidateToServerToRegister();
 	
 	// Œ»Ý‚ÌŒó•â‚ðŠm’èB
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    parent->fix(numconv_.Apply(candidates[current_candidate_index]));
-	} else {
-	    parent->fix(candidates[current_candidate_index]);
-	}
+	parent->fix(convertNumeric(numconv_, candidates[current_candidate_index]));
 	
 	if (status == STATUS_BLACK_WITH_WINDOW) {
 	    // ƒEƒCƒ“ƒhƒE‚ð•Â‚¶‚éB
@@ -888,10 +873,7 @@
 	return CppCFString().append(0x25bd).append(root_to_display).append('*').append(okuri_to_display);
     }
     else if (status == STATUS_BLACK || status == STATUS_BLACK_WITH_WINDOW) {
-	CppCFString str = candidates[current_candidate_index];
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    str = numconv_.Apply(str);
-	}
+	CppCFString str = convertNumeric(numconv_, candidates[current_candidate_index]);
 	// ¥Œ»Ý‚ÌŒó•â
 	return CppCFString().append(0x25bc).append(str);
     }
@@ -913,19 +895,13 @@
 	result = root + okuri;
     }
     else if (status == STATUS_BLACK) {
-	result = candidates[current_candidate_index];
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    result = numconv_.Apply(candidates[current_candidate_index]);
-	}
+	result = convertNumeric(numconv_, candidates[current_candidate_index]);
 
 	// ŽI‚É‘—M
 	sendCurrentCandidateToServerToRegister();
     }
     else if (status == STATUS_BLACK_WITH_WINDOW) {
-	result = candidates[current_candidate_index];
-	if(ClientConfiguration::theInstance().useNumericConversion()) {
-	    result = numconv_.Apply(result);
-	}
+	result = convertNumeric(numconv_, candidates[current_candidate_index]);
 
 	// ŽI‚É‘—M
 	sendCurrentCandidateToServerToRegister();
@@ -1018,11 +994,13 @@
     }
 
     // ”’l•ÏŠ·‚ª—LŒø‚©H
-    if(!hasOkuri && ClientConfiguration::theInstance().useNumericConversion() && numconv_.Setup(root)) {
+    if(!hasOkuri && ClientConfiguration::theInstance().useNumericConversion() &&
+       numconv_.Setup(root.toStdString(kCFStringEncodingUTF8))) {
+	CppCFString normalized(numconv_.NormalizedKey().c_str(), kCFStringEncodingUTF8);
 	std::vector<CppCFString> result;
 	CppCFData cfdata;
 
-	cfdata.own(CppCFString().append('-').append(numconv_.NormalizedKey()).toCFData());
+	cfdata.own(CppCFString().append('-').append(normalized).toCFData());
 
 	::askServerTheCandidates(cfdata, result);
 
@@ -1110,10 +1088,11 @@
     CppCFString str;
     NumericConverter conv;
 
-    if(ClientConfiguration::theInstance().useNumericConversion() && conv.Setup(index)) {
-	CppCFString applied = conv.Apply(kanji);
+    if(ClientConfiguration::theInstance().useNumericConversion() &&
+       conv.Setup(index.toStdString(kCFStringEncodingUTF8))) {
+	CppCFString applied(convertNumeric(conv, kanji));
 	if(applied != kanji) {
-	    str = conv.NormalizedKey();
+	    str = CppCFString(conv.NormalizedKey().c_str(), kCFStringEncodingUTF8);
 	} else {
 	    str = index;
 	}
@@ -1137,11 +1116,7 @@
     } else {
 	for(std::vector<CppCFString>::const_iterator ite = candidates.begin() + (show_cands_window_after_Nth_cand - 1);
 	    ite != candidates.end(); ++ ite) {
-	    if(ClientConfiguration::theInstance().useNumericConversion()) {
-		cands_without_okuri.push_back(numconv_.Apply(*ite));
-	    } else {
-		cands_without_okuri.push_back(*ite);
-	    }
+	    cands_without_okuri.push_back(convertNumeric(numconv_, *ite));
 	}
     }
 
@@ -1250,7 +1225,7 @@
     std::set<CppCFString> check;
     std::vector<CppCFString> result;
 
-    check.insert(numconv.OriginalKey());
+    check.insert(CppCFString(numconv.OriginalKey().c_str(), kCFStringEncodingUTF8));
 
     // €”õ
     for(std::vector<CppCFString>::iterator iter = master.begin(); iter != master.end(); ++ iter) {
@@ -1262,7 +1237,7 @@
 
     // ƒ}[ƒW
     for(std::vector<CppCFString>::iterator iter = cands.begin(); iter != cands.end(); ++ iter) {
-	CppCFString target(numconv.Apply(*iter));
+	CppCFString target(convertNumeric(numconv, *iter));
 	if(check.find(target) != check.end()) continue;
 	
 	check.insert(check.lower_bound(target), target);
@@ -1270,3 +1245,13 @@
     }
     result.swap(master);
 }
+
+CppCFString convertNumeric(const NumericConverter& numconv, const CppCFString& candidate) {
+    if(!ClientConfiguration::theInstance().useNumericConversion()) {
+	return candidate;
+    }
+
+    std::string result(numconv.Apply(candidate.toStdString(kCFStringEncodingUTF8)));
+
+    return CppCFString(result.c_str(), kCFStringEncodingUTF8);
+}
Index: AquaSKK/KanjiConversionMode.h
diff -u AquaSKK/KanjiConversionMode.h:1.6 AquaSKK/KanjiConversionMode.h:1.6.2.1
--- AquaSKK/KanjiConversionMode.h:1.6	Mon Jun 12 23:14:48 2006
+++ AquaSKK/KanjiConversionMode.h	Fri Dec  8 23:38:57 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: KanjiConversionMode.h,v 1.6 2006/06/12 14:14:48 t-suwa Exp $
+  $Id: KanjiConversionMode.h,v 1.6.2.1 2006/12/08 14:38:57 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -122,5 +122,6 @@
 CppCFData newCFDataRefWithWindowID(unsigned window_id);
 void mergeCandidates(const NumericConverter& numconv,
 		     std::vector<CppCFString>& master, std::vector<CppCFString>& cands);
+CppCFString convertNumeric(const NumericConverter& numconv, const CppCFString& candidate);
 
 #endif	// INC__KanjiConversionMode__
Index: AquaSKK/NumericConverter.cpp
diff -u AquaSKK/NumericConverter.cpp:1.3 AquaSKK/NumericConverter.cpp:1.3.2.1
--- AquaSKK/NumericConverter.cpp:1.3	Sat Jul  1 08:44:30 2006
+++ AquaSKK/NumericConverter.cpp	Fri Dec  8 23:38:57 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: NumericConverter.cpp,v 1.3 2006/06/30 23:44:30 t-suwa Exp $
+  $Id: NumericConverter.cpp,v 1.3.2.1 2006/12/08 14:38:57 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -23,56 +23,86 @@
 #include "NumericConverter.h"
 
 // ======================================================================
-// 数値変換を実装するユーティリティ関数
+// 数値変換を実装するユーティリティ関数
 // ======================================================================
 
-// 1024 → 1024
+// 1024 → 1024
 std::string ConvertType1(const std::string& src) {
     std::string result;
 
     for(unsigned i = 0; i < src.size(); ++ i) {
-	result += 0xa3;
-	result += (src[i] + 0x80);
+	switch(src[i]) {
+	case '0':
+	    result += "0";
+	    break;
+	case '1':
+	    result += "1";
+	    break;
+	case '2':
+	    result += "ï¼’";
+	    break;
+	case '3':
+	    result += "3";
+	    break;
+	case '4':
+	    result += "ï¼”";
+	    break;
+	case '5':
+	    result += "5";
+	    break;
+	case '6':
+	    result += "ï¼–";
+	    break;
+	case '7':
+	    result += "ï¼—";
+	    break;
+	case '8':
+	    result += "8";
+	    break;
+	case '9':
+	    result += "ï¼™";
+	    break;
+	}
     }
 
     return result;
 }
 
-// 1024 → 一〇二四
+// 1024 → 一〇二四
 std::string ConvertType2(const std::string& src) {
     std::string result;
 
     for(unsigned i = 0; i < src.size(); ++ i) {
 	switch(src[i]) {
 	case '0':
-	    result += "〇";
+	    result += "〇";
 	    break;
 	case '1':
-	    result += "一";
+	    result += "一";
 	    break;
 	case '2':
-	    result += "二";
+	    result += "二";
 	    break;
 	case '3':
-	    result += "三";
+	    result += "三";
 	    break;
 	case '4':
-	    result += "四";
+	    result += "å››";
 	    break;
 	case '5':
-	    result += "五";
+	    result += "五";
 	    break;
 	case '6':
-	    result += "六";
+	    result += "å…­";
 	    break;
 	case '7':
-	    result += "七";
+	    result += "七";
 	    break;
 	case '8':
-	    result += "八";
+	    result += "å…«";
 	    break;
 	case '9':
-	    result += "九";
+	    result += "九";
 	    break;
 	}
     }
@@ -80,66 +110,66 @@
     return result;
 }
 
-// 1024 → 千二十四
+// 1024 → 千二十四
 std::string ConvertType3(const std::string& src) {
-    const char* unit1[] = { "", "万", "億", "兆", "京", "垓" };
-    const char* unit2[] = { "十", "百", "千" };
+    const char* unit1[] = { "", "万", "億", "兆", "京", "垓" };
+    const char* unit2[] = { "十", "百", "千" };
     std::string result;
 
     if(src.size() == 1 && src[0] == '0') {
-	return "〇";
+	return "〇";
     }
 
     for(unsigned i = src.find_first_not_of("0"); i < src.size(); ++ i) {
 	switch(src[i]) {
 	case '2':
-	    result += "二";
+	    result += "二";
 	    break;
 	case '3':
-	    result += "三";
+	    result += "三";
 	    break;
 	case '4':
-	    result += "四";
+	    result += "å››";
 	    break;
 	case '5':
-	    result += "五";
+	    result += "五";
 	    break;
 	case '6':
-	    result += "六";
+	    result += "å…­";
 	    break;
 	case '7':
-	    result += "七";
+	    result += "七";
 	    break;
 	case '8':
-	    result += "八";
+	    result += "å…«";
 	    break;
 	case '9':
-	    result += "九";
+	    result += "九";
 	    break;
 	}
 
 	int distance = src.size() - i;
 
-	// 「十、百、千」以外の位
+	// 「十、百、千」以外の位
 	if(distance > 4 && (distance - 1) % 4 == 0) {
 	    if(src[i] == '1') {
-		result += "一";
+		result += "一";
 	    }
 	    result += unit1[(distance - 1) / 4];
 	} else {
-	    // 十の位以上
+	    // 十の位以上
 	    if(distance > 1) {
 		if(src[i] != '0') {
-		    // 「一千万」の処理
+		    // 「一千万」の処理
 		    if(src[i] == '1' && distance > 4 && (distance - 2) % 4 == 2) {
-			result += "一";
+			result += "一";
 		    }
 		    result += unit2[(distance - 2) % 4];
 		}
 	    } else {
-		// 一の位
+		// 一の位
 		if(src[i] == '1') {
-		    result += "一";
+		    result += "一";
 		}
 	    }
 	}
@@ -148,59 +178,59 @@
     return result;
 }
 
-// 数値再変換(AquaSKK では無視)
+// 数値再変換(AquaSKK では無視)
 std::string ConvertType4(const std::string& src) {
     return src;
 }
 
-// 1024 → 壱阡弐拾四
+// 1024 → 壱阡弐拾四
 std::string ConvertType5(const std::string& src) {
-    const char* unit1[] = { "", "萬", "億", "兆", "京", "垓" };
-    const char* unit2[] = { "拾", "百", "阡" };
+    const char* unit1[] = { "", "萬", "億", "兆", "京", "垓" };
+    const char* unit2[] = { "拾", "百", "阡" };
     std::string result;
 
     if(src.size() == 1 && src[0] == '0') {
-	return "零";
+	return "零";
     }
 
     for(unsigned i = src.find_first_not_of("0"); i < src.size(); ++ i) {
 	switch(src[i]) {
 	case '1':
-	    result += "壱";
+	    result += "壱";
 	    break;
 	case '2':
-	    result += "弐";
+	    result += "弐";
 	    break;
 	case '3':
-	    result += "参";
+	    result += "参";
 	    break;
 	case '4':
-	    result += "四";
+	    result += "å››";
 	    break;
 	case '5':
-	    result += "伍";
+	    result += "伍";
 	    break;
 	case '6':
-	    result += "六";
+	    result += "å…­";
 	    break;
 	case '7':
-	    result += "七";
+	    result += "七";
 	    break;
 	case '8':
-	    result += "八";
+	    result += "å…«";
 	    break;
 	case '9':
-	    result += "九";
+	    result += "九";
 	    break;
 	}
 
 	int distance = src.size() - i;
 
-	// 「十、百、千」以外の位
+	// 「十、百、千」以外の位
 	if(distance > 4 && (distance - 1) % 4 == 0) {
 	    result += unit1[(distance - 1) / 4];
 	} else {
-	    // 十の位以上
+	    // 十の位以上
 	    if(distance > 1) {
 		if(src[i] != '0') {
 		    result += unit2[(distance - 2) % 4];
@@ -212,25 +242,25 @@
     return result;
 }
 
-// 34 → 3四
+// 34 → 3四
 std::string ConvertType9(const std::string& src) {
     return  ConvertType1(src.substr(0, 1)) + ConvertType2(src.substr(1, 1));
 }
 
 // ======================================================================
-// クラスインタフェース
+// クラスインタフェース
 // ======================================================================
 
-// 検索キーの正規化
-bool NumericConverter::Setup(const CppCFString& query) {
+// 検索キーの正規化
+bool NumericConverter::Setup(const std::string& query) {
     params_.clear();
     original_ = query;
 
     const char* numbers = "0123456789";
-    std::string src(query.toStdString());
+    std::string src(query);
     std::string::size_type from = src.find_first_of(numbers);
 
-    // 連続した数値を見つけたら vector に格納し、"#" に正規化
+    // 連続した数値を見つけたら vector に格納し、"#" に正規化
     while(from != std::string::npos) {
 	std::string::size_type to = src.find_first_not_of(numbers, from);
 	params_.push_back(src.substr(from, to - from));
@@ -239,30 +269,30 @@
 	from = src.find_first_of(numbers, to);
     }
 
-    normalized_ = CppCFString(src.c_str(), kCFStringEncodingEUC_JP);
+    normalized_ = src;
 
     return !params_.empty();
 }
 
-// オリジナルのキー
-CppCFString NumericConverter::OriginalKey() const {
+// オリジナルのキー
+const std::string& NumericConverter::OriginalKey() const {
     return original_;
 }
 
-// 正規化されたキー
-CppCFString NumericConverter::NormalizedKey() const {
+// 正規化されたキー
+const std::string& NumericConverter::NormalizedKey() const {
     if(params_.empty()) return original_;
 
     return normalized_;
 }
 
-// 数値変換を適用する
-CppCFString NumericConverter::Apply(const CppCFString& candidate) const {
+// 数値変換を適用する
+std::string NumericConverter::Apply(const std::string& candidate) const {
     if(params_.empty()) return candidate;
 
     const char* numbers = "0123459";
     std::string result;
-    std::string src(candidate.toStdString());
+    std::string src(candidate);
     std::string::size_type pos = 0;
     int index = 0;
 
@@ -270,25 +300,25 @@
 	pos = src.find_first_of(numbers, pos + 1);
 	if(src[pos - 1] == '#') {
 	    switch(src[pos]) {
-	    case '0':		// 無変換
+	    case '0':		// 無変換
 		src.replace(pos - 1, 2, params_[index]);
 		break;
-	    case '1':		// 半角→全角変換
+	    case '1':		// 半角→全角変換
 		src.replace(pos - 1, 2, ConvertType1(params_[index]));
 		break;
-	    case '2':		// 漢数字位取りなし
+	    case '2':		// 漢数字位取りなし
 		src.replace(pos - 1, 2, ConvertType2(params_[index]));
 		break;
-	    case '3':		// 漢数字位取りあり
+	    case '3':		// 漢数字位取りあり
 		src.replace(pos - 1, 2, ConvertType3(params_[index]));
 		break;
-	    case '4':		// 数値再変換(AquaSKK では無変換)
+	    case '4':		// 数値再変換(AquaSKK では無変換)
 		src.replace(pos - 1, 2, ConvertType4(params_[index]));
 		break;
-	    case '5':		// 小切手・手形
+	    case '5':		// 小切手・手形
 		src.replace(pos - 1, 2, ConvertType5(params_[index]));
 		break;
-	    case '9':		// 棋譜入力用
+	    case '9':		// 棋譜入力用
 		src.replace(pos - 1, 2, ConvertType9(params_[index]));
 		break;
 	    }
@@ -297,5 +327,5 @@
 	}
     } while(pos != std::string::npos);
 
-    return CppCFString(src.c_str(), kCFStringEncodingEUC_JP);
+    return src;
 }
Index: AquaSKK/NumericConverter.h
diff -u AquaSKK/NumericConverter.h:1.1 AquaSKK/NumericConverter.h:1.1.2.1
--- AquaSKK/NumericConverter.h:1.1	Sat Jun  3 10:23:18 2006
+++ AquaSKK/NumericConverter.h	Fri Dec  8 23:38:57 2006
@@ -1,5 +1,5 @@
 /* -*- c++ -*-
-  $Id: NumericConverter.h,v 1.1 2006/06/03 01:23:18 t-suwa Exp $
+  $Id: NumericConverter.h,v 1.1.2.1 2006/12/08 14:38:57 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -25,21 +25,20 @@
 
 #include <vector>
 #include <string>
-#include "CppCFString.h"
 
-// 数値変換をサポートするユーティリティ
+// 数値変換用ユーティリティクラス
 
 class NumericConverter {
-    CppCFString original_;
-    CppCFString normalized_;
+    std::string original_;
+    std::string normalized_;
     std::vector<std::string> params_;
 
 public:
-    bool Setup(const CppCFString& query);
+    bool Setup(const std::string& query);
 
-    CppCFString OriginalKey() const;
-    CppCFString NormalizedKey() const;
-    CppCFString Apply(const CppCFString& candidate) const;
+    const std::string& OriginalKey() const;
+    const std::string& NormalizedKey() const;
+    std::string Apply(const std::string& candidate) const;
 };
 
 #endif	// INC__NumericConverter__
Index: AquaSKK/skkserv.cpp
diff -u AquaSKK/skkserv.cpp:1.3.2.2 AquaSKK/skkserv.cpp:1.3.2.3
--- AquaSKK/skkserv.cpp:1.3.2.2	Sat Dec  2 16:54:13 2006
+++ AquaSKK/skkserv.cpp	Fri Dec  8 23:38:57 2006
@@ -1,5 +1,5 @@
 /*
-  $Id: skkserv.cpp,v 1.3.2.2 2006/12/02 07:54:13 t-suwa Exp $
+  $Id: skkserv.cpp,v 1.3.2.3 2006/12/08 14:38:57 t-suwa Exp $
 
   MacOS X implementation of the SKK input method.
 
@@ -111,7 +111,7 @@
 	    }
 
 	    // 見つかった?
-	    if(!result.empty()) {
+	    if(result != "//") {
 		std::string candidates;
 		jconv::convert_utf8_to_eucj(result, candidates);
 		sock << "1" << candidates << "\n";


aquaskk-changes メーリングリストの案内
Back to archive index