[阅读: 1214] 2008-07-11 06:01:42
.h============================================
// Generated by the protocol buffer compiler. DO NOT EDIT!
#ifndef PROTOBUF_test_2eproto__INCLUDED
#define PROTOBUF_test_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 2000000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 2000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
class DeviceItem;
// ===================================================================
class DeviceItem : public ::google::protobuf::Message {
public:
DeviceItem();
virtual ~DeviceItem();
DeviceItem(const DeviceItem& from);
inline DeviceItem& operator=(const DeviceItem& from) {
CopyFrom(from);
return *this;
}
inline static const DeviceItem& default_instance() {
return default_instance_;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
return _reflection_.unknown_fields();
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
return _reflection_.mutable_unknown_fields();
}
static const ::google::protobuf::Descriptor* descriptor();
// implements Message ----------------------------------------------
DeviceItem* New() const;
int GetCachedSize() const { return _cached_size_; }
private:
void SetCachedSize(int size) const { _cached_size_ = size; }
public:
const ::google::protobuf::Descriptor* GetDescriptor() const;
const ::google::protobuf::Message::Reflection* GetReflection() const;
::google::protobuf::Message::Reflection* GetReflection();
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// required int32 index = 1;
inline bool has_index() const;
inline void clear_index();
inline ::google::protobuf::int32 index() const;
inline void set_index(::google::protobuf::int32 value);
// required string name = 2;
inline bool has_name() const;
inline void clear_name();
inline const ::std::string& name() const;
inline void set_name(const ::std::string& value);
inline void set_name(const char* value);
inline ::std::string* mutable_name();
// optional int32 ratio = 3;
inline bool has_ratio() const;
inline void clear_ratio();
inline ::google::protobuf::int32 ratio() const;
inline void set_ratio(::google::protobuf::int32 value);
private:
::google::protobuf::internal::GeneratedMessageReflection _reflection_;
mutable int _cached_size_;
::google::protobuf::int32 index_;
::std::string* name_;
static const ::std::string _default_name_;
::google::protobuf::int32 ratio_;
static const DeviceItem default_instance_;
static const int _offsets_[3];
::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
// WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
inline bool _has_bit(int index) const {
return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
}
inline void _set_bit(int index) {
_has_bits_[index / 32] |= (1u << (index % 32));
}
inline void _clear_bit(int index) {
_has_bits_[index / 32] &= ~(1u << (index % 32));
}
};
// ===================================================================
// ===================================================================
// ===================================================================
// DeviceItem
// required int32 index = 1;
inline bool DeviceItem::has_index() const {
return _has_bit(0);
}
inline void DeviceItem::clear_index() {
index_ = 0;
_clear_bit(0);
}
inline ::google::protobuf::int32 DeviceItem::index() const {
return index_;
}
inline void DeviceItem::set_index(::google::protobuf::int32 value) {
_set_bit(0);
index_ = value;
}
// required string name = 2;
inline bool DeviceItem::has_name() const {
return _has_bit(1);
}
inline void DeviceItem::clear_name() {
if (name_ != &_default_name_) {
name_->clear();
}
_clear_bit(1);
}
inline const ::std::string& DeviceItem::name() const {
return *name_;
}
inline void DeviceItem::set_name(const ::std::string& value) {
_set_bit(1);
if (name_ == &_default_name_) {
name_ = new ::std::string;
}
name_->assign(value);
}
inline void DeviceItem::set_name(const char* value) {
_set_bit(1);
if (name_ == &_default_name_) {
name_ = new ::std::string;
}
name_->assign(value);
}
inline ::std::string* DeviceItem::mutable_name() {
_set_bit(1);
if (name_ == &_default_name_) {
name_ = new ::std::string;
}
return name_;
}
// optional int32 ratio = 3;
inline bool DeviceItem::has_ratio() const {
return _has_bit(2);
}
inline void DeviceItem::clear_ratio() {
ratio_ = 0;
_clear_bit(2);
}
inline ::google::protobuf::int32 DeviceItem::ratio() const {
return ratio_;
}
inline void DeviceItem::set_ratio(::google::protobuf::int32 value) {
_set_bit(2);
ratio_ = value;
}
#endif // PROTOBUF_test_2eproto__INCLUDED
.cc==========================================================
// Generated by the protocol buffer compiler. DO NOT EDIT!
#include "test.pb.h"
#include <google/protobuf/descriptor.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format_inl.h>
namespace {
const ::google::protobuf::Descriptor* DeviceItem_descriptor_ = NULL;
} // namespace
void proto_BuildDescriptors_test_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::google::protobuf::DescriptorPool* pool =
::google::protobuf::DescriptorPool::internal_generated_pool();
const ::google::protobuf::FileDescriptor* file = pool->InternalBuildGeneratedFile(
"\n\ntest.proto\"8\n\nDeviceItem\022\r\n\005index\030\001 \002("
"\005\022\014\n\004name\030\002 \002(\t\022\r\n\005ratio\030\003 \001(\005", 70);
DeviceItem_descriptor_ = file->message_type(0);
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
DeviceItem_descriptor_, &DeviceItem::default_instance());
}
// Force BuildDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_test_2eproto {
StaticDescriptorInitializer_test_2eproto() {
proto_BuildDescriptors_test_2eproto();
}
} static_descriptor_initializer_test_2eproto_;
// ===================================================================
const DeviceItem DeviceItem::default_instance_;
const ::std::string DeviceItem::_default_name_;
const int DeviceItem::_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceItem, index_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceItem, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeviceItem, ratio_),
};
DeviceItem::DeviceItem()
: _reflection_(descriptor(),
this, &default_instance_,
_offsets_, _has_bits_, NULL),
_cached_size_(0),
index_(0),
name_(const_cast< ::std::string*>(&_default_name_)),
ratio_(0) {
::memset(_has_bits_, 0, sizeof(_has_bits_));
if (this == &default_instance_) {
}
}
DeviceItem::DeviceItem(const DeviceItem& from)
: _reflection_(descriptor(),
this, &default_instance_,
_offsets_, _has_bits_, NULL),
_cached_size_(0),
index_(0),
name_(const_cast< ::std::string*>(&_default_name_)),
ratio_(0) {
::memset(_has_bits_, 0, sizeof(_has_bits_));
MergeFrom(from);
}
DeviceItem::~DeviceItem() {
if (name_ != &_default_name_) {
delete name_;
}
if (this != &default_instance_) {
}
}
const ::google::protobuf::Descriptor* DeviceItem::descriptor() {
if (DeviceItem_descriptor_ == NULL) proto_BuildDescriptors_test_2eproto();
return DeviceItem_descriptor_;
}
DeviceItem* DeviceItem::New() const {
return new DeviceItem;
}
const ::google::protobuf::Descriptor* DeviceItem::GetDescriptor() const {
return descriptor();
}
const ::google::protobuf::Message::Reflection*
DeviceItem::GetReflection() const {
return &_reflection_;
}
::google::protobuf::Message::Reflection* DeviceItem::GetReflection() {
return &_reflection_;
}