Protocol buffersとは?
Googleが開発したXMLより高速に解析処理および書き出し処理がかけて、コンパクトになるデータ構造化言語。
→http://code.google.com/apis/protocolbuffers/
使い方
protoファイル作成
まず、protoファイルという、フォーマット定義ファイルを規定する(以下)。
message SearchRequest {
required string query = 1;
optional int32 page_number = 2;
optional int32 result_per_page = 3;
}
コンパイル
次に、protoファイルをコンパイルします。
コンパイラは、protocol buffers compilerを使用します(Googleからソースごとダウンロード可能です)。
ここで、コンパイルして出力されるのは、.hや.ccなどのC/C++のソースファイルになります。