本文整理汇总了C++中OPT_SET函数的典型用法代码示例。如果您正苦于以下问题:C++ OPT_SET函数的具体用法?C++ OPT_SET怎么用?C++ OPT_SET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OPT_SET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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 {
示例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());
}
示例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();
}
示例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;
}
示例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);
}
}
示例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);
示例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;
}
示例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);
}
示例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);
}
}
示例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());
}
示例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());
}
}
示例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
}
示例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);
}
示例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);
}
}