本文整理汇总了C++中NotSupportedException函数的典型用法代码示例。如果您正苦于以下问题:C++ NotSupportedException函数的具体用法?C++ NotSupportedException怎么用?C++ NotSupportedException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NotSupportedException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HHVM_FUNCTION
static bool HHVM_FUNCTION(clock_settime,
int64_t clk_id, int64_t sec, int64_t nsec) {
#if defined(__APPLE__)
throw NotSupportedException(__func__, "feature not supported on OSX");
#else
struct timespec ts;
ts.tv_sec = sec;
ts.tv_nsec = nsec;
int ret = clock_settime(clk_id, &ts);
return ret == 0;
#endif
}
示例2: f_forward_static_call
Variant f_forward_static_call(int _argc, CVarRef function, CArrRef _argv /* = null_array */) {
#ifdef ENABLE_LATE_STATIC_BINDING
CStrRef cls = FrameInjection::GetClassName();
if (cls.empty()) {
raise_error("Cannot call forward_static_call() "
"when no class scope is active");
return null;
}
FrameInjection::StaticClassNameHelper h(ThreadInfo::s_threadInfo.get(), cls);
return f_call_user_func_array(function, _argv, true);
#else
throw NotSupportedException(__func__, "ENABLE_LATE_STATIC_BINDING is off");
#endif
}
示例3: f_sncompress
Variant f_sncompress(CStrRef data) {
#ifndef HAVE_SNAPPY
throw NotSupportedException(__func__, "Snappy library cannot be found");
#else
size_t size;
char *compressed =
(char *)malloc(snappy::MaxCompressedLength(data.size()) + 1);
snappy::RawCompress(data.data(), data.size(), compressed, &size);
compressed = (char *)realloc(compressed, size + 1);
compressed[size] = '\0';
return String(compressed, size, AttachString);
#endif
}
示例4: CheckIfClosedThrowDisposed
void MemoryStream::WriteByte(byte value)
{
CheckIfClosedThrowDisposed();
if(!_canWrite)
throw NotSupportedException(L"Cannot write to this stream.");
if(_position >= _length)
{
Expand(_position + 1);
_length = _position + 1;
}
(*_internalBuffer)[_position++] = value;
}
示例5: NotSupportedException
void FileStream::Write(const u8 *buffer, u64 count)
{
if (!(access & std::ios::out))
throw NotSupportedException();
if (!stream.is_open())
throw IOException();
if (stream.fail())
throw IOException();
stream.write((const char *) buffer, count);
if (stream.fail())
throw IOException();
}
示例6: catch
void GraphController::Load(const std::string& desc, const std::vector<IEditorGraph*>& editors) {
// Try to load the file with one of the editor interfaces.
bool loaded = false;
for (auto& graphEditor : editors) {
try {
graphEditor->LoadJSON(desc);
m_model = graphEditor;
loaded = true;
break;
}
catch (NotSupportedException&) {
// Graph editor does not support specified type.
}
}
if (!loaded) {
throw NotSupportedException("Graph type is not supported.");
}
m_nodes.clear();
// Set node list.
std::vector<std::u32string> nameList;
for (const auto& name : m_model->GetNodeList()) {
nameList.push_back(EncodeString<char32_t>(name));
}
m_selectPanel->SetChoices(nameList);
// Create nodes.
std::map<IGraphEditorNode*, NodeControl*> inversionMap;
auto graphNodes = m_model->GetNodes();
for (auto realNode : graphNodes) {
auto viewNode = CreateViewNode(realNode);
Vec2 position = realNode->GetMetaData().placement;
m_view->AddNode(viewNode, position);
inversionMap[realNode] = viewNode.get();
m_nodes.insert({viewNode, realNode});
}
auto graphLinks = m_model->GetLinks();
for (auto realLink : graphLinks) {
NodeControl* src = inversionMap[realLink.sourceNode];
NodeControl* tar = inversionMap[realLink.targetNode];
m_view->AddLink(src, realLink.sourcePort, tar, realLink.targetPort);
}
}
示例7: f_snuncompress
Variant f_snuncompress(CStrRef data) {
#ifndef HAVE_SNAPPY
throw NotSupportedException(__func__, "Snappy library cannot be found");
#else
char *uncompressed;
size_t dsize;
snappy::GetUncompressedLength(data.data(), data.size(), &dsize);
uncompressed = (char *)malloc(dsize + 1);
if (!snappy::RawUncompress(data.data(), data.size(), uncompressed)) {
free(uncompressed);
return false;
}
uncompressed[dsize] = '\0';
return String(uncompressed, dsize, AttachString);
#endif
}
示例8: FileNotFoundException
void FileStream::Open(std::string path, FileMode mode, FileAccess access)
{
this->mode = mode;
this->access = access;
if (mode == FileMode::Append || mode == FileMode::Open || mode == FileMode::Truncate)
{
if (!FileExists(path.c_str()))
throw FileNotFoundException();
}
if (mode == FileMode::CreateNew)
{
if (FileExists(path.c_str()))
throw IOException();
}
if ((mode == FileMode::Append || mode == FileMode::Truncate) && access == FileAccess::Read)
{
throw NotSupportedException();
}
/* Create the file if it doesn't exist */
if (mode == FileMode::CreateNew || mode == FileMode::Create || mode == FileMode::OpenOrCreate)
{
if (!FileExists(path.c_str()))
{
std::fstream tmp(path, std::ios::out);
/* Let's do a dummy write */
tmp.write(path.c_str(), 0);
tmp.close();
}
}
int openFlags = (int) access | std::ios::binary;
if (mode == FileMode::Append)
openFlags |= std::ios::ate;
else if (mode == FileMode::Truncate)
openFlags |= std::ios::trunc;
stream.open(path, openFlags);
if (!stream.is_open() || !stream.good())
throw IOException();
}
示例9: HHVM_FUNCTION
static Variant HHVM_FUNCTION(assert, const Variant& assertion) {
if (!s_option_data->assertActive) return true;
JIT::CallerFrame cf;
Offset callerOffset;
auto const fp = cf(&callerOffset);
auto const passed = [&]() -> bool {
if (assertion.isString()) {
if (RuntimeOption::EvalAuthoritativeMode) {
// We could support this with compile-time string literals,
// but it's not yet implemented.
throw NotSupportedException(__func__,
"assert with strings argument in RepoAuthoritative mode");
}
return eval_for_assert(fp, assertion.toString()).toBoolean();
}
return assertion.toBoolean();
}();
if (passed) return true;
if (!s_option_data->assertCallback.isNull()) {
auto const unit = fp->m_func->unit();
PackedArrayInit ai(3);
ai.append(String(const_cast<StringData*>(unit->filepath())));
ai.append(Variant(unit->getLineNumber(callerOffset)));
ai.append(assertion.isString() ? assertion.toString()
: static_cast<String>(empty_string));
f_call_user_func(1, s_option_data->assertCallback, ai.toArray());
}
if (s_option_data->assertWarning) {
auto const str = !assertion.isString()
? String("Assertion failed")
: concat3("Assertion \"", assertion.toString(), "\" failed");
raise_warning("%s", str.data());
}
if (s_option_data->assertBail) {
throw Assertion();
}
return uninit_null();
}
示例10: f_assert
Variant f_assert(CVarRef assertion) {
if (!s_option_data->assertActive) return true;
Transl::CallerFrame cf;
Offset callerOffset;
auto const fp = cf(&callerOffset);
auto const passed = [&]() -> bool {
if (assertion.isString()) {
if (RuntimeOption::RepoAuthoritative) {
// We could support this with compile-time string literals,
// but it's not yet implemented.
throw NotSupportedException(__func__,
"assert with strings argument in RepoAuthoritative mode");
}
return eval_for_assert(fp, assertion.toString()).toBoolean();
}
return assertion.toBoolean();
}();
if (passed) return true;
if (!s_option_data->assertCallback.isNull()) {
auto const unit = fp->m_func->unit();
ArrayInit ai(3, ArrayInit::vectorInit);
ai.set(String(unit->filepath()));
ai.set(Variant(unit->getLineNumber(callerOffset)));
ai.set(assertion.isString() ? assertion.toString() : String(""));
f_call_user_func(1, s_option_data->assertCallback, ai.toArray());
}
if (s_option_data->assertWarning) {
auto const str = !assertion.isString()
? String("Assertion failed")
: concat3("Assertion \"", assertion.toString(), "\" failed");
raise_warning("%s", str.data());
}
if (s_option_data->assertBail) {
throw Assertion();
}
return uninit_null();
}
示例11: f_qlzcompress
Variant f_qlzcompress(CStrRef data, int level /* = 1 */) {
#ifndef HAVE_QUICKLZ
throw NotSupportedException(__func__, "QuickLZ library cannot be found");
#else
if (level < 1 || level > 3) {
throw_invalid_argument("level: %d", level);
return false;
}
char *compressed = (char*)malloc(data.size() + 401);
size_t size;
switch (level) {
case 1: {
QuickLZ1::qlz_state_compress state;
memset(&state, 0, sizeof(state));
size = QuickLZ1::qlz_compress(data.data(), compressed, data.size(),
&state);
break;
}
case 2: {
QuickLZ2::qlz_state_compress state;
memset(&state, 0, sizeof(state));
size = QuickLZ2::qlz_compress(data.data(), compressed, data.size(),
&state);
break;
}
case 3:
QuickLZ3::qlz_state_compress *state = new QuickLZ3::qlz_state_compress();
memset(state, 0, sizeof(*state));
size = QuickLZ3::qlz_compress(data.data(), compressed, data.size(),
state);
delete state;
break;
}
ASSERT(size < (size_t)data.size() + 401);
compressed = (char *)realloc(compressed, size + 1);
compressed[size] = '\0';
return String(compressed, size, AttachString);
#endif
}
示例12: wpi_selfTrace
void wpi_selfTrace()
{
throw NotSupportedException();
}
示例13: ToggleRIO_FPGA_LED
/**
* Toggle the state of the FPGA status LED on the cRIO.
* @return The new state of the FPGA LED.
*/
INT32 ToggleRIO_FPGA_LED()
{
throw NotSupportedException();
}
示例14: wpiStackTask
static INT32 wpiStackTask(INT32 taskId)
{
throw NotSupportedException();
}
示例15: SetRIO_FPGA_LED
/**
* Set the state of the FPGA status LED on the cRIO.
*/
void SetRIO_FPGA_LED(UINT32 state)
{
throw NotSupportedException();
}