This commit is contained in:
Wouter van Oortmerssen
2016-04-04 16:55:25 -07:00
11 changed files with 114 additions and 38 deletions

View File

@@ -91,6 +91,14 @@
#else
#define FLATBUFFERS_FINAL_CLASS
#endif
#if (!defined(_MSC_VER) || _MSC_VER >= 1900) && \
(!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406))
#define FLATBUFFERS_CONSTEXPR constexpr
#else
#define FLATBUFFERS_CONSTEXPR
#endif
/// @endcond
/// @file
@@ -1112,14 +1120,14 @@ FLATBUFFERS_FINAL_CLASS
bool force_defaults_; // Serialize values equal to their defaults anyway.
struct StringOffsetCompare {
StringOffsetCompare(const vector_downward &buf) : buf_(buf) {}
StringOffsetCompare(const vector_downward &buf) : buf_(&buf) {}
bool operator() (const Offset<String> &a, const Offset<String> &b) const {
auto stra = reinterpret_cast<const String *>(buf_.data_at(a.o));
auto strb = reinterpret_cast<const String *>(buf_.data_at(b.o));
auto stra = reinterpret_cast<const String *>(buf_->data_at(a.o));
auto strb = reinterpret_cast<const String *>(buf_->data_at(b.o));
return strncmp(stra->c_str(), strb->c_str(),
std::min(stra->size(), strb->size()) + 1) < 0;
}
const vector_downward &buf_;
const vector_downward *buf_;
};
// For use with CreateSharedString. Instantiated on first use only.

View File

@@ -331,6 +331,7 @@ struct IDLOptions {
bool proto_mode;
bool generate_all;
bool skip_unexpected_fields_in_json;
bool generate_name_strings;
// Possible options for the more general generator below.
enum Language { kJava, kCSharp, kGo, kMAX };
@@ -349,6 +350,7 @@ struct IDLOptions {
proto_mode(false),
generate_all(false),
skip_unexpected_fields_in_json(false),
generate_name_strings(false),
lang(IDLOptions::kJava) {}
};