/Godeps/_workspace/src/github.com/gogo/protobuf/test/enumstringer/enumstringer.pb.go

https://gitlab.com/JamesClonk/firehose-to-syslog · Go · 506 lines · 454 code · 35 blank · 17 comment · 193 complexity · 0a5074699f6a73d913544513dbb085b0 MD5 · raw file

  1. // Code generated by protoc-gen-gogo.
  2. // source: enumstringer.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package enumstringer is a generated protocol buffer package.
  6. It is generated from these files:
  7. enumstringer.proto
  8. It has these top-level messages:
  9. NidOptEnum
  10. NinOptEnum
  11. NidRepEnum
  12. NinRepEnum
  13. */
  14. package enumstringer
  15. import proto "github.com/gogo/protobuf/proto"
  16. import math "math"
  17. // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto/gogo.pb"
  18. import fmt "fmt"
  19. import bytes "bytes"
  20. // Reference imports to suppress errors if they are not otherwise used.
  21. var _ = proto.Marshal
  22. var _ = math.Inf
  23. type TheTestEnum int32
  24. const (
  25. TheTestEnum_A TheTestEnum = 0
  26. TheTestEnum_B TheTestEnum = 1
  27. TheTestEnum_C TheTestEnum = 2
  28. )
  29. var TheTestEnum_name = map[int32]string{
  30. 0: "A",
  31. 1: "B",
  32. 2: "C",
  33. }
  34. var TheTestEnum_value = map[string]int32{
  35. "A": 0,
  36. "B": 1,
  37. "C": 2,
  38. }
  39. func (x TheTestEnum) Enum() *TheTestEnum {
  40. p := new(TheTestEnum)
  41. *p = x
  42. return p
  43. }
  44. func (x TheTestEnum) MarshalJSON() ([]byte, error) {
  45. return proto.MarshalJSONEnum(TheTestEnum_name, int32(x))
  46. }
  47. func (x *TheTestEnum) UnmarshalJSON(data []byte) error {
  48. value, err := proto.UnmarshalJSONEnum(TheTestEnum_value, data, "TheTestEnum")
  49. if err != nil {
  50. return err
  51. }
  52. *x = TheTestEnum(value)
  53. return nil
  54. }
  55. type NidOptEnum struct {
  56. Field1 TheTestEnum `protobuf:"varint,1,opt,enum=enumstringer.TheTestEnum" json:"Field1"`
  57. XXX_unrecognized []byte `json:"-"`
  58. }
  59. func (m *NidOptEnum) Reset() { *m = NidOptEnum{} }
  60. func (m *NidOptEnum) String() string { return proto.CompactTextString(m) }
  61. func (*NidOptEnum) ProtoMessage() {}
  62. func (m *NidOptEnum) GetField1() TheTestEnum {
  63. if m != nil {
  64. return m.Field1
  65. }
  66. return TheTestEnum_A
  67. }
  68. type NinOptEnum struct {
  69. Field1 *TheTestEnum `protobuf:"varint,1,opt,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
  70. XXX_unrecognized []byte `json:"-"`
  71. }
  72. func (m *NinOptEnum) Reset() { *m = NinOptEnum{} }
  73. func (m *NinOptEnum) String() string { return proto.CompactTextString(m) }
  74. func (*NinOptEnum) ProtoMessage() {}
  75. func (m *NinOptEnum) GetField1() TheTestEnum {
  76. if m != nil && m.Field1 != nil {
  77. return *m.Field1
  78. }
  79. return TheTestEnum_A
  80. }
  81. type NidRepEnum struct {
  82. Field1 []TheTestEnum `protobuf:"varint,1,rep,enum=enumstringer.TheTestEnum" json:"Field1"`
  83. XXX_unrecognized []byte `json:"-"`
  84. }
  85. func (m *NidRepEnum) Reset() { *m = NidRepEnum{} }
  86. func (m *NidRepEnum) String() string { return proto.CompactTextString(m) }
  87. func (*NidRepEnum) ProtoMessage() {}
  88. func (m *NidRepEnum) GetField1() []TheTestEnum {
  89. if m != nil {
  90. return m.Field1
  91. }
  92. return nil
  93. }
  94. type NinRepEnum struct {
  95. Field1 []TheTestEnum `protobuf:"varint,1,rep,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
  96. XXX_unrecognized []byte `json:"-"`
  97. }
  98. func (m *NinRepEnum) Reset() { *m = NinRepEnum{} }
  99. func (m *NinRepEnum) String() string { return proto.CompactTextString(m) }
  100. func (*NinRepEnum) ProtoMessage() {}
  101. func (m *NinRepEnum) GetField1() []TheTestEnum {
  102. if m != nil {
  103. return m.Field1
  104. }
  105. return nil
  106. }
  107. func init() {
  108. proto.RegisterEnum("enumstringer.TheTestEnum", TheTestEnum_name, TheTestEnum_value)
  109. }
  110. func NewPopulatedNidOptEnum(r randyEnumstringer, easy bool) *NidOptEnum {
  111. this := &NidOptEnum{}
  112. this.Field1 = TheTestEnum([]int32{0, 1, 2}[r.Intn(3)])
  113. if !easy && r.Intn(10) != 0 {
  114. this.XXX_unrecognized = randUnrecognizedEnumstringer(r, 2)
  115. }
  116. return this
  117. }
  118. func NewPopulatedNinOptEnum(r randyEnumstringer, easy bool) *NinOptEnum {
  119. this := &NinOptEnum{}
  120. if r.Intn(10) != 0 {
  121. v1 := TheTestEnum([]int32{0, 1, 2}[r.Intn(3)])
  122. this.Field1 = &v1
  123. }
  124. if !easy && r.Intn(10) != 0 {
  125. this.XXX_unrecognized = randUnrecognizedEnumstringer(r, 2)
  126. }
  127. return this
  128. }
  129. func NewPopulatedNidRepEnum(r randyEnumstringer, easy bool) *NidRepEnum {
  130. this := &NidRepEnum{}
  131. if r.Intn(10) != 0 {
  132. v2 := r.Intn(10)
  133. this.Field1 = make([]TheTestEnum, v2)
  134. for i := 0; i < v2; i++ {
  135. this.Field1[i] = TheTestEnum([]int32{0, 1, 2}[r.Intn(3)])
  136. }
  137. }
  138. if !easy && r.Intn(10) != 0 {
  139. this.XXX_unrecognized = randUnrecognizedEnumstringer(r, 2)
  140. }
  141. return this
  142. }
  143. func NewPopulatedNinRepEnum(r randyEnumstringer, easy bool) *NinRepEnum {
  144. this := &NinRepEnum{}
  145. if r.Intn(10) != 0 {
  146. v3 := r.Intn(10)
  147. this.Field1 = make([]TheTestEnum, v3)
  148. for i := 0; i < v3; i++ {
  149. this.Field1[i] = TheTestEnum([]int32{0, 1, 2}[r.Intn(3)])
  150. }
  151. }
  152. if !easy && r.Intn(10) != 0 {
  153. this.XXX_unrecognized = randUnrecognizedEnumstringer(r, 2)
  154. }
  155. return this
  156. }
  157. type randyEnumstringer interface {
  158. Float32() float32
  159. Float64() float64
  160. Int63() int64
  161. Int31() int32
  162. Uint32() uint32
  163. Intn(n int) int
  164. }
  165. func randUTF8RuneEnumstringer(r randyEnumstringer) rune {
  166. return rune(r.Intn(126-43) + 43)
  167. }
  168. func randStringEnumstringer(r randyEnumstringer) string {
  169. v4 := r.Intn(100)
  170. tmps := make([]rune, v4)
  171. for i := 0; i < v4; i++ {
  172. tmps[i] = randUTF8RuneEnumstringer(r)
  173. }
  174. return string(tmps)
  175. }
  176. func randUnrecognizedEnumstringer(r randyEnumstringer, maxFieldNumber int) (data []byte) {
  177. l := r.Intn(5)
  178. for i := 0; i < l; i++ {
  179. wire := r.Intn(4)
  180. if wire == 3 {
  181. wire = 5
  182. }
  183. fieldNumber := maxFieldNumber + r.Intn(100)
  184. data = randFieldEnumstringer(data, r, fieldNumber, wire)
  185. }
  186. return data
  187. }
  188. func randFieldEnumstringer(data []byte, r randyEnumstringer, fieldNumber int, wire int) []byte {
  189. key := uint32(fieldNumber)<<3 | uint32(wire)
  190. switch wire {
  191. case 0:
  192. data = encodeVarintPopulateEnumstringer(data, uint64(key))
  193. v5 := r.Int63()
  194. if r.Intn(2) == 0 {
  195. v5 *= -1
  196. }
  197. data = encodeVarintPopulateEnumstringer(data, uint64(v5))
  198. case 1:
  199. data = encodeVarintPopulateEnumstringer(data, uint64(key))
  200. data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  201. case 2:
  202. data = encodeVarintPopulateEnumstringer(data, uint64(key))
  203. ll := r.Intn(100)
  204. data = encodeVarintPopulateEnumstringer(data, uint64(ll))
  205. for j := 0; j < ll; j++ {
  206. data = append(data, byte(r.Intn(256)))
  207. }
  208. default:
  209. data = encodeVarintPopulateEnumstringer(data, uint64(key))
  210. data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  211. }
  212. return data
  213. }
  214. func encodeVarintPopulateEnumstringer(data []byte, v uint64) []byte {
  215. for v >= 1<<7 {
  216. data = append(data, uint8(uint64(v)&0x7f|0x80))
  217. v >>= 7
  218. }
  219. data = append(data, uint8(v))
  220. return data
  221. }
  222. func (this *NidOptEnum) VerboseEqual(that interface{}) error {
  223. if that == nil {
  224. if this == nil {
  225. return nil
  226. }
  227. return fmt.Errorf("that == nil && this != nil")
  228. }
  229. that1, ok := that.(*NidOptEnum)
  230. if !ok {
  231. return fmt.Errorf("that is not of type *NidOptEnum")
  232. }
  233. if that1 == nil {
  234. if this == nil {
  235. return nil
  236. }
  237. return fmt.Errorf("that is type *NidOptEnum but is nil && this != nil")
  238. } else if this == nil {
  239. return fmt.Errorf("that is type *NidOptEnumbut is not nil && this == nil")
  240. }
  241. if this.Field1 != that1.Field1 {
  242. return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", this.Field1, that1.Field1)
  243. }
  244. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  245. return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
  246. }
  247. return nil
  248. }
  249. func (this *NidOptEnum) Equal(that interface{}) bool {
  250. if that == nil {
  251. if this == nil {
  252. return true
  253. }
  254. return false
  255. }
  256. that1, ok := that.(*NidOptEnum)
  257. if !ok {
  258. return false
  259. }
  260. if that1 == nil {
  261. if this == nil {
  262. return true
  263. }
  264. return false
  265. } else if this == nil {
  266. return false
  267. }
  268. if this.Field1 != that1.Field1 {
  269. return false
  270. }
  271. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  272. return false
  273. }
  274. return true
  275. }
  276. func (this *NinOptEnum) VerboseEqual(that interface{}) error {
  277. if that == nil {
  278. if this == nil {
  279. return nil
  280. }
  281. return fmt.Errorf("that == nil && this != nil")
  282. }
  283. that1, ok := that.(*NinOptEnum)
  284. if !ok {
  285. return fmt.Errorf("that is not of type *NinOptEnum")
  286. }
  287. if that1 == nil {
  288. if this == nil {
  289. return nil
  290. }
  291. return fmt.Errorf("that is type *NinOptEnum but is nil && this != nil")
  292. } else if this == nil {
  293. return fmt.Errorf("that is type *NinOptEnumbut is not nil && this == nil")
  294. }
  295. if this.Field1 != nil && that1.Field1 != nil {
  296. if *this.Field1 != *that1.Field1 {
  297. return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", *this.Field1, *that1.Field1)
  298. }
  299. } else if this.Field1 != nil {
  300. return fmt.Errorf("this.Field1 == nil && that.Field1 != nil")
  301. } else if that1.Field1 != nil {
  302. return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", this.Field1, that1.Field1)
  303. }
  304. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  305. return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
  306. }
  307. return nil
  308. }
  309. func (this *NinOptEnum) Equal(that interface{}) bool {
  310. if that == nil {
  311. if this == nil {
  312. return true
  313. }
  314. return false
  315. }
  316. that1, ok := that.(*NinOptEnum)
  317. if !ok {
  318. return false
  319. }
  320. if that1 == nil {
  321. if this == nil {
  322. return true
  323. }
  324. return false
  325. } else if this == nil {
  326. return false
  327. }
  328. if this.Field1 != nil && that1.Field1 != nil {
  329. if *this.Field1 != *that1.Field1 {
  330. return false
  331. }
  332. } else if this.Field1 != nil {
  333. return false
  334. } else if that1.Field1 != nil {
  335. return false
  336. }
  337. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  338. return false
  339. }
  340. return true
  341. }
  342. func (this *NidRepEnum) VerboseEqual(that interface{}) error {
  343. if that == nil {
  344. if this == nil {
  345. return nil
  346. }
  347. return fmt.Errorf("that == nil && this != nil")
  348. }
  349. that1, ok := that.(*NidRepEnum)
  350. if !ok {
  351. return fmt.Errorf("that is not of type *NidRepEnum")
  352. }
  353. if that1 == nil {
  354. if this == nil {
  355. return nil
  356. }
  357. return fmt.Errorf("that is type *NidRepEnum but is nil && this != nil")
  358. } else if this == nil {
  359. return fmt.Errorf("that is type *NidRepEnumbut is not nil && this == nil")
  360. }
  361. if len(this.Field1) != len(that1.Field1) {
  362. return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", len(this.Field1), len(that1.Field1))
  363. }
  364. for i := range this.Field1 {
  365. if this.Field1[i] != that1.Field1[i] {
  366. return fmt.Errorf("Field1 this[%v](%v) Not Equal that[%v](%v)", i, this.Field1[i], i, that1.Field1[i])
  367. }
  368. }
  369. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  370. return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
  371. }
  372. return nil
  373. }
  374. func (this *NidRepEnum) Equal(that interface{}) bool {
  375. if that == nil {
  376. if this == nil {
  377. return true
  378. }
  379. return false
  380. }
  381. that1, ok := that.(*NidRepEnum)
  382. if !ok {
  383. return false
  384. }
  385. if that1 == nil {
  386. if this == nil {
  387. return true
  388. }
  389. return false
  390. } else if this == nil {
  391. return false
  392. }
  393. if len(this.Field1) != len(that1.Field1) {
  394. return false
  395. }
  396. for i := range this.Field1 {
  397. if this.Field1[i] != that1.Field1[i] {
  398. return false
  399. }
  400. }
  401. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  402. return false
  403. }
  404. return true
  405. }
  406. func (this *NinRepEnum) VerboseEqual(that interface{}) error {
  407. if that == nil {
  408. if this == nil {
  409. return nil
  410. }
  411. return fmt.Errorf("that == nil && this != nil")
  412. }
  413. that1, ok := that.(*NinRepEnum)
  414. if !ok {
  415. return fmt.Errorf("that is not of type *NinRepEnum")
  416. }
  417. if that1 == nil {
  418. if this == nil {
  419. return nil
  420. }
  421. return fmt.Errorf("that is type *NinRepEnum but is nil && this != nil")
  422. } else if this == nil {
  423. return fmt.Errorf("that is type *NinRepEnumbut is not nil && this == nil")
  424. }
  425. if len(this.Field1) != len(that1.Field1) {
  426. return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", len(this.Field1), len(that1.Field1))
  427. }
  428. for i := range this.Field1 {
  429. if this.Field1[i] != that1.Field1[i] {
  430. return fmt.Errorf("Field1 this[%v](%v) Not Equal that[%v](%v)", i, this.Field1[i], i, that1.Field1[i])
  431. }
  432. }
  433. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  434. return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
  435. }
  436. return nil
  437. }
  438. func (this *NinRepEnum) Equal(that interface{}) bool {
  439. if that == nil {
  440. if this == nil {
  441. return true
  442. }
  443. return false
  444. }
  445. that1, ok := that.(*NinRepEnum)
  446. if !ok {
  447. return false
  448. }
  449. if that1 == nil {
  450. if this == nil {
  451. return true
  452. }
  453. return false
  454. } else if this == nil {
  455. return false
  456. }
  457. if len(this.Field1) != len(that1.Field1) {
  458. return false
  459. }
  460. for i := range this.Field1 {
  461. if this.Field1[i] != that1.Field1[i] {
  462. return false
  463. }
  464. }
  465. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  466. return false
  467. }
  468. return true
  469. }