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


C++ List::constEnd方法代码示例

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


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

示例1: main

int main( int argc, char **argv )
{
  KAboutData aboutData( "testkabcdlg", 0, ki18n( "TestKabc" ), "0.1" );
  KCmdLineArgs::init( argc, argv, &aboutData );

  KCmdLineOptions options;
  options.add( "multiple", ki18n( "Allow selection of multiple addressees" ) );
  KCmdLineArgs::addCmdLineOptions( options );

  KApplication app;

  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
  if ( args->isSet( "multiple" ) ) {
    Addressee::List al = AddresseeDialog::getAddressees( 0 );
    Addressee::List::ConstIterator it;
    kDebug() << "Selected Addressees:";
    for ( it = al.constBegin(); it != al.constEnd(); ++it ) {
      kDebug() << "  " << ( *it ).fullEmail();
    }
  } else {
    Addressee a = AddresseeDialog::getAddressee( 0 );

    if ( !a.isEmpty() ) {
      kDebug() << "Selected Addressee:";
      kDebug() << a.toString();
    } else {
      kDebug() << "No Addressee selected.";
    }
  }
}
开发者ID:lenggi,项目名称:kcalcore,代码行数:30,代码来源:testkabcdlg.cpp

示例2: createVCards

// TODO: make list a const&
QString VCardTool::createVCards(Addressee::List list, VCard::Version version)
{
    VCard::List vCardList;

    Addressee::List::ConstIterator addrIt;
    Addressee::List::ConstIterator listEnd(list.constEnd());
    for(addrIt = list.constBegin(); addrIt != listEnd; ++addrIt)
    {
        VCard card;
        QStringList::ConstIterator strIt;

        // ADR + LABEL
        const Address::List addresses = (*addrIt).addresses();
        for(Address::List::ConstIterator it = addresses.begin(); it != addresses.end(); ++it)
        {
            QStringList address;

            bool isEmpty = ((*it).postOfficeBox().isEmpty() && (*it).extended().isEmpty() && (*it).street().isEmpty() && (*it).locality().isEmpty()
                            && (*it).region().isEmpty() && (*it).postalCode().isEmpty() && (*it).country().isEmpty());

            address.append((*it).postOfficeBox().replace(';', "\\;"));
            address.append((*it).extended().replace(';', "\\;"));
            address.append((*it).street().replace(';', "\\;"));
            address.append((*it).locality().replace(';', "\\;"));
            address.append((*it).region().replace(';', "\\;"));
            address.append((*it).postalCode().replace(';', "\\;"));
            address.append((*it).country().replace(';', "\\;"));

            VCardLine adrLine("ADR", address.join(";"));
            if(version == VCard::v2_1 && needsEncoding(address.join(";")))
            {
                adrLine.addParameter("charset", "UTF-8");
                adrLine.addParameter("encoding", "QUOTED-PRINTABLE");
            }

            VCardLine labelLine("LABEL", (*it).label());
            if(version == VCard::v2_1 && needsEncoding((*it).label()))
            {
                labelLine.addParameter("charset", "UTF-8");
                labelLine.addParameter("encoding", "QUOTED-PRINTABLE");
            }

            bool hasLabel = !(*it).label().isEmpty();
            QMap< QString, int >::ConstIterator typeIt;
            for(typeIt = mAddressTypeMap.constBegin(); typeIt != mAddressTypeMap.constEnd(); ++typeIt)
            {
                if(typeIt.data() & (*it).type())
                {
                    adrLine.addParameter("TYPE", typeIt.key());
                    if(hasLabel)
                        labelLine.addParameter("TYPE", typeIt.key());
                }
            }

            if(!isEmpty)
                card.addLine(adrLine);
            if(hasLabel)
                card.addLine(labelLine);
        }

        // AGENT
        card.addLine(createAgent(version, (*addrIt).agent()));

        // BDAY
        card.addLine(VCardLine("BDAY", createDateTime((*addrIt).birthday())));

        // CATEGORIES
        if(version == VCard::v3_0)
        {
            QStringList categories = (*addrIt).categories();
            QStringList::Iterator catIt;
            for(catIt = categories.begin(); catIt != categories.end(); ++catIt)
                (*catIt).replace(',', "\\,");

            VCardLine catLine("CATEGORIES", categories.join(","));
            if(version == VCard::v2_1 && needsEncoding(categories.join(",")))
            {
                catLine.addParameter("charset", "UTF-8");
                catLine.addParameter("encoding", "QUOTED-PRINTABLE");
            }

            card.addLine(catLine);
        }

        // CLASS
        if(version == VCard::v3_0)
        {
            card.addLine(createSecrecy((*addrIt).secrecy()));
        }

        // EMAIL
        const QStringList emails = (*addrIt).emails();
        bool pref = true;
        for(strIt = emails.begin(); strIt != emails.end(); ++strIt)
        {
            VCardLine line("EMAIL", *strIt);
            if(pref == true && emails.count() > 1)
            {
                line.addParameter("TYPE", "PREF");
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:101,代码来源:vcardtool.cpp


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