~neon/kiten/master

« back to all changes in this revision

Viewing changes to radselect/radicalfile.cpp

  • Committer: Frédéric Brière
  • Date: 2021-01-17 02:54:01 UTC
  • Revision ID: git-v1:77005b25a4986f2cf0483c77f75b1ae9052bf8a2
radselect: Correctly parse modern versions of radkfile

Ever since the release of xjdic version 24 (back in 2003), some radkfile
entries have included an additional element (either in the form of a JIS
X 0212 hex code or an image filename), which must be excluded when
parsing the stroke count.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#include "radicalfile.h"
11
11
 
12
12
#include <QFile>
 
13
#include <QRegExp>
13
14
#include <QString>
14
15
#include <QTextCodec>
15
16
#include <QTextStream>
79
80
        m_radicals.insert( *newestRadical, *newestRadical );
80
81
      }
81
82
      delete newestRadical;
82
 
      newestRadical = new Radical(  QString( line.at( 2 ) )
83
 
                                  , line.rightRef( 2 ).toUInt() );
 
83
      QStringList lineElements = line.split( QRegExp( QStringLiteral( "\\s+" ) ) );
 
84
      newestRadical = new Radical(  lineElements.at( 1 )
 
85
                                  , lineElements.at( 2 ).toUInt() );
84
86
    }
85
87
    else if( newestRadical != nullptr )
86
88
    {