Go to the documentation of this file.
43 namespace objectivec {
57 std::set<std::string> value_names;
64 if (
value == canonical_value) {
69 if (value_names.find(value_name) != value_names.end()) {
72 value_names.insert(value_name);
91 "#pragma mark - Enum $name$\n"
109 printer->
Print(
"$comments$typedef$deprecated_attribute$ GPB_ENUM($name$) {\n",
110 "comments", enum_comments,
119 " * Value used if any message's field encounters a value that is not defined\n"
120 " * by this enum. The message will also have C functions to get/set the rawValue\n"
123 "$name$_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue,\n",
133 if (comments.length() > 0) {
135 printer->
Print(
"\n");
137 printer->
Print(comments.c_str());
142 "$name$$deprecated_attribute$ = $value$,\n",
151 "GPBEnumDescriptor *$name$_EnumDescriptor(void);\n"
154 " * Checks to see if the given value is defined by the enum or was not known at\n"
155 " * the time this source was generated.\n"
157 "BOOL $name$_IsValidValue(int32_t value);\n"
164 "#pragma mark - Enum $name$\n"
174 int enum_value_description_key = -1;
178 ++enum_value_description_key;
180 text_blob += short_name +
'\0';
182 text_format_decode_data.
AddString(enum_value_description_key, short_name,
188 "GPBEnumDescriptor *$name$_EnumDescriptor(void) {\n"
189 " static _Atomic(GPBEnumDescriptor*) descriptor = nil;\n"
190 " if (!descriptor) {\n",
193 static const int kBytesPerLine = 40;
195 " static const char *valueNames =");
196 for (
int i = 0;
i < text_blob.size();
i += kBytesPerLine) {
203 " static const int32_t values[] = {\n");
207 printer->
Print(
" };\n");
211 " GPBEnumDescriptor *worker =\n"
212 " [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n"
213 " valueNames:valueNames\n"
215 " count:(uint32_t)(sizeof(values) / sizeof(int32_t))\n"
216 " enumVerifier:$name$_IsValidValue];\n",
220 " static const char *extraTextFormatInfo = \"$extraTextFormatInfo$\";\n"
221 " GPBEnumDescriptor *worker =\n"
222 " [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol($name$)\n"
223 " valueNames:valueNames\n"
225 " count:(uint32_t)(sizeof(values) / sizeof(int32_t))\n"
226 " enumVerifier:$name$_IsValidValue\n"
227 " extraTextFormatInfo:extraTextFormatInfo];\n",
229 "extraTextFormatInfo",
CEscape(text_format_decode_data.
Data()));
232 " GPBEnumDescriptor *expected = nil;\n"
233 " if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {\n"
234 " [worker release];\n"
237 " return descriptor;\n"
241 "BOOL $name$_IsValidValue(int32_t value__) {\n"
242 " switch (value__) {\n",
void Print(const std::map< std::string, std::string > &variables, const char *text)
std::set< const EnumValueDescriptor * > alias_values_to_skip_
string StrCat(const AlphaNum &a, const AlphaNum &b)
bool HasPreservingUnknownEnumSemantics(const FileDescriptor *file)
string EnumValueShortName(const EnumValueDescriptor *descriptor)
const string & name() const
const EnumDescriptor * descriptor_
string CEscape(const string &src)
string BuildCommentsString(const SourceLocation &location, bool prefer_single_line)
const EnumValueDescriptor * FindValueByNumber(int number) const
std::vector< const EnumValueDescriptor * > all_values_
string EnumValueName(const EnumValueDescriptor *descriptor)
string GetOptionalDeprecatedAttribute(const TDescriptor *descriptor, const FileDescriptor *file=NULL, bool preSpace=true, bool postNewline=false)
const FileDescriptor * file() const
const EnumValueDescriptor * value(int index) const
void GenerateSource(io::Printer *printer)
void AddString(int32 key, const string &input_for_decode, const string &desired_output)
string UnCamelCaseEnumShortName(const string &name)
size_t num_entries() const
std::vector< const EnumValueDescriptor * > base_values_
void GenerateHeader(io::Printer *printer)
GLsizei const GLfloat * value
bool GetSourceLocation(SourceLocation *out_location) const
const Descriptor * descriptor_
string EnumName(const EnumDescriptor *descriptor)
EnumGenerator(const EnumDescriptor *descriptor)
string EscapeTrigraphs(const string &to_escape)
libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:57