本文整理汇总了C++中xbox::VString::ToBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ VString::ToBlock方法的具体用法?C++ VString::ToBlock怎么用?C++ VString::ToBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xbox::VString
的用法示例。
在下文中一共展示了VString::ToBlock方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetUserInfos
bool HttpRequest::SetUserInfos(const XBOX::VString& inUser, const XBOX::VString& inPasswd, bool inAllowBasic)
{
if(!fHandle)
return false;
XBOX::VString userInfos;
userInfos.AppendString(inUser).AppendCString(":").AppendString(inPasswd);
int maxlen=2*userInfos.GetLength()+1; //We convert utf16 to utf8, it should be large enough.
char* buf=new char[maxlen];
if(!buf)
return false;
int len=userInfos.ToBlock(buf, maxlen, XBOX::VTC_UTF_8, true, false);
curl_easy_setopt(fHandle, CURLOPT_USERPWD, buf);
delete buf;
if(inAllowBasic)
curl_easy_setopt(fHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC|CURLAUTH_DIGEST);
else
curl_easy_setopt(fHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
return true;
}
示例2: SetClientCertificate
bool HttpRequest::SetClientCertificate(const XBOX::VString& inKeyPath, const XBOX::VString& inCertPath)
{
if(!fHandle)
return false;
//tmp buffer for path conversion
char buf[2048];
int len=inKeyPath.ToBlock(buf, sizeof(buf), XBOX::VTC_UTF_8, true, false);
curl_easy_setopt(fHandle, CURLOPT_SSLKEY, buf);
len=inCertPath.ToBlock(buf, sizeof(buf), XBOX::VTC_UTF_8, true, false);
curl_easy_setopt(fHandle, CURLOPT_SSLCERT, buf);
return true;
}
示例3: StdStringFromAsciiVString
std::string StdStringFromAsciiVString(const XBOX::VString inStr)
{
int len=inStr.GetLength();
char* buf=new char[len];
if(!buf)
return std::string();
inStr.ToBlock(buf, len, XBOX::VTC_US_ASCII, false, false);
std::string outStr(buf, len);
delete[] buf;
return outStr;
}
示例4: SetData
bool HttpRequest::SetData(const XBOX::VString& inData, XBOX::CharSet inCS)
{
int maxlen=2*inData.GetLength(); //We convert utf16 to utf8, it should be large enough.
char* buf=new char[maxlen];
if(!buf)
return false;
//int len=inData.ToBlock(buf, maxlen, XBOX::VTC_UTF_8, false, false);
inCS=(inCS!=XBOX::VTC_UNKNOWN ? inCS : XBOX::VTC_US_ASCII);
int len=inData.ToBlock(buf, maxlen, inCS, false, false);
int count=fData.AddRawPtr(buf, len);
delete(buf);
fReqHdrs.FixContentThings();
curl_easy_setopt(fHandle, CURLOPT_POSTFIELDSIZE, count);
return len==count;
}