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

C++ OPT_SET函数代码示例

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

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



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

示例1: main_fft

int main_fft(int argc, char* argv[])
{
	bool unitary = false;
	bool inv = false;

	const struct opt_s opts[] = {

		OPT_SET('u', &unitary, "unitary"),
		OPT_SET('i', &inv, "inverse"),
	};

	cmdline(&argc, argv, 3, 3, usage_str, help_str, ARRAY_SIZE(opts), opts);

	long dims[DIMS];
	complex float* idata = load_cfl(argv[2], DIMS, dims);
	complex float* data = create_cfl(argv[3], DIMS, dims);

	unsigned long flags = labs(atol(argv[1]));


	md_copy(DIMS, dims, data, idata, sizeof(complex float));
	unmap_cfl(DIMS, dims, idata);

	if (unitary)
		fftscale(DIMS, dims, flags, data, data);

	(inv ? ifftc : fftc)(DIMS, dims, flags, data, data);

	unmap_cfl(DIMS, dims, data);
	exit(0);
}
开发者ID:hisgoodbuddy,项目名称:bart,代码行数:31,代码来源:fft.c


示例2: parse

static int
parse()
{
    char *arg = cmd;
    char *ep, *p, *q;
    char unit;
    size_t len;
    const char *cp;
#if 0
    int c, i, j;
#else
    int c, i;
#endif

    while ((c = *arg++)) {
	if (c == ' ' || c == '\t' || c == '\n')
	    continue;
	for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++);
	ep = p;
	if (*p)
	    *p++ = 0;
	if (c == '-') {
	    while ((c = *arg++)) {
		if (c == 'P') {
			cp = "yes";
#if 0
		    } else {
			opts |= OPT_SET(RBX_DUAL) | OPT_SET(RBX_SERIAL);
			cp = "no";
		    }
#endif
		    printf("Keyboard: %s\n", cp);
		    continue;
#if 0
		} else if (c == 'S') {
		    j = 0;
		    while ((unsigned int)(i = *arg++ - '0') <= 9)
			j = j * 10 + i;
		    if (j > 0 && i == -'0') {
			comspeed = j;
			break;
		    }
		    /* Fall through to error below ('S' not in optstr[]). */
#endif
		}
		for (i = 0; c != optstr[i]; i++)
		    if (i == NOPT - 1)
			return -1;
		opts ^= OPT_SET(flags[i]);
	    }
	    ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) :
		     OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD;
#if 0
	    if (ioctrl & IO_SERIAL) {
	        if (sio_init(115200 / comspeed) != 0)
		    ioctrl &= ~IO_SERIAL;
	    }
