Skip to content

Commit

Permalink
Adding some helper functions for testing file options.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Parise committed Nov 15, 2010
1 parent ff33902 commit a62dde9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/compiler/objc_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <string>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/descriptor.pb.h>

namespace google {
namespace protobuf {
Expand Down Expand Up @@ -105,6 +106,22 @@ string BoxValue(const FieldDescriptor* field, const string& value);

const char* GetArrayValueType(const FieldDescriptor* field);

// Do message classes in this file keep track of unknown fields?
inline bool HasUnknownFields(const FileDescriptor *file) {
return file->options().optimize_for() != FileOptions::LITE_RUNTIME;
}

// Does this file have generated parsing, serialization, and other
// standard methods for which reflection-based fallback implementations exist?
inline bool HasGeneratedMethods(const FileDescriptor *file) {
return file->options().optimize_for() != FileOptions::CODE_SIZE;
}

// Do message classes in this file have descriptor and refelction methods?
inline bool HasDescriptorMethods(const FileDescriptor *file) {
return file->options().optimize_for() != FileOptions::LITE_RUNTIME;
}

} // namespace objectivec
} // namespace compiler
} // namespace protobuf
Expand Down

0 comments on commit a62dde9

Please sign in to comment.