当前位置: 首页>>代码示例>>C++>>正文


C++ ContentType::subtype方法代码示例

本文整理汇总了C++中ContentType::subtype方法的典型用法代码示例。如果您正苦于以下问题:C++ ContentType::subtype方法的具体用法?C++ ContentType::subtype怎么用?C++ ContentType::subtype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentType的用法示例。


在下文中一共展示了ContentType::subtype方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: substituer

void substituer(MimeEntity * mimeEntity, const string url, const string affectations, const string affectations_html) {
    // Substitue _URL_ et _AFFECTATIONS_ dans toutes les parties text/plain et text/html
    ContentType contentType = mimeEntity->header().contentType();
    if (
            contentType.type() == "text" and (
                contentType.subtype() == "plain" or
                contentType.subtype() == "html")
            )
    {
        Body& body = mimeEntity->body();
        string::size_type position;
        while((position = body.find("_URL_")) != string::npos) {
            body.replace(position, sizeof("_URL_") - 1, url);
        }
        while((position = body.find("_AFFECTATIONS_")) != string::npos) {
            body.replace(position, sizeof("_AFFECTATIONS_") - 1, (contentType.subtype() == "html" ? affectations_html : affectations));
        }
    } else {
        MimeEntityList::iterator sous_partie_iterator = mimeEntity->body().parts().begin(),
                        fin = mimeEntity->body().parts().end();
        for(;sous_partie_iterator!=fin;++sous_partie_iterator) {
            substituer(*sous_partie_iterator, url, affectations, affectations_html);
        }
    }
}
开发者ID:sebastiendu,项目名称:laguntzaile,代码行数:25,代码来源:main.cpp

示例2: appendAnyPart

void Multipart::appendAnyPart( EString &r, const Bodypart * bp,
                               ContentType * ct, bool avoidUtf8 ) const
{
    ContentType * childct = bp->header()->contentType();
    EString::Encoding e = EString::Binary;
    ContentTransferEncoding * cte
        = bp->header()->contentTransferEncoding();
    if ( cte )
        e = cte->encoding();

    if ( ( childct && childct->type() == "message" ) ||
         ( ct && ct->type() == "multipart" && ct->subtype() == "digest" &&
           !childct ) )
    {
        if ( childct && childct->subtype() != "rfc822" )
            appendTextPart( r, bp, childct );
        else
            r.append( bp->message()->rfc822( avoidUtf8 ) );
    }
    else if ( !childct || childct->type().lower() == "text" ) {
        appendTextPart( r, bp, childct );
    }
    else if ( childct->type() == "multipart" ) {
        bp->appendMultipart( r, avoidUtf8 );
    }
    else {
        r.append( bp->data().encoded( e, 72 ) );
    }
}
开发者ID:aox,项目名称:aox,代码行数:29,代码来源:multipart.cpp

示例3: if

void Message::fix8BitHeaderFields()
{
    EString charset;
    EString fallback = "us-ascii";
    bool conflict = false;
    List<Bodypart>::Iterator i( allBodyparts() );
    while ( i ) {
        ContentType * ct = 0;
        if ( i->header() )
            ct = i->header()->contentType();
        if ( ct && ct->type() == "text" ) {
            EString cs = ct->parameter( "charset" ).lower();
            if ( cs == "windows-1252" )
                cs = "iso-8859-1";
            if ( cs.isEmpty() )
                ; // no conclusion from this part
            else if ( charset.isEmpty() )
                charset = cs; // use this charset...?
            else if ( cs != charset )
                conflict = true;
            if ( ct && ct->subtype() == "html" )
                fallback = "iso-8859-1";
        }
        ++i;
    }
    Codec * c = 0;
    if ( !charset.isEmpty() )
        c = Codec::byName( charset );
    else
        c = Codec::byString( badFields( header() ) );
    if ( !c )
        c = Codec::byName( fallback );
    if ( conflict || !c )
        c = new AsciiCodec;

    header()->fix8BitFields( c );
    i = allBodyparts()->first();
    while ( i ) {
        if ( i->header() )
            i->header()->fix8BitFields( c );
        if ( i->message() && i->message()->header() )
            i->message()->header()->fix8BitFields( c );
        ++i;
    }
}
开发者ID:copernicus,项目名称:aox,代码行数:45,代码来源:message.cpp

示例4: if

ContentType * Bodypart::contentType() const
{
    ContentType * ct = header()->contentType();
    if ( ct )
        return ct;
    if ( !parent() )
        return 0;
    ct = parent()->header()->contentType();
    if ( ct ) {
        if ( ct->type() == "multipart" ) {
            ct = 0;
        }
        else if ( ct->type() == "message" && ct->subtype() == "rfc822" ) {
            Bodypart * bp = parent()->children()->firstElement();
            ct = bp->header()->contentType();
        }
    }
    return ct;
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例5: parse

void Message::parse( const EString & rfc2822 )
{
    uint i = 0;

    children()->clear();

    setHeader( parseHeader( i, rfc2822.length(), rfc2822, Header::Rfc2822 ) );
    header()->repair();
    header()->repair( this, rfc2822.mid( i ) );

    ContentType * ct = header()->contentType();
    if ( ct && ct->type() == "multipart" ) {
        Bodypart::parseMultipart( i, rfc2822.length(), rfc2822,
                                  ct->parameter( "boundary" ),
                                  ct->subtype() == "digest",
                                  children(), this );
    }
    else {
        Bodypart * bp = Bodypart::parseBodypart( i, rfc2822.length(), rfc2822,
                                                 header(), this );
        children()->append( bp );
    }

    fix8BitHeaderFields();
    header()->simplify();

    EString e = d->error;
    recomputeError();
    if ( d->error.isEmpty() )
        d->error = e;

    if ( !d->error.isEmpty() )
        return;
    setAddressesFetched();
    setHeadersFetched();
    setBodiesFetched();
}
开发者ID:copernicus,项目名称:aox,代码行数:37,代码来源:message.cpp

示例6: headerSummary

static void headerSummary( Header * h, int n )
{
    EStringList l;

    ContentType * ct = h->contentType();
    if ( ct )
        l.append( ct->type() + "/" + ct->subtype() );

    ContentTransferEncoding * cte = h->contentTransferEncoding();
    if ( cte ) {
        EString s;
        switch ( cte->encoding() ) {
        case EString::QP:
            s = "quoted-printable";
            break;
        case EString::Base64:
            s = "base64";
            break;
        case EString::Uuencode:
            s = "x-uuencode";
            break;
        case EString::Binary:
            s = "7bit";
            break;
        }
        l.append( s );
    }

    HeaderField * cd = h->field( HeaderField::ContentDescription );
    if ( cd )
        l.append( cd->rfc822( false ) );

    if ( !l.isEmpty() ) {
        spaces( n );
        fprintf( stderr, "%s\n", l.join( ";" ).cstr() );
    }
}
开发者ID:aox,项目名称:aox,代码行数:37,代码来源:multipart.cpp


注:本文中的ContentType::subtype方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。