UnknownFieldSetBuilder.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. // Protocol Buffers for Objective C
  2. //
  3. // Copyright 2010 Booyah Inc.
  4. // Copyright 2008 Cyrus Najmabadi
  5. //
  6. // Licensed under the Apache License, Version 2.0 (the "License");
  7. // you may not use this file except in compliance with the License.
  8. // You may obtain a copy of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS,
  14. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. // See the License for the specific language governing permissions and
  16. // limitations under the License.
  17. #import "MessageBuilder.h"
  18. @class PBField;
  19. @class PBMutableField;
  20. @interface PBUnknownFieldSetBuilder : NSObject <PBMessageBuilder> {
  21. @private
  22. NSMutableDictionary* fields;
  23. // Optimization: We keep around a builder for the last field that was
  24. // modified so that we can efficiently add to it multiple times in a
  25. // row (important when parsing an unknown repeated field).
  26. SInt32 lastFieldNumber;
  27. PBMutableField* lastField;
  28. }
  29. //+ (PBUnknownFieldSetBuilder*) createBuilder:(PBUnknownFieldSet*) unknownFields;
  30. - (PBUnknownFieldSet*) build;
  31. /**
  32. * @brief 合并Unknown类型
  33. *
  34. * @param PBUnknownFieldSet
  35. *
  36. * @return instance
  37. */
  38. - (PBUnknownFieldSetBuilder*) mergeUnknownFields:(PBUnknownFieldSet*) other;
  39. /**
  40. * @brief 合并Unknown类型
  41. *
  42. * @param PBCodedInputStream
  43. *
  44. * @return instance
  45. */
  46. - (PBUnknownFieldSetBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input;
  47. /**
  48. * @brief 合并Unknown类型
  49. *
  50. * @param NSData
  51. *
  52. * @return instance
  53. */
  54. - (PBUnknownFieldSetBuilder*) mergeFromData:(NSData*) data;
  55. /**
  56. * @brief 合并Unknown类型
  57. *
  58. * @param NSInputStream
  59. *
  60. * @return instance
  61. */
  62. - (PBUnknownFieldSetBuilder*) mergeFromInputStream:(NSInputStream*) input;
  63. /**
  64. * @brief 合并可变整数
  65. *
  66. * @param number
  67. * @param value
  68. *
  69. * @return instance
  70. */
  71. - (PBUnknownFieldSetBuilder*) mergeVarintField:(SInt32) number value:(SInt32) value;
  72. /**
  73. * @brief 同构PB的tag合并input类型
  74. *
  75. * @param tag
  76. * @param input
  77. *
  78. * @return instance
  79. */
  80. - (BOOL) mergeFieldFrom:(SInt32) tag input:(PBCodedInputStream*) input;
  81. /**
  82. * @brief 添加field
  83. *
  84. * @param field
  85. * @param number
  86. *
  87. * @return instance
  88. */
  89. - (PBUnknownFieldSetBuilder*) addField:(PBField*) field forNumber:(SInt32) number;
  90. /**
  91. * @brief clear
  92. *
  93. * @return instance
  94. */
  95. - (PBUnknownFieldSetBuilder*) clear;
  96. /**
  97. * @brief 合并field
  98. *
  99. * @param field
  100. * @param number
  101. *
  102. * @return instance
  103. */
  104. - (PBUnknownFieldSetBuilder*) mergeField:(PBField*) field forNumber:(SInt32) number;
  105. @end