本文整理汇总了C++中ContentType::addParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ ContentType::addParameter方法的具体用法?C++ ContentType::addParameter怎么用?C++ ContentType::addParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentType
的用法示例。
在下文中一共展示了ContentType::addParameter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
// labelling the message as UTF-8.
c = new Utf8Codec;
body = c->fromUnicode( bp->d->text );
}
else if ( !specified && c->state() == Codec::Invalid ) {
// the codec was not specified, and we couldn't find
// anything. we call it unknown-8bit.
c = new Unknown8BitCodec;
bp->d->text = c->toUnicode( body );
}
// if we ended up using a 16-bit codec and were using q-p, we
// need to reevaluate without any trailing CRLF
if ( e == EString::QP && c->name().startsWith( "UTF-16" ) )
bp->d->text = c->toUnicode( body.stripCRLF() );
if ( !c->valid() && bp->d->error.isEmpty() ) {
bp->d->error = "Could not convert body to Unicode";
if ( specified ) {
EString cs;
if ( ct )
cs = ct->parameter( "charset" );
if ( cs.isEmpty() )
cs = c->name();
bp->d->error.append( " from " + cs );
}
if ( specified && unknown )
bp->d->error.append( ": Character set not implemented" );
else if ( !c->error().isEmpty() )
bp->d->error.append( ": " + c->error() );
}
if ( c->name().lower() != "us-ascii" )
ct->addParameter( "charset", c->name().lower() );
else if ( ct )
ct->removeParameter( "charset" );
body = c->fromUnicode( bp->d->text );
bool qp = body.needsQP();
if ( cte ) {
if ( !qp ) {
h->removeField( HeaderField::ContentTransferEncoding );
cte = 0;
}
else if ( cte->encoding() != EString::QP ) {
cte->setEncoding( EString::QP );
}
}
else if ( qp ) {
h->add( "Content-Transfer-Encoding", "quoted-printable" );
cte = h->contentTransferEncoding();
}
}
else {
bp->d->data = body;
if ( ct->type() != "multipart" && ct->type() != "message" ) {
e = EString::Base64;
// there may be exceptions. cases where some format really
// needs another content-transfer-encoding:
if ( ct->type() == "application" &&
ct->subtype().startsWith( "pgp-" ) &&
!body.needsQP() ) {
// seems some PGP things need "Version: 1" unencoded
e = EString::Binary;
}