const style format::style() const { if (!has_style()) { throw invalid_attribute(); } return d_->parent->style(d_->style.get()); }
void test_style() { xlnt::workbook wb; auto ws = wb.active_sheet(); auto cell = ws.cell("A1"); xlnt_assert(!cell.has_style()); auto test_style = wb.create_style("test_style"); test_style.number_format(xlnt::number_format::date_ddmmyyyy(), true); cell.style(test_style); xlnt_assert(cell.has_style()); xlnt_assert_equals(cell.style().number_format(), xlnt::number_format::date_ddmmyyyy()); xlnt_assert_equals(cell.style(), test_style); auto other_style = wb.create_style("other_style"); other_style.number_format(xlnt::number_format::date_time2(), true); cell.style("other_style"); xlnt_assert_equals(cell.style().number_format(), xlnt::number_format::date_time2()); xlnt_assert_equals(cell.style(), other_style); auto last_style = wb.create_style("last_style"); last_style.number_format(xlnt::number_format::percentage(), true); cell.style(last_style); xlnt_assert_equals(cell.style().number_format(), xlnt::number_format::percentage()); xlnt_assert_equals(cell.style(), last_style); xlnt_assert_throws(cell.style("doesn't exist"), xlnt::key_not_found); cell.clear_style(); xlnt_assert(!cell.has_style()); xlnt_assert_throws(cell.style(), xlnt::invalid_attribute); }
bool cell::garbage_collectible() const { return !(get_data_type() != type::null || is_merged() || has_comment() || has_formula() || has_style()); }
void UserBasicInfo::SerializeWithCachedSizes( ::google::protobuf::io::CodedOutputStream* output) const { // optional string uid = 1; if (has_uid()) { ::google::protobuf::internal::WireFormatLite::WriteString( 1, this->uid(), output); } // optional string name = 2; if (has_name()) { ::google::protobuf::internal::WireFormatLite::WriteString( 2, this->name(), output); } // optional uint32 level = 3 [default = 1]; if (has_level()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->level(), output); } // optional uint32 style = 4; if (has_style()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->style(), output); } // optional uint32 winCount = 5; if (has_wincount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->wincount(), output); } // optional uint32 loseCount = 6; if (has_losecount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->losecount(), output); } // optional float winRate = 7; if (has_winrate()) { ::google::protobuf::internal::WireFormatLite::WriteFloat(7, this->winrate(), output); } // optional .message.UserBasicInfo.EffectData effect = 8; if (has_effect()) { ::google::protobuf::internal::WireFormatLite::WriteMessage( 8, this->effect(), output); } // optional uint32 iconId = 9 [default = 6000]; if (has_iconid()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->iconid(), output); } // optional uint32 successionWinCount = 10; if (has_successionwincount()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(10, this->successionwincount(), output); } // optional uint32 onceLong = 11; if (has_oncelong()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->oncelong(), output); } // optional uint64 maximum = 12; if (has_maximum()) { ::google::protobuf::internal::WireFormatLite::WriteUInt64(12, this->maximum(), output); } // optional uint64 totalTime = 13; if (has_totaltime()) { ::google::protobuf::internal::WireFormatLite::WriteUInt64(13, this->totaltime(), output); } // optional uint32 roundsPlayed = 14; if (has_roundsplayed()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(14, this->roundsplayed(), output); } // optional uint32 throwStones = 15; if (has_throwstones()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(15, this->throwstones(), output); } // optional uint32 thrownStones = 16; if (has_thrownstones()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(16, this->thrownstones(), output); } // optional uint32 colorCats = 17; if (has_colorcats()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(17, this->colorcats(), output); } // optional uint32 consumeGolds = 18; if (has_consumegolds()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(18, this->consumegolds(), output); } // optional uint32 consumeItems1 = 19; if (has_consumeitems1()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(19, this->consumeitems1(), output); } // optional uint32 consumeItems2 = 20; if (has_consumeitems2()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(20, this->consumeitems2(), output); } // optional uint32 consumeItems3 = 21; if (has_consumeitems3()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(21, this->consumeitems3(), output); } // optional uint32 consumeItems4 = 22; if (has_consumeitems4()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(22, this->consumeitems4(), output); } // optional uint32 golds = 23; if (has_golds()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(23, this->golds(), output); } // optional uint32 experience = 24; if (has_experience()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(24, this->experience(), output); } // optional uint32 maxExperience = 25 [default = 1]; if (has_maxexperience()) { ::google::protobuf::internal::WireFormatLite::WriteUInt32(25, this->maxexperience(), output); } // repeated uint32 buyEquipFrame = 26; for (int i = 0; i < this->buyequipframe_size(); i++) { ::google::protobuf::internal::WireFormatLite::WriteUInt32( 26, this->buyequipframe(i), output); } }
int UserBasicInfo::ByteSize() const { int total_size = 0; if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { // optional string uid = 1; if (has_uid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->uid()); } // optional string name = 2; if (has_name()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( this->name()); } // optional uint32 level = 3 [default = 1]; if (has_level()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->level()); } // optional uint32 style = 4; if (has_style()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->style()); } // optional uint32 winCount = 5; if (has_wincount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->wincount()); } // optional uint32 loseCount = 6; if (has_losecount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->losecount()); } // optional float winRate = 7; if (has_winrate()) { total_size += 1 + 4; } // optional .message.UserBasicInfo.EffectData effect = 8; if (has_effect()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( this->effect()); } } if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) { // optional uint32 iconId = 9 [default = 6000]; if (has_iconid()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->iconid()); } // optional uint32 successionWinCount = 10; if (has_successionwincount()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->successionwincount()); } // optional uint32 onceLong = 11; if (has_oncelong()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->oncelong()); } // optional uint64 maximum = 12; if (has_maximum()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt64Size( this->maximum()); } // optional uint64 totalTime = 13; if (has_totaltime()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt64Size( this->totaltime()); } // optional uint32 roundsPlayed = 14; if (has_roundsplayed()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->roundsplayed()); } // optional uint32 throwStones = 15; if (has_throwstones()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->throwstones()); } // optional uint32 thrownStones = 16; if (has_thrownstones()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->thrownstones()); } } if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) { // optional uint32 colorCats = 17; if (has_colorcats()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->colorcats()); } // optional uint32 consumeGolds = 18; if (has_consumegolds()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumegolds()); } // optional uint32 consumeItems1 = 19; if (has_consumeitems1()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems1()); } // optional uint32 consumeItems2 = 20; if (has_consumeitems2()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems2()); } // optional uint32 consumeItems3 = 21; if (has_consumeitems3()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems3()); } // optional uint32 consumeItems4 = 22; if (has_consumeitems4()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->consumeitems4()); } // optional uint32 golds = 23; if (has_golds()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->golds()); } // optional uint32 experience = 24; if (has_experience()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->experience()); } } if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) { // optional uint32 maxExperience = 25 [default = 1]; if (has_maxexperience()) { total_size += 2 + ::google::protobuf::internal::WireFormatLite::UInt32Size( this->maxexperience()); } } // repeated uint32 buyEquipFrame = 26; { int data_size = 0; for (int i = 0; i < this->buyequipframe_size(); i++) { data_size += ::google::protobuf::internal::WireFormatLite:: UInt32Size(this->buyequipframe(i)); } total_size += 2 * this->buyequipframe_size() + data_size; } GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); _cached_size_ = total_size; GOOGLE_SAFE_CONCURRENT_WRITES_END(); return total_size; }