本文整理汇总了C++中aws::Vector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector::size方法的具体用法?C++ Vector::size怎么用?C++ Vector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aws::Vector
的用法示例。
在下文中一共展示了Vector::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteHeader
size_t CurlHttpClient::WriteHeader(char* ptr, size_t size, size_t nmemb, void* userdata)
{
if (ptr)
{
AWS_LOGSTREAM_TRACE(CURL_HTTP_CLIENT_TAG, ptr);
HttpResponse* response = (HttpResponse*) userdata;
Aws::String headerLine(ptr);
Aws::Vector<Aws::String> keyValuePair = StringUtils::Split(headerLine, ':');
if (keyValuePair.size() > 1)
{
Aws::String headerName = keyValuePair[0];
headerName = StringUtils::Trim(headerName.c_str());
Aws::String headerValue = headerLine.substr(headerName.length() + 1).c_str();
headerValue = StringUtils::Trim(headerValue.c_str());
response->AddHeader(headerName, headerValue);
}
return size * nmemb;
}
return 0;
}
示例2: VerifyAllLogsAtOrBelow
void VerifyAllLogsAtOrBelow(LogLevel logLevel, const Aws::String& tag, const Aws::Vector<Aws::String>& loggedStatements)
{
static const uint32_t STATEMENTS_PER_LEVEL = 3;
uint32_t expectedLogLevels = static_cast<uint32_t>(logLevel);
uint32_t expectedStatementCount = expectedLogLevels * STATEMENTS_PER_LEVEL;
ASSERT_EQ(expectedStatementCount, loggedStatements.size());
for(uint32_t i = 0; i < expectedLogLevels; ++i)
{
LogLevel currentLevel = static_cast<LogLevel>(i + 1);
Aws::String levelTag = "[" + GetLogLevelName(currentLevel) + "]";
for(uint32_t j = 0; j < STATEMENTS_PER_LEVEL; ++j)
{
uint32_t statementIndex = i * STATEMENTS_PER_LEVEL + j;
ASSERT_TRUE(loggedStatements[statementIndex].find(levelTag) != Aws::String::npos);
ASSERT_TRUE(loggedStatements[statementIndex].find(tag) != Aws::String::npos);
}
Aws::String logText1 = "test " + StringUtils::ToLower(GetLogLevelName(currentLevel).c_str()) + " level";
ASSERT_TRUE(loggedStatements[i * STATEMENTS_PER_LEVEL].find(logText1) != Aws::String::npos);
Aws::String logText2 = "test " + StringUtils::ToLower(GetLogLevelName(currentLevel).c_str()) + " format level";
ASSERT_TRUE(loggedStatements[i * STATEMENTS_PER_LEVEL + 1].find(logText2) != Aws::String::npos);
Aws::String logText3 = "test " + StringUtils::ToLower(GetLogLevelName(currentLevel).c_str()) + " stream level";
ASSERT_TRUE(loggedStatements[i * STATEMENTS_PER_LEVEL + 2].find(logText3) != Aws::String::npos);
}
}
示例3:
TEST(StringUtilsTest, TestSplitDelimiterNotFound)
{
AWS_BEGIN_MEMORY_TEST(16, 10)
Aws::String toSplit = "BlahBlahBlah";
Aws::Vector<Aws::String> splits = StringUtils::Split(toSplit, ',');
ASSERT_EQ(1uL, splits.size());
AWS_END_MEMORY_TEST
}
示例4: profileFile
Aws::Map<Aws::String, Aws::String> ProfileConfigFileAWSCredentialsProvider::ParseProfileConfigFile(const Aws::String& filename)
{
std::ifstream profileFile(filename.c_str());
Aws::Map<Aws::String, Aws::String> propertyValueMap;
Aws::String profile = "";
if (profileFile.good() && profileFile.is_open())
{
Aws::String line;
while (std::getline(profileFile, line))
{
Aws::String trimmedLine(StringUtils::Trim(line.c_str()));
if (trimmedLine.empty() || trimmedLine.front() == '#')
continue;
if (trimmedLine.front() == '[' && trimmedLine.back() == ']')
{
profile = StringUtils::Trim(trimmedLine.substr(1, trimmedLine.length() - 2).c_str());
AWS_LOGSTREAM_DEBUG(profileLogTag, "Found profile " << profile);
}
Aws::Vector<Aws::String> propertyPair = StringUtils::Split(trimmedLine, '=');
if (propertyPair.size() == 2)
{
Aws::String key(StringUtils::Trim(propertyPair[0].c_str()));
Aws::String value(StringUtils::Trim(propertyPair[1].c_str()));
AWS_LOGSTREAM_TRACE(profileLogTag, "Found property " << key << "for profile " << profile);
if (key == AWS_ACCESS_KEY_ID || key == AWS_SECRET_ACCESS_KEY || key == AWS_SESSION_TOKEN || key == AWS_ACCOUNT_ID)
propertyValueMap[profile + ":" + key] = value;
}
}
}
if (profileFile.is_open())
profileFile.close();
return std::move(propertyValueMap);
}
示例5: headerValue
std::shared_ptr<HttpResponse> WinSyncHttpClient::BuildSuccessResponse(const Aws::Http::HttpRequest& request, void* hHttpRequest, Aws::Utils::RateLimits::RateLimiterInterface* readLimiter) const
{
auto response = Aws::MakeShared<StandardHttpResponse>(GetLogTag(), request);
Aws::StringStream ss;
uint64_t read = 0;
DoQueryHeaders(hHttpRequest, response, ss, read);
if(readLimiter != nullptr && read > 0)
{
readLimiter->ApplyAndPayForCost(read);
}
Aws::Vector<Aws::String> rawHeaders = StringUtils::SplitOnLine(ss.str());
for (auto& header : rawHeaders)
{
Aws::Vector<Aws::String> keyValuePair = StringUtils::Split(header, ':');
if (keyValuePair.size() > 1)
{
Aws::String headerName = keyValuePair[0];
headerName = StringUtils::Trim(headerName.c_str());
Aws::String headerValue(keyValuePair[1]);
for (unsigned i = 2; i < keyValuePair.size(); ++i)
{
headerValue += ":";
headerValue += keyValuePair[i];
}
response->AddHeader(headerName, StringUtils::Trim(headerValue.c_str()));
}
}
if (request.GetMethod() != HttpMethod::HTTP_HEAD)
{
char body[1024];
uint64_t bodySize = sizeof(body);
read = 0;
bool success = true;
while (DoReadData(hHttpRequest, body, bodySize, read) && read > 0 && success)
{
response->GetResponseBody().write(body, read);
if (read > 0)
{
if (readLimiter != nullptr)
{
readLimiter->ApplyAndPayForCost(read);
}
auto& receivedHandler = request.GetDataReceivedEventHandler();
if (receivedHandler)
{
receivedHandler(&request, response.get(), (long long)read);
}
}
success = success && IsRequestProcessingEnabled();
}
if(!success)
{
return nullptr;
}
}
//go ahead and flush the response body.
response->GetResponseBody().flush();
return response;
}