当前位置: 首页>>代码示例>>C++>>正文


C++ not_null::data方法代码示例

本文整理汇总了C++中not_null::data方法的典型用法代码示例。如果您正苦于以下问题:C++ not_null::data方法的具体用法?C++ not_null::data怎么用?C++ not_null::data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在not_null的用法示例。


在下文中一共展示了not_null::data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: HistoryMedia

HistoryGame::HistoryGame(
	not_null<Element*> parent,
	not_null<GameData*> data,
	const TextWithEntities &consumed)
: HistoryMedia(parent)
, _data(data)
, _title(st::msgMinWidth - st::webPageLeft)
, _description(st::msgMinWidth - st::webPageLeft) {
	if (!consumed.text.isEmpty()) {
		_description.setMarkedText(
			st::webPageDescriptionStyle,
			consumed,
			Ui::ItemTextOptions(parent->data()));
	}
	history()->owner().registerGameView(_data, _parent);
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:16,代码来源:history_media_game.cpp

示例4: computeIsAttachToPrevious

bool Element::computeIsAttachToPrevious(not_null<Element*> previous) {
	const auto item = data();
	if (!Has<DateBadge>() && !Has<UnreadBar>()) {
		const auto prev = previous->data();
		const auto possible = !item->serviceMsg() && !prev->serviceMsg()
			&& !item->isEmpty() && !prev->isEmpty()
			&& (std::abs(prev->date() - item->date()) < kAttachMessageToPreviousSecondsDelta)
			&& (_context == Context::Feed
				|| (!item->isPost() && !prev->isPost()));
		if (possible) {
			if (item->history()->peer->isSelf()) {
				return prev->senderOriginal() == item->senderOriginal()
					&& (prev->Has<HistoryMessageForwarded>() == item->Has<HistoryMessageForwarded>());
			} else {
				return prev->from() == item->from();
			}
		}
	}
	return false;
}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:20,代码来源:history_view_element.cpp


注:本文中的not_null::data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。