本文整理汇总了C++中not_null类的典型用法代码示例。如果您正苦于以下问题:C++ not_null类的具体用法?C++ not_null怎么用?C++ not_null使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了not_null类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CreateAttach
std::unique_ptr<HistoryMedia> CreateAttach(
not_null<HistoryView::Element*> parent,
DocumentData *document,
PhotoData *photo,
const std::vector<std::unique_ptr<Data::Media>> &collage,
const QString &webpageUrl) {
if (!collage.empty()) {
return std::make_unique<HistoryGroupedMedia>(parent, collage);
} else if (document) {
if (document->sticker()) {
return std::make_unique<HistorySticker>(parent, document);
} else if (document->isAnimation()) {
return std::make_unique<HistoryGif>(parent, document);
} else if (document->isVideoFile()) {
return std::make_unique<HistoryVideo>(
parent,
parent->data(),
document);
} else if (document->isWallPaper()) {
return std::make_unique<HistoryWallPaper>(
parent,
document,
webpageUrl);
}
return std::make_unique<HistoryDocument>(parent, document);
} else if (photo) {
return std::make_unique<HistoryPhoto>(
parent,
parent->data(),
photo);
}
return nullptr;
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:33,代码来源:history_media_common.cpp
示例2: fillFrom
void MessageCursor::fillFrom(not_null<const Ui::InputField*> field) {
const auto cursor = field->textCursor();
position = cursor.position();
anchor = cursor.anchor();
const auto top = field->scrollTop().current();
scroll = (top != field->scrollTopMax()) ? top : QFIXED_MAX;
}
开发者ID:JuanPotato,项目名称:tdesktop,代码行数:7,代码来源:data_types.cpp
示例3: removeRow
void PeerListContent::removeRow(not_null<PeerListRow*> row) {
auto index = row->absoluteIndex();
auto isSearchResult = row->isSearchResult();
auto &eraseFrom = isSearchResult ? _searchRows : _rows;
Assert(index >= 0 && index < eraseFrom.size());
Assert(eraseFrom[index].get() == row);
auto pressedData = saveSelectedData(_pressed);
auto contextedData = saveSelectedData(_contexted);
setSelected(Selected());
setPressed(Selected());
setContexted(Selected());
_rowsById.erase(row->id());
auto &byPeer = _rowsByPeer[row->peer()];
byPeer.erase(ranges::remove(byPeer, row), end(byPeer));
removeFromSearchIndex(row);
_filterResults.erase(
ranges::remove(_filterResults, row),
end(_filterResults));
removeRowAtIndex(eraseFrom, index);
restoreSelection();
setPressed(restoreSelectedData(pressedData));
setContexted(restoreSelectedData(contextedData));
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:27,代码来源:peer_list_box.cpp
示例4:
void AdaptiveStepSize<ODE>::WriteToMessage(
not_null<serialization::AdaptiveStepSizeIntegratorInstance::
AdaptiveStepSize*> const message) const {
first_time_step.WriteToMessage(message->mutable_first_time_step());
message->set_safety_factor(safety_factor);
message->set_max_steps(max_steps);
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例5: prepare
void ReplyPreview::prepare(
not_null<Image*> image,
FileOrigin origin,
Images::Options options) {
int w = image->width(), h = image->height();
if (w <= 0) w = 1;
if (h <= 0) h = 1;
auto thumbSize = (w > h)
? QSize(
w * st::msgReplyBarSize.height() / h,
st::msgReplyBarSize.height())
: QSize(
st::msgReplyBarSize.height(),
h * st::msgReplyBarSize.height() / w);
thumbSize *= cIntRetinaFactor();
const auto prepareOptions = Images::Option::Smooth
| Images::Option::TransparentBackground
| options;
auto outerSize = st::msgReplyBarSize.height();
auto bitmap = image->pixNoCache(
origin,
thumbSize.width(),
thumbSize.height(),
prepareOptions,
outerSize,
outerSize);
_data = std::make_unique<ReplyPreview::Data>(
std::make_unique<Images::ImageSource>(
bitmap.toImage(),
"PNG"),
((options & Images::Option::Blurred) == 0));
}
开发者ID:JuanPotato,项目名称:tdesktop,代码行数:32,代码来源:data_types.cpp
示例6: TestRotatingBody
void TestRotatingBody() {
using F = Frame<Tag, tag, true>;
AngularVelocity<F> const angular_velocity =
AngularVelocity<F>({-1 * Radian / Second,
2 * Radian / Second,
5 * Radian / Second});
auto const rotating_body =
RotatingBody<F>(17 * SIUnit<GravitationalParameter>(),
typename RotatingBody<F>::Parameters(
3 * Radian,
Instant() + 4 * Second,
angular_velocity));
serialization::Body message;
RotatingBody<F> const* cast_rotating_body;
rotating_body.WriteToMessage(&message);
EXPECT_TRUE(message.has_massive_body());
EXPECT_FALSE(message.has_massless_body());
EXPECT_TRUE(message.massive_body().HasExtension(
serialization::RotatingBody::rotating_body));
not_null<std::unique_ptr<MassiveBody const>> const massive_body =
MassiveBody::ReadFromMessage(message);
EXPECT_EQ(rotating_body.gravitational_parameter(),
massive_body->gravitational_parameter());
cast_rotating_body = dynamic_cast<RotatingBody<F> const*>(&*massive_body);
EXPECT_THAT(cast_rotating_body, NotNull());
}
开发者ID:Wavechaser,项目名称:Principia,代码行数:29,代码来源:body_test.cpp
示例7: isGrouped
bool Groups::isGrouped(not_null<HistoryItem*> item) const {
if (!item->groupId()) {
return false;
}
const auto media = item->media();
return media && media->canBeGrouped();
}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:7,代码来源:data_groups.cpp
示例8: evtToDoc
j::json evtToDoc(not_null<OdinEvent*> evt) {
return j::json({
{"type", (int) evt->getType() },
{"code", (int) evt->getCode() },
{"source", evt->getDoco() }
});
}
开发者ID:llnek,项目名称:elmo,代码行数:7,代码来源:Odin.cpp
示例9:
void Ephemeris<Frame>::ComputeMasslessBodiesGravitationalAccelerations(
Instant const& t,
std::vector<Position<Frame>> const& positions,
not_null<std::vector<Vector<Acceleration, Frame>>*> const accelerations,
not_null<std::vector<typename ContinuousTrajectory<Frame>::Hint>*>
const hints) const {
CHECK_EQ(positions.size(), accelerations->size());
accelerations->assign(accelerations->size(), Vector<Acceleration, Frame>());
for (std::size_t b1 = 0; b1 < number_of_oblate_bodies_; ++b1) {
MassiveBody const& body1 = *bodies_[b1];
ComputeGravitationalAccelerationByMassiveBodyOnMasslessBodies<
/*body1_is_oblate=*/true>(
t,
body1, b1,
positions,
accelerations,
&(*hints)[b1]);
}
for (std::size_t b1 = number_of_oblate_bodies_;
b1 < number_of_oblate_bodies_ +
number_of_spherical_bodies_;
++b1) {
MassiveBody const& body1 = *bodies_[b1];
ComputeGravitationalAccelerationByMassiveBodyOnMasslessBodies<
/*body1_is_oblate=*/false>(
t,
body1, b1,
positions,
accelerations,
&(*hints)[b1]);
}
}
开发者ID:pdn4kd,项目名称:Principia,代码行数:33,代码来源:ephemeris_body.hpp
示例10: LOG
void Ephemeris<Frame>::WriteToMessage(
not_null<serialization::Ephemeris*> const message) const {
LOG(INFO) << __FUNCTION__;
// The bodies are serialized in the order in which they were given at
// construction.
for (auto const& unowned_body : unowned_bodies_) {
unowned_body->WriteToMessage(message->add_body());
}
// The trajectories are serialized in the order resulting from the separation
// between oblate and spherical bodies.
if (checkpoints_.empty()) {
for (auto const& trajectory : trajectories_) {
trajectory->WriteToMessage(message->add_trajectory());
}
last_state_.WriteToMessage(message->mutable_last_state());
} else {
auto const& checkpoints = checkpoints_.front().checkpoints;
CHECK_EQ(trajectories_.size(), checkpoints.size());
for (int i = 0; i < trajectories_.size(); ++i) {
trajectories_[i]->WriteToMessage(message->add_trajectory(),
checkpoints[i]);
}
checkpoints_.front().system_state.WriteToMessage(
message->mutable_last_state());
t_max().WriteToMessage(message->mutable_t_max());
}
parameters_.WriteToMessage(message->mutable_fixed_step_parameters());
fitting_tolerance_.WriteToMessage(message->mutable_fitting_tolerance());
LOG(INFO) << NAMED(message->SpaceUsed());
LOG(INFO) << NAMED(message->ByteSize());
}
开发者ID:pdn4kd,项目名称:Principia,代码行数:31,代码来源:ephemeris_body.hpp
示例11: WriteToMessage
void Pair<T1, T2>::WriteToMessage(
not_null<serialization::Pair*> const message) const {
PointOrMultivectorSerializer<T1, serialization::Pair::Element>::
WriteToMessage(t1_, message->mutable_t1());
PointOrMultivectorSerializer<T2, serialization::Pair::Element>::
WriteToMessage(t2_, message->mutable_t2());
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例12: applyTo
void MessageCursor::applyTo(not_null<Ui::InputField*> field) {
auto cursor = field->textCursor();
cursor.setPosition(anchor, QTextCursor::MoveAnchor);
cursor.setPosition(position, QTextCursor::KeepAnchor);
field->setTextCursor(cursor);
field->scrollTo(scroll);
}
开发者ID:JuanPotato,项目名称:tdesktop,代码行数:7,代码来源:data_types.cpp
示例13: netSend
//////////////////////////////////////////////////////////////////////////////
// Send this msg through the socket
void netSend(not_null<OdinIO*> wss,
MType m, EType e, const j::json &body) {
if (wss->getState() == CType::S_CONNECTED) {
auto d = evtToDoc(m,e,body);
wss->getSocket()->send(d.dump());
}
}
开发者ID:llnek,项目名称:elmo,代码行数:10,代码来源:Odin.cpp
示例14:
void Frame<FrameTag, frame_tag, frame_is_inertial>::WriteToMessage(
not_null<serialization::Frame*> const message) {
std::string const& tag_type_full_name =
google::protobuf::GetEnumDescriptor<Tag>()->full_name();
message->set_tag_type_fingerprint(Fingerprint(tag_type_full_name));
message->set_tag(tag);
message->set_is_inertial(is_inertial);
}
开发者ID:mkalte666,项目名称:Principia,代码行数:9,代码来源:frame_body.hpp
示例15: SourceFromPeer
Source SourceFromPeer(not_null<PeerData*> peer) {
if (peer->isUser()) {
return Source::User;
} else if (peer->isChat() || peer->isMegagroup()) {
return Source::Group;
} else {
return Source::Channel;
}
}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:9,代码来源:data_auto_download.cpp
示例16: WriteToMessage
inline void Celestial::WriteToMessage(
not_null<serialization::Celestial*> const message) const {
CHECK(is_initialized());
body_->WriteToMessage(message->mutable_body());
history_->WriteToMessage(
message->mutable_history_and_prolongation()->mutable_history());
prolongation_->WritePointerToMessage(
message->mutable_history_and_prolongation()->mutable_prolongation());
}
开发者ID:d235j,项目名称:Principia,代码行数:9,代码来源:celestial_body.hpp
示例17: setDimensionsToContent
void BoxContent::setDimensionsToContent(
int newWidth,
not_null<Ui::RpWidget*> content) {
content->resizeToWidth(newWidth);
content->heightValue(
) | rpl::start_with_next([=](int height) {
setDimensions(newWidth, height);
}, content->lifetime());
}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:9,代码来源:abstract_box.cpp
示例18: HistoryFileMedia
HistoryPhoto::HistoryPhoto(
not_null<Element*> parent,
not_null<PeerData*> chat,
not_null<PhotoData*> photo,
int width)
: HistoryFileMedia(parent, parent->data())
, _data(photo)
, _serviceWidth(width) {
create(parent->data()->fullId(), chat);
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:10,代码来源:history_media_photo.cpp
示例19:
void DoublePrecision<T>::WriteToMessage(
not_null<serialization::DoublePrecision*> const message) const {
using ValueSerializer = PointOrMultivectorSerializer<
T, serialization::DoublePrecision::Value>;
using ErrorSerializer = QuantityOrMultivectorSerializer<
Difference<T>,
serialization::DoublePrecision::Error>;
ValueSerializer::WriteToMessage(value, message->mutable_value());
ErrorSerializer::WriteToMessage(error, message->mutable_error());
}
开发者ID:fordream,项目名称:Principia,代码行数:10,代码来源:double_precision_body.hpp
示例20: Times
static std::vector<Instant> Times(
not_null<FakeTrajectory const*> const trajectory) {
std::vector<Instant> times;
for (FakeTrajectory::Iterator it = trajectory->Begin();
it != trajectory->End();
++it) {
times.push_back(*it.current());
}
return times;
}
开发者ID:,项目名称:,代码行数:10,代码来源:
注:本文中的not_null类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论