本文整理汇总了C++中GetVar函数的典型用法代码示例。如果您正苦于以下问题:C++ GetVar函数的具体用法?C++ GetVar怎么用?C++ GetVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IDriveCloseFileWrite
int IDriveCloseFileWrite(TFileStore *FS, STREAM *S)
{
char *Tempstr=NULL, *Error=NULL, *ptr;
ListNode *Vars=NULL;
HTTPInfoStruct *Info;
int result=FALSE, val;
Info=(HTTPInfoStruct *) FS->Extra;
if (Info)
{
Tempstr=MCopyStr(Tempstr,"\r\n--",STREAMGetValue(S,"Boundary"),"--\r\n",NULL);
STREAMWriteLine(Tempstr,S);
STREAMFlush(S);
HTTPTransact(Info);
/*
<?xml version="1.0" encoding="UTF-8"?>
<tree message="SUCCESS">
<item filename="autoget.c" filesize="27620"
lmd="1969/12/31 16:00:00" message="SUCCESS"/>
</tree>
*/
val=HTTPReadDocument(S, &Tempstr);
if (Settings.Flags & FLAG_VERBOSE) printf("\n%s\n",Tempstr);
Vars=ListCreate();
IDriveParseResponse(Tempstr, Vars);
Tempstr=CopyStr(Tempstr,GetVar(Vars,"message"));
if (strcmp(Tempstr,"SUCCESS")==0)
{
val=atoi(STREAMGetValue(S,"Transfer-Size"));
if (val==atoi(GetVar(Vars,"filesize"))) result=TRUE;
else result=ERR_INTERRUPTED;
}
else
{
SetVar(FS->Vars,"Error",GetVar(Vars,"desc"));
result=ERR_CUSTOM;
}
}
DestroyString(Tempstr);
return(result);
}
示例2: OAuthRefresh
int OAuthRefresh(OAUTH *Ctx, const char *URL)
{
char *Tempstr=NULL, *Args=NULL;
const char *ptr;
int result;
/*
POST, GET client_id (integer) :
Your app's client_id (obtained during app registration)
client_id and client_secrect can be provided via HTTP Basic Authentication see http://tools.ietf.org/html/rfc6750#section-2.1
POST, GET client_secret (string) :
Your app's client_secret (obtained during app registration)
client_id and client_secrect can be provided via HTTP Basic Authentication see http://tools.ietf.org/html/rfc6750#section-2.1
POST, GET grant_type (string) :
The value must be refresh_token
POST, GET refresh_token (string) :
required
*/
ptr=GetVar(Ctx->Vars, "client_id");
if (StrValid(ptr))
{
Tempstr=HTTPQuote(Tempstr, ptr);
Args=MCopyStr(Args,"client_id=",Tempstr,NULL);
}
ptr=GetVar(Ctx->Vars, "client_secret");
if (StrValid(ptr))
{
Tempstr=HTTPQuote(Tempstr, ptr);
Args=MCatStr(Args,"&client_secret=",Tempstr,NULL);
}
if (StrValid(Ctx->RefreshToken))
{
Tempstr=HTTPQuote(Tempstr, Ctx->RefreshToken);
Args=MCatStr(Args,"&refresh_token=",Tempstr,NULL);
}
Args=MCatStr(Args,"&grant_type=refresh_token",NULL);
result=OAuthGrant(Ctx, URL, Args);
DestroyString(Tempstr);
DestroyString(Args);
return(result);
}
示例3: IDriveLoadDir
int IDriveLoadDir(TFileStore *FS, char *InPattern, ListNode *Items, int Flags)
{
int result;
char *Tempstr=NULL, *XML=NULL;
char *TagName=NULL, *TagData=NULL, *ptr;
TFileInfo *FI;
HTTPInfoStruct *Info;
ListNode *Vars;
Tempstr=MCopyStr(Tempstr,"https://",FS->Host,"/evs/browseFolder?uid=",FS->Logon,"&pwd=",FS->Passwd,"&p=",FS->CurrDir,NULL);
FS->S=HTTPMethod("POST",Tempstr,"","","","",0);
Tempstr=STREAMReadDocument(Tempstr, FS->S, TRUE);
ptr=XMLGetTag(Tempstr,NULL,&TagName,&TagData);
while (ptr)
{
if (strcmp(TagName,"item")==0)
{
FI=IDriveReadFileEntry(TagData);
if (Items) ListAddNamedItem(Items,FI->Name,FI);
}
ptr=XMLGetTag(ptr,NULL,&TagName,&TagData);
}
STREAMClose(FS->S);
FS->S=NULL;
Tempstr=MCopyStr(Tempstr,"https://",FS->Host,"/evs/getAccountQuota?uid=",FS->Logon,"&pwd=",FS->Passwd,NULL);
FS->S=HTTPMethod("POST",Tempstr,"","","","",0);
Tempstr=STREAMReadDocument(Tempstr, FS->S, TRUE);
Vars=ListCreate();
IDriveParseResponse(Tempstr,Vars);
FS->BytesAvailable=strtod(GetVar(Vars,"totalquota"),NULL);
FS->BytesUsed=strtod(GetVar(Vars,"usedquota"),NULL);
ListDestroy(Vars,DestroyString);
DestroyString(TagName);
DestroyString(TagData);
DestroyString(Tempstr);
DestroyString(XML);
return(TRUE);
}
示例4: GetVar
ConfVarString* ConfVarTable::GetStr(const string_t &name, const string_t &def)
{
std::pair<ConfVar*, bool> p = GetVar(name, ConfVar::typeString);
if( !p.second )
p.first->AsStr()->Set(def);
return p.first->AsStr();
}
示例5: GetNsisString
// Based on Dave Laundon's simplified process_string
AString GetNsisString(const AString &s)
{
AString res;
for (int i = 0; i < s.Length();)
{
unsigned char nVarIdx = s[i++];
if (nVarIdx > NS_CODES_START && i + 2 <= s.Length())
{
int nData = s[i++] & 0x7F;
unsigned char c1 = s[i++];
nData |= (((int)(c1 & 0x7F)) << 7);
if (nVarIdx == NS_SHELL_CODE)
res += GetShellString(c1);
else if (nVarIdx == NS_VAR_CODE)
res += GetVar(nData);
else if (nVarIdx == NS_LANG_CODE)
res += "NS_LANG_CODE";
}
else if (nVarIdx == NS_SKIP_CODE)
{
if (i < s.Length())
res += s[i++];
}
else // Normal char
res += (char)nVarIdx;
}
return res;
}
示例6: FileStoreGetFileType
STREAM *InternalCopyOpenDest(TTransferContext *Ctx, TFileInfo *SrcFI, TFileInfo *DestFI)
{
STREAM *S;
char *ptr;
int val=0;
//For the destination we are writing the file into the current directory, so never use a full path
//use the name of the source file as the path
if (Ctx->CmdFlags & FLAG_CMD_EXTN_TEMP) DestFI->Path=PathChangeExtn(DestFI->Path, SrcFI->Name, GetVar(Ctx->Vars,"TransferTempExtn"));
else DestFI->Path=CopyStr(DestFI->Path, SrcFI->Name);
DestFI->Permissions=CopyStr(DestFI->Permissions,TransferDecidePermissions(SrcFI));
ptr=GetVar(Ctx->Vars,"ContentType");
if (StrLen(ptr)) DestFI->MediaType=CopyStr(DestFI->MediaType,ptr);
else FileStoreGetFileType(Ctx->SrcFS, DestFI);
val=OPEN_WRITE;
if (Ctx->CmdFlags & FLAG_CMD_PUBLIC) val |= OPEN_PUBLIC;
if (
(Ctx->CmdFlags & FLAG_CMD_RESUME) &&
(Ctx->SrcFS->Features & FS_RESUME_TRANSFERS) &&
(Ctx->DestFS->Features & FS_RESUME_TRANSFERS)
) val |= OPEN_RESUME;
S=Ctx->DestFS->OpenFile(Ctx->DestFS,DestFI, val);
return(S);
}
示例7: font_read_settings
// Read settings
void font_read_settings(font_data *data)
{
char buf[80],*ptr;
struct IBox dims;
// Get environment variable
if (GetVar("dopus/Font Viewer",buf,sizeof(buf),GVF_GLOBAL_ONLY)<=0)
return;
// Get pointer to buffer
ptr=buf;
// Parse settings
read_parse_set(&ptr,(UWORD *)&dims.Left);
read_parse_set(&ptr,(UWORD *)&dims.Top);
read_parse_set(&ptr,(UWORD *)&dims.Width);
read_parse_set(&ptr,(UWORD *)&dims.Height);
// Got valid size?
if (dims.Height>0)
{
// Clear character coordinates
data->win_dims.char_dim.Top=0;
data->win_dims.char_dim.Left=0;
data->win_dims.char_dim.Width=0;
data->win_dims.char_dim.Height=0;
// Set absolute coordinates
data->win_dims.fine_dim=dims;
}
}
示例8: EncontrarCant
/* ' @remarks This function reads the Npc.dat file */
int EncontrarCant(int NpcIndex, int ObjIndex) {
int retval;
/* '*************************************************** */
/* 'Author: Unknown */
/* 'Last Modification: 03/09/08 */
/* 'Last Modification By: Marco Vanotti (Marco) */
/* ' - 03/09/08 EncontrarCant now returns 0 if the npc doesn't have it (Marco) */
/* '*************************************************** */
/* 'Devuelve la cantidad original del obj de un npc */
std::string ln;
std::string npcfile;
int i;
npcfile = GetDatPath(DATPATH::NPCs);
for (i = (1); i <= (MAX_INVENTORY_SLOTS); i++) {
ln = GetVar(npcfile, "NPC" + vb6::CStr(Npclist[NpcIndex].Numero), "Obj" + vb6::CStr(i));
if (ObjIndex == vb6::val(ReadField(1, ln, 45))) {
retval = (int) vb6::val(ReadField(2, ln, 45));
return retval;
}
}
retval = 0;
return retval;
}
示例9: GetVar
void clConsole::ExecuteBinding( const int Key, const bool KeyState )
{
if ( !FKeyBindings[Key].empty() )
{
if ( LStr::IsFirstChar( FKeyBindings[Key], '+' ) )
{
// The "+" command is processed separatly and doesn't need to be registred
LString VarName = FKeyBindings[Key].substr( 1, FKeyBindings[Key].length() - 1 );
clCVar* CVar = GetVar( VarName );
CVar->SetBool( KeyState );
}
else
{
if ( KeyState )
{
SendCommand( FKeyBindings[Key] );
}
}
}
// autorelease mouse wheel
if ( ( Key == LK_WHEELUP || Key == LK_WHEELDOWN ) && ( KeyState ) )
{
ExecuteBinding( Key, false );
}
}
示例10: SetupDefaultMethod
One<Builder> MakeBuild::CreateBuilder(Host *host)
{
SetupDefaultMethod();
VectorMap<String, String> bm = GetMethodVars(method);
String builder = bm.Get("BUILDER", "GCC");
int q = BuilderMap().Find(builder);
if(q < 0) {
PutConsole("Invalid builder " + builder);
ConsoleShow();
return NULL;
}
One<Builder> b = (*BuilderMap().Get(builder))();
b->host = host;
b->compiler = bm.Get("COMPILER", "");
b->include = SplitDirs(GetVar("UPP") + ';' + bm.Get("INCLUDE", "") + ';' + add_includes);
const Workspace& wspc = GetIdeWorkspace();
for(int i = 0; i < wspc.GetCount(); i++) {
const Package& pkg = wspc.GetPackage(i);
for(int j = 0; j < pkg.include.GetCount(); j++)
b->include.Add(SourcePath(wspc[i], pkg.include[j].text));
}
b->libpath = SplitDirs(bm.Get("LIB", ""));
b->debug_options = bm.Get("DEBUG_OPTIONS", "");
b->release_options = bm.Get("RELEASE_OPTIONS", "");
b->release_size_options = bm.Get("RELEASE_SIZE_OPTIONS", "");
b->debug_link = bm.Get("DEBUG_LINK", "");
b->release_link = bm.Get("RELEASE_LINK", "");
b->script = bm.Get("SCRIPT", "");
b->main_conf = !!main_conf.GetCount();
return b;
}
示例11: LocalHost
String MakeBuild::OutDir(const Index<String>& cfg, const String& package, const VectorMap<String, String>& bm,
bool use_target)
{
Index<String> excl;
excl.Add(bm.Get("BUILDER", "GCC"));
excl.Add("MSC");
LocalHost().AddFlags(excl);
Vector<String> x;
bool dbg = cfg.Find("DEBUG_FULL") >= 0 || cfg.Find("DEBUG_MINIMAL") >= 0;
if(cfg.Find("DEBUG") >= 0) {
excl.Add("BLITZ");
if(cfg.Find("BLITZ") < 0)
x.Add("NOBLITZ");
}
else
if(dbg)
x.Add("RELEASE");
if(use_target)
excl.Add("MAIN");
for(int i = 0; i < cfg.GetCount(); i++)
if(excl.Find(cfg[i]) < 0)
x.Add(cfg[i]);
Sort(x);
for(int i = 0; i < x.GetCount(); i++)
x[i] = InitCaps(x[i]);
String outdir = GetVar("OUTPUT");
if(output_per_assembly)
outdir = AppendFileName(outdir, GetVarsName());
if(!use_target)
outdir = AppendFileName(outdir, package);
outdir = AppendFileName(outdir, GetFileTitle(method) + "." + Join(x, "."));
outdir = Filter(outdir, CharFilterSlash);
return outdir;
}
示例12: DoCommand
void DoCommand(const std::string& newline, User* user, Channel *chan, const std::string &original_line)
{
std::string result;
result.reserve(newline.length());
for (unsigned int i = 0; i < newline.length(); i++)
{
char c = newline[i];
if ((c == '$') && (i + 1 < newline.length()))
{
if (isdigit(newline[i+1]))
{
int len = ((i + 2 < newline.length()) && (newline[i+2] == '-')) ? 3 : 2;
std::string var = newline.substr(i, len);
result.append(GetVar(var, original_line));
i += len - 1;
}
else if (newline.substr(i, 5) == "$nick")
{
result.append(user->nick);
i += 4;
}
else if (newline.substr(i, 5) == "$host")
{
result.append(user->host);
i += 4;
}
else if (newline.substr(i, 5) == "$chan")
{
if (chan)
result.append(chan->name);
i += 4;
}
else if (newline.substr(i, 6) == "$ident")
{
result.append(user->ident);
i += 5;
}
else if (newline.substr(i, 6) == "$vhost")
{
result.append(user->dhost);
i += 5;
}
else
result.push_back(c);
}
else
result.push_back(c);
}
irc::tokenstream ss(result);
std::vector<std::string> pars;
std::string command, token;
ss.GetToken(command);
while (ss.GetToken(token))
{
pars.push_back(token);
}
ServerInstance->Parser->CallHandler(command, pars, user);
}
示例13: SaveIfNeeded
// 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();
}
}
示例14: test_serect
char* test_serect()
{
loadtable();
SetVar(test,100);
GetVar(outputpool,100);
return outputpool;
}
示例15: void
ConfVarArray* ConfVarTable::GetArray(const string_t &name, void (*init)(ConfVarArray*))
{
std::pair<ConfVar*, bool> p = GetVar(name, ConfVar::typeArray);
if( !p.second && init )
init(p.first->AsArray());
return p.first->AsArray();
}