Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

char32_tとXpressiveと

2,380 views

Published on

Boost.勉強会#6 札幌で発表したときのものです。

Published in: Technology
  • -- DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT -- ......................................................................................................................... ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... (Unlimited)
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download Full EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download EPUB Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... Download doc Ebook here { https://tinyurl.com/yyxo9sk7 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

char32_tとXpressiveと

  1. 1. char32_tとXpressiveとH.23/11/05EgtraBoost.勉強会#6 札幌
  2. 2. char32_tとXpressiveと• Egtra – @egtra – http://dev.activebasic.com/egtra/
  3. 3. char32_t……• とchar16_t – C++11の新しいデータ型 – typedefではない – UTF‐32とUTF‐16 – 4バイトと2バイト
  4. 4. char32_tとchar16_t• 新しいデータ型 – void f(char c); – void f(wchar_t c); – void f(char16_t c); – void f(char32_t c);
  5. 5. char32_tとchar16_t• リテラル – char c = a; – wchar_t c = La; – char16_t c = ua; – char32_t c = Ua;
  6. 6. char32_tとchar16_t• リテラル – char s1[] = "hoge"; – wchar_t s2[] = L"hoge"; – char16_t s3[] = u"hoge"; – char32_t s4[] = U"hoge"; – char s5[] = u8"hoge";
  7. 7. char32_tとchar16_t• リテラル – char const* s1 = "foo"; – wchar_t const* s2 = L"foo"; – char16_t const* s3 = u"foo"; – char32_t const* s4 = U"foo"; – char const* s5 = u8"foo";
  8. 8. char32_tとchar16_t• std::basic_string<> – std::string – std::wstring – std::u16string – std::u32string
  9. 9. char32_tとchar16_t• どこで使える? – GCC 4.4/4.5 – Clang 2.9 – Visual C++ 2010?
  10. 10. char32_tとchar16_t• Visual C++ 2010 – typedef!!! – v11(次バージョン)でも変わらず – u""やU""やu8""も非対応
  11. 11. char32_tとchar16_t• 以上 – 君も今日からchar16/32_t使い – UTF‐16/32なデータのところに char16/32_t使おう!
  12. 12. char32_tとchar16_t• 以上 – 君も今日からchar16/32_t使い – 私は使っていません •Visual C++ 2010なので……
  13. 13. char32_tとchar16_t• 以上と思った? – 足りないものだらけですね
  14. 14. char32_tとchar16_t (続)• 入出力 – u16streamとかu32streamとか ありません – 適当にtypedefしましょう
  15. 15. char32_tとchar16_t (続)• <codecvt> – codecvt_utf8 •UTF‐8とUTF‐32 – codecvt_utf16 •UTF‐16とUTF‐32 – codecvt_utf8_utf16
  16. 16. char32_tとchar16_t (続)• UTF‐8のファイルをchar32_tとして読む typedef basic_ifstream<char32_t> u32ifstream; u32ifstream ifs("hoge.txt"); locale loc(locale(), new codecvt_utf8<char32_t>()); ifs.imbue(loc);
  17. 17. char32_tとchar16_t (続)• UTF‐8のファイルをchar32_tとして読む typedef basic_ifstream<char32_t> u32ifstream; u32ifstream ifs("hoge.txt"); – 実はこれでいける(はず)
  18. 18. char32_tとchar16_t (続)• なぜ? std::locale::classic() – 下を持っている •codecvt<char, wchar_t> •codecvt<char, char16_t> •codecvt<char, char32_t>
  19. 19. char32_tとchar16_t (続)• 特殊化 codecvt<char, char16_t> codecvt<char, char32_t> – UTF‐8とUTF‐16/32との変換 – これで揃った?
  20. 20. char32_tとchar16_t (続)• codecvtで可能な変換 – char(マルチバイト) ⇄ wchar_t (C++98/03) – char (UTF‐8) ⇄ UTF‐16 – char (UTF‐8) ⇄ UTF‐32 – UTF‐16 ⇄ UTF‐32
  21. 21. char32_tとchar16_t (続)• マルチバイトとUTFの変換は? –ない! – iconvなどを使いましょう
  22. 22. char32_tとchar16_t (続)• wchar_tは? – UTF‐16/32とは限らない •例: ja_JP.eucJPな*BSD
  23. 23. char32_tとchar16_t (続)• マルチバイトとUTFの変換は? – 解その2: Boost.Locale? •今回は説明しません
  24. 24. char32_tとchar16_t (続)• std::basic_regex<> – charとwchar_t版しかありません •なのでBoost.Regex(ICU版)を 使いましょう
  25. 25. char32_tとchar16_t (続)• 以上
  26. 26. おまけ• Boost.XpressiveでUTF‐32の 文字列を使いたい – やっつけで対応させた
  27. 27. おまけ• traitsクラスを作る – やっつけなので null_regex_traits<char32_t> から派生 struct u32_traits : …… {
  28. 28. おまけ• traitsクラスを作る struct locale_type {};
  29. 29. おまけ• traitsクラスを作る enum char_class { InvalidClass = 0, Lu = 1, Ll = 1 << 1, ……
  30. 30. おまけ• traitsクラスを作る NewLine = 1 << ……, }; typedef boost::uint_value_t< NewLine>::least_t char_class_type;
  31. 31. おまけ• traitsクラスを作る private: static std::unordered_map< char_type, char_class_type> LoadCategoryMap(); – isctype内で使用
  32. 32. おまけ• traitsクラスを作る namespace Property { boost::proto::terminal< boost::xpressive::detail:: posix_charset_placeholder>::type const L = {{"L", false}}; ……

×