objectivec_helpers.h

#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
namespace google::protobuf::compiler::objectivec

Helper functions for generating ObjectiveC code.

Classes in this file

Generator options (see objectivec_generator.cc for a description of each):
Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform the input into the expected output.
Helper for parsing simple files.
Helper class for parsing framework import mappings and generating import statements.

File Members

These definitions are not part of any class.
enum
ObjectiveCType
enum
FlagType
const char *const
ProtobufLibraryFrameworkName
The name the commonly used by the library when built as a framework. more...
string
EscapeTrigraphs(const string & to_escape)
Escape C++ trigraphs by escaping question marks to "\?".
string
StripProto(const string & filename)
Strips ".proto" or ".protodevel" from the end of a filename.
void
StringPieceTrimWhitespace(StringPiece * input)
Remove white space from either end of a StringPiece.
bool
IsRetainedName(const string & name)
Returns true if the name requires a ns_returns_not_retained attribute applied to it.
bool
IsInitName(const string & name)
Returns true if the name starts with "init" and will need to have special handling under ARC.
string
FileClassPrefix(const FileDescriptor * file)
Gets the objc_class_prefix.
string
FilePath(const FileDescriptor * file)
Gets the path of the file we're going to generate (sans the .pb.h extension). more...
string
FilePathBasename(const FileDescriptor * file)
Just like FilePath(), but without the directory part.
string
FileClassName(const FileDescriptor * file)
Gets the name of the root class we'll generate in the file. more...
string
ClassName(const Descriptor * descriptor)
These return the fully-qualified class name corresponding to the given descriptor.
string
ClassName(const Descriptor * descriptor, string * out_suffix_added)
string
EnumName(const EnumDescriptor * descriptor)
string
EnumValueName(const EnumValueDescriptor * descriptor)
Returns the fully-qualified name of the enum value corresponding to the the descriptor.
string
EnumValueShortName(const EnumValueDescriptor * descriptor)
Returns the name of the enum value corresponding to the descriptor.
string
UnCamelCaseEnumShortName(const string & name)
Reverse what an enum does.
string
ExtensionMethodName(const FieldDescriptor * descriptor)
Returns the name to use for the extension (used as the method off the file's Root class).
string
FieldName(const FieldDescriptor * field)
Returns the transformed field name.
string
FieldNameCapitalized(const FieldDescriptor * field)
string
OneofEnumName(const OneofDescriptor * descriptor)
Returns the transformed oneof name.
string
OneofName(const OneofDescriptor * descriptor)
string
OneofNameCapitalized(const OneofDescriptor * descriptor)
bool
HasFieldPresence(const FileDescriptor * file)
bool
HasPreservingUnknownEnumSemantics(const FileDescriptor * file)
bool
IsMapEntryMessage(const Descriptor * descriptor)
string
UnCamelCaseFieldName(const string & name, const FieldDescriptor * field)
Reverse of the above.
template string
GetOptionalDeprecatedAttribute(const TDescriptor * descriptor, bool preSpace = true, bool postNewline = false)
string
GetCapitalizedType(const FieldDescriptor * field)
ObjectiveCType
GetObjectiveCType(FieldDescriptor::Type field_type)
ObjectiveCType
GetObjectiveCType(const FieldDescriptor * field)
bool
IsPrimitiveType(const FieldDescriptor * field)
bool
IsReferenceType(const FieldDescriptor * field)
string
GPBGenericValueFieldName(const FieldDescriptor * field)
string
DefaultValue(const FieldDescriptor * field)
bool
HasNonZeroDefaultValue(const FieldDescriptor * field)
string
BuildFlagsString(const FlagType type, const vector< string > & strings)
string
BuildCommentsString(const SourceLocation & location, bool prefer_single_line)
Builds HeaderDoc/appledoc style comments out of the comments in the .proto file.
string
ProtobufFrameworkImportSymbol(const string & framework_name)
Returns the CPP symbol name to use as the gate for framework style imports for the given framework name to use.
bool
IsProtobufLibraryBundledProtoFile(const FileDescriptor * file)
Checks if the file is one of the proto's bundled with the library.
bool
ValidateObjCClassPrefixes(const vector< const FileDescriptor * > & files, const Options & generation_options, string * out_error)
Checks the prefix for the given files and outputs any warnings as needed. more...
bool
ParseSimpleFile(const string & path, LineConsumer * line_consumer, string * out_error)

enum objectivec::ObjectiveCType {
  OBJECTIVECTYPE_INT32,
  OBJECTIVECTYPE_UINT32,
  OBJECTIVECTYPE_INT64,
  OBJECTIVECTYPE_UINT64,
  OBJECTIVECTYPE_FLOAT,
  OBJECTIVECTYPE_DOUBLE,
  OBJECTIVECTYPE_BOOLEAN,
  OBJECTIVECTYPE_STRING,
  OBJECTIVECTYPE_DATA,
  OBJECTIVECTYPE_ENUM,
  OBJECTIVECTYPE_MESSAGE
}

OBJECTIVECTYPE_INT32
OBJECTIVECTYPE_UINT32
OBJECTIVECTYPE_INT64
OBJECTIVECTYPE_UINT64
OBJECTIVECTYPE_FLOAT
OBJECTIVECTYPE_DOUBLE
OBJECTIVECTYPE_BOOLEAN
OBJECTIVECTYPE_STRING
OBJECTIVECTYPE_DATA
OBJECTIVECTYPE_ENUM
OBJECTIVECTYPE_MESSAGE

enum objectivec::FlagType {
  FLAGTYPE_DESCRIPTOR_INITIALIZATION,
  FLAGTYPE_EXTENSION,
  FLAGTYPE_FIELD
}

FLAGTYPE_DESCRIPTOR_INITIALIZATION
FLAGTYPE_EXTENSION
FLAGTYPE_FIELD

const char *constobjectivec::ProtobufLibraryFrameworkName

The name the commonly used by the library when built as a framework.

This lines up to the name used in the CocoaPod.


string objectivec::FilePath(
        const FileDescriptor * file)

Gets the path of the file we're going to generate (sans the .pb.h extension).

The path will be dependent on the objectivec package declared in the proto package.


string objectivec::FileClassName(
        const FileDescriptor * file)

Gets the name of the root class we'll generate in the file.

This class is not meant for external consumption, but instead contains helpers that the rest of the classes need


bool objectivec::ValidateObjCClassPrefixes(
        const vector< const FileDescriptor * > & files,
        const Options & generation_options,
        string * out_error)

Checks the prefix for the given files and outputs any warnings as needed.

If there are flat out errors, then out_error is filled in with the first error and the result is false.

struct Options

#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
namespace google::protobuf::compiler::objectivec

Generator options (see objectivec_generator.cc for a description of each):

Members

string
expected_prefixes_path
string
generate_for_named_framework
string
named_framework_to_proto_path_mappings_path
Options()

class TextFormatDecodeData

#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
namespace google::protobuf::compiler::objectivec

Generate decode data needed for ObjC's GPBDecodeTextFormatName() to transform the input into the expected output.

Members

TextFormatDecodeData()
~TextFormatDecodeData()
void
AddString(int32 key, const string & input_for_decode, const string & desired_output)
size_t
num_entries() const
string
Data() const
static string
DecodeDataForString(const string & input_for_decode, const string & desired_output)

class LineConsumer

#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
namespace google::protobuf::compiler::objectivec

Helper for parsing simple files.

Members

LineConsumer()
virtual
~LineConsumer()
virtual bool
ConsumeLine(const StringPiece & line, string * out_error) = 0

class ImportWriter

#include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
namespace google::protobuf::compiler::objectivec

Helper class for parsing framework import mappings and generating import statements.

Members

ImportWriter(const string & generate_for_named_framework, const string & named_framework_to_proto_path_mappings_path)
~ImportWriter()
void
AddFile(const FileDescriptor * file, const string & header_extension)
void
Print(io::Printer * printer) const