Ignore:
Timestamp:
Nov 16, 2005, 8:36:46 PM (20 years ago)
Author:
dmik
Message:

Transferred Qt for OS/2 version 3.3.1-rc5 sources from the CVS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/codecs/qtextcodec.cpp

    r7 r8  
    562562
    563563
    564 #ifdef Q_OS_WIN32
     564#if defined(Q_OS_WIN32)
    565565class QWindowsLocalCodec: public QTextCodec
    566566{
     
    621621
    622622int QWindowsLocalCodec::heuristicContentMatch(const char* chars, int len) const
     623{
     624    // ### Not a bad default implementation?
     625    QString t = toUnicode(chars,len);
     626    int l = t.length();
     627    QCString mb = fromUnicode(t,l);
     628    int i=0;
     629    while ( i < len ) {
     630        if ( chars[i] == mb[i] )
     631            i++;
     632       else
     633           break;
     634    }
     635    return i;
     636}
     637
     638#elif defined(Q_OS_OS2)
     639
     640class QOS2LocalCodec: public QTextCodec
     641{
     642public:
     643    QOS2LocalCodec();
     644    ~QOS2LocalCodec();
     645
     646    QString toUnicode(const char* chars, int len) const;
     647    QCString fromUnicode(const QString& uc, int& lenInOut ) const;
     648
     649    const char* name() const;
     650    int mibEnum() const;
     651
     652    int heuristicContentMatch(const char* chars, int len) const;
     653};
     654
     655QOS2LocalCodec::QOS2LocalCodec()
     656{
     657}
     658
     659QOS2LocalCodec::~QOS2LocalCodec()
     660{
     661}
     662
     663
     664QString QOS2LocalCodec::toUnicode(const char* chars, int len) const
     665{
     666    return qt_os2MB2QString( chars, len );
     667}
     668
     669QCString QOS2LocalCodec::fromUnicode(const QString& uc, int& lenInOut ) const
     670{
     671    QCString r = qt_os2QString2MB( uc, lenInOut );
     672    lenInOut = r.length();
     673    return r;
     674}
     675
     676
     677const char* QOS2LocalCodec::name() const
     678{
     679    return "System";
     680}
     681
     682int QOS2LocalCodec::mibEnum() const
     683{
     684    return 0;
     685}
     686
     687
     688int QOS2LocalCodec::heuristicContentMatch(const char* chars, int len) const
    623689{
    624690    // ### Not a bad default implementation?
     
    26922758static void setupLocaleMapper()
    26932759{
    2694 #ifdef Q_OS_WIN32
     2760#if defined(Q_OS_WIN32) || defined(Q_OS_OS2)
    26952761    localeMapper = QTextCodec::codecForName( "System" );
    26962762#else
     
    28552921#endif // Q_OS_WIN32
    28562922
     2923#ifdef Q_OS_OS2
     2924    (void) new QOS2LocalCodec;
     2925#endif // Q_OS_OS2
     2926
    28572927    if ( !localeMapper )
    28582928        setupLocaleMapper();
Note: See TracChangeset for help on using the changeset viewer.