Path: blob/trunk/third_party/closure/goog/proto/proto.js
2868 views
// Copyright 2007 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview Protocol buffer serializer.16* @author [email protected] (Erik Arvidsson)17*/1819goog.provide('goog.proto');202122goog.require('goog.proto.Serializer');232425/**26* Instance of the serializer object.27* @type {goog.proto.Serializer}28* @private29*/30goog.proto.serializer_ = null;313233/**34* Serializes an object or a value to a protocol buffer string.35* @param {Object} object The object to serialize.36* @return {string} The serialized protocol buffer string.37*/38goog.proto.serialize = function(object) {39if (!goog.proto.serializer_) {40goog.proto.serializer_ = new goog.proto.Serializer;41}42return goog.proto.serializer_.serialize(object);43};444546