Download free for 30 days
Sign in
Upload
Language (EN)
Support
Business
Mobile
Social Media
Marketing
Technology
Art & Photos
Career
Design
Education
Presentations & Public Speaking
Government & Nonprofit
Healthcare
Internet
Law
Leadership & Management
Automotive
Engineering
Software
Recruiting & HR
Retail
Sales
Services
Science
Small Business & Entrepreneurship
Food
Environment
Economy & Finance
Data & Analytics
Investor Relations
Sports
Spiritual
News & Politics
Travel
Self Improvement
Real Estate
Entertainment & Humor
Health & Medicine
Devices & Hardware
Lifestyle
Change Language
Language
English
Español
Português
Français
Deutsche
Cancel
Save
EN
Uploaded by
egtra
PDF, PPTX
2,999 views
Casablanca
Boost.勉強会#16 大阪で発表したときのものです。
Technology
◦
Read more
3
Save
Share
Embed
Embed presentation
Download
Download as PDF, PPTX
1
/ 20
2
/ 20
3
/ 20
4
/ 20
5
/ 20
6
/ 20
7
/ 20
8
/ 20
9
/ 20
10
/ 20
11
/ 20
12
/ 20
13
/ 20
14
/ 20
15
/ 20
16
/ 20
17
/ 20
18
/ 20
19
/ 20
20
/ 20
More Related Content
PDF
C++ REST SDKを使ってWebサービスを利用する
by
You&I
PDF
RespClient - Minimal Redis Client for PowerShell
by
Yoshifumi Kawai
PDF
asm.jsとWebAssemblyって実際なんなの?
by
Yosuke Onoue
PDF
Config mapについて
by
Arata Honda
PDF
ちゃんとWeb会議スライド『Coffee script』
by
H2O Space. Co., Ltd.
PDF
Webブラウザで使えるいろんな処理系
by
祐司 伊藤
PDF
PIAXで作る P2Pネットワーク
by
祐司 伊藤
PDF
Excite beer bash06
by
Arata Honda
C++ REST SDKを使ってWebサービスを利用する
by
You&I
RespClient - Minimal Redis Client for PowerShell
by
Yoshifumi Kawai
asm.jsとWebAssemblyって実際なんなの?
by
Yosuke Onoue
Config mapについて
by
Arata Honda
ちゃんとWeb会議スライド『Coffee script』
by
H2O Space. Co., Ltd.
Webブラウザで使えるいろんな処理系
by
祐司 伊藤
PIAXで作る P2Pネットワーク
by
祐司 伊藤
Excite beer bash06
by
Arata Honda
What's hot
PPTX
F# で ASP.NET
by
m ishizaki
PPTX
Web socket and gRPC
by
TIS Inc
PPTX
私が ASP.NET を選ぶ理由
by
m ishizaki
PDF
[2001/01/23] VSLive! / Visual C++.NET 新機能概要
by
Tatsuhiko Tanaka
PDF
C#の強み、或いは何故PHPから乗り換えるのか
by
Yoshifumi Kawai
PDF
Visual Studio Codeで始めるTypeScript
by
Akira Inoue
PDF
.NET Core 5 ~ Windows, Linux, OS X そして Docker まで ~
by
Akira Inoue
PDF
The History of LINQ
by
Yoshifumi Kawai
PDF
WebComponentsとPolymer
by
Takahiro Maki
PPTX
Bait and switch
by
m ishizaki
PDF
Webの未来 〜 PNaClとasm.jsでカワルミライ - いま、モバイルWebの先端で起こっていること
by
Kei Nakazawa
PDF
emscriptenでC/C++プログラムをwebブラウザから使うまでの難所攻略
by
祐司 伊藤
PDF
本当のClosure Compilerをお見せしますよ。
by
Teppei Sato
KEY
ライブラリにあらず! 〜Google Closure Toolsの事始め〜
by
Kazuya Hiruma
PPTX
Visual studio 2015 update1 ctpとcsi
by
Tadahiro Ishisaka
PDF
TypeScript と Visual Studio Code
by
Akira Inoue
PDF
Closure CompilerのES6対応 あるいはES6時代のAltJS生存戦略
by
Teppei Sato
PPTX
Alt#0x008 2017/5/20
by
Koki Natsume
PDF
Using xvim with macvim
by
pebble8888
PDF
SPA×Auth0
by
春奈 岡
F# で ASP.NET
by
m ishizaki
Web socket and gRPC
by
TIS Inc
私が ASP.NET を選ぶ理由
by
m ishizaki
[2001/01/23] VSLive! / Visual C++.NET 新機能概要
by
Tatsuhiko Tanaka
C#の強み、或いは何故PHPから乗り換えるのか
by
Yoshifumi Kawai
Visual Studio Codeで始めるTypeScript
by
Akira Inoue
.NET Core 5 ~ Windows, Linux, OS X そして Docker まで ~
by
Akira Inoue
The History of LINQ
by
Yoshifumi Kawai
WebComponentsとPolymer
by
Takahiro Maki
Bait and switch
by
m ishizaki
Webの未来 〜 PNaClとasm.jsでカワルミライ - いま、モバイルWebの先端で起こっていること
by
Kei Nakazawa
emscriptenでC/C++プログラムをwebブラウザから使うまでの難所攻略
by
祐司 伊藤
本当のClosure Compilerをお見せしますよ。
by
Teppei Sato
ライブラリにあらず! 〜Google Closure Toolsの事始め〜
by
Kazuya Hiruma
Visual studio 2015 update1 ctpとcsi
by
Tadahiro Ishisaka
TypeScript と Visual Studio Code
by
Akira Inoue
Closure CompilerのES6対応 あるいはES6時代のAltJS生存戦略
by
Teppei Sato
Alt#0x008 2017/5/20
by
Koki Natsume
Using xvim with macvim
by
pebble8888
SPA×Auth0
by
春奈 岡
More from egtra
PDF
Visual C++コード分析を支えるSAL
by
egtra
PDF
エクストリームC++11/14プログラミング
by
egtra
PDF
Visual C++ 2015の紹介(C++11/14的に)
by
egtra
PDF
Firefox拡張機能を始める
by
egtra
PDF
ATLに見る魔術
by
egtra
PDF
再変換 (K2Editor)
by
egtra
PDF
C++11概要 ライブラリ編
by
egtra
PDF
char32_tとXpressiveと
by
egtra
PDF
Boost.Range入門
by
egtra
PPTX
Boost.Graph入門
by
egtra
Visual C++コード分析を支えるSAL
by
egtra
エクストリームC++11/14プログラミング
by
egtra
Visual C++ 2015の紹介(C++11/14的に)
by
egtra
Firefox拡張機能を始める
by
egtra
ATLに見る魔術
by
egtra
再変換 (K2Editor)
by
egtra
C++11概要 ライブラリ編
by
egtra
char32_tとXpressiveと
by
egtra
Boost.Range入門
by
egtra
Boost.Graph入門
by
egtra
Casablanca
1.
Casablanca でHTTP H.26/09/20
Egtra For Boost.勉強会#16
2.
自分 •Egtra –Twitter:
@egtra –http://dev.activebasic.com/egtra/ •仕事: 主にVisual C++ 2005 (Windows) –最近C++ (Linux)も少し
3.
動機:私は探していた •HTTPライブラリ(クライアント) –主にAPIサーバー相手の通信
•クロスプラットフォーム –WindowsとLinuxほかUnix系
4.
C++ REST SDK
•クライアント・サーバ –HTTPS対応 •JSON, Oauth, WebScoket •Win/Mac/Linuxなど •C++11必須 •MS発OSSライブラリ •https://casablanca.codeprex.com/ ※ グレーは今回私が使っていないものです。
5.
プラットフォーム •Windows –Desktop/Store/Phone
•Linux, FreeBSD –Android: 対応中(?) •Mac OS X, iOS
6.
こんな感じ(1⁄2) http_clientclient(U("http://example.com/")); http_requestreq(methods::POST);
req.set_request_uri(U("my_api.txt")); req.set_body(……); autoresTask= client.request(req); // resTaskはpplx::task<http_response>
7.
こんな感じ(2⁄2) autobodyTask= resTask.then([](consthttp_response&
res) { // res.status_code(); // res.headers().content_type(); returnres.extract_body(); }; std::vector<unsigned char> body = bodyTask.get();
8.
こんな感じ(まとめ) •http_clientを作る •requestに↑
を渡す •http_responseを受け取る •extract_*()で中身を得る
9.
pplx::task •VC++のppl::taskの移植版 •ほぼstd::future
–thenメンバ関数がある! –協調的キャンセル機構など
10.
thenによるチェイン(1) client.request(req) .then([](constauto&
res) { returnres.extract_vector(); }).then([](constauto& vec) { returnvecをいい感じに解析; }).then([](conststd::string& result) { ……
11.
thenによるチェイン(2) pplx::task<std::string> call_my_api()
{ returnclient.request(req) .then([](constauto& res) { returnres.extract_vector(); }).then([](constauto& vec) { returnvecをいい感じに解析; }); }
12.
ヘッダー •req.headers().… orres.headers().…
–add(name, value), remove(name) –has(name), [], find(name) –begin(), end(), size(), empty() –content_type(), content_length(), –date(), cache_control()(読み取り) •set_…(value)(書き込み)
13.
リクエスト・ボディー •req.set_body(……) –文字列(std::string
orstring_t) –文字列, Content-Type文字列 –json::value –std::vector<unsigned char> –concurrency::stream::istream
14.
ステータスコード •res.status_code() ->
status_code –typedefunsigned shortstatus_code; –定数status_codes::OKほか •res.reason_phrase()
15.
レスポンス・ボディー •res.extract_string()-> pplx::task<文字列>
•res.extract_json() -> pplx::<json::value> •res.extract_vector() -> pplx::task<std::vector<unsigned char>> •body() -> concurrency::streams::istream
16.
文字列 •Windows: UTF-16(wchar_t)
•その他: UTF-8(char) •共通化 –char_t, string_t, stringstream_t –U("リテラル") –ucout, ucin, ucerr
17.
足回り •Windows: –WinHTTP.dll,
WinHTTP.sys –IXmlHttpRequest2 •その他: Boost.Asio –SSL: boost::asio::ssl(OpenSSL)
18.
インストール •Windows: –Visual
Studio内nuget
19.
インストール(Ubuntu) apt-get install
openssl-devcmake cdcasablanca/Release mkdirbuild.release cdbuild.release cmake.. BOOST_ROOT=…… # aptでBoostを入れたなら、BOOST_ROOT不要
20.
This work is
licensed under a Creative Commons Attribution- ShareAlike4.0 International License.
Download