本文整理汇总了C++中Poco::File方法的典型用法代码示例。如果您正苦于以下问题:C++ Poco::File方法的具体用法?C++ Poco::File怎么用?C++ Poco::File使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poco
的用法示例。
在下文中一共展示了Poco::File方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveRendering
void TileCache::saveRendering(const std::string& name, const std::string& dir, const char *data, size_t size)
{
// can fonts be invalidated?
const std::string dirName = _cacheDir + "/" + dir;
File(dirName).createDirectories();
const std::string fileName = dirName + "/" + name;
std::fstream outStream(fileName, std::ios::out);
outStream.write(data, size);
outStream.close();
}
示例2: directory
std::unique_ptr<std::fstream> TileCache::lookupRendering(const std::string& name, const std::string& dir)
{
const std::string dirName = _cacheDir + "/" + dir;
const std::string fileName = dirName + "/" + name;
File directory(dirName);
if (directory.exists() && directory.isDirectory() && File(fileName).exists())
{
std::unique_ptr<std::fstream> result(new std::fstream(fileName, std::ios::in));
return result;
}
return nullptr;
}
示例3: Exception
AvailableTickets::AvailableTickets(string atf_file)
{
File file = File(atf_file);
if (file.exists())
{
this->atf_file = atf_file;
/* Parse the available tickets file */
this->parse();
}
else
{
throw Exception(ATF_NOT_FOUND);
}
}
示例4: handleRequest
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
{
response.setChunkedTransferEncoding(true);
//response.setContentType("text/html");
Path path(_file);
if (File(path).exists())
{
std::string mime = "application/binary";
std::string ext = path.getExtension();
if (ext == "html" || ext == "htm" || ext == "js" || ext == "css" || ext == "xml")
mime = "text/" + ext;
response.sendFile(_file, mime);
}
else
{
response.setStatusAndReason(HTTPResponse::HTTP_NOT_FOUND);
response.send();
}
}