本文整理汇总了C++中setContentType函数的典型用法代码示例。如果您正苦于以下问题:C++ setContentType函数的具体用法?C++ setContentType怎么用?C++ setContentType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setContentType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setGuid
MHSyncItemInfo::MHSyncItemInfo(MHSyncItemInfo& copy) {
iD = copy.getId();
setGuid(copy.getGuid());
setLuid(copy.getLuid());
setName(copy.getName());
setSize(copy.getSize());
setServerUrl(copy.getServerUrl());
setContentType(copy.getContentType());
setCreationDate(copy.getCreationDate());
setModificationDate(copy.getModificationDate());
setStatus(copy.getStatus());
setServerLastUpdate(copy.getServerLastUpdate());
setRemoteItemUrl(copy.getRemoteItemUrl());
setRemoteThumbUrl(copy.getRemoteThumbUrl());
setRemotePreviewUrl(copy.getRemotePreviewUrl());
setLocalThumbPath(copy.getLocalThumbPath());
setLocalPreviewPath(copy.getLocalPreviewPath());
setLocalItemPath(copy.getLocalItemPath());
setLocalItemETag(copy.getLocalItemETag().c_str());
setLocalThumbETag(copy.getLocalThumbETag().c_str());
setLocalPreviewETag(copy.getLocalPreviewETag().c_str());
setRemoteItemETag(copy.getRemoteItemETag().c_str());
setRemoteThumbETag(copy.getRemoteThumbETag().c_str());
setRemotePreviewETag(copy.getRemotePreviewETag().c_str());
setItemExifData(copy.exifData);
setItemVideoMetadata(copy.videoMetadata);
setExportedServices(copy.exportedServices);
setShared(copy.shared);
setNumUploadFailures(copy.numUploadFailures);
}
示例2: setContentType
//-----------------------------------------------------------------------
void TextureUnitState::setAnimatedTextureName(const String* const names, unsigned int numFrames, Real duration)
{
setContentType(CONTENT_NAMED);
mTextureLoadFailed = false;
mFrames.resize(numFrames);
// resize pointers, but don't populate until needed
mFramePtrs.resize(numFrames);
mAnimDuration = duration;
mCurrentFrame = 0;
mCubic = false;
for (unsigned int i = 0; i < mFrames.size(); ++i)
{
mFrames[i] = names[i];
mFramePtrs[i].setNull();
}
// Load immediately if Material loaded
if (isLoaded())
{
_load();
}
// Tell parent to recalculate hash
if( Pass::getHashFunction() == Pass::getBuiltinHashFunction( Pass::MIN_TEXTURE_CHANGE ) )
{
mParent->_dirtyHash();
}
}
示例3: _pStoreFactory
MailMessage::MailMessage(PartStoreFactory* pStoreFactory):
_pStoreFactory(pStoreFactory)
{
Poco::Timestamp now;
setDate(now);
setContentType("text/plain");
}
示例4: SYSTEM_ERROR
bool HttpResponse::sendFile(String fileName, bool allowGzipFileCheck /* = true*/)
{
if (stream != NULL)
{
SYSTEM_ERROR("Stream already created");
delete stream;
stream = NULL;
}
String compressed = fileName + ".gz";
if (allowGzipFileCheck && fileExist(compressed))
{
debugf("found %s", compressed.c_str());
stream = new FileStream(compressed);
setHeader("Content-Encoding", "gzip");
}
else if (fileExist(fileName))
{
debugf("found %s", fileName.c_str());
stream = new FileStream(fileName);
}
else
{
notFound();
return false;
}
if (!hasHeader("Content-Type"))
{
const char *mime = ContentType::fromFullFileName(fileName);
if (mime != NULL)
setContentType(mime);
}
return true;
}
示例5: setContentType
void QMessageContentContainerPrivate::setContent(const QByteArray &content, const QByteArray &type, const QByteArray &subType, const QByteArray &charset)
{
setContentType(type, subType, charset);
_content = content;
_available = true;
}
示例6: N
IMM::IMM(BOOM::Vector<TrainingSequence*> &v,int order,
int minSampleSize,int phase,ContentType contentType,
Strand strand)
: N(order),
alphabetSize(alphabet.getNumElements()),
phase(phase),
revComp(NULL),
models(new BOOM::Vector<BOOM::StringMap<double>*>)
{
setContentType(contentType);
if(strand==EITHER_STRAND) strand=::getStrand(contentType);
setStrand(strand);
buildModels(v,minSampleSize);
if(strand==FORWARD_STRAND)
{
BOOM::Vector<TrainingSequence*> rcSeqs;
revCompSeqs(v,rcSeqs);
revComp=new IMM(rcSeqs,order,minSampleSize,phase,
::reverseComplement(contentType),
REVERSE_STRAND);
revComp->revComp=this;
}
}
示例7: poco_assert
void HTTPServerResponseImpl::sendFile(const std::string& path, const std::string& mediaType)
{
poco_assert (!_pStream);
File f(path);
Timestamp dateTime = f.getLastModified();
File::FileSize length = f.getSize();
set("Last-Modified", DateTimeFormatter::format(dateTime, DateTimeFormat::HTTP_FORMAT));
#if defined(POCO_HAVE_INT64)
setContentLength64(length);
#else
setContentLength(static_cast<int>(length));
#endif
setContentType(mediaType);
setChunkedTransferEncoding(false);
Poco::FileInputStream istr(path);
if (istr.good())
{
_pStream = new HTTPHeaderOutputStream(_session);
write(*_pStream);
if (_pRequest && _pRequest->getMethod() != HTTPRequest::HTTP_HEAD)
{
StreamCopier::copyStream(istr, *_pStream);
}
}
else throw OpenFileException(path);
}
示例8: log_debug
////////////////////////////////////////////////////////////////////////
// componentdefinition
//
unsigned Unzip::operator() (tnt::HttpRequest& request, tnt::HttpReply& reply, tnt::QueryParams& qparams)
{
std::string pi = request.getPathInfo();
log_debug("unzip archive \"" << request.getArg("file") << "\" file \"" << pi << '"');
try
{
unzipFile f(request.getArg("file"));
unzipFileStream in(f, pi, false);
// set Content-Type
std::string contentType = request.getArg("contenttype");
if (contentType.empty())
setContentType(request, reply);
else
reply.setContentType(contentType);
reply.out() << in.rdbuf();
}
catch (const unzipEndOfListOfFile&)
{
log_debug("file \"" << pi << "\" not found in archive");
return DECLINED;
}
return HTTP_OK;
}
示例9: setContentType
void IMM::load(istream &is)
{
int numModels, numElements;
BOOM::String str, pStr;
ContentType contentType;
is >> contentType >> N >> phase >> numModels;
setContentType(contentType);
for(int i=0 ; i<numModels ; ++i)
{
models->push_back(new BOOM::StringMap<double>(hashTableSize(N)));
BOOM::StringMap<double> &model=*(*models)[i];
is >> numElements;
for(int j=0 ; j<numElements ; ++j)
{
is >> str >> pStr;
model.lookup(str.c_str(),str.length())=pStr.asDouble();
}
}
if(getStrand()==FORWARD_STRAND)
{
BOOM::String modelType;
is >> modelType;
revComp=new IMM(is,REVERSE_STRAND);
revComp->revComp=this;
}
示例10: setContentType
void QxtMailAttachment::setExtraHeader(const QString& key, const QString& value)
{
if (key.compare(QStringLiteral("Content-Type"), Qt::CaseInsensitive) == 0)
setContentType(value);
else
qxt_d->extraHeaders[key.toLower()] = value;
}
示例11: ASSERT
Blob* XMLHttpRequest::responseBlob()
{
ASSERT(m_responseTypeCode == ResponseTypeBlob);
ASSERT(doneWithoutErrors());
if (!m_responseBlob) {
// FIXME: This causes two (or more) unnecessary copies of the data.
// Chromium stores blob data in the browser process, so we're pulling the data
// from the network only to copy it into the renderer to copy it back to the browser.
// Ideally we'd get the blob/file-handle from the ResourceResponse directly
// instead of copying the bytes. Embedders who store blob data in the
// same process as WebCore would at least to teach BlobData to take
// a SharedBuffer, even if they don't get the Blob from the network layer directly.
auto blobData = std::make_unique<BlobData>();
// If we errored out or got no data, we still return a blob, just an empty one.
size_t size = 0;
if (m_binaryResponseBuilder) {
RefPtr<RawData> rawData = RawData::create();
size = m_binaryResponseBuilder->size();
rawData->mutableData()->append(m_binaryResponseBuilder->data(), size);
blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile);
String normalizedContentType = Blob::normalizedContentType(responseMIMEType());
blobData->setContentType(normalizedContentType); // responseMIMEType defaults to text/xml which may be incorrect.
m_binaryResponseBuilder.clear();
}
m_responseBlob = Blob::create(std::move(blobData), size);
}
return m_responseBlob.get();
}
示例12: setCubicTextureName
//-----------------------------------------------------------------------
void TextureUnitState::setCubicTextureName( const String& name, bool forUVW)
{
if (forUVW)
{
setCubicTextureName(&name, forUVW);
}
else
{
setContentType(CONTENT_NAMED);
mTextureLoadFailed = false;
String ext;
String suffixes[6] = {"_fr", "_bk", "_lf", "_rt", "_up", "_dn"};
String baseName;
String fullNames[6];
size_t pos = name.find_last_of(".");
if( pos != String::npos )
{
baseName = name.substr(0, pos);
ext = name.substr(pos);
}
else
baseName = name;
for (int i = 0; i < 6; ++i)
{
fullNames[i] = baseName + suffixes[i] + ext;
}
setCubicTextureName(fullNames, forUVW);
}
}
示例13: connect
void ServerImpl::handleRegisterFiles(QHttpRequest *req, QHttpResponse *resp)
{
req->storeBody();
connect(req, &QHttpRequest::end, [this, req, resp]() {
QByteArray jsonTextBin = req->body();
QJsonObject json = QJsonDocument::fromJson(jsonTextBin).object();
QByteArray content("ok");
if (!json.isEmpty()) {
FileInfo fi;
fi.filename = json["filename"].toString();
fi.filepath = json["filepath"].toString();
fi.hash = json["md5"].toString();
fi.ttl = json["ttl"].toInt();
fi.registeredTime = QDateTime::currentDateTime();
if (!fi.filename.isEmpty() && !fi.hash.isEmpty() && QFile::exists(fi.filepath)) {
mRegisteredFiles[fi.hash] = fi;
}
}
resp->setHeader("Content-Length", QString::number(content.length()));
setContentType(resp, "text/plain");
resp->writeHead(200); // everything is OK
resp->write(content);
resp->end();
});
}
示例14: foreach
foreach (const QString &headerRow, headerLines) {
QRegExp messageIdRx("^Message-ID: (.*)$", Qt::CaseInsensitive);
QRegExp fromRx("^From: (.*)$", Qt::CaseInsensitive);
QRegExp toRx("^To: (.*)$", Qt::CaseInsensitive);
QRegExp ccRx("^Cc: (.*)$", Qt::CaseInsensitive);
QRegExp subjectRx("^Subject: (.*)$", Qt::CaseInsensitive);
QRegExp dateRx("^Date: (.*)$", Qt::CaseInsensitive);
QRegExp mimeVerstionRx("^MIME-Version: (.*)$", Qt::CaseInsensitive);
QRegExp contentTransferEncodingRx("^Content-Transfer-Encoding: (.*)$", Qt::CaseInsensitive);
QRegExp contentTypeRx("^Content-Type: (.*)$", Qt::CaseInsensitive);
if (messageIdRx.indexIn(headerRow) != -1)
setMessageId(messageIdRx.cap(1));
else if (fromRx.indexIn(headerRow) != -1)
setFrom(headerDecode(fromRx.cap(1)));
else if (toRx.indexIn(headerRow) != -1)
setTo(headerDecode(toRx.cap(1)));
else if (ccRx.indexIn(headerRow) != -1)
setCc(headerDecode(ccRx.cap(1)));
else if (subjectRx.indexIn(headerRow) != -1)
setSubject(headerDecode(subjectRx.cap(1)));
else if (dateRx.indexIn(headerRow) != -1) {
QDateTime date = QDateTime::fromString(dateRx.cap(1), Qt::RFC2822Date);
setDate(date);
} else if (mimeVerstionRx.indexIn(headerRow) != -1)
setMimeVersion(mimeVerstionRx.cap(1));
else if (contentTransferEncodingRx.indexIn(headerRow) != -1)
setContentTransferEncoding(IqPostmanAbstractContent::contentTransferEncodingFromString(headerRow));
else if (contentTypeRx.indexIn(headerRow) != -1)
setContentType(IqPostmanAbstractContentType::createFromString(headerRow));
}
示例15: setContentType
void body::setContents(ref <const contentHandler> contents, const mediaType& type,
const charset& chset, const encoding& enc)
{
m_contents = contents;
setContentType(type, chset);
setEncoding(enc);
}