PriorityControl::PriorityControl(const char *name, const char *label, uint32 flags) : BOptionPopUp(name, label, new BMessage(kPriorityChanged), flags) { AddOption(MAKE_STRING(LOW), B_LOW_PRIORITY); AddOption(MAKE_STRING(NORMAL), B_NORMAL_PRIORITY); AddOption(MAKE_STRING(HIGH), B_NORMAL_PRIORITY + 2); }
// add DHCP DISCOVER fields to a basic BOOTP request static int prep_dhcp_discover(bootp_header_t *b) { unsigned char *p = b->bp_vend; AddOption(p, dhcpCookie); AddOption(p, dhcpDiscover); AddOption(p, dhcpParamRequestList); AddOption(p, dhcpEnd); if (p < &b->bp_vend[BP_MIN_VEND_SIZE]) p = &b->bp_vend[BP_MIN_VEND_SIZE]; return p - (unsigned char *)b; }
void GetProjectInfoCommandType::BuildSignature(CommandSignature &signature) { auto infoTypeValidator = make_movable<OptionValidator>(); infoTypeValidator->AddOption(wxT("Name")); infoTypeValidator->AddOption(wxT("NumberOfTracks")); infoTypeValidator->AddOption(wxT("SelectedTracks")); infoTypeValidator->AddOption(wxT("MuteTracks")); infoTypeValidator->AddOption(wxT("SoloTracks")); infoTypeValidator->AddOption(wxT("FocusedTrackID")); // returns the Track ID number of the track in focus signature.AddParameter(wxT("Type"), wxT("Name"), std::move(infoTypeValidator)); }
void ExportCommandType::BuildSignature(CommandSignature &signature) { auto modeValidator = make_movable<OptionValidator>(); modeValidator->AddOption(wxT("All")); modeValidator->AddOption(wxT("Selection")); signature.AddParameter(wxT("Mode"), wxT("All"), std::move(modeValidator)); auto filenameValidator = make_movable<DefaultValidator>(); signature.AddParameter(wxT("Filename"), wxT("exported.wav"), std::move(filenameValidator)); auto channelsValidator = make_movable<IntValidator>(); signature.AddParameter(wxT("Channels"), 1, std::move(channelsValidator)); }
// add DHCP REQUEST fields to a basic BOOTP request using data from supplied DHCP OFFER static int prep_dhcp_request(bootp_header_t *b, bootp_header_t *offer) { unsigned char *p = b->bp_vend; AddOption(p, dhcpCookie); AddOption(p, dhcpRequest); AddOption(p, dhcpRequestIP); memcpy(p, &offer->bp_yiaddr, dhcpRequestIP[1]); p += dhcpRequestIP[1]; // Ask for the address just given AddOption(p, dhcpParamRequestList); AddOption(p, dhcpEnd); if (p < &b->bp_vend[BP_MIN_VEND_SIZE]) p = &b->bp_vend[BP_MIN_VEND_SIZE]; return p - (unsigned char *)b; }
/**\brief Add multiple options * If there were no options before, the first option is the new default. * \param[in] options The list of new options. */ Dropdown* Dropdown::AddOptions( list<string> options ) { list<string>::iterator iter; for( iter = options.begin(); iter != options.end(); ++iter ) { AddOption( *iter ); } return this; }
void ReadOptionsFromCommandLine (int argc, char **argv) { int i, key, mod; for (i = 1; i < argc; i++) { mod = 1; if (argv[i][0] != '-') { if (i == 1) continue; else mod = 0; } key = 0; while (key < n_options && strcmp (&argv[i][mod], options[key]) != 0) { key++; } if (key < n_options) { i++; if (i < argc) mod = AddOption (key, argv[i]); else printf ("Didn't find value before end of command line option.\n"); if (mod == 0) i--; } else { printf ("Unrecognised option %s. Continuing.\n", argv[i]); } } }
void wxCmdLineParser::SetDesc(const wxCmdLineEntryDesc *desc) { for ( ;; desc++ ) { switch ( desc->kind ) { case wxCMD_LINE_SWITCH: AddSwitch(desc->shortName, desc->longName, desc->description, desc->flags); break; case wxCMD_LINE_OPTION: AddOption(desc->shortName, desc->longName, desc->description, desc->type, desc->flags); break; case wxCMD_LINE_PARAM: AddParam(desc->description, desc->type, desc->flags); break; default: wxFAIL_MSG( _T("unknown command line entry type") ); // still fall through case wxCMD_LINE_NONE: return; } } }
void CUrlOptions::AddOption(const std::string &key, const char *value) { if (key.empty() || value == NULL) return; return AddOption(key, std::string(value)); }
void CProfileOptions::Init() { XmlNodeRef root = GetISystem()->LoadXmlFromFile("libs/config/profiles/default/attributes.xml"); if(!root) { CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "Failed loading attributes.xml"); return; } CGameXmlParamReader reader(root); const int childCount = reader.GetUnfilteredChildCount(); m_allOptions.reserve(childCount); for (int i = 0; i < childCount; ++i) { XmlNodeRef node = reader.GetFilteredChildAt(i); if(node) { AddOption(node); } } IPlayerProfileManager* const profileManager = g_pGame->GetIGameFramework()->GetIPlayerProfileManager(); CRY_ASSERT_MESSAGE(profileManager != NULL, "IPlayerProfileManager doesn't exist - profile options will not be updated"); if(profileManager) profileManager->AddListener(this, false); }
void CProfileOptions::SetOptionValue(const char* command, const char* param, bool toPendingOptions) { if (!command || !command[0]) return; if (!param) return; if(!IsOption(command)) { AddOption(command, param); } if (toPendingOptions) { AddOrReplacePendingOption(command, param); return; } ScopedSwitchToGlobalHeap globalHeap; std::vector<COption*>::const_iterator it = m_allOptions.begin(); std::vector<COption*>::const_iterator end = m_allOptions.end(); for(; it!=end; ++it) { if((*it)->GetName().compare(command)==0) { (*it)->Set(param); } } }
static void SetClassPath(char *s) { char *def = MemAlloc(strlen(s) + 40); sprintf(def, "-Djava.class.path=%s", s); AddOption(def, NULL); }
static void ProcOldOverlay( const char *arg ) /*******************************************/ { /* unused parameters */ (void)arg; AddOption( "standard" ); }
static void ProcNoLogo( const char *arg ) /***************************************/ { /* unused parameters */ (void)arg; AddOption( "quiet" ); }
EditorColourSet::EditorColourSet(const EditorColourSet& other) // copy ctor { m_Name = other.m_Name; m_Sets.clear(); for (OptionSetsMap::const_iterator it = other.m_Sets.begin(); it != other.m_Sets.end(); ++it) { OptionSet& mset = m_Sets[it->first]; mset.m_Langs = it->second.m_Langs; mset.m_Lexers = it->second.m_Lexers; for (int i = 0; i <= wxSCI_KEYWORDSET_MAX; ++i) { mset.m_Keywords[i] = it->second.m_Keywords[i]; mset.m_originalKeywords[i] = it->second.m_originalKeywords[i]; } mset.m_FileMasks = it->second.m_FileMasks; mset.m_originalFileMasks = it->second.m_originalFileMasks; mset.m_SampleCode = it->second.m_SampleCode; mset.m_BreakLine = it->second.m_BreakLine; mset.m_DebugLine = it->second.m_DebugLine; mset.m_ErrorLine = it->second.m_ErrorLine; mset.comment = it->second.comment; mset.m_CaseSensitive = it->second.m_CaseSensitive; const OptionColours& value = it->second.m_Colours; for (unsigned int i = 0; i < value.GetCount(); ++i) { AddOption(it->first, value[i]); } } }
static void ProcNoIgnoreCase( const char *arg ) /*********************************************/ { /* unused parameters */ (void)arg; AddOption( "caseexact" ); }
static void ProcDosseg( const char *arg ) /***************************************/ { /* unused parameters */ (void)arg; AddOption( "dosseg" ); }
static void ProcOnError( const char *arg ) /****************************************/ { arg=arg; Warning( "undefsok behaviour slightly different than onerror", OPTION_SLOT ); AddOption( "undefsok" ); }
void EditorColourSet::AddOption(HighlightLanguage lang, const wxString& name, int value, wxColour fore, wxColour back, bool bold, bool italics, bool underlined, bool isStyle) { if (lang == HL_NONE) return; OptionColour* opt = new OptionColour; opt->name = name; opt->value = value; opt->fore = fore; opt->back = back; opt->bold = bold; opt->italics = italics; opt->underlined = underlined; opt->isStyle = isStyle; opt->originalfore = fore; opt->originalback = back; opt->originalbold = bold; opt->originalitalics = italics; opt->originalunderlined = underlined; opt->originalisStyle = isStyle; AddOption(lang, opt); delete opt; }
void CProfileOptions::AddOption(const XmlNodeRef node) { const char *platform = node->getAttr("platform"); if(platform != NULL && platform[0]) { bool result = (strstr(platform, "pc")==0); if (result) return; } // Ignore gameOnly attributes in the editor bool gameOnly = false; node->getAttr("gameOnly",gameOnly); if(gameOnly && gEnv->IsEditor()) return; const char* name = node->getAttr("name"); const char* val = node->getAttr("value"); const char* cvar = node->getAttr("cvar"); bool preview = false; node->getAttr("preview", preview); bool confirmation = false; node->getAttr("confirmation", confirmation); bool restart = false; node->getAttr("requiresRestart", restart); bool writeToConfig = false; node->getAttr("writeToConfig", writeToConfig); AddOption(name, val, cvar, preview, confirmation, restart, restart||writeToConfig); //options that require restart also need to be written to the config }
void CompilerOptions::AddOption(const wxString& name, const wxString& option, const wxString& category, const wxString& additionalLibs, bool doChecks, const wxString& checkAgainst, const wxString& checkMessage) { if (name.IsEmpty() || (option.IsEmpty() && additionalLibs.IsEmpty())) return; CompOption* coption = new CompOption; wxString listboxname = name + _T(" ["); if (option.IsEmpty()) listboxname += additionalLibs; else listboxname += option; listboxname += _T("]"); coption->name = listboxname; coption->option = option; coption->additionalLibs = additionalLibs; coption->enabled = false; coption->category = category; coption->doChecks = doChecks; coption->checkAgainst = checkAgainst; coption->checkMessage = checkMessage; AddOption(coption); }
static void ProcNoDefLibSearch( const char *arg ) /***********************************************/ { AddOption( "nodefaultlibs" ); if( arg != NULL ) { Warning( "nodefaultlibrarysearch applies to all libraries in WLINK", OPTION_SLOT ); } }
static void ProcOnError( const char *arg ) /****************************************/ { /* unused parameters */ (void)arg; Warning( "undefsok behaviour slightly different than onerror", OPTION_SLOT ); AddOption( "undefsok" ); }
void CmdOptions::AddSoloOption (QString longName, QString shortName, QString msg) { Option * thisopt = AddOption (longName, shortName, msg); thisopt->theType = Opt_Solo; }
/* * For our tools, we try to add 3 VM options: * -Denv.class.path=<envcp> * -Dapplication.home=<apphome> * -Djava.class.path=<appcp> * <envcp> is the user's setting of CLASSPATH -- for instance the user * tells javac where to find binary classes through this environment * variable. Notice that users will be able to compile against our * tools classes (sun.tools.javac.Main) only if they explicitly add * tools.jar to CLASSPATH. * <apphome> is the directory where the application is installed. * <appcp> is the classpath to where our apps' classfiles are. */ static jboolean AddApplicationOptions() { const int NUM_APP_CLASSPATH = (sizeof(app_classpath) / sizeof(char *)); char *s, *envcp, *appcp, *apphome; char home[MAXPATHLEN]; /* application home */ char separator[] = { PATH_SEPARATOR, '\0' }; int size, i; int strlenHome; s = getenv("CLASSPATH"); if (s) { /* 40 for -Denv.class.path= */ envcp = (char *)MemAlloc(strlen(s) + 40); sprintf(envcp, "-Denv.class.path=%s", s); AddOption(envcp, NULL); } if (!GetApplicationHome(home, sizeof(home))) { ReportErrorMessage("Can't determine application home", JNI_TRUE); return JNI_FALSE; } /* 40 for '-Dapplication.home=' */ apphome = (char *)MemAlloc(strlen(home) + 40); sprintf(apphome, "-Dapplication.home=%s", home); AddOption(apphome, NULL); /* How big is the application's classpath? */ size = 40; /* 40: "-Djava.class.path=" */ strlenHome = (int)strlen(home); for (i = 0; i < NUM_APP_CLASSPATH; i++) { size += strlenHome + (int)strlen(app_classpath[i]) + 1; /* 1: separator */ } appcp = (char *)MemAlloc(size + 1); strcpy(appcp, "-Djava.class.path="); for (i = 0; i < NUM_APP_CLASSPATH; i++) { strcat(appcp, home); /* c:\program files\myapp */ strcat(appcp, app_classpath[i]); /* \lib\myapp.jar */ strcat(appcp, separator); /* ; */ } appcp[strlen(appcp)-1] = '\0'; /* remove trailing path separator */ AddOption(appcp, NULL); return JNI_TRUE; }
int Configuration::AddOption( char *name, int value, int max, int increment) { Option *option = new Option(); option->name = name; option->max = max; option->increment = increment; option->value = value; return AddOption( option); }
CMFCPropertyGridProperty * ChannelGrid::CreatePlugin() { auto pGroup = new CMFCPropertyGridProperty(_T("插件")); auto pProp = new CMFCPropertyGridProperty(_T("插件"), (_variant_t)_T("Example"), _T("插件选择")); pProp->AddOption(_T("MultiNet")); pProp->AddOption(_T("Example")); pProp->AllowEdit(FALSE); pGroup->AddSubItem(pProp); pGroup->AddSubItem(new CMFCPropertyGridPluginProperty(_T("本地插件配置"), pProp, (_variant_t)_T(""), _T("远端插件配置"))); pGroup->AddSubItem(new CMFCPropertyGridPluginProperty(_T("本地插件配置"), pProp, (_variant_t)_T(""), _T("远端插件配置"))); return pGroup; }
void SetJavaLauncherPlatformProps() { /* Linux only */ #ifdef __linux__ const char *substr = "-Dsun.java.launcher.pid="; char *pid_prop_str = (char *)JLI_MemAlloc(JLI_StrLen(substr) + MAX_PID_STR_SZ + 1); sprintf(pid_prop_str, "%s%d", substr, getpid()); AddOption(pid_prop_str, NULL); #endif }
// // Load URL from config. // void FURL::LoadURLConfig( const TCHAR* Section, const FString& Filename ) { TArray<FString> Options; GConfig->GetSection( Section, Options, Filename ); for( int32 i=0;i<Options.Num();i++ ) { AddOption( *Options[i] ); } }
void CmdOptions::AddIntOption (const QString longName, const QString shortName, const QString msg) { Option * thisopt = AddOption (longName, shortName, msg); thisopt->theType = Opt_Int; thisopt->theValue.setValue(0); }