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


C++ Content::assemble方法代码示例

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


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

示例1: testHeaderAppendPrepend

void ContentTest::testHeaderAppendPrepend()
{
  Content *c = new Content;
  QByteArray d1( "Resent-From: [email protected]" );
  QByteArray d2( "Resent-From: [email protected]" );
  Headers::Generic *h1 = new Headers::Generic( "Resent-From", 0, "[email protected]" );
  Headers::Generic *h2 = new Headers::Generic( "Resent-From", 0, "[email protected]" );
  c->appendHeader( h1 );
  c->appendHeader( h2 );
  c->assemble();
  QByteArray head = d1 + '\n' + d2 + '\n';
  QCOMPARE( c->head(), head );

  QByteArray d3( "Resent-From: [email protected]" );
  Headers::Generic *h3 = new Headers::Generic( "Resent-From", 0, "[email protected]" );
  c->prependHeader( h3 );
  c->assemble();
  head.prepend( d3 + '\n' );
  QCOMPARE( c->head(), head );
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:20,代码来源:contenttest.cpp

示例2: testHeaderAddRemove

void ContentTest::testHeaderAddRemove()
{
  // Add a Content-Description header to a content.
  Content *c = new Content;
  QVERIFY( !c->contentDescription( false ) );
  c->contentDescription()->from7BitString( "description" );

  // The content must now have the header.
  QVERIFY( c->contentDescription( false ) );
  QCOMPARE( c->contentDescription()->as7BitString( false ), QByteArray( "description" ) );

  // The content's head must also have the header.  Save the head.
  c->assemble();
  QByteArray head = c->head();

  // Clear the content.  It must now forget the cached header.
  c->clear();
  QVERIFY( c->head().isEmpty() );
  QVERIFY( !c->contentDescription( false ) );

  // Put the head back.  It must now remember the header.
  c->setHead( head );
  QVERIFY( !c->contentDescription( false ) );
  c->parse();
  QVERIFY( c->contentDescription( false ) );
  c->contentDescription()->from7BitString( "description" );

  // Now remove the header explicitly.
  bool ret = c->removeHeader( "Content-Description" );
  QVERIFY( ret );

  // The content must have forgotten the header now.
  QVERIFY( !c->contentDescription( false ) );

  // And after assembly the header should stay gone.
  c->assemble();
  QVERIFY( c->head().isEmpty() );
  QVERIFY( !c->contentDescription( false ) );
}
开发者ID:pvuorela,项目名称:kcalcore,代码行数:39,代码来源:contenttest.cpp


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