コード例 #1
0
// OK, replace this with a factory with plugin support later on...
const KMail::BodyPartFormatter * KMail::BodyPartFormatter::createFor( const char * type, const char * subtype ) {
  if ( type && *type )
    switch ( type[0] ) {
    case 'a': // application
    case 'A':
      if ( kasciistricmp( type, "application" ) == 0 )
	return createForApplication( subtype );
      break;
    case 'i': // image
    case 'I':
      if ( kasciistricmp( type, "image" ) == 0 )
	return createForImage( subtype );
      break;
    case 'm': // multipart / message
    case 'M':
      if ( kasciistricmp( type, "multipart" ) == 0 )
	return createForMultiPart( subtype );
      else if ( kasciistricmp( type, "message" ) == 0 )
	return createForMessage( subtype );
      break;
    case 't': // text
    case 'T':
      if ( kasciistricmp( type, "text" ) == 0 )
	return createForText( subtype );
      break;
    }

  return AnyTypeBodyPartFormatter::create();
}
コード例 #2
0
static const KMail::BodyPartFormatter * createForApplication( const char * subtype ) {
  if ( subtype && *subtype )
    switch ( subtype[0] ) {
    case 'p':
    case 'P':
      if ( kasciistricmp( subtype, "pgp" ) == 0 )
	return ApplicationPgpBodyPartFormatter::create();
      // fall through
    case 'x':
    case 'X':
      if ( kasciistricmp( subtype, "pkcs7-mime" ) == 0 ||
	   kasciistricmp( subtype, "x-pkcs7-mime" ) == 0 )
	return ApplicationPkcs7MimeBodyPartFormatter::create();
      break;
    case 'm':
    case 'M':
      if ( kasciistricmp( subtype, "ms-tnef" ) == 0 )
        return ApplicationMsTnefBodyPartFormatter::create();
      break;
    case 'v':
    case 'V':
      if ( kasciistricmp( subtype, "vnd.de.bund.bsi.chiasmus-text") == 0)
        return ApplicationChiasmusTextBodyPartFormatter::create();
      break;
    }

  return AnyTypeBodyPartFormatter::create();
}
コード例 #3
0
static const KMail::BodyPartFormatter * createForText( const char * subtype ) {
  if ( subtype && *subtype )
    switch ( subtype[0] ) {
    case 'h':
    case 'H':
      if ( kasciistricmp( subtype, "html" ) == 0 )
	return TextHtmlBodyPartFormatter::create();
      break;
    case 'r':
    case 'R':
      if ( kasciistricmp( subtype, "rtf" ) == 0 )
	return AnyTypeBodyPartFormatter::create();
      break;
    case 'x':
    case 'X':
    case 'v':
    case 'V':
      if ( kasciistricmp( subtype, "x-vcard" ) == 0 ||
	   kasciistricmp( subtype, "vcard" ) == 0 )
	return AnyTypeBodyPartFormatter::create();
      break;
    }

  return TextPlainBodyPartFormatter::create();
}
コード例 #4
0
partNode* partNode::findNodeForDwPart( DwBodyPart* part )
{
    partNode* found = 0;
    if( kasciistricmp( dwPart()->partId(), part->partId() ) == 0 )
        return this;
    if( mChild )
        found = mChild->findNodeForDwPart( part );
    if( mNext && !found )
        found = mNext->findNodeForDwPart( part );
    return found;
}
コード例 #5
0
static const KMail::BodyPartFormatter * createForMultiPart( const char * subtype ) {
  if ( subtype && *subtype )
    switch ( subtype[0] ) {
    case 'a':
    case 'A':
      if ( kasciistricmp( subtype, "alternative" ) == 0 )
	return MultiPartAlternativeBodyPartFormatter::create();
      break;
    case 'e':
    case 'E':
      if ( kasciistricmp( subtype, "encrypted" ) == 0 )
	return MultiPartEncryptedBodyPartFormatter::create();
      break;
    case 's':
    case 'S':
      if ( kasciistricmp( subtype, "signed" ) == 0 )
	return MultiPartSignedBodyPartFormatter::create();
      break;
    }

  return MultiPartMixedBodyPartFormatter::create();
}
コード例 #6
0
ファイル: kasciitest.cpp プロジェクト: KDE/kdelibs4support
void KAsciiTest::testkasciistricmp()
{
    QVERIFY(kasciistricmp("test", "test") == 0);
    QVERIFY(kasciistricmp("test", "Test") == 0);
    QVERIFY(kasciistricmp("TeSt", "tEst") == 0);

    QVERIFY(kasciistricmp(0, 0) == 0);
    QVERIFY(kasciistricmp("", "") == 0);
    QVERIFY(kasciistricmp(0, "") < 0);
    QVERIFY(kasciistricmp("", 0) > 0);

    QVERIFY(kasciistricmp("", "foo") < 0);
    QVERIFY(kasciistricmp("foo", "") > 0);

    QVERIFY(kasciistricmp("test", "testtest") < 0);
    QVERIFY(kasciistricmp("testtest", "test") > 0);

    QVERIFY(kasciistricmp("a", "b") < 0);
    QVERIFY(kasciistricmp("b", "a") > 0);
    QVERIFY(kasciistricmp("A", "b") < 0);
    QVERIFY(kasciistricmp("b", "A") > 0);
    QVERIFY(kasciistricmp("a", "B") < 0);
    QVERIFY(kasciistricmp("B", "a") > 0);
    QVERIFY(kasciistricmp("A", "B") < 0);
    QVERIFY(kasciistricmp("B", "A") > 0);
}
コード例 #7
0
ファイル: FontEngine.cpp プロジェクト: serghei/kde3-kdebase
CFontEngine::EWeight CFontEngine::strToWeight(const char *str)
{
    if(NULL == str)
        return WEIGHT_MEDIUM; // WEIGHT_UNKNOWN;
    else if(kasciistricmp(str, "Bold") == 0)
        return WEIGHT_BOLD;
    else if(kasciistricmp(str, "Black") == 0)
        return WEIGHT_BLACK;
    else if(kasciistricmp(str, "ExtraBold") == 0)
        return WEIGHT_EXTRA_BOLD;
    else if(kasciistricmp(str, "UltraBold") == 0)
        return WEIGHT_ULTRA_BOLD;
    else if(kasciistricmp(str, "ExtraLight") == 0)
        return WEIGHT_EXTRA_LIGHT;
    else if(kasciistricmp(str, "UltraLight") == 0)
        return WEIGHT_ULTRA_LIGHT;
    else if(kasciistricmp(str, "Light") == 0)
        return WEIGHT_LIGHT;
    else if(kasciistricmp(str, "Medium") == 0 || kasciistricmp(str, "Normal") == 0 || kasciistricmp(str, "Roman") == 0)
        return WEIGHT_MEDIUM;
    else if(kasciistricmp(str, "Regular") == 0)
        return WEIGHT_MEDIUM; // WEIGHT_REGULAR;
    else if(kasciistricmp(str, "Demi") == 0)
        return WEIGHT_DEMI;
    else if(kasciistricmp(str, "SemiBold") == 0)
        return WEIGHT_SEMI_BOLD;
    else if(kasciistricmp(str, "DemiBold") == 0)
        return WEIGHT_DEMI_BOLD;
    else if(kasciistricmp(str, "Thin") == 0)
        return WEIGHT_THIN;
    else if(kasciistricmp(str, "Book") == 0)
        return WEIGHT_BOOK;
    else
        return WEIGHT_MEDIUM; // WEIGHT_UNKNOWN;
}
コード例 #8
0
void testkasciistricmp()
{
  assert( kasciistricmp( "test", "test" ) == 0 );
  assert( kasciistricmp( "test", "Test" ) == 0 );
  assert( kasciistricmp( "TeSt", "tEst" ) == 0 );

  assert( kasciistricmp( 0, 0 ) == 0 );
  assert( kasciistricmp( "", "" ) == 0 );
  assert( kasciistricmp( 0, "" ) < 0 );
  assert( kasciistricmp( "", 0 ) > 0 );

  assert( kasciistricmp( "", "foo" ) < 0 );
  assert( kasciistricmp( "foo", "" ) > 0 );

  assert( kasciistricmp( "test", "testtest" ) < 0 );
  assert( kasciistricmp( "testtest", "test" ) > 0 );

  assert( kasciistricmp( "a", "b" ) < 0 );
  assert( kasciistricmp( "b", "a" ) > 0 );
  assert( kasciistricmp( "A", "b" ) < 0 );
  assert( kasciistricmp( "b", "A" ) > 0 );
  assert( kasciistricmp( "a", "B" ) < 0 );
  assert( kasciistricmp( "B", "a" ) > 0 );
  assert( kasciistricmp( "A", "B" ) < 0 );
  assert( kasciistricmp( "B", "A" ) > 0 );
}
コード例 #9
0
static const KMail::BodyPartFormatter * createForMessage( const char * subtype ) {
  if ( kasciistricmp( subtype, "rfc822" ) == 0 )
    return MessageRfc822BodyPartFormatter::create();
  return AnyTypeBodyPartFormatter::create();
}