/tags/protobuf-gdc/test-cases/a.h

http://d-protobuf.googlecode.com/ · C Header · 310 lines · 232 code · 58 blank · 20 comment · 12 complexity · f840e8ed62b906abc08880ff260fe836 MD5 · raw file

  1. // Generated by the protocol buffer compiler. DO NOT EDIT!
  2. #ifndef PROTOBUF_test_2epro__INCLUDED
  3. #define PROTOBUF_test_2epro__INCLUDED
  4. #include <string>
  5. #include <google/protobuf/stubs/common.h>
  6. #if GOOGLE_PROTOBUF_VERSION < 2000003
  7. #error This file was generated by a newer version of protoc which is
  8. #error incompatible with your Protocol Buffer headers. Please update
  9. #error your headers.
  10. #endif
  11. #if 2000003 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
  12. #error This file was generated by an older version of protoc which is
  13. #error incompatible with your Protocol Buffer headers. Please
  14. #error regenerate this file with a newer version of protoc.
  15. #endif
  16. #include <google/protobuf/generated_message_reflection.h>
  17. #include <google/protobuf/repeated_field.h>
  18. #include <google/protobuf/extension_set.h>
  19. // Internal implementation detail -- do not call these.
  20. void protobuf_BuildDesc_test_2epro();
  21. void protobuf_BuildDesc_test_2epro_AssignGlobalDescriptors(
  22. ::google::protobuf::FileDescriptor* file);
  23. class SearchRequest;
  24. class Foo;
  25. // ===================================================================
  26. class SearchRequest : public ::google::protobuf::Message {
  27. public:
  28. SearchRequest();
  29. virtual ~SearchRequest();
  30. SearchRequest(const SearchRequest& from);
  31. inline SearchRequest& operator=(const SearchRequest& from) {
  32. CopyFrom(from);
  33. return *this;
  34. }
  35. inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
  36. return _unknown_fields_;
  37. }
  38. inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
  39. return &_unknown_fields_;
  40. }
  41. static const ::google::protobuf::Descriptor* descriptor();
  42. static const SearchRequest& default_instance();
  43. void Swap(SearchRequest* other);
  44. // implements Message ----------------------------------------------
  45. SearchRequest* New() const;
  46. int GetCachedSize() const { return _cached_size_; }
  47. private:
  48. void SetCachedSize(int size) const { _cached_size_ = size; }
  49. public:
  50. const ::google::protobuf::Descriptor* GetDescriptor() const;
  51. const ::google::protobuf::Reflection* GetReflection() const;
  52. // nested types ----------------------------------------------------
  53. // accessors -------------------------------------------------------
  54. // optional bytes query = 1;
  55. inline bool has_query() const;
  56. inline void clear_query();
  57. inline const ::std::string& query() const;
  58. inline void set_query(const ::std::string& value);
  59. inline void set_query(const char* value);
  60. inline void set_query(const void* value, size_t size);
  61. inline ::std::string* mutable_query();
  62. private:
  63. ::google::protobuf::UnknownFieldSet _unknown_fields_;
  64. mutable int _cached_size_;
  65. ::std::string* query_;
  66. static const ::std::string _default_query_;
  67. friend void protobuf_BuildDesc_test_2epro_AssignGlobalDescriptors(
  68. const ::google::protobuf::FileDescriptor* file);
  69. ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
  70. // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
  71. inline bool _has_bit(int index) const {
  72. return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
  73. }
  74. inline void _set_bit(int index) {
  75. _has_bits_[index / 32] |= (1u << (index % 32));
  76. }
  77. inline void _clear_bit(int index) {
  78. _has_bits_[index / 32] &= ~(1u << (index % 32));
  79. }
  80. void InitAsDefaultInstance();
  81. static SearchRequest* default_instance_;
  82. };
  83. // -------------------------------------------------------------------
  84. class Foo : public ::google::protobuf::Message {
  85. public:
  86. Foo();
  87. virtual ~Foo();
  88. Foo(const Foo& from);
  89. inline Foo& operator=(const Foo& from) {
  90. CopyFrom(from);
  91. return *this;
  92. }
  93. inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
  94. return _unknown_fields_;
  95. }
  96. inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
  97. return &_unknown_fields_;
  98. }
  99. static const ::google::protobuf::Descriptor* descriptor();
  100. static const Foo& default_instance();
  101. void Swap(Foo* other);
  102. // implements Message ----------------------------------------------
  103. Foo* New() const;
  104. int GetCachedSize() const { return _cached_size_; }
  105. private:
  106. void SetCachedSize(int size) const { _cached_size_ = size; }
  107. public:
  108. const ::google::protobuf::Descriptor* GetDescriptor() const;
  109. const ::google::protobuf::Reflection* GetReflection() const;
  110. // nested types ----------------------------------------------------
  111. // accessors -------------------------------------------------------
  112. template <typename _proto_TypeTraits>
  113. inline bool HasExtension(
  114. const ::google::protobuf::internal::ExtensionIdentifier<
  115. Foo, _proto_TypeTraits>& id) const {
  116. return _extensions_.Has(id.number());
  117. }
  118. template <typename _proto_TypeTraits>
  119. inline void ClearExtension(
  120. const ::google::protobuf::internal::ExtensionIdentifier<
  121. Foo, _proto_TypeTraits>& id) {
  122. _extensions_.ClearExtension(id.number());
  123. }
  124. template <typename _proto_TypeTraits>
  125. inline int ExtensionSize(
  126. const ::google::protobuf::internal::ExtensionIdentifier<
  127. Foo, _proto_TypeTraits>& id) const {
  128. return _extensions_.ExtensionSize(id.number());
  129. }
  130. template <typename _proto_TypeTraits>
  131. inline typename _proto_TypeTraits::ConstType GetExtension(
  132. const ::google::protobuf::internal::ExtensionIdentifier<
  133. Foo, _proto_TypeTraits>& id) const {
  134. return _proto_TypeTraits::Get(id.number(), _extensions_);
  135. }
  136. template <typename _proto_TypeTraits>
  137. inline typename _proto_TypeTraits::MutableType MutableExtension(
  138. const ::google::protobuf::internal::ExtensionIdentifier<
  139. Foo, _proto_TypeTraits>& id) {
  140. return _proto_TypeTraits::Mutable(id.number(), &_extensions_);
  141. }
  142. template <typename _proto_TypeTraits>
  143. inline void SetExtension(
  144. const ::google::protobuf::internal::ExtensionIdentifier<
  145. Foo, _proto_TypeTraits>& id,
  146. typename _proto_TypeTraits::ConstType value) {
  147. _proto_TypeTraits::Set(id.number(), value, &_extensions_);
  148. }
  149. template <typename _proto_TypeTraits>
  150. inline typename _proto_TypeTraits::ConstType GetExtension(
  151. const ::google::protobuf::internal::ExtensionIdentifier<
  152. Foo, _proto_TypeTraits>& id,
  153. int index) const {
  154. return _proto_TypeTraits::Get(id.number(), _extensions_, index);
  155. }
  156. template <typename _proto_TypeTraits>
  157. inline typename _proto_TypeTraits::MutableType MutableExtension(
  158. const ::google::protobuf::internal::ExtensionIdentifier<
  159. Foo, _proto_TypeTraits>& id,
  160. int index) {
  161. return _proto_TypeTraits::Mutable(id.number(),index,&_extensions_);
  162. }
  163. template <typename _proto_TypeTraits>
  164. inline void SetExtension(
  165. const ::google::protobuf::internal::ExtensionIdentifier<
  166. Foo, _proto_TypeTraits>& id,
  167. int index, typename _proto_TypeTraits::ConstType value) {
  168. _proto_TypeTraits::Set(id.number(), index, value, &_extensions_);
  169. }
  170. template <typename _proto_TypeTraits>
  171. inline typename _proto_TypeTraits::MutableType AddExtension(
  172. const ::google::protobuf::internal::ExtensionIdentifier<
  173. Foo, _proto_TypeTraits>& id) {
  174. return _proto_TypeTraits::Add(id.number(), &_extensions_);
  175. }
  176. template <typename _proto_TypeTraits>
  177. inline void AddExtension(
  178. const ::google::protobuf::internal::ExtensionIdentifier<
  179. Foo, _proto_TypeTraits>& id,
  180. typename _proto_TypeTraits::ConstType value) {
  181. _proto_TypeTraits::Add(id.number(), value, &_extensions_);
  182. }
  183. private:
  184. ::google::protobuf::internal::ExtensionSet _extensions_;
  185. ::google::protobuf::UnknownFieldSet _unknown_fields_;
  186. mutable int _cached_size_;
  187. friend void protobuf_BuildDesc_test_2epro_AssignGlobalDescriptors(
  188. const ::google::protobuf::FileDescriptor* file);
  189. ::google::protobuf::uint32 _has_bits_[1];
  190. // WHY DOES & HAVE LOWER PRECEDENCE THAN != !?
  191. inline bool _has_bit(int index) const {
  192. return (_has_bits_[index / 32] & (1u << (index % 32))) != 0;
  193. }
  194. inline void _set_bit(int index) {
  195. _has_bits_[index / 32] |= (1u << (index % 32));
  196. }
  197. inline void _clear_bit(int index) {
  198. _has_bits_[index / 32] &= ~(1u << (index % 32));
  199. }
  200. void InitAsDefaultInstance();
  201. static Foo* default_instance_;
  202. };
  203. // ===================================================================
  204. // ===================================================================
  205. extern ::google::protobuf::internal::ExtensionIdentifier< ::Foo,
  206. ::google::protobuf::internal::PrimitiveTypeTraits< ::google::protobuf::int32 > > bar;
  207. // ===================================================================
  208. // SearchRequest
  209. // optional bytes query = 1;
  210. inline bool SearchRequest::has_query() const {
  211. return _has_bit(0);
  212. }
  213. inline void SearchRequest::clear_query() {
  214. if (query_ != &_default_query_) {
  215. query_->clear();
  216. }
  217. _clear_bit(0);
  218. }
  219. inline const ::std::string& SearchRequest::query() const {
  220. return *query_;
  221. }
  222. inline void SearchRequest::set_query(const ::std::string& value) {
  223. _set_bit(0);
  224. if (query_ == &_default_query_) {
  225. query_ = new ::std::string;
  226. }
  227. query_->assign(value);
  228. }
  229. inline void SearchRequest::set_query(const char* value) {
  230. _set_bit(0);
  231. if (query_ == &_default_query_) {
  232. query_ = new ::std::string;
  233. }
  234. query_->assign(value);
  235. }
  236. inline void SearchRequest::set_query(const void* value, size_t size) {
  237. _set_bit(0);
  238. if (query_ == &_default_query_) {
  239. query_ = new ::std::string;
  240. }
  241. query_->assign(reinterpret_cast<const char*>(value), size);
  242. }
  243. inline ::std::string* SearchRequest::mutable_query() {
  244. _set_bit(0);
  245. if (query_ == &_default_query_) {
  246. query_ = new ::std::string;
  247. }
  248. return query_;
  249. }
  250. // -------------------------------------------------------------------
  251. // Foo
  252. #endif // PROTOBUF_test_2epro__INCLUDED