本文整理汇总了C++中Poco::cat方法的典型用法代码示例。如果您正苦于以下问题:C++ Poco::cat方法的具体用法?C++ Poco::cat怎么用?C++ Poco::cat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poco
的用法示例。
在下文中一共展示了Poco::cat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testCat
void StringTest::testCat()
{
std::string s1("one");
std::string s2("two");
std::string s3("three");
std::string s4("four");
std::string s5("five");
std::string s6("six");
assert (cat(s1, s2) == "onetwo");
assert (cat(s1, s2, s3) == "onetwothree");
assert (cat(s1, s2, s3, s4) == "onetwothreefour");
assert (cat(s1, s2, s3, s4, s5) == "onetwothreefourfive");
assert (cat(s1, s2, s3, s4, s5, s6) == "onetwothreefourfivesix");
std::vector<std::string> vec;
assert (cat(std::string(), vec.begin(), vec.end()) == "");
assert (cat(std::string(","), vec.begin(), vec.end()) == "");
vec.push_back(s1);
assert (cat(std::string(","), vec.begin(), vec.end()) == "one");
vec.push_back(s2);
assert (cat(std::string(","), vec.begin(), vec.end()) == "one,two");
vec.push_back(s3);
assert (cat(std::string(","), vec.begin(), vec.end()) == "one,two,three");
}
示例2: handleRequest
void handleRequest (HTTPServerRequest &request, HTTPServerResponse &response)
{
Application& app = Application::instance();
app.logger().information("Запрос от " + request.clientAddress().toString());
// std::cout << request.getURI() << std::endl;
// std::string filename(request.getURI().substr(0, request.getURI().find("?")));
// app.logger().information("Файл: " + filename);
/*
if (opendir(std::string("www" + filename).c_str()) != NULL)
{
response.setStatus(Poco::Net::HTTPResponse::HTTP_NOT_FOUND);
return;
}
if (filename != "balda.json")
{
ifstream fin(filename.c_str());
if (fin.is_open())
{
}
return;
}
*/
response.setChunkedTransferEncoding(true);
std::ostream &ostr = response.send();
// try
// {
// response.sendFile("/media/hdisk0/programming/project/anbal/2001/www" + filename, "text/plain");
// }
// catch (...)
// {
// ostr << "BAD" << std::endl;
// }
// return;
response.setContentType("text/javascript; charset=UTF-8");
HTMLForm form(request, request.stream());
if (!form.empty())
{
std::map < std::string , Glib::ustring > params;
for (NameValueCollection::ConstIterator it = form.begin(); it != form.end(); ++it)
params[it->first] = Glib::ustring(it->second);
if (params["map"].length() != 25)
return;
std::vector < std::vector < SMyGUniChar > > char_map(5, std::vector < SMyGUniChar >(5));
Glib::ustring u_map = params["map"];
for (int i = 0, len = u_map.length(); i < len; ++i)
char_map[i / 5][i % 5] = SMyGUniChar(u_map[i], i / 5, i % 5, u_map[i] == Glib::ustring(".")[0]);
CBalda balda(*dictionary);
std::vector < Glib::ustring > words = balda.calc(char_map);
ostr << params["callback"] << "({\"word\": [\"" << cat(std::string("\", \""), words.begin(), words.end()) << "\"]})";
}
}