• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Expects函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Expects函数的典型用法代码示例。如果您正苦于以下问题:C++ Expects函数的具体用法?C++ Expects怎么用?C++ Expects使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Expects函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NetworkServicePImpl

		NetworkServicePImpl(int port, IPVersion version)
			: localEndpoint(version == IPVersion::IPv4 ? asio::ip::udp::v4() : asio::ip::udp::v6(), port)
			, socket(service, localEndpoint)
		{
			Expects(port == 0 || port > 1024);
			Expects(port < 65536);
		}
开发者ID:amzeratul,项目名称:halley,代码行数:7,代码来源:network_service.cpp


示例2: DecodeTga

	std::unique_ptr<uint8_t[]> DecodeTga(array_view<uint8_t> data) {

		if (data.size() < sizeof(TgaHeader)) {
			throw TempleException("Not enough data for TGA header");
		}

		auto header = reinterpret_cast<const TgaHeader*>(data.data());

		if (header->colorMapType != TgaColorMapType::TrueColor) {
			throw TempleException("Only true color TGA images are supported.");
		}

		if (header->dataType != TgaDataType::UncompressedRgb) {
			throw TempleException("Only uncompressed RGB TGA images are supported.");
		}

		if (header->bpp != 24 && header->bpp != 32) {
			throw TempleException("Only uncompressed RGB 24-bpp or 32-bpp TGA images are supported.");
		}

		auto result(std::make_unique<uint8_t[]>(header->width * header->height * 4));
		auto dest = result.get();

		// Points to the start of the TGA image data
		auto srcStart = data.data() + sizeof(TgaHeader) + header->imageIdLength;
		auto srcSize = data.size() - sizeof(TgaHeader) - header->imageIdLength;		

		if (header->bpp == 24) {
			auto srcPitch = header->width * 3;
			Expects((int) srcSize >= header->height * srcPitch);			
			for (int y = 0; y < header->height; ++y) {
				auto src = srcStart + (header->height - y - 1) * srcPitch;
				for (int x = 0; x < header->width; ++x) {
					*dest++ = *src++;
					*dest++ = *src++;
					*dest++ = *src++;
					*dest++ = 0xFF; // Fixed alpha
				}
			}
		} else {
			auto srcPitch = header->width * 4;
			Expects((int) srcSize >= header->height * srcPitch);
			for (int y = 0; y < header->height; ++y) {
				auto src = srcStart + (header->height - y - 1) * srcPitch;
				for (int x = 0; x < header->width; ++x) {
					*dest++ = *src++;
					*dest++ = *src++;
					*dest++ = *src++;
					*dest++ = *src++;
				}
			}
		}

		return result;
	}
开发者ID:ema29,项目名称:TemplePlus,代码行数:55,代码来源:images_tga.cpp


示例3: Expects

void Element::attachToBlock(not_null<HistoryBlock*> block, int index) {
	Expects(!_data->isLogEntry());
	Expects(_block == nullptr);
	Expects(_indexInBlock < 0);
	Expects(index >= 0);

	_block = block;
	_indexInBlock = index;
	_data->setMainView(this);
	previousInBlocksChanged();
}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:11,代码来源:history_view_element.cpp


示例4: Expects

