本文整理汇总了C++中SetVar函数的典型用法代码示例。如果您正苦于以下问题:C++ SetVar函数的具体用法?C++ SetVar怎么用?C++ SetVar使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetVar
bool BaseSetupDlg::Run(String& vars)
{
upp <<= GetVar("UPP");
output <<= GetVar("OUTPUT");
base <<= vars;
new_base = IsNull(vars);
while(TopWindow::Run() == IDOK)
{
String varname = ~base;
String varfile = VarFilePath(varname);
if(varname != vars)
{
if(FileExists(varfile) && !PromptOKCancel(NFormat("Overwrite existing assembly [* \1%s\1]?", varfile)))
continue;
if(!SaveVars(varname))
{
Exclamation(NFormat("Error writing assmbly [* \1%s\1].", VarFilePath(varname)));
continue;
}
}
SetVar("UPP", ~upp);
SetVar("OUTPUT", ~output);
Vector<String> paths = SplitDirs(upp.GetText().ToString());
for(int i = 0; i < paths.GetCount(); i++)
RealizeDirectory(paths[i]);
RealizeDirectory(output);
vars = varname;
return true;
}
return false;
}
示例2: OAuthParseForm
void OAuthParseForm(char *HTML, char *SubmitType, char **SubmitURL, ListNode *HiddenVals, ListNode *QueryVals)
{
char *TagName=NULL, *TagData=NULL, *Type=NULL, *Name=NULL, *Value=NULL, *ptr;
ptr=XMLGetTag(HTML,NULL,&TagName,&TagData);
while (ptr)
{
if (strcmp(TagName,"input")==0)
{
ParseTagData(TagName,TagData,&Type,&Name,&Value);
if (strcasecmp(Type,"hidden")==0) SetVar(HiddenVals,Name,Value);
if (strcasecmp(Type,"submit")==0) SetVar(HiddenVals,Name,Value);
if (strcasecmp(Type,"text")==0) SetVar(QueryVals,Name,Value);
if (strcasecmp(Type,"password")==0) SetVar(QueryVals,Name,Value);
}
if (strcmp(TagName,"form")==0)
{
ParseTagData(TagName,TagData,&Type,&Name,SubmitURL);
}
ptr=XMLGetTag(ptr,NULL,&TagName,&TagData);
}
DestroyString(TagName);
DestroyString(TagData);
DestroyString(Type);
DestroyString(Name);
DestroyString(Value);
}
示例3: calloc
TFileStore *IDriveFileStoreCreate(char *Name, char *ConnectSetup)
{
TFileStore *FS;
FS=(TFileStore *) calloc(1,sizeof(TFileStore));
FS->Flags=FS_SSL | FS_WRITEABLE | FS_CHDIR_FULLPATH;
FS->Features=FS_FILE_SIZE;
FS->Vars=ListCreate();
FS->CurrDir=CopyStr(FS->CurrDir,"");
FS->InitArg=CopyStr(FS->InitArg,ConnectSetup);
FS->Name=CopyStr(FS->Name,Name);
SetVar(FS->Vars,"LSFormat:Details","%s %m %v %n ");
SetVar(FS->Vars,"LSFormat:Long","%S %m %v %n ");
FS->Create=IDriveFileStoreCreate;
FS->Open=IDriveOpen;
FS->Close=IDriveClose;
FS->ChDir=DefaultChDir;
FS->MkDir=IDriveMkDir;
FS->LoadDir=IDriveLoadDir;
FS->OpenFile=IDriveOpenFile;
FS->CloseFile=IDriveCloseFile;
FS->ReadBytes=DefaultReadBytes;
FS->WriteBytes=DefaultWriteBytes;
FS->RenameFile=IDriveRenameFile;
FS->DeleteFile=IDriveDeleteFile;
FS->GetFileSize=FileStoreGetFileSize;
return(FS);
}
示例4: InsertFrame
RichEditHdrFtr::RichEditHdrFtr()
{
InsertFrame(0, toolbar);
WhenRefreshBar = callback(this, &RichEditHdrFtr::RefreshBar);
SetVar("PAGECOUNT", "###");
SetVar("PAGENUMBER", "#");
SetVar("__DISPLAY_VALUE_FIELDS", 1);
}
示例5: SetupOAuthTypes
void SetupOAuthTypes()
{
OAuthTypes=ListCreate();
SetVar(OAuthTypes, "implicit", "response_type=token&client_id=$(client_id)&redirect_uri=$(redirect_uri)&scope=basic&state=$(session)");
SetVar(OAuthTypes, "device", "client_id=$(client_id)&scope=$(scope),client_id=$(client_id)&client_secret=$(client_secret)&code=$(device_code)&grant_type=http://oauth.net/grant_type/device/1.0");
SetVar(OAuthTypes, "password", "client_name=$(client_id)&scope=$(scope)&redirect_uris=$(redirect_uri)&grant_type=password,client_id=$(client_id)&client_secret=$(client_secret)&grant_type=password&username=$(username)&password=$(password)");
SetVar(OAuthTypes, "getpocket.com", "consumer_key=$(client_id)&scope=$(scope)&redirect_uri=$(redirect_uri),consumer_key=$(client_id)&code=$(code),https://getpocket.com/auth/authorize?request_token=$(code)&redirect_uri=$(redirect_uri)");
SetVar(OAuthTypes, "auth", ",client_id=$(client_id)&client_secret=$(client_secret)&code=$(code)&grant_type=authorization_code&redirect_uri=$(redirect_uri),$(url)?response_type=code&client_id=$(client_id)&redirect_uri=$(redirect_uri)&scope=$(scope)&state=$(session)");
}
示例6: LibUsefulInitSettings
void LibUsefulInitSettings()
{
char *Tempstr=NULL;
LibUsefulSettings=ListCreate();
SetVar(LibUsefulSettings,"LibUsefulVersion",__LIBUSEFUL_VERSION__);
Tempstr=MCopyStr(Tempstr,__LIBUSEFUL_BUILD_DATE__," ",__LIBUSEFUL_BUILD_TIME__,NULL);
SetVar(LibUsefulSettings,"LibUsefulBuildTime",Tempstr);
DestroyString(Tempstr);
}
示例7: OAuthSetUserCreds
void OAuthSetUserCreds(OAUTH *Ctx, const char *UserName, const char *Password)
{
char *Tempstr=NULL;
Tempstr=HTTPQuote(Tempstr, UserName);
SetVar(Ctx->Vars, "username", Tempstr);
Tempstr=HTTPQuote(Tempstr, Password);
SetVar(Ctx->Vars, "password", Tempstr);
DestroyString(Tempstr);
}
示例8: CGIDisplayOptions
static void CGIDisplayOptions(const char *HashType, const char *Encoding, const char *LineEnding, int OutputLength)
{
char *Token=NULL, *Tempstr=NULL;
const char *ptr;
ListNode *Items=NULL;
int i;
Items=ListCreate();
printf("<tr>\r\n");
Tempstr=HashAvailableTypes(Tempstr);
ptr=GetToken(Tempstr, ",",&Token,0);
while (ptr)
{
ListAddNamedItem(Items, Token, CopyStr(NULL, Token));
ptr=GetToken(ptr, ",",&Token,0);
}
printf("<td align=left>Type: ");
CGIPrintSelect("HashType", HashType, Items);
ListClear(Items, Destroy);
printf("</td>\r\n");
printf("<td align=right>Encoding: ");
for (i=0; EncodingNames[i] !=NULL; i++) SetVar(Items, EncodingNames[i], EncodingDescriptions[i]);
CGIPrintSelect("Encoding", Encoding, Items);
ListClear(Items, Destroy);
printf("</td>\r\n");
printf("<tr>\r\n");
printf("<td align=left>Line Ending: </td>");
printf("<td align=right>");
for (i=0; LineEndingNames[i] !=NULL; i++) SetVar(Items, LineEndingNames[i], LineEndingDescriptions[i]);
CGIPrintSelect("LineEnding", LineEnding, Items);
ListClear(Items, Destroy);
printf("</td>\r\n");
printf("</tr>\r\n");
printf("<tr>\r\n");
printf("<td align=left>Hash Length: </td>");
printf("<td align=right>");
if (OutputLength > 0) printf("<input type=text width=90%% name=\"OutputLength\" style=\"font-weight: bold; font-size:16px\" value=\"%d\">\r\n",OutputLength);
else printf("<input type=text width=90%% name=\"OutputLength\" style=\"font-weight: bold; font-size:16px\">\r\n");
printf("</td>\r\n");
printf("</tr>\r\n");
ListDestroy(Items, Destroy);
Destroy(Tempstr);
Destroy(Token);
}
示例9: HandleChildRegisterRequest
pid_t HandleChildRegisterRequest(STREAM *S, char *Data)
{
char *Tempstr=NULL, *Host=NULL, *ptr;
int Flags=0;
time_t LastTime;
ptr=GetToken(Data,":",&Host,0);
if (*ptr=='A') Flags |= LOGIN_CHECK_ALLOWED;
if (*ptr=='I') Flags |= LOGGED_IN;
if (*ptr=='F') Flags |= LOGIN_FAIL;
if (*ptr=='C') Flags |= LOGIN_CHANGE;
ptr=GetVar(Settings.HostConnections,Host);
LastTime=time(NULL);
if (Flags & LOGIN_CHECK_ALLOWED)
{
if (ptr && (strcmp(ptr,"logout")==0))
{
SetVar(Settings.HostConnections,Host,"");
STREAMWriteLine("logout\n",S);
}
else
{
STREAMWriteLine("okay\n",S);
}
}
else if (Flags & LOGIN_CHANGE)
{
Tempstr=CopyStr(Tempstr,"logout");
SetVar(Settings.HostConnections,Host,Tempstr);
STREAMWriteLine("okay\n",S);
}
else
{
if (Flags & LOGGED_IN) LastTime=0;
Tempstr=FormatStr(Tempstr,"%ld",LastTime);
SetVar(Settings.HostConnections,Host,Tempstr);
STREAMWriteLine("okay\n",S);
}
STREAMFlush(S);
DestroyString(Tempstr);
DestroyString(Host);
return(0);
}
示例10: SetVar
// SaveIfNeeded
void SavedVariableBank::SaveIfNeeded() {
// Basically, force save if the player collected a star
if(GM_STAR_COUNT > GetVar(SPECIAL_SAVE_STR)) {
SetVar(SPECIAL_SAVE_STR, GM_STAR_COUNT);
WriteBank();
}
}
示例11: test_serect
char* test_serect()
{
loadtable();
SetVar(test,100);
GetVar(outputpool,100);
return outputpool;
}
示例12: while
/// Parses GET or POST-style variable data.
/// Saves to internal variable structure using HTTP::Parser::SetVar.
void HTTP::Parser::parseVars(std::string data) {
std::string varname;
std::string varval;
// position where a part start (e.g. after &)
size_t pos = 0;
while (pos < data.length()) {
size_t nextpos = data.find('&', pos);
if (nextpos == std::string::npos) {
nextpos = data.length();
}
size_t eq_pos = data.find('=', pos);
if (eq_pos < nextpos) {
// there is a key and value
varname = data.substr(pos, eq_pos - pos);
varval = data.substr(eq_pos + 1, nextpos - eq_pos - 1);
} else {
// no value, only a key
varname = data.substr(pos, nextpos - pos);
varval.clear();
}
SetVar(urlunescape(varname), urlunescape(varval));
if (nextpos == std::string::npos) {
// in case the string is gigantic
break;
}
// erase &
pos = nextpos + 1;
}
}
示例13: OAuthParseReply
int OAuthParseReply(OAUTH *Ctx, const char *ContentType, const char *Reply)
{
ListNode *P=NULL, *Curr=NULL;
const char *ptr;
if (! StrValid(ContentType)) return(FALSE);
if (! StrValid(Reply)) return(FALSE);
P=ParserParseDocument(ContentType, Reply);
Curr=ListGetNext(P);
while (Curr)
{
SetVar(Ctx->Vars, Curr->Tag, (char *) Curr->Item);
Curr=ListGetNext(Curr);
}
ptr=ParserGetValue(P, "access_token");
if (StrValid(ptr)) Ctx->AccessToken=CopyStr(Ctx->AccessToken, ptr);
ptr=ParserGetValue(P, "refresh_token");
if (StrValid(ptr)) Ctx->RefreshToken=CopyStr(Ctx->RefreshToken, ptr);
Ctx->VerifyCode=CopyStr(Ctx->VerifyCode, ParserGetValue(P, "user_code"));
Ctx->VerifyURL=CopyStr(Ctx->VerifyURL, ParserGetValue(P, "verification_url"));
ParserItemsDestroy(P);
return(TRUE);
}
示例14: OAuthParseJSON
void OAuthParseJSON(char *JSON, ListNode *Vars)
{
char *ptr, *ptr2, *Token=NULL, *Name=NULL, *Value=NULL;
StripLeadingWhitespace(JSON);
StripTrailingWhitespace(JSON);
ptr=JSON+StrLen(JSON)-1;
if (*ptr=='}') *ptr='\0';
ptr=JSON;
if (*ptr=='{') ptr++;
ptr=GetToken(ptr,",",&Token,0);
while (ptr)
{
printf("TOK: %s\n",Token);
ptr2=GetToken(Token,":",&Name,0);
StripTrailingWhitespace(Name);
StripQuotes(Name);
ptr2=GetToken(ptr2,":",&Value,GETTOKEN_QUOTES);
StripLeadingWhitespace(Value);
StripTrailingWhitespace(Value);
StripQuotes(Value);
printf("JSON: %s=%s\n",Name,Value);
SetVar(Vars,Name,Value);
ptr=GetToken(ptr,",",&Token,0);
}
DestroyString(Name);
DestroyString(Value);
DestroyString(Token);
}
示例15: DiaReportValue
/*!
*
* @brief start DIA macro request for "interface-datafield" reporting value
* - $r_value is set with fmt ... parameters
* - load and parse diatemplates/dat_inst_%04x_%04x_%d.xml
* @param dev device/sensor number
* @param serial serial number of the device
* @param app application number
* @param cluster cluster number
* @param attribut attribut number
* @param member member number
* @param fmt ... printf(3) like
* @return void
*
*/
void DiaReportValue(int dev,int serial,int app,int cluster,int attr,int member,char *fmt,...)
{
t_dia_req req;
char value[1024];
va_list listArg;
if (DiaDisconnected())
return;
va_start(listArg,fmt);
vsprintf (value, fmt, listArg);
va_end(listArg);
SetVar("r_value",value);
memset (&req,0,sizeof(t_dia_req));
req.rq_cli = NULL;
req.rq_dev = dev;
req.rq_serial = serial;
req.rq_app = app;
req.rq_cluster = cluster;
req.rq_attribut = attr;
req.rq_member = member;
req.rq_name = (char *)__func__;
req.rq_plcDup = 1;
req.rq_flags = DiaRequestMode; DiaRequestMode = 0;
DiaRepInstCreate(&req,NULL);
}