本文整理汇总了C++中AutoArray::append方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoArray::append方法的具体用法?C++ AutoArray::append怎么用?C++ AutoArray::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoArray
的用法示例。
在下文中一共展示了AutoArray::append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flagsToDB
LightSpeed::StringA flagsToDB(const LightSpeed::JSON::INode &nd) {
using namespace LightSpeed;
if (nd.getType() == JSON::ndString) return nd.getStringUtf8();
AutoArray<char, SmallAlloc<256> > buff;
ConstStrA comma(",");
ConstStrA div = comma.head(0);
for(natural i = 0; i < nd.getEntryCount(); i++) {
buff.append(div);
div = comma;
buff.append(nd[i].getString());
}
return buff;
}
示例2: dbOrderFromJSON
LightSpeed::StringA dbOrderFromJSON(const LightSpeed::JSON::INode &nd) {
using namespace LightSpeed;
AutoArray<char, SmallAlloc<256> > buff;
for (natural i = 0; i < nd.getEntryCount();i++) {
ConstStrA fld = nd[i].getStringUtf8();
if (fld.empty() || fld == ConstStrA('^') || fld.find('`') != naturalNull)
throw ErrorMessageException(THISLOCATION, "Unacceptable field name");
if (i) buff.append(ConstStrA(", "));
if (fld[0] == '^') {
buff.add('`');buff.append(fld.offset(1));buff.add('`');
buff.append(ConstStrA(" DESC"));
} else {
buff.add('`');buff.append(fld);buff.add('`');
buff.append(ConstStrA(" ASC"));
}
}
return ConstStrA(buff);
}
示例3: startApp
int LightSpeed::AppBase::main_entry( int argc, char *argv[], ConstStrW pathname)
{
AutoArray<String> params;
AutoArray<ConstStrW> wparams;
params.reserve(argc);
for (int i = 0; i < argc; i++)
params.add(String(argv[i]));
wparams.append(params);
appPathname = pathname;
return startApp(Args(wparams));
}
示例4: initRequest
void WinHttpStream::initRequest()
{
TextParser<wchar_t> parser;
if (!parser(L"%1://%[*-_.a-zA-Z0-9:@]2%%[/](*)*3",url))
throw FileOpenError(THISLOCATION,ERROR_FILE_NOT_FOUND,url);
String protocol = parser[1].str();
String hostident = parser[2].str();
String::SplitIterator hostidentsplit = hostident.split('@');
String ident;
String domain;
domain = hostidentsplit.getNext();
while (hostidentsplit.hasItems()) {
ident = ident + domain + ConstStrW('@');
domain = hostidentsplit.getNext();
}
String path = parser[3].str();
natural port;
String username;
String password;
bool secure;
if (parser( L"%1:%u2",domain)) {
domain = parser[1].str();
port = parser[2];
secure = false;
} else if (protocol == ConstStrW(L"http")) {
port = INTERNET_DEFAULT_HTTP_PORT;
secure = false;
} else if (protocol == ConstStrW(L"https")) {
port = INTERNET_DEFAULT_HTTPS_PORT;
secure = true;
} else
throw FileOpenError(THISLOCATION,ERROR_NOT_FOUND,url);
if (!ident.empty()) {
if (parser(L"%1:%[email protected]",ident)) {
username = parser[1].str();
password = parser[2].str();
} else {
throw FileMsgException(THISLOCATION,0,url,"Invalid identification field in the url");
}
}
DWORD accessType;
switch (settings.proxyMode) {
case pmManual: accessType = INTERNET_OPEN_TYPE_PROXY;
case pmDirect: accessType = INTERNET_OPEN_TYPE_DIRECT;
case pmAuto: accessType = INTERNET_OPEN_TYPE_PRECONFIG;
}
TextFormatBuff<wchar_t> fmt;
String proxyName;
if (accessType == INTERNET_OPEN_TYPE_PROXY) {
fmt(L"%1:%2") << settings.proxyAddr << settings.proxyPort;
proxyName = fmt.write();
}
if (hInternet) InternetCloseHandle(hInternet);
hInternet = InternetOpenW(settings.userAgent.cStr(),accessType,proxyName.cStr(),0,0);
if (hInternet == 0)
throw FileMsgException(THISLOCATION,GetLastError(),url,"Cannot initialize WinInet");
if (hConnect) InternetCloseHandle(hConnect);
hConnect = InternetConnectW(hInternet,domain.cStr(),(INTERNET_PORT)port,
username.empty()?0:username.cStr(),
password.empty()?0:password.cStr(),
INTERNET_SERVICE_HTTP ,0,0);
if (hConnect == 0)
throw FileMsgException(THISLOCATION,GetLastError(),url,"Cannot connect remote site");
DWORD reqFlags = INTERNET_FLAG_NO_UI |INTERNET_FLAG_HYPERLINK ;
if (redirDisabled) reqFlags|=INTERNET_FLAG_NO_AUTO_REDIRECT ;
if (!settings.cookiesEnabled) reqFlags|=INTERNET_FLAG_NO_COOKIES;
if (secure) reqFlags|=INTERNET_FLAG_SECURE;
hHTTPConn = HttpOpenRequestW(hConnect,String(method).cStr(),path.cStr(),
0,0,0,reqFlags,0);
if (hHTTPConn == 0)
throw FileMsgException(THISLOCATION,GetLastError(),url,"Cannot connect remote site");
AutoArray<wchar_t> hdrall;
for (HeaderMap::Iterator iter = hdrmap.getFwIter(); iter.hasItems();) {
const HeaderMap::Entity &e = iter.getNext();
fmt(L"%1: %2\n") << e.key << e.value;
hdrall.append(fmt.write());
}
if (!hdrall.empty() &&
!HttpAddRequestHeadersW(hHTTPConn,hdrall.data(),(DWORD)hdrall.length(),HTTP_ADDREQ_FLAG_REPLACE|HTTP_ADDREQ_FLAG_ADD))
throw FileMsgException(THISLOCATION,GetLastError(),url,"AddRequest failed");
if (!HttpSendRequestW(hHTTPConn,0,0,postBuffer.data(),(DWORD)postBuffer.length())) {
bool stillError = true;
DWORD dwError = GetLastError();
if (dwError == ERROR_INTERNET_INVALID_CA && settings.allowUntrustedCert) {
DWORD dwFlags;
DWORD dwBuffLen = sizeof(dwFlags);
InternetQueryOption (hHTTPConn, INTERNET_OPTION_SECURITY_FLAGS,
//.........这里部分代码省略.........