void PeerListContent::appendSearchRow(std::unique_ptr<PeerListRow> row) {
	Expects(row != nullptr);
	Expects(showingSearch());

	if (_rowsById.find(row->id()) == _rowsById.cend()) {
		row->setAbsoluteIndex(_searchRows.size());
		row->setIsSearchResult(true);
		addRowEntry(row.get());
		_filterResults.push_back(row.get());
		_searchRows.push_back(std::move(row));
	}
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:12,代码来源:peer_list_box.cpp


示例5: Expects

void MessagesList::Slice::merge(
		const Range &moreMessages,
		MessagesRange moreNoSkipRange) {
	Expects(moreNoSkipRange.from <= range.till);
	Expects(range.from <= moreNoSkipRange.till);

	messages.merge(std::begin(moreMessages), std::end(moreMessages));
	range = {
		qMin(range.from, moreNoSkipRange.from),
		qMax(range.till, moreNoSkipRange.till)
	};
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:12,代码来源:data_messages.cpp


示例6: mConfig

	AasAnimatedModelFactory::AasAnimatedModelFactory(const AasConfig& config) : mConfig(config) {
		Expects(!sInstance);
		sInstance = this;

		LegacyAasConfig legacyConfig;
		legacyConfig.scaleX = config.scaleX;
		legacyConfig.scaleY = config.scaleY;
		legacyConfig.getSkaFilename = [](int meshId, char* filenameOut) -> AasStatus {
			if (sInstance->mConfig.resolveSkaFile) {
				auto filename(sInstance->mConfig.resolveSkaFile(meshId));
				if (!filename.empty()) {
					Expects(filename.size() < MAX_PATH);
					strncpy(filenameOut, filename.c_str(), MAX_PATH);
					return AAS_OK;
				}
			}
			return AAS_ERROR;
		};
		legacyConfig.getSkmFilename = [](int meshId, char* filenameOut) -> AasStatus {
			if (sInstance->mConfig.resolveSkmFile) {
				auto filename(sInstance->mConfig.resolveSkmFile(meshId));
				if (!filename.empty()) {
					Expects(filename.size() < MAX_PATH);
					strncpy(filenameOut, filename.c_str(), MAX_PATH);
					return AAS_OK;
				}
			}
			return AAS_ERROR;
		};
		legacyConfig.runScript = [](const char* script) {
			if (sInstance->mConfig.runScript) {
				sInstance->mConfig.runScript(script);
			}
		};

		if (functions.Init(&legacyConfig)) {
			throw TempleException("Unable to initialize the animation system.");
		}

		// The MDF resolver is not configurable, so we have to set it here manually
		MH_CreateHook(temple::GetPointer<void*>(0x10269430), &AasResolveMaterial, nullptr);
		MH_CreateHook(functions.Free, &AasFreeModel, (void**)&mOrgModelFree);
		MH_EnableHook(nullptr);

		auto meshesMapping = MesFile::ParseFile("art/meshes/meshes.mes");
		mMapping.insert(meshesMapping.begin(), meshesMapping.end());
		logger->debug("Loaded mapping for {} meshes from art/meshes/meshes.mes", 
			meshesMapping.size());

	}
开发者ID:pakoito,项目名称:TemplePlus,代码行数:50,代码来源:meshes.cpp


示例7: Expects

void Controller::replaceFloatPlayerDelegate(
		not_null<Media::Player::FloatDelegate*> replacement) {
	Expects(_floatPlayers != nullptr);

	_replacementFloatPlayerDelegate = replacement;
	_floatPlayers->replaceDelegate(replacement);
}
开发者ID:JuanPotato,项目名称:tdesktop,代码行数:7,代码来源:window_controller.cpp


示例8: Expects

void ChangePhoneBox::EnterPhone::sendPhoneDone(const QString &phoneNumber, const MTPauth_SentCode &result) {
	Expects(result.type() == mtpc_auth_sentCode);
	_requestId = 0;

	auto codeLength = 0;
	auto &data = result.c_auth_sentCode();
	switch (data.vtype.type()) {
	case mtpc_auth_sentCodeTypeApp:
		LOG(("Error: should not be in-app code!"));
		showError(Lang::Hard::ServerError());
		return;
	case mtpc_auth_sentCodeTypeSms: codeLength = data.vtype.c_auth_sentCodeTypeSms().vlength.v; break;
	case mtpc_auth_sentCodeTypeCall: codeLength = data.vtype.c_auth_sentCodeTypeCall().vlength.v; break;
	case mtpc_auth_sentCodeTypeFlashCall:
		LOG(("Error: should not be flashcall!"));
		showError(Lang::Hard::ServerError());
		return;
	}
	auto phoneCodeHash = qs(data.vphone_code_hash);
	auto callTimeout = 0;
	if (data.has_next_type() && data.vnext_type.type() == mtpc_auth_codeTypeCall) {
		callTimeout = data.has_timeout() ? data.vtimeout.v : 60;
	}
	Ui::show(
		Box<EnterCode>(
			phoneNumber,
			phoneCodeHash,
			codeLength,
			callTimeout),
		LayerOption::KeepOther);
}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:31,代码来源:change_phone_box.cpp


示例9: Expects

void CodeWidget::gotPassword(const MTPaccount_Password &result) {
	Expects(result.type() == mtpc_account_password);

	stopCheck();
	_sentRequest = 0;
	const auto &d = result.c_account_password();
	getData()->pwdRequest = Core::ParseCloudPasswordCheckRequest(d);
	if (!d.has_current_algo() || !d.has_srp_id() || !d.has_srp_B()) {
		LOG(("API Error: No current password received on login."));
		_code->setFocus();
		return;
	} else if (!getData()->pwdRequest) {
		const auto box = std::make_shared<QPointer<BoxContent>>();
		const auto callback = [=] {
			Core::UpdateApplication();
			if (*box) (*box)->closeBox();
		};
		*box = Ui::show(Box<ConfirmBox>(
			lang(lng_passport_app_out_of_date),
			lang(lng_menu_update),
			callback));
		return;
	}
	getData()->hasRecovery = d.is_has_recovery();
	getData()->pwdHint = qs(d.vhint);
	getData()->pwdNotEmptyPassport = d.is_has_secure_values();
	goReplace(new Intro::PwdCheckWidget(parentWidget(), getData()));
}
开发者ID:JuanPotato,项目名称:tdesktop,代码行数:28,代码来源:introcode.cpp


示例10: Expects

std::unique_ptr<ContentMemento> Memento::DefaultContent(
		PeerId peerId,
		Section section) {
	Expects(peerId != 0);

	auto peer = Auth().data().peer(peerId);
	if (auto to = peer->migrateTo()) {
		peer = to;
	}
	auto migrated = peer->migrateFrom();
	peerId = peer->id;
	auto migratedPeerId = migrated ? migrated->id : PeerId(0);

	switch (section.type()) {
	case Section::Type::Profile:
		return std::make_unique<Profile::Memento>(
			peerId,
			migratedPeerId);
	case Section::Type::Media:
		return std::make_unique<Media::Memento>(
			peerId,
			migratedPeerId,
			section.mediaType());
	case Section::Type::CommonGroups:
		Assert(peerIsUser(peerId));
		return std::make_unique<CommonGroups::Memento>(
			peerToUser(peerId));
	case Section::Type::Members:
		return std::make_unique<Members::Memento>(
			peerId,
			migratedPeerId);
	}
	Unexpected("Wrong section type in Info::Memento::DefaultContent()");
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:34,代码来源:info_memento.cpp


示例11: Expects

void Entry::removeChatListEntryByLetter(Mode list, QChar letter) {
	Expects(letter != 0);

	if (inChatList(list)) {
		chatListLinks(list).remove(letter);
	}
}
开发者ID:Federated-Blockchains-Initiative,项目名称:tdesktop,代码行数:7,代码来源:dialogs_entry.cpp


示例12: Expects

rpl::producer<SparseIdsMergedSlice> SearchController::idsSlice(
		SparseIdsMergedSlice::UniversalMsgId aroundId,
		int limitBefore,
		int limitAfter) {
	Expects(_current != _cache.cend());

	auto query = (const Query&)_current->first;
	auto createSimpleViewer = [=](
			PeerId peerId,
			SparseIdsSlice::Key simpleKey,
			int limitBefore,
			int limitAfter) {
		return simpleIdsSlice(
			peerId,
			simpleKey,
			query,
			limitBefore,
			limitAfter);
	};
	return SparseIdsMergedSlice::CreateViewer(
		SparseIdsMergedSlice::Key(
			query.peerId,
			query.migratedPeerId,
			aroundId),
		limitBefore,
		limitAfter,
		std::move(createSimpleViewer));
}
开发者ID:zhangsoledad,项目名称:tdesktop,代码行数:28,代码来源:data_search_controller.cpp


示例13: mDevice

AasRenderer::AasRenderer(AasAnimatedModelFactory &aasFactory, 
						 RenderingDevice& device, 
						 ShapeRenderer2d &shapeRenderer2d,
						 ShapeRenderer3d &shapeRenderer3d,
						 MdfMaterialFactory &mdfFactory) 
	: mDevice(device), 
	  mMdfFactory(mdfFactory), 
	  mShapeRenderer2d(shapeRenderer2d),
	  mShapeRenderer3d(shapeRenderer3d),
	  mAasFactory(aasFactory),
	  mGeometryShadowMaterial(CreateGeometryShadowMaterial(device)),
	  mShadowTarget(device.CreateRenderTargetTexture(D3DFMT_A8R8G8B8, ShadowMapWidth, ShadowMapHeight)),
	  mShadowTargetTmp(device.CreateRenderTargetTexture(D3DFMT_A8R8G8B8, ShadowMapWidth, ShadowMapHeight)),
	  mShadowMapMaterial(CreateShadowMapMaterial(device)),
	  mGaussBlurHor(CreateGaussBlurMaterial(device, mShadowTarget, true)),
	  mGaussBlurVer(CreateGaussBlurMaterial(device, mShadowTargetTmp, false)) {
	Expects(!aasRenderer);

	/*
		When an AAS handle is freed by the factory, remove all associated
		rendering data here as well.
	*/
	mListenerHandle = aasFactory.AddFreeListener([&](AasHandle handle) {
		auto it = mRenderDataCache.find(handle);
		if (it != mRenderDataCache.end()) {
			mRenderDataCache.erase(it);
		}
	});

}
开发者ID:pakoito,项目名称:TemplePlus,代码行数:30,代码来源:aasrenderer.cpp


示例14: Expects

object_ptr<TabbedSelector::InnerFooter> GifsListWidget::createFooter() {
	Expects(_footer == nullptr);

	auto result = object_ptr<Footer>(this);
	_footer = result;
	return std::move(result);
}
开发者ID:telegramdesktop,项目名称:tdesktop,代码行数:7,代码来源:gifs_list_widget.cpp


示例15: _controller

PeerListBox::PeerListBox(
	QWidget*,
	std::unique_ptr<PeerListController> controller,
	base::lambda<void(not_null<PeerListBox*>)> init)
: _controller(std::move(controller))
, _init(std::move(init)) {
	Expects(_controller != nullptr);
}
开发者ID:zhangsoledad,项目名称:tdesktop,代码行数:8,代码来源:peer_list_box.cpp


示例16: Expects

Header Header::parse(const char* data)
{
  Expects(data != nullptr);
  return Header{
    static_cast<Transport_code>(data[0]), 
    *(reinterpret_cast<const uint32_t*>(&data[1]))
  };
}
开发者ID:AnnikaH,项目名称:IncludeOS,代码行数:8,代码来源:transport.cpp


示例17: Expects

std::pair<std::string, std::string> LedToken::split(const Delimiter& del) const

{
    Expects(value.size() >= 3);

    const auto first_of_del = value.find_first_of(del);

    Expects(first_of_del != std::string::npos);
    Expects(first_of_del != 0);
    Expects(first_of_del != value.size() - 1);

    const auto& split_point = value.begin() + first_of_del;

    auto left = std::string{value.begin(), split_point};
    auto right = std::string{split_point + 1, value.end()};
    return std::make_pair(left, right);
}
开发者ID:Feldmarszalekduda,项目名称:papuc_exercises,代码行数:17,代码来源:LedToken.cpp


示例18: Expects

void BinlogWrapper::finish(size_type rollback) {
	Expects(rollback >= 0);

	if (rollback > 0) {
		_failed = true;
	}
	rollback += _part.size();
	_binlog.seek(_binlog.offset() - rollback);
}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:9,代码来源:storage_cache_binlog_reader.cpp


示例19: computeFingerprint

	void computeFingerprint() {
		Expects(isValid());

		mtpBuffer string;
		MTP_bytes(toBytes(_rsa->n)).write(string);
		MTP_bytes(toBytes(_rsa->e)).write(string);

		uchar sha1Buffer[20];
		_fingerprint = *(uint64*)(hashSha1(&string[0], string.size() * sizeof(mtpPrime), sha1Buffer) + 3);
	}
开发者ID:Peque,项目名称:tdesktop,代码行数:10,代码来源:rsa_public_key.cpp


示例20: Expects

SharedMediaWithLastSlice::Value SharedMediaWithLastSlice::operator[](int index) const {
	Expects(index >= 0 && index < size());

	if (_reversed) {
		index = size() - index - 1;
	}
	return (index < _slice.size())
		? Value(_slice[index])
		: Value(Auth().data().photo(*_lastPhotoId));
}
开发者ID:Federated-Blockchains-Initiative,项目名称:tdesktop,代码行数:10,代码来源:data_shared_media.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Expression函数代码示例发布时间:2022-05-30
下一篇:
C++ Expect函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap