void printing_device::ustr_to_vec(ustring& str, vector<gunichar>& vec) { vec.clear(); ustring::iterator iter; for (iter = str.begin(); iter != str.end(); ++iter) { vec.push_back(*iter); } }
bool isDigit(const ustring& str) { ustring::const_iterator i; for (i = str.begin(); i != str.end(); ++i) if (isdigit(*i) == 0) return false; return true; }
ustring directories::backslashes_to_forwardslashes(const ustring &tofix) { ustring retval; ustring::const_iterator it; for (it = tofix.begin(); it < tofix.end(); it++) { if (*it == '\\') { retval.push_back('/'); } else { retval.push_back(*it); } } return retval; }
// Change forward slash to backslash on WIN32, else there are major // problems with system calls to the file system (unix_rmdir, for instance). ustring directories::fix_slashes(const ustring &tofix) { ustring retval; #ifdef WIN32 ustring::const_iterator it; for (it = tofix.begin(); it < tofix.end(); it++) { if (*it == '/') { retval.push_back('\\'); } else { retval.push_back(*it); } } #else retval = tofix; #endif return retval; }
void CGlobalRecords::wide2str16(const ustring& str1, u16string& str2) { ustring::const_iterator cBegin, cEnd; size_t len; str2.clear(); len = str1.length(); str2.reserve(len); cBegin = str1.begin(); cEnd = str1.end(); while(cBegin != cEnd) { str2.push_back((unsigned16_t)*cBegin++); } XL_ASSERT(str2.length() == str1.length()); }
inline ustring ascii_toupper(ustring str) { ustring ret; for (ustring::const_iterator it = str.begin(); it != str.end(); ++it) { uchar x = *it; if (x >= 0x61 && x <= 0x7A) x -= 0x20; ret.append(x); } return ret; }
// vim: ts=4 sw=4 expandtab: // Tue Mar 21 19:14:17 EST 2006 //--------------------------------------------------------------------------// #include <string> #include <glibmm.h> using namespace Glib; typedef std::wstring py_ustring; //---------------------------------------------------------------------------// const ustring hiragana("ぁあぃいぅうぇえぉおかがきぎくぐけげこごさざしじすずせぜそぞただち>ぢっつづてでとどなにぬねのはばぱひびぴふぶぷへべぺほぼぽまみむめもゃやゅゆょよらりるれろゎわゐゑをんゔゕゖ"); const py_ustring py_hiragana(hiragana.begin(), hiragana.end()); const ustring katakana("ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチ>ヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロヮワヰヱヲンヴヵヶ"); //---------------------------------------------------------------------------// const int _interKanaDistance = katakana[0] - hiragana[0]; const wchar_t _hiraganaStarts = 12353; // ぁ character const wchar_t _hiraganaEnds = 12438; // hiragana ヶ character const wchar_t _katakanaStarts = 12449; // ァ character const wchar_t _katakanaEnds = 12534; // ヶ character const wchar_t _kanjiStarts = 19968; // 一 character const wchar_t _kanjiEnds = 40869; // 龥 character //---------------------------------------------------------------------------//