1
// Copyright 2011 Google Inc.
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
15
// Author: jmarantz@google.com (Joshua Marantz)
17
#ifndef PAGESPEED_KERNEL_BASE_PROTO_UTIL_H_
18
#define PAGESPEED_KERNEL_BASE_PROTO_UTIL_H_
20
#include "pagespeed/kernel/base/basictypes.h"
21
#include "pagespeed/kernel/base/string_util.h"
24
#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
25
#include "google/protobuf/message_lite.h"
26
#include "google/protobuf/repeated_field.h"
28
namespace net_instaweb {
30
// TODO(sligocki): Get rid of these special cases.
31
typedef google::protobuf::io::StringOutputStream StringOutputStream;
32
typedef google::protobuf::io::ArrayInputStream ArrayInputStream;
36
// Pulls all google::protobuf namespace into net_instaweb::protobuf namespace.
37
using namespace google::protobuf; // NOLINT
39
} // namespace protobuf
41
inline bool ParseProtoFromStringPiece(
42
StringPiece sp, protobuf::MessageLite* proto) {
43
return proto->ParseFromString(sp.as_string());
46
} // namespace net_instaweb
49
#endif // PAGESPEED_KERNEL_BASE_PROTO_UTIL_H_