1 /** 2 * 3 * See_Also: 4 * http://www.honeyplanet.jp/download.html#libguess 5 * http://hg.honeyplanet.jp/libguess/ 6 */ 7 module libguess_d.libguess; 8 9 10 public import libguess_d.encoding; 11 public import libguess_d.guess.common; 12 public import libguess_d.guess.cjk; 13 //public import libguess_d.guess.russian; 14 15 /** 16 * 17 * 18 * Params: 19 * input = input string 20 * 21 * Returns: Character encoding or null 22 */ 23 pure nothrow @trusted @nogc 24 libguess_d.encoding.libguess_encoding guess_encoding(const char[] input, const libguess_d.encoding.supported_lang lang) 25 26 in 27 { 28 switch (lang) { 29 case lang.ar: 30 case lang.cn: 31 case lang.gr: 32 case lang.hw: 33 case lang.ja: 34 case lang.kr: 35 //case lang.ru: 36 case lang.tr: 37 case lang.tw: 38 break; 39 40 default: 41 assert(0); 42 } 43 } 44 45 do 46 { 47 static import libguess_d.encoding; 48 static import libguess_d.guess.cjk; 49 static import libguess_d.guess.common; 50 //static import libguess_d.guess.russian; 51 52 switch (lang) { 53 case lang.ar: 54 return libguess_d.guess.common.guess_ar(input); 55 56 case lang.cn: 57 return libguess_d.guess.cjk.guess_cn(input); 58 59 case lang.gr: 60 return libguess_d.guess.common.guess_gr(input); 61 62 case lang.hw: 63 return libguess_d.guess.common.guess_hw(input); 64 65 case lang.ja: 66 return libguess_d.guess.cjk.guess_ja(input); 67 68 case lang.kr: 69 return libguess_d.guess.cjk.guess_kr(input); 70 71 /* 72 case lang.ru: 73 return libguess_d.guess.russian.guess_ru(input); 74 */ 75 76 case lang.tr: 77 return libguess_d.guess.common.guess_tr(input); 78 79 case lang.tw: 80 return libguess_d.guess.cjk.guess_tw(input); 81 82 default: 83 return libguess_d.encoding.libguess_encoding.undefined; 84 } 85 }