#endif
	} else {
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:59,代码来源:boot2.c


示例3: OPT_SET

void DialogSearchReplace::UpdateSettings() {
	Search.isReg = CheckRegExp->IsChecked() && CheckRegExp->IsEnabled();
	Search.matchCase = CheckMatchCase->IsChecked();
	Search.updateVideo = CheckUpdateVideo->IsChecked() && CheckUpdateVideo->IsEnabled();
	OPT_SET("Tool/Search Replace/Match Case")->SetBool(CheckMatchCase->IsChecked());
	OPT_SET("Tool/Search Replace/RegExp")->SetBool(CheckRegExp->IsChecked());
	OPT_SET("Tool/Search Replace/Video Update")->SetBool(CheckUpdateVideo->IsChecked());
	OPT_SET("Tool/Search Replace/Field")->SetInt(Field->GetSelection());
	OPT_SET("Tool/Search Replace/Affect")->SetInt(Affect->GetSelection());
}
开发者ID:Gpower2,项目名称:Aegisub,代码行数:10,代码来源:dialog_search_replace.cpp


示例4: x_opt

PersistLocation::PersistLocation(wxDialog *dialog, std::string options_prefix, bool size_too)
: x_opt(OPT_SET(options_prefix + "/Last/X"))
, y_opt(OPT_SET(options_prefix + "/Last/Y"))
, w_opt(size_too ? OPT_SET(options_prefix + "/Last/Width") : nullptr)
, h_opt(size_too ? OPT_SET(options_prefix + "/Last/Height") : nullptr)
, maximize_opt(OPT_SET(options_prefix + "/Maximized"))
, dialog(dialog)
{
	int x = x_opt->GetInt();
	int y = y_opt->GetInt();
	if (x == -1 && y == -1)
		dialog->CenterOnParent();
	else {
		// First move to the saved place so that it ends up on the right monitor
		dialog->Move(x, y);

		if (size_too && w_opt->GetInt() > 0 && h_opt->GetInt() > 0)
			dialog->SetSize(w_opt->GetInt(), h_opt->GetInt());

		int display_index = wxDisplay::GetFromWindow(dialog);

		// If it's moved offscreen center on the parent and try again
		if (display_index == wxNOT_FOUND) {
			dialog->CenterOnParent();
			display_index = wxDisplay::GetFromWindow(dialog);
		}

		// If it's still offscreen just give up
		if (display_index == wxNOT_FOUND) return;

		wxRect display_area = wxDisplay(display_index).GetClientArea();
		wxSize dialog_size = dialog->GetSize();

		// Ensure that the top-left corner is onscreen
		if (x < display_area.x) x = display_area.x;
		if (y < display_area.y) y = display_area.y;

		// Ensure that the bottom-right corner is onscreen as long as doing so
		// wouldn't force the top-left corner offscreen
		if (x + dialog_size.x > display_area.GetRight())
			x = std::max(display_area.x, display_area.GetRight() - dialog_size.x);
		if (y + dialog_size.y > display_area.GetBottom())
			y = std::max(display_area.y, display_area.GetBottom() - dialog_size.y);

		dialog->Move(x, y);
	}

	dialog->Bind(wxEVT_MOVE, &PersistLocation::OnMove, this);

	dialog->Bind(wxEVT_SIZE, &PersistLocation::OnSize, this);
	if ((dialog->GetWindowStyle() & wxMAXIMIZE_BOX) && maximize_opt->GetBool())
		dialog->Maximize();
}
开发者ID:Leinad4Mind,项目名称:Aegisub,代码行数:53,代码来源:persist_location.cpp


示例5: parse_option

int
parse_option( const char *option, struct option *opts ) {
  char *end;

  int ret = 0;
  for ( ; opts->type != OPTION_END; opts++ ) {
    if ( !prefixcmp( option, opts->prefix_opt ) ) {
      char *mask_ptr = NULL;
      if ( OPT_MASK_SET( opts->flags ) ) {
        mask_ptr = strchr( option, '/' );
        *mask_ptr = '\0';
        mask_ptr = mask_ptr + 1;
      }
      char *ptr = strchr( option, '=' ) + 1;
      switch( opts->type ) {
        case OPTION_UINT8: {
          *( uint8_t * ) opts->value = ( uint8_t ) strtol( ptr, &end, 10 );
          OPT_SET( opts->flags );
        }
        break;
        case OPTION_UINT16: {
          *( uint16_t * ) opts->value = ( uint16_t ) strtol( ptr, &end, 10 );
          OPT_SET( opts->flags );
        }
        break;
        case OPTION_UINT32: {
          *( uint32_t * ) opts->value = ( uint32_t ) strtol( ptr, &end, 10 );
          OPT_SET( opts->flags );
        }
        break;
        case OPTION_UINT64: {
          if ( OPT_MASK_SET( opts->flags ) ) {
            *( uint64_t * ) opts->value = ( uint64_t ) strtoll( ptr, &end, 0 );
            *( ( uint64_t * ) opts->value + 1 ) = ( uint64_t ) strtoll( mask_ptr, &end, 0 );
           }
           else {
            *( uint64_t * ) opts->value = ( uint64_t ) strtoll( ptr, &end, 0 );
           }
           OPT_SET( opts->flags );
        }
        break;
        default:
          warn( "Unsupported option type %d ", opts->type );
          ret = -1;
        break;
      }
    }
  }

  return ret;
}
开发者ID:nickkaranatsios,项目名称:trema_exp,代码行数:51,代码来源:switch-ctrl.c


示例6: OPT_GET

void AudioBox::OnMouseWheel(wxMouseEvent &evt) {
	if (!ForwardMouseWheelEvent(audioDisplay, evt))
		return;

	bool zoom = evt.CmdDown() != OPT_GET("Audio/Wheel Default to Zoom")->GetBool();
	if (!zoom)
	{
		int amount = -evt.GetWheelRotation() * GetClientSize().GetWidth() / (evt.GetWheelDelta() * 3);
		// If the user did a horizontal scroll the amount should be inverted
		// for it to be natural.
		if (evt.GetWheelAxis() == 1) amount = -amount;

		// Reset any accumulated zoom
		mouse_zoom_accum = 0;

		audioDisplay->ScrollBy(amount);
	}
	else if (evt.GetWheelAxis() == 0)
	{
		mouse_zoom_accum += evt.GetWheelRotation();
		int zoom_delta = mouse_zoom_accum / evt.GetWheelDelta();
		mouse_zoom_accum %= evt.GetWheelDelta();
		int new_zoom = audioDisplay->GetZoomLevel() + zoom_delta;
		audioDisplay->SetZoomLevel(new_zoom);
		HorizontalZoom->SetValue(-new_zoom);
		OPT_SET("Audio/Zoom/Horizontal")->SetInt(new_zoom);
	}
}
开发者ID:Azpidatziak,项目名称:Aegisub,代码行数:28,代码来源:audio_box.cpp


示例7: main_estdelay

int main_estdelay(int argc, char* argv[])
{
	bool ring = false;
	int pad_factor = 100;
	unsigned int no_intersec_sp = 1;
	float size = 1.5;

	const struct opt_s opts[] = {

		OPT_SET('R', &ring, "RING method"),
		OPT_INT('p', &pad_factor, "p", "[RING] Padding"),
		OPT_UINT('n', &no_intersec_sp, "n", "[RING] Number of intersecting spokes"),
		OPT_FLOAT('r', &size, "r", "[RING] Central region size"),
	};

	cmdline(&argc, argv, 2, 2, usage_str, help_str, ARRAY_SIZE(opts), opts);

	num_init();

	if (pad_factor % 2 != 0)
		error("Pad_factor -p should be even\n");


	long tdims[DIMS];
	const complex float* traj = load_cfl(argv[1], DIMS, tdims);

	long tdims1[DIMS];
	md_select_dims(DIMS, ~MD_BIT(1), tdims1, tdims);

	complex float* traj1 = md_alloc(DIMS, tdims1, CFL_SIZE);
	md_slice(DIMS, MD_BIT(1), (long[DIMS]){ 0 }, tdims, traj1, traj, CFL_SIZE);
开发者ID:mrirecon,项目名称:bart,代码行数:31,代码来源:estdelay.c


示例8: parse

static int
parse()
{
    char *arg = cmd;
    char *ep, *p;
    int c, i;

    while ((c = *arg++)) {
	if (c == ' ' || c == '\t' || c == '\n')
	    continue;
	for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++);
	ep = p;
	if (*p)
	    *p++ = 0;
	if (c == '-') {
	    while ((c = *arg++)) {
		for (i = 0; c != optstr[i]; i++)
		    if (i == NOPT - 1)
			return -1;
		opts ^= OPT_SET(flags[i]);
	    }
	} else {
	    arg--;
	    if ((i = ep - arg)) {
		if ((size_t)i >= sizeof(kname))
		    return -1;
		memcpy(kname, arg, i + 1);
	    }
	}
	arg = p;
    }
    return 0;
}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:33,代码来源:boot2.c


示例9: OPT_SET

void DialogPasteOver::OnOK(wxCommandEvent &) {
	std::vector<bool> options;
	for (size_t i = 0; i < ListBox->GetCount(); ++i)
		options.push_back(ListBox->IsChecked(i));
	OPT_SET("Tool/Paste Lines Over/Fields")->SetListBool(options);

	EndModal(0);
}
开发者ID:Azpidatziak,项目名称:Aegisub,代码行数:8,代码来源:dialog_paste_over.cpp


示例10: SetTitle

void DialogDetachedVideo::OnVideoOpen() {
	if (context->videoController->IsLoaded())
		SetTitle(wxString::Format(_("Video: %s"), context->videoController->GetVideoName().filename().wstring()));
	else {
		Close();
		OPT_SET("Video/Detached/Enabled")->SetBool(true);
	}
}
开发者ID:Leinad4Mind,项目名称:Aegisub,代码行数:8,代码来源:dialog_detached_video.cpp


示例11: OPT_SET

DialogSelection::~DialogSelection() {
	OPT_SET("Tool/Select Lines/Text")->SetString(from_wx(match_text->GetValue()));
	OPT_SET("Tool/Select Lines/Condition")->SetInt(select_unmatching_lines->GetValue());
	OPT_SET("Tool/Select Lines/Field")->SetInt(dialogue_field->GetSelection());
	OPT_SET("Tool/Select Lines/Action")->SetInt(selection_change_type->GetSelection());
	OPT_SET("Tool/Select Lines/Mode")->SetInt(match_mode->GetSelection());
	OPT_SET("Tool/Select Lines/Match/Case")->SetBool(case_sensitive->IsChecked());
	OPT_SET("Tool/Select Lines/Match/Dialogue")->SetBool(apply_to_dialogue->IsChecked());
	OPT_SET("Tool/Select Lines/Match/Comment")->SetBool(apply_to_comments->IsChecked());
}
开发者ID:liloneum,项目名称:Aegisub,代码行数:10,代码来源:dialog_selection.cpp


示例12: OPT_SET

/// @brief Change colour of preview's background
void DialogStyleEditor::OnPreviewColourChange (wxCommandEvent &evt) {
	ColourButton *btn = static_cast<ColourButton*>(evt.GetClientData());
	if (!btn)
		evt.Skip();
	else {
		SubsPreview->SetColour(btn->GetColor());
		OPT_SET("Colour/Style Editor/Background/Preview")->SetColor(btn->GetColor());
	}
}
开发者ID:sthenc,项目名称:Aegisub,代码行数:10,代码来源:dialog_style_editor.cpp


示例13: CreateCocoaSpellChecker

std::unique_ptr<agi::SpellChecker> SpellCheckerFactory::GetSpellChecker() {
#ifdef __APPLE__
	return agi::CreateCocoaSpellChecker(OPT_SET("Tool/Spell Checker/Language"));
#elif defined(WITH_HUNSPELL)
	return agi::make_unique<HunspellSpellChecker>();
#else
	return {};
#endif
}
开发者ID:Aegisub,项目名称:Aegisub,代码行数:9,代码来源:spellchecker.cpp


示例14: map

void BaseGrid::OnShowColMenu(wxCommandEvent &event) {
	int item = event.GetId() - MENU_SHOW_COL;
	showCol[item] = !showCol[item];

	std::vector<bool> map(showCol, showCol + columns);
	OPT_SET("Subtitle/Grid/Column")->SetListBool(map);

	SetColumnWidths();
	Refresh(false);
}
开发者ID:sthenc,项目名称:Aegisub,代码行数:10,代码来源:base_grid.cpp


示例15: mid

void AudioBox::OnVerticalZoom(wxScrollEvent &event) {
	int pos = mid(1, event.GetPosition(), 100);
	OPT_SET("Audio/Zoom/Vertical")->SetInt(pos);
	double value = pow(pos / 50.0, 3);
	audioDisplay->SetAmplitudeScale(value);
	if (!VolumeBar->IsEnabled()) {
		VolumeBar->SetValue(pos);
		controller->SetVolume(value);
	}
}
开发者ID:Phonations,项目名称:Aegisub,代码行数:10,代码来源:audio_box.cpp


示例16: testSubs

void FrameMain::LoadSubtitles(wxString const& filename, wxString const& charset) {
	if (context->ass->loaded) {
		if (TryToCloseSubs() == wxCANCEL) return;
	}

	try {
		// Make sure that file isn't actually a timecode file
		try {
			TextFileReader testSubs(filename, charset);
			wxString cur = testSubs.ReadLineFromFile();
			if (cur.Left(10) == "# timecode") {
				context->videoController->LoadTimecodes(filename);
				return;
			}
		}
		catch (...) {
			// if trying to load the file as timecodes fails it's fairly
			// safe to assume that it is in fact not a timecode file
		}

		context->ass->Load(filename, charset);

		wxFileName file(filename);
		StandardPaths::SetPathValue("?script", file.GetPath());
		config::mru->Add("Subtitle", STD_STR(filename));
		OPT_SET("Path/Last/Subtitles")->SetString(STD_STR(file.GetPath()));

		// Save backup of file
		if (context->ass->CanSave() && OPT_GET("App/Auto/Backup")->GetBool()) {
			if (file.FileExists()) {
				wxString path = lagi_wxString(OPT_GET("Path/Auto/Backup")->GetString());
				if (path.empty()) path = file.GetPath();
				wxFileName dstpath(StandardPaths::DecodePath(path + "/"));
				if (!dstpath.DirExists())
					wxMkdir(dstpath.GetPath());

				dstpath.SetFullName(file.GetName() + ".ORIGINAL." + file.GetExt());

				wxCopyFile(file.GetFullPath(), dstpath.GetFullPath(), true);
			}
		}
	}
	catch (agi::FileNotFoundError const&) {
		wxMessageBox(filename + " not found.", "Error", wxOK | wxICON_ERROR | wxCENTER, this);
		config::mru->Remove("Subtitle", STD_STR(filename));
		return;
	}
	catch (agi::Exception const& err) {
		wxMessageBox(lagi_wxString(err.GetChainedMessage()), "Error", wxOK | wxICON_ERROR | wxCENTER, this);
	}
	catch (...) {
		wxMessageBox("Unknown error", "Error", wxOK | wxICON_ERROR | wxCENTER, this);
		return;
	}
}
开发者ID:sthenc,项目名称:Aegisub,代码行数:55,代码来源:frame_main.cpp


示例17: TransferDataFromWindow

void DialogSearchReplace::FindReplace(bool (SearchReplaceEngine::*func)()) {
	TransferDataFromWindow();

	if (settings->find.empty())
		return;

	c->search->Configure(*settings);
	try {
		(c->search->*func)();
	}
	catch (std::exception const& e) {
		wxMessageBox(to_wx(e.what()), "Error", wxOK | wxICON_ERROR | wxCENTER, this);
		return;
	}

	config::mru->Add("Find", settings->find);
	if (has_replace)
		config::mru->Add("Replace", settings->replace_with);

	OPT_SET("Tool/Search Replace/Match Case")->SetBool(settings->match_case);
	OPT_SET("Tool/Search Replace/RegExp")->SetBool(settings->use_regex);
	OPT_SET("Tool/Search Replace/Skip Comments")->SetBool(settings->ignore_comments);
	OPT_SET("Tool/Search Replace/Skip Tags")->SetBool(settings->skip_tags);
	OPT_SET("Tool/Search Replace/Field")->SetInt(static_cast<int>(settings->field));
	OPT_SET("Tool/Search Replace/Affect")->SetInt(static_cast<int>(settings->limit_to));

	UpdateDropDowns();
}
开发者ID:seawaveT,项目名称:Aegisub,代码行数:28,代码来源:dialog_search_replace.cpp


示例18: OPT_SET

void DialogDetachedVideo::OnClose(wxCloseEvent &evt) {
	context->videoDisplay->Destroy();

	context->videoDisplay = old_display;
	context->videoSlider = old_slider;

	OPT_SET("Video/Detached/Enabled")->SetBool(false);

	if (context->videoController->IsLoaded())
		context->videoController->JumpToFrame(context->videoController->GetFrameN());

	evt.Skip();
}
开发者ID:Azpidatziak,项目名称:Aegisub,代码行数:13,代码来源:dialog_detached_video.cpp


示例19: main_mip

int main_mip(int argc, char* argv[argc])
{

	bool mIP = false;

	const struct opt_s opts[] = {

		OPT_SET('m', &mIP, "minimum" ),
	};

	cmdline(&argc, argv, 3, 3, usage_str, help_str, ARRAY_SIZE(opts), opts);


	unsigned int flags = atoi(argv[1]);

	long idims[DIMS];
	complex float* in = load_cfl(argv[2], DIMS, idims);

	long odims[DIMS];
	md_select_dims(DIMS, ~flags, odims, idims);

	complex float* out = create_cfl(argv[3], DIMS, odims);

	complex float* tmp = md_alloc(DIMS, idims, CFL_SIZE);
	md_zabs(DIMS, idims, tmp, in);

	long istr[DIMS];
	long ostr[DIMS];

	md_calc_strides(DIMS, istr, idims, CFL_SIZE);
	md_calc_strides(DIMS, ostr, odims, CFL_SIZE);

	md_clear(DIMS, odims, out, CFL_SIZE);
	md_max2(DIMS, idims, ostr, (float*)out, ostr, (const float*)out, istr, (const float*)tmp);

	if (mIP) {

		// need result of max in output
		md_min2(DIMS, idims, ostr, (float*)out, ostr, (const float*)out, istr, (const float*)tmp);
	}

	md_free(tmp);

	unmap_cfl(DIMS, idims, in);
	unmap_cfl(DIMS, odims, out);

	exit(0);
}
开发者ID:morpheus-med,项目名称:bart,代码行数:48,代码来源:mip.c


示例20: GetParent

void AudioBox::OnSashDrag(wxSashEvent &event) {
	if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE)
		return;

	int new_height = std::min(event.GetDragRect().GetHeight(), GetParent()->GetSize().GetHeight() - 1);

	SetMinSize(wxSize(-1, new_height));
	GetParent()->Layout();

	// Karaoke mode is always disabled when the audio box is first opened, so
	// the initial height shouldn't include it
	if (context->karaoke->IsEnabled())
		new_height -= context->karaoke->GetSize().GetHeight() + 6;

	OPT_SET("Audio/Display Height")->SetInt(new_height);
}
开发者ID:Phonations,项目名称:Aegisub,代码行数:16,代码来源:audio_box.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ OPT_SET_INT函数代码示例发布时间:2022-05-30
下一篇:
C++ OPT_INTEGER函数代码示例发布时间: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