本文整理汇总了C++中contentType函数的典型用法代码示例。如果您正苦于以下问题:C++ contentType函数的具体用法?C++ contentType怎么用?C++ contentType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了contentType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: switch
void GitEditor::setPlainTextFiltered(const QString &text)
{
QString modText = text;
GitPlugin *plugin = GitPlugin::instance();
// If desired, filter out the date from annotation
switch (contentType())
{
case VcsBase::AnnotateOutput: {
const bool omitAnnotationDate = plugin->settings().boolValue(GitSettings::omitAnnotationDateKey);
if (omitAnnotationDate)
modText = removeAnnotationDate(text);
break;
}
case VcsBase::DiffOutput: {
if (modText.isEmpty()) {
modText = QLatin1String("No difference to HEAD");
} else {
const QFileInfo fi(source());
const QString workingDirectory = fi.isDir() ? fi.absoluteFilePath() : fi.absolutePath();
modText = plugin->gitClient()->extendedShowDescription(workingDirectory, modText);
}
break;
}
default:
break;
}
setPlainText(modText);
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:29,代码来源:giteditor.cpp
示例2: getParentObject
void CodeClassFieldDeclarationBlock::syncToParent ()
{
// for role-based accessors, we DON'T write ourselves out when
// the name of the role is not defined.
if (!(getParentClassField()->parentIsAttribute()))
{
UMLRole * parent = getParentObject()->asUMLRole();
if (parent == 0)
return;
if (parent->name().isEmpty())
{
getComment()->setWriteOutText(false);
setWriteOutText(false);
} else {
getComment()->setWriteOutText(true);
setWriteOutText(true);
}
}
// only update IF we are NOT AutoGenerated
if (contentType() != AutoGenerated)
return;
updateContent();
}
开发者ID:KDE,项目名称:umbrello,代码行数:25,代码来源:codeclassfielddeclarationblock.cpp
示例3: writeRequested
void writeRequested(int connfd,char* protocol,char* url){
struct stat fs;
char response[1024];
char* page;
char* contType;
contType = contentType(url);
int fd = open(url+1, O_RDONLY);
if(fd==-1){
writeFileNotFound(connfd,protocol);
return;
}
if(fstat(fd,&fs)==-1){
printf("Could Not retrieve file size!\n");
writeInternal(connfd,protocol);
}
page = (char*)malloc(fs.st_size);
read(fd,page,fs.st_size);
sprintf(response,"%s 200 OK\nContent-Type: %s\nContent-Length: %d\r\n\r\n",protocol,contType,(int)fs.st_size);
if(write(connfd,response,strlen(response))==-1){
fprintf(stderr,"200 Errno %d: %s\n",errno,strerror(errno));
}
if(write(connfd,page,fs.st_size)==-1){
fprintf(stderr,"200 Errno %d: %s\n",errno,strerror(errno));
}
printf("Returning Response from Thread %lu\n",pthread_self());
printf("****Writing Response****\n%s\n",response);
close(fd);
free(page);
}
开发者ID:Zanaku,项目名称:AEs,代码行数:33,代码来源:web_server.c
示例4: contentType
// -----------------------------------------------------------------------------
// CWPPushMessage::ParseHeader
// -----------------------------------------------------------------------------
//
EXPORT_C void CWPPushMessage::ParseHeaderL()
{
// CHTTPResponse panicks if it is used for parsing a zero-length
// descriptor.
if( iHeader->Response().Length() > 0 )
{
// We use lexer for safety.
TLex8 contentType( ContentTypeHeader( *iHeader ) );
if( !contentType.Eos() )
{
ParseContentType( contentType );
}
TLex8 initiatorURI( InitiatorURIHeader( *iHeader ) );
if( !initiatorURI.Eos() )
{
ParseInitiatorURI( initiatorURI );
}
TLex8 pushFlag( PushFlagHeader( *iHeader ) );
if( !pushFlag.Eos() )
{
ParsePushFlag( pushFlag );
}
}
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:30,代码来源:CWPPushMessage.cpp
示例5: Log
void IcyConnector::ProcessHeaders(const QString &hdrs)
{
QStringList f0;
QStringList f1;
QString txt;
f0=hdrs.split("\r\n");
if(f0[0]!="OK2") {
Log(LOG_WARNING,
QString().sprintf("login to \"%s:%d\" rejected: %s",
(const char *)hostHostname().toUtf8(),
0xFFFF&hostPort(),
(const char *)f0[0].toUtf8()));
return;
}
icy_authenticated=true;
WriteHeader("icy-name: "+streamName());
WriteHeader("icy-genre: "+streamGenre());
WriteHeader("icy-pub: "+QString().sprintf("%d",streamPublic()));
WriteHeader("icy-br: "+QString().sprintf("%u",audioBitrate()));
if(icy_protocol_version==1) {
WriteHeader("icy-url: "+streamUrl());
}
WriteHeader("icy-irc: "+streamIrc());
WriteHeader("icy-icq: "+streamIcq());
WriteHeader("icy-aim: "+streamAim());
WriteHeader("Content-Type: "+contentType());
WriteHeader("");
setConnected(true);
}
开发者ID:saschaludwig,项目名称:GlassCoder,代码行数:31,代码来源:icyconnector.cpp
示例6: hideContent
void SCgNode::updateContentViewer()
{
bool isCntVis = mContentVisible;
if(isCntVis)
hideContent();
if (mContentViewer != 0)
{
delete mContentViewer;
mContentViewer = 0;
}
if (!contentType() == SCgContent::Empty)
{
// creating new viewer
if (!mContentViewer) mContentViewer = SCgContentFactory::createViewer(contentFormat());
Q_ASSERT(mContentViewer);
mContentViewer->setData(contentData());
mContentViewer->setParentItem(this);
if (isCntVis)
showContent();
}
update();
}
开发者ID:DavidBermuda,项目名称:kbe,代码行数:27,代码来源:scgnode.cpp
示例7: syncToParent
void OwnedHierarchicalCodeBlock::syncToParent()
{
if (contentType() != CodeBlock::AutoGenerated)
return;
updateContent();
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:7,代码来源:ownedhierarchicalcodeblock.cpp
示例8: switch
QString CvsEditorWidget::changeUnderCursor(const QTextCursor &c) const
{
// Try to match "1.1" strictly:
// 1) Annotation: Check for a revision number at the beginning of the line.
// Note that "cursor.select(QTextCursor::WordUnderCursor)" will
// only select the part up until the dot.
// Check if we are at the beginning of a line within a reasonable offset.
// 2) Log: check for lines like "revision 1.1", cursor past "revision"
switch (contentType()) {
case VcsBase::OtherContent:
case VcsBase::DiffOutput:
break;
case VcsBase::AnnotateOutput: {
const QTextBlock block = c.block();
if (c.atBlockStart() || (c.position() - block.position() < 3)) {
const QString line = block.text();
if (m_revisionAnnotationPattern.exactMatch(line))
return m_revisionAnnotationPattern.cap(1);
}
}
break;
case VcsBase::LogOutput: {
const QTextBlock block = c.block();
if (c.position() - block.position() > 8 && m_revisionLogPattern.exactMatch(block.text()))
return m_revisionLogPattern.cap(1);
}
break;
}
return QString();
}
开发者ID:acacid,项目名称:qt-creator,代码行数:30,代码来源:cvseditor.cpp
示例9: contentType
/*!
* returns email part attachment name
* @return attachment name
*/
QString NmMessagePart::attachmentName() const
{
NM_FUNCTION;
// Look first from Content-Type param "name"
QString content = contentType();
int ptr = content.indexOf(NmContentTypeParamName);
if(ptr >= 0) {
d->mAttachmentName = content.section('"',1,1);
return d->mAttachmentName;
}
// then if Content-Disposition is "attachment" look from
// Content-Disposition param "filename" and
content = contentDisposition();
ptr = content.indexOf(NmContentDispAttachment);
if(ptr >= 0) {
ptr = content.indexOf(NmContentDispParamFilename);
if(ptr > 0) {
d->mAttachmentName = content.section('"',1,1);
return d->mAttachmentName;
}
}
// finally look if there is Content-Description.
return d->mContentDescription;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:29,代码来源:nmmessagepart.cpp
示例10: status
bool ccWebServerResponse::notFoundFile(const std::string& strURI)
{
std::string strContent;
ccString::format(
strContent,
"<!DOCTYPE html>\r\n"
"<html lang=en>\r\n"
"<head>\r\n"
" <meta charset=utf-8>\r\n"
" <meta name=viewport content=\"initial-scale=1, minimum-scale=1, width=device-width\">\r\n"
" <title>Error 404 (Not Found)!!1</title>\r\n"
"</head>\r\n"
"<body>\r\n"
" <p><b>404.</b> <ins>That's an error.</ins></p>\r\n"
" <p>The requested URL <code>%s</code> was not found on this server.</p>\r\n"
"</body>\r\n"
"</html>\r\n",
strURI.c_str());
status(404, "Not Found");
contentType("text/html", strContent.length());
doWriteContentToConnector(strContent.c_str(), strContent.length());
return true;
}
开发者ID:aucd29,项目名称:Luna,代码行数:27,代码来源:ccWebServerResponse.cpp
示例11: ActiveDOMObject
MediaRecorder::MediaRecorder(ExecutionContext* context, MediaStream* stream, const MediaRecorderOptions& options, ExceptionState& exceptionState)
: ActiveDOMObject(context)
, m_stream(stream)
, m_streamAmountOfTracks(stream->getTracks().size())
, m_mimeType(options.mimeType())
, m_stopped(true)
, m_ignoreMutedMedia(true)
, m_state(State::Inactive)
, m_dispatchScheduledEventRunner(AsyncMethodRunner<MediaRecorder>::create(this, &MediaRecorder::dispatchScheduledEvent))
{
ASSERT(m_stream->getTracks().size());
m_recorderHandler = adoptPtr(Platform::current()->createMediaRecorderHandler());
ASSERT(m_recorderHandler);
// We deviate from the spec by not returning |UnsupportedOption|, see https://github.com/w3c/mediacapture-record/issues/18
if (!m_recorderHandler) {
exceptionState.throwDOMException(NotSupportedError, "No MediaRecorder handler can be created.");
return;
}
ContentType contentType(m_mimeType);
if (!m_recorderHandler->initialize(this, stream->descriptor(), contentType.type(), contentType.parameter("codecs"))) {
exceptionState.throwDOMException(NotSupportedError, "Failed to initialize native MediaRecorder, the type provided " + m_mimeType + "is unsupported." );
return;
}
m_stopped = false;
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:27,代码来源:MediaRecorder.cpp
示例12: LOG
bool MediaSource::isTypeSupported(const String& type)
{
LOG(MediaSource, "MediaSource::isTypeSupported(%s)", type.ascii().data());
// Section 2.2 isTypeSupported() method steps.
// https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#widl-MediaSource-isTypeSupported-boolean-DOMString-type
// 1. If type is an empty string, then return false.
if (type.isNull() || type.isEmpty())
return false;
// FIXME: Why do we convert to lowercase here, but not in MediaSource::addSourceBuffer?
ContentType contentType(type.convertToASCIILowercase());
String codecs = contentType.parameter("codecs");
// 2. If type does not contain a valid MIME type string, then return false.
if (contentType.type().isEmpty())
return false;
// 3. If type contains a media type or media subtype that the MediaSource does not support, then return false.
// 4. If type contains at a codec that the MediaSource does not support, then return false.
// 5. If the MediaSource does not support the specified combination of media type, media subtype, and codecs then return false.
// 6. Return true.
MediaEngineSupportParameters parameters;
parameters.type = contentType.type();
parameters.codecs = codecs;
parameters.isMediaSource = true;
MediaPlayer::SupportsType supported = MediaPlayer::supportsType(parameters, 0);
if (codecs.isEmpty())
return supported != MediaPlayer::IsNotSupported;
return supported == MediaPlayer::IsSupported;
}
开发者ID:edcwconan,项目名称:webkit,代码行数:33,代码来源:MediaSource.cpp
示例13: contentType
SourceBuffer* MediaSource::addSourceBuffer(const String& type, ExceptionCode& ec)
{
// 3.1 http://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html#dom-addsourcebuffer
// 1. If type is null or an empty then throw an INVALID_ACCESS_ERR exception and
// abort these steps.
if (type.isNull() || type.isEmpty()) {
ec = INVALID_ACCESS_ERR;
return 0;
}
// 2. If type contains a MIME type that is not supported ..., then throw a
// NOT_SUPPORTED_ERR exception and abort these steps.
ContentType contentType(type);
Vector<String> codecs = contentType.codecs();
if (!codecs.size()) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
// 4. If the readyState attribute is not in the "open" state then throw an
// INVALID_STATE_ERR exception and abort these steps.
if (!m_player || m_readyState != openKeyword()) {
ec = INVALID_STATE_ERR;
return 0;
}
// 5. Create a new SourceBuffer object and associated resources.
String id = m_sourceBuffers->generateUniqueId();
if (id == emptyString()) {
ec = QUOTA_EXCEEDED_ERR;
return 0;
}
RefPtr<SourceBuffer> buffer = SourceBuffer::create(id, this);
switch (m_player->sourceAddId(buffer->id(), contentType.type(), codecs)) {
case MediaPlayer::Ok:
// 6. Add the new object to sourceBuffers and fire a addsourcebuffer on that object.
m_sourceBuffers->add(buffer);
m_activeSourceBuffers->add(buffer);
// 7. Return the new object to the caller.
return buffer.get();
case MediaPlayer::NotSupported:
// 2 (cont). If type contains a MIME type ... that is not supported with the types
// specified for the other SourceBuffer objects in sourceBuffers, then throw
// a NOT_SUPPORTED_ERR exception and abort these steps.
ec = NOT_SUPPORTED_ERR;
return 0;
case MediaPlayer::ReachedIdLimit:
// 3 (cont). If the user agent can't handle any more SourceBuffer objects then throw
// a QUOTA_EXCEEDED_ERR exception and abort these steps.
ec = QUOTA_EXCEEDED_ERR;
return 0;
}
ASSERT_NOT_REACHED();
return 0;
}
开发者ID:fatman2021,项目名称:webkitgtk,代码行数:59,代码来源:MediaSource.cpp
示例14: addChangeActions
void GitEditor::addChangeActions(QMenu *menu, const QString &change)
{
m_currentChange = change;
if (contentType() != VcsBase::OtherContent) {
menu->addAction(tr("Cherry-Pick Change %1").arg(change), this, SLOT(cherryPickChange()));
menu->addAction(tr("Revert Change %1").arg(change), this, SLOT(revertChange()));
}
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:8,代码来源:giteditor.cpp
示例15: str
void MPForm::reset()
{
m_buffer.resize(0);
QByteArray str(contentType().toLatin1());
str += "\r\n";
str += "MIME-version: 1.0";
str += "\r\n\r\n";
m_buffer.append(str);
}
开发者ID:UIKit0,项目名称:digikam,代码行数:9,代码来源:mpform.cpp
示例16: QFETCH
void tst_QMailMessageBody::toFile()
{
QFETCH( QString, string_input );
QFETCH( QByteArray, bytearray_input );
QFETCH( QByteArray, type );
QFETCH( QMailMessageBody::EncodingFormat, format );
QFETCH( QByteArray, bytearray_output );
QTemporaryFile file(QString("%1/%2").arg(QDir::tempPath()).arg(metaObject()->className()));
QVERIFY( file.open() );
QString name = file.fileName();
file.close();
QMailMessageContentType contentType( type );
// Create a body from whatever data was supplied
if ( !string_input.isEmpty() )
{
QMailMessageBody body = QMailMessageBody::fromData( string_input, contentType, QMailMessageBody::Base64 );
body.toFile( name, format );
}
else
{
QMailMessageBody body = QMailMessageBody::fromData( bytearray_input, contentType, QMailMessageBody::Base64, QMailMessageBody::RequiresEncoding );
body.toFile( name, format );
}
QVERIFY( file.open() );
if ( !string_input.isEmpty() && format == QMailMessageBody::Decoded )
{
// Read the string from the file and compare
QTextStream in( &file );
in.setCodec( contentType.charset() );
QString data = in.readAll();
QCOMPARE( data, string_input );
}
else
{
// Find the size of the file data
QFileInfo fi( name );
QByteArray data( fi.size(), '\0' );
// Read the file data in for comparison
QDataStream in( &file );
in.readRawData( data.data(), data.length() );
if ( !bytearray_output.isEmpty() )
{
QCOMPARE( data, bytearray_output );
}
else
{
QCOMPARE( data, bytearray_input );
}
}
}
开发者ID:jose-g,项目名称:qt-labs-messagingframework,代码行数:56,代码来源:tst_qmailmessagebody.cpp
示例17: networkAccessManager
void SidebarPrivate::linkClickedFinished()
{
QNetworkReply * reply = static_cast< QNetworkReply * >(sender());
QString target = reply->property("__target").toString();
QVariant redirectsVariant = reply->property("__redirects");
int redirects = redirectsVariant.isNull() ? 20 : redirectsVariant.toInt();
// Redirect?
QUrl redirectedUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
if (redirectedUrl.isValid())
{
if (redirectedUrl.isRelative())
{
QUrl oldUrl = reply->url();
redirectedUrl.setScheme(oldUrl.scheme());
redirectedUrl.setAuthority(oldUrl.authority());
}
if (redirects > 0)
{
QNetworkRequest request = reply->request();
request.setUrl(redirectedUrl);
QNetworkReply * reply = networkAccessManager()->get(request);
reply->setProperty("__target", target);
connect(reply, SIGNAL(finished()), this, SLOT(linkClickedFinished()));
}
else
{
// TOO MANY REDIRECTS
}
reply->deleteLater();
return;
}
// Check headers... if PDF then launch a new window, otherwise give it to the OS
QString contentType(reply->header(QNetworkRequest::ContentTypeHeader).toString());
if (contentType.contains("application/pdf")) {
emit urlRequested(reply->request().url(), "tab");
} else {
QUrl href(reply->request().url());
if (href.isValid()) {
if (href.scheme() == "http" || href.scheme() == "https") {
if (target == "sidebar") {
webView->setUrl(href);
slideLayout->push("web");
return;
}
}
QDesktopServices::openUrl(href);
}
// FIXME error
}
reply->deleteLater();
}
开发者ID:project-renard-survey,项目名称:utopia-documents-mirror,代码行数:56,代码来源:sidebar.cpp
示例18: contentType
void ccWebServerResponse::doCheckHeadersSent()
{
if (_bHeadersSent)
return;
if (!_bContentTypeSet)
contentType("text/plain");
_bHeadersSent = true;
}
开发者ID:aucd29,项目名称:Luna,代码行数:10,代码来源:ccWebServerResponse.cpp
示例19: CleanupResetAndDestroyPushL
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
MEmailMessageContent* CEmailMessage::ContentL() const
{
if ( iTextContent )
{
return iTextContent;
}
if ( iContent )
{
return iContent;
}
User::LeaveIfNull( iPluginMessage );
RPointerArray<CFSMailMessagePart> parts;
CleanupResetAndDestroyPushL( parts );
iPluginMessage->ChildPartsL( parts );
TInt count( parts.Count() );
if( count == 0 )
{
/* No content, return NULL */
CleanupStack::PopAndDestroy( &parts ); // in case heap allocated but not used
return NULL;
}
CFSMailMessagePart* part = parts[0];
TContentType contentType( part->GetContentType() );
TMessageContentId msgContentId = TMessageContentId(
part->GetPartId().Id(),
iMessageId.iId,
iMessageId.iFolderId.iId,
iMessageId.iFolderId.iMailboxId );
if ( contentType.Equals( KFSMailContentTypeTextPlain ) ||
contentType.Equals( KFSMailContentTypeTextHtml ) )
{
iTextContent = CEmailTextContent::NewL(iPluginData, msgContentId, part, EAPIOwns );
parts[0] = NULL; // ownership of part transferred
}
else if ( contentType.Equals( KFSMailContentTypeMultipartMixed ) ||
contentType.Equals( KFSMailContentTypeMultipartAlternative ) ||
contentType.Equals( KFSMailContentTypeMultipartDigest ) ||
contentType.Equals( KFSMailContentTypeMultipartRelated ) ||
contentType.Equals( KFSMailContentTypeMultipartParallel ) )
{
iContent = CEmailMultipart::NewL(iPluginData, msgContentId, part, EAPIOwns);
parts[0] = NULL; // ownership of part transferred
}
CleanupStack::PopAndDestroy( &parts ); // parts
if (iTextContent)
{
return iTextContent;
}
return iContent;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:58,代码来源:emailmessage.cpp
示例20: contentType
// 获取 Content-Type
string RequestBaseTask::GetContentType() const
{
string contentType("");
if (NULL != mpHttpRequestManager) {
const HttpRequest* request = mpHttpRequestManager->GetRequestById(mRequestId);
if (NULL != request) {
contentType = request->GetContentType();
}
}
return contentType;
}
开发者ID:KingsleyYau,项目名称:Dating4Lady,代码行数:12,代码来源:RequestBaseTask.cpp
注:本文中的contentType函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论