From 78cf641d757ba31e6c7470f5c0a089b6818a044d Mon Sep 17 00:00:00 2001 From: Constantin Shalnev Date: Tue, 10 Nov 2015 13:43:03 +0300 Subject: [PATCH] Extended drules_struct.proto: added member is_optional --- indexer/drules_struct.pb.cc | 35 +++++++++++++- indexer/drules_struct.pb.h | 34 ++++++++++++++ indexer/drules_struct.proto | 1 + tools/python/stylesheet/drules_struct_pb2.py | 49 +++++++++++--------- 4 files changed, 96 insertions(+), 23 deletions(-) diff --git a/indexer/drules_struct.pb.cc b/indexer/drules_struct.pb.cc index f09838dbee..89f5b0ce45 100644 --- a/indexer/drules_struct.pb.cc +++ b/indexer/drules_struct.pb.cc @@ -2036,6 +2036,7 @@ const int CaptionDefProto::kStrokeColorFieldNumber; const int CaptionDefProto::kOffsetXFieldNumber; const int CaptionDefProto::kOffsetYFieldNumber; const int CaptionDefProto::kTextFieldNumber; +const int CaptionDefProto::kIsOptionalFieldNumber; #endif // !_MSC_VER CaptionDefProto::CaptionDefProto() @@ -2063,6 +2064,7 @@ void CaptionDefProto::SharedCtor() { offset_x_ = 0; offset_y_ = 0; text_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + is_optional_ = false; ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -2114,9 +2116,9 @@ void CaptionDefProto::Clear() { ::memset(&first, 0, n); \ } while (0) - if (_has_bits_[0 / 32] & 63) { + if (_has_bits_[0 / 32] & 127) { ZR_(height_, offset_x_); - offset_y_ = 0; + ZR_(offset_y_, is_optional_); if (has_text()) { if (text_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { text_->clear(); @@ -2228,6 +2230,21 @@ bool CaptionDefProto::MergePartialFromCodedStream( } else { goto handle_unusual; } + if (input->ExpectTag(56)) goto parse_is_optional; + break; + } + + // optional bool is_optional = 7; + case 7: { + if (tag == 56) { + parse_is_optional: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &is_optional_))); + set_has_is_optional(); + } else { + goto handle_unusual; + } if (input->ExpectAtEnd()) goto success; break; } @@ -2288,6 +2305,11 @@ void CaptionDefProto::SerializeWithCachedSizes( 6, this->text(), output); } + // optional bool is_optional = 7; + if (has_is_optional()) { + ::google::protobuf::internal::WireFormatLite::WriteBool(7, this->is_optional(), output); + } + output->WriteRaw(unknown_fields().data(), unknown_fields().size()); // @@protoc_insertion_point(serialize_end:CaptionDefProto) @@ -2339,6 +2361,11 @@ int CaptionDefProto::ByteSize() const { this->text()); } + // optional bool is_optional = 7; + if (has_is_optional()) { + total_size += 1 + 1; + } + } total_size += unknown_fields().size(); @@ -2374,6 +2401,9 @@ void CaptionDefProto::MergeFrom(const CaptionDefProto& from) { if (from.has_text()) { set_text(from.text()); } + if (from.has_is_optional()) { + set_is_optional(from.is_optional()); + } } mutable_unknown_fields()->append(from.unknown_fields()); } @@ -2398,6 +2428,7 @@ void CaptionDefProto::Swap(CaptionDefProto* other) { std::swap(offset_x_, other->offset_x_); std::swap(offset_y_, other->offset_y_); std::swap(text_, other->text_); + std::swap(is_optional_, other->is_optional_); std::swap(_has_bits_[0], other->_has_bits_[0]); _unknown_fields_.swap(other->_unknown_fields_); std::swap(_cached_size_, other->_cached_size_); diff --git a/indexer/drules_struct.pb.h b/indexer/drules_struct.pb.h index e1fd153ea9..6628b0789f 100644 --- a/indexer/drules_struct.pb.h +++ b/indexer/drules_struct.pb.h @@ -924,6 +924,13 @@ class CaptionDefProto : public ::google::protobuf::MessageLite { inline ::std::string* release_text(); inline void set_allocated_text(::std::string* text); + // optional bool is_optional = 7; + inline bool has_is_optional() const; + inline void clear_is_optional(); + static const int kIsOptionalFieldNumber = 7; + inline bool is_optional() const; + inline void set_is_optional(bool value); + // @@protoc_insertion_point(class_scope:CaptionDefProto) private: inline void set_has_height(); @@ -938,6 +945,8 @@ class CaptionDefProto : public ::google::protobuf::MessageLite { inline void clear_has_offset_y(); inline void set_has_text(); inline void clear_has_text(); + inline void set_has_is_optional(); + inline void clear_has_is_optional(); ::std::string _unknown_fields_; @@ -949,6 +958,7 @@ class CaptionDefProto : public ::google::protobuf::MessageLite { ::google::protobuf::int32 offset_x_; ::std::string* text_; ::google::protobuf::int32 offset_y_; + bool is_optional_; #ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER friend void protobuf_AddDesc_drules_5fstruct_2eproto_impl(); #else @@ -2852,6 +2862,30 @@ inline void CaptionDefProto::set_allocated_text(::std::string* text) { // @@protoc_insertion_point(field_set_allocated:CaptionDefProto.text) } +// optional bool is_optional = 7; +inline bool CaptionDefProto::has_is_optional() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void CaptionDefProto::set_has_is_optional() { + _has_bits_[0] |= 0x00000040u; +} +inline void CaptionDefProto::clear_has_is_optional() { + _has_bits_[0] &= ~0x00000040u; +} +inline void CaptionDefProto::clear_is_optional() { + is_optional_ = false; + clear_has_is_optional(); +} +inline bool CaptionDefProto::is_optional() const { + // @@protoc_insertion_point(field_get:CaptionDefProto.is_optional) + return is_optional_; +} +inline void CaptionDefProto::set_is_optional(bool value) { + set_has_is_optional(); + is_optional_ = value; + // @@protoc_insertion_point(field_set:CaptionDefProto.is_optional) +} + // ------------------------------------------------------------------- // CaptionRuleProto diff --git a/indexer/drules_struct.proto b/indexer/drules_struct.proto index 887f29be65..dabc958596 100644 --- a/indexer/drules_struct.proto +++ b/indexer/drules_struct.proto @@ -70,6 +70,7 @@ message CaptionDefProto optional int32 offset_x = 4; optional int32 offset_y = 5; optional string text = 6; + optional bool is_optional = 7; } message CaptionRuleProto diff --git a/tools/python/stylesheet/drules_struct_pb2.py b/tools/python/stylesheet/drules_struct_pb2.py index ff3f6c8237..6f8cf4fcf2 100644 --- a/tools/python/stylesheet/drules_struct_pb2.py +++ b/tools/python/stylesheet/drules_struct_pb2.py @@ -19,7 +19,7 @@ _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='drules_struct.proto', package='', - serialized_pb=_b('\n\x13\x64rules_struct.proto\"*\n\x0c\x44\x61shDotProto\x12\n\n\x02\x64\x64\x18\x01 \x03(\x01\x12\x0e\n\x06offset\x18\x02 \x01(\x01\":\n\x0cPathSymProto\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x0c\n\x04step\x18\x02 \x02(\x01\x12\x0e\n\x06offset\x18\x03 \x01(\x01\"\xaf\x01\n\rLineRuleProto\x12\r\n\x05width\x18\x01 \x02(\x01\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x1e\n\x07\x64\x61shdot\x18\x03 \x01(\x0b\x32\r.DashDotProto\x12\x10\n\x08priority\x18\x04 \x02(\x05\x12\x1e\n\x07pathsym\x18\x05 \x01(\x0b\x32\r.PathSymProto\x12\x17\n\x04join\x18\x06 \x01(\x0e\x32\t.LineJoin\x12\x15\n\x03\x63\x61p\x18\x07 \x01(\x0e\x32\x08.LineCap\"\x9c\x01\n\x0cLineDefProto\x12\r\n\x05width\x18\x01 \x02(\x01\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x1e\n\x07\x64\x61shdot\x18\x03 \x01(\x0b\x32\r.DashDotProto\x12\x1e\n\x07pathsym\x18\x04 \x01(\x0b\x32\r.PathSymProto\x12\x17\n\x04join\x18\x06 \x01(\x0e\x32\t.LineJoin\x12\x15\n\x03\x63\x61p\x18\x07 \x01(\x0e\x32\x08.LineCap\"O\n\rAreaRuleProto\x12\r\n\x05\x63olor\x18\x01 \x02(\r\x12\x1d\n\x06\x62order\x18\x02 \x01(\x0b\x32\r.LineDefProto\x12\x10\n\x08priority\x18\x03 \x02(\x05\"I\n\x0fSymbolRuleProto\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x16\n\x0e\x61pply_for_type\x18\x02 \x01(\x05\x12\x10\n\x08priority\x18\x03 \x02(\x05\"x\n\x0f\x43\x61ptionDefProto\x12\x0e\n\x06height\x18\x01 \x02(\x05\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x14\n\x0cstroke_color\x18\x03 \x01(\r\x12\x10\n\x08offset_x\x18\x04 \x01(\x05\x12\x10\n\x08offset_y\x18\x05 \x01(\x05\x12\x0c\n\x04text\x18\x06 \x01(\t\"l\n\x10\x43\x61ptionRuleProto\x12!\n\x07primary\x18\x01 \x02(\x0b\x32\x10.CaptionDefProto\x12#\n\tsecondary\x18\x02 \x01(\x0b\x32\x10.CaptionDefProto\x12\x10\n\x08priority\x18\x03 \x02(\x05\"a\n\x0f\x43ircleRuleProto\x12\x0e\n\x06radius\x18\x01 \x02(\x01\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x1d\n\x06\x62order\x18\x03 \x01(\x0b\x32\r.LineDefProto\x12\x10\n\x08priority\x18\x04 \x02(\x05\"m\n\x11PathTextRuleProto\x12!\n\x07primary\x18\x01 \x02(\x0b\x32\x10.CaptionDefProto\x12#\n\tsecondary\x18\x02 \x01(\x0b\x32\x10.CaptionDefProto\x12\x10\n\x08priority\x18\x03 \x02(\x05\"X\n\x0fShieldRuleProto\x12\x0e\n\x06height\x18\x01 \x02(\x05\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x14\n\x0cstroke_color\x18\x03 \x01(\r\x12\x10\n\x08priority\x18\x04 \x02(\x05\"\xa1\x02\n\x10\x44rawElementProto\x12\r\n\x05scale\x18\x01 \x02(\x05\x12\x1d\n\x05lines\x18\x02 \x03(\x0b\x32\x0e.LineRuleProto\x12\x1c\n\x04\x61rea\x18\x03 \x01(\x0b\x32\x0e.AreaRuleProto\x12 \n\x06symbol\x18\x04 \x01(\x0b\x32\x10.SymbolRuleProto\x12\"\n\x07\x63\x61ption\x18\x05 \x01(\x0b\x32\x11.CaptionRuleProto\x12 \n\x06\x63ircle\x18\x06 \x01(\x0b\x32\x10.CircleRuleProto\x12%\n\tpath_text\x18\x07 \x01(\x0b\x32\x12.PathTextRuleProto\x12 \n\x06shield\x18\x08 \x01(\x0b\x32\x10.ShieldRuleProto\x12\x10\n\x08\x61pply_if\x18\t \x03(\t\"G\n\x13\x43lassifElementProto\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\"\n\x07\x65lement\x18\x02 \x03(\x0b\x32\x11.DrawElementProto\"4\n\x0e\x43ontainerProto\x12\"\n\x04\x63ont\x18\x01 \x03(\x0b\x32\x14.ClassifElementProto*4\n\x08LineJoin\x12\r\n\tROUNDJOIN\x10\x00\x12\r\n\tBEVELJOIN\x10\x01\x12\n\n\x06NOJOIN\x10\x02*3\n\x07LineCap\x12\x0c\n\x08ROUNDCAP\x10\x00\x12\x0b\n\x07\x42UTTCAP\x10\x01\x12\r\n\tSQUARECAP\x10\x02\x42\x02H\x03') + serialized_pb=_b('\n\x13\x64rules_struct.proto\"*\n\x0c\x44\x61shDotProto\x12\n\n\x02\x64\x64\x18\x01 \x03(\x01\x12\x0e\n\x06offset\x18\x02 \x01(\x01\":\n\x0cPathSymProto\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x0c\n\x04step\x18\x02 \x02(\x01\x12\x0e\n\x06offset\x18\x03 \x01(\x01\"\xaf\x01\n\rLineRuleProto\x12\r\n\x05width\x18\x01 \x02(\x01\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x1e\n\x07\x64\x61shdot\x18\x03 \x01(\x0b\x32\r.DashDotProto\x12\x10\n\x08priority\x18\x04 \x02(\x05\x12\x1e\n\x07pathsym\x18\x05 \x01(\x0b\x32\r.PathSymProto\x12\x17\n\x04join\x18\x06 \x01(\x0e\x32\t.LineJoin\x12\x15\n\x03\x63\x61p\x18\x07 \x01(\x0e\x32\x08.LineCap\"\x9c\x01\n\x0cLineDefProto\x12\r\n\x05width\x18\x01 \x02(\x01\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x1e\n\x07\x64\x61shdot\x18\x03 \x01(\x0b\x32\r.DashDotProto\x12\x1e\n\x07pathsym\x18\x04 \x01(\x0b\x32\r.PathSymProto\x12\x17\n\x04join\x18\x06 \x01(\x0e\x32\t.LineJoin\x12\x15\n\x03\x63\x61p\x18\x07 \x01(\x0e\x32\x08.LineCap\"O\n\rAreaRuleProto\x12\r\n\x05\x63olor\x18\x01 \x02(\r\x12\x1d\n\x06\x62order\x18\x02 \x01(\x0b\x32\r.LineDefProto\x12\x10\n\x08priority\x18\x03 \x02(\x05\"I\n\x0fSymbolRuleProto\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x16\n\x0e\x61pply_for_type\x18\x02 \x01(\x05\x12\x10\n\x08priority\x18\x03 \x02(\x05\"\x8d\x01\n\x0f\x43\x61ptionDefProto\x12\x0e\n\x06height\x18\x01 \x02(\x05\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x14\n\x0cstroke_color\x18\x03 \x01(\r\x12\x10\n\x08offset_x\x18\x04 \x01(\x05\x12\x10\n\x08offset_y\x18\x05 \x01(\x05\x12\x0c\n\x04text\x18\x06 \x01(\t\x12\x13\n\x0bis_optional\x18\x07 \x01(\x08\"l\n\x10\x43\x61ptionRuleProto\x12!\n\x07primary\x18\x01 \x02(\x0b\x32\x10.CaptionDefProto\x12#\n\tsecondary\x18\x02 \x01(\x0b\x32\x10.CaptionDefProto\x12\x10\n\x08priority\x18\x03 \x02(\x05\"a\n\x0f\x43ircleRuleProto\x12\x0e\n\x06radius\x18\x01 \x02(\x01\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x1d\n\x06\x62order\x18\x03 \x01(\x0b\x32\r.LineDefProto\x12\x10\n\x08priority\x18\x04 \x02(\x05\"m\n\x11PathTextRuleProto\x12!\n\x07primary\x18\x01 \x02(\x0b\x32\x10.CaptionDefProto\x12#\n\tsecondary\x18\x02 \x01(\x0b\x32\x10.CaptionDefProto\x12\x10\n\x08priority\x18\x03 \x02(\x05\"X\n\x0fShieldRuleProto\x12\x0e\n\x06height\x18\x01 \x02(\x05\x12\r\n\x05\x63olor\x18\x02 \x02(\r\x12\x14\n\x0cstroke_color\x18\x03 \x01(\r\x12\x10\n\x08priority\x18\x04 \x02(\x05\"\xa1\x02\n\x10\x44rawElementProto\x12\r\n\x05scale\x18\x01 \x02(\x05\x12\x1d\n\x05lines\x18\x02 \x03(\x0b\x32\x0e.LineRuleProto\x12\x1c\n\x04\x61rea\x18\x03 \x01(\x0b\x32\x0e.AreaRuleProto\x12 \n\x06symbol\x18\x04 \x01(\x0b\x32\x10.SymbolRuleProto\x12\"\n\x07\x63\x61ption\x18\x05 \x01(\x0b\x32\x11.CaptionRuleProto\x12 \n\x06\x63ircle\x18\x06 \x01(\x0b\x32\x10.CircleRuleProto\x12%\n\tpath_text\x18\x07 \x01(\x0b\x32\x12.PathTextRuleProto\x12 \n\x06shield\x18\x08 \x01(\x0b\x32\x10.ShieldRuleProto\x12\x10\n\x08\x61pply_if\x18\t \x03(\t\"G\n\x13\x43lassifElementProto\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\"\n\x07\x65lement\x18\x02 \x03(\x0b\x32\x11.DrawElementProto\"4\n\x0e\x43ontainerProto\x12\"\n\x04\x63ont\x18\x01 \x03(\x0b\x32\x14.ClassifElementProto*4\n\x08LineJoin\x12\r\n\tROUNDJOIN\x10\x00\x12\r\n\tBEVELJOIN\x10\x01\x12\n\n\x06NOJOIN\x10\x02*3\n\x07LineCap\x12\x0c\n\x08ROUNDCAP\x10\x00\x12\x0b\n\x07\x42UTTCAP\x10\x01\x12\r\n\tSQUARECAP\x10\x02\x42\x02H\x03') ) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -44,8 +44,8 @@ _LINEJOIN = _descriptor.EnumDescriptor( ], containing_type=None, options=None, - serialized_start=1571, - serialized_end=1623, + serialized_start=1593, + serialized_end=1645, ) _sym_db.RegisterEnumDescriptor(_LINEJOIN) @@ -71,8 +71,8 @@ _LINECAP = _descriptor.EnumDescriptor( ], containing_type=None, options=None, - serialized_start=1625, - serialized_end=1676, + serialized_start=1647, + serialized_end=1698, ) _sym_db.RegisterEnumDescriptor(_LINECAP) @@ -441,6 +441,13 @@ _CAPTIONDEFPROTO = _descriptor.Descriptor( message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), + _descriptor.FieldDescriptor( + name='is_optional', full_name='CaptionDefProto.is_optional', index=6, + number=7, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), ], extensions=[ ], @@ -452,8 +459,8 @@ _CAPTIONDEFPROTO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=620, - serialized_end=740, + serialized_start=621, + serialized_end=762, ) @@ -496,8 +503,8 @@ _CAPTIONRULEPROTO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=742, - serialized_end=850, + serialized_start=764, + serialized_end=872, ) @@ -547,8 +554,8 @@ _CIRCLERULEPROTO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=852, - serialized_end=949, + serialized_start=874, + serialized_end=971, ) @@ -591,8 +598,8 @@ _PATHTEXTRULEPROTO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=951, - serialized_end=1060, + serialized_start=973, + serialized_end=1082, ) @@ -642,8 +649,8 @@ _SHIELDRULEPROTO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1062, - serialized_end=1150, + serialized_start=1084, + serialized_end=1172, ) @@ -728,8 +735,8 @@ _DRAWELEMENTPROTO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1153, - serialized_end=1442, + serialized_start=1175, + serialized_end=1464, ) @@ -765,8 +772,8 @@ _CLASSIFELEMENTPROTO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1444, - serialized_end=1515, + serialized_start=1466, + serialized_end=1537, ) @@ -795,8 +802,8 @@ _CONTAINERPROTO = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1517, - serialized_end=1569, + serialized_start=1539, + serialized_end=1591, ) _LINERULEPROTO.fields_by_name['dashdot'].message_type = _DASHDOTPROTO