Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtranslator.cpp File Reference

(6b13e0ca593592b34ea34837335db0d5cefdf630)

#include "qplatformdefs.h"
#include "qtranslator.h"
#include "qfileinfo.h"
#include "qstring.h"
#include "qstringlist.h"
#include "qcoreapplication.h"
#include "qcoreapplication_p.h"
#include "qdatastream.h"
#include "qendian.h"
#include "qfile.h"
#include "qmap.h"
#include "qalgorithms.h"
#include "qtranslator_p.h"
#include "qlocale.h"
#include "qresource.h"
#include <stdlib.h>
#include <new>
#include "qobject_p.h"
#include <vector>
#include <memory>
#include "moc_qtranslator.cpp"
+ Include dependency graph for qtranslator.cpp:

Go to the source code of this file.

Classes

class  QTranslatorPrivate
 

Namespaces

namespace  QT_BEGIN_NAMESPACE
 Combined button and popup list for selecting options.
 

Enumerations

enum  QT_BEGIN_NAMESPACE::Tag {
  QT_BEGIN_NAMESPACE::Tag_End = 1 , QT_BEGIN_NAMESPACE::Tag_SourceText16 , QT_BEGIN_NAMESPACE::Tag_Translation , QT_BEGIN_NAMESPACE::Tag_Context16 ,
  QT_BEGIN_NAMESPACE::Tag_Obsolete1 , QT_BEGIN_NAMESPACE::Tag_SourceText , QT_BEGIN_NAMESPACE::Tag_Context , QT_BEGIN_NAMESPACE::Tag_Comment ,
  QT_BEGIN_NAMESPACE::Tag_Obsolete2
}
 

Functions

static QString dotQmLiteral ()
 
static bool match (const uchar *found, uint foundLen, const char *target, uint targetLen)
 
static void elfHash_continue (const char *name, uint &h)
 
static void elfHash_finish (uint &h)
 
static uint elfHash (const char *name)
 
static bool isValidNumerusRules (const uchar *rules, uint rulesSize)
 
static uint numerusHelper (int n, const uchar *rules, uint rulesSize)
 
static Q_NEVER_INLINE bool is_readable_file (const QString &name)
 
static QString find_translation (const QLocale &locale, const QString &filename, const QString &prefix, const QString &directory, const QString &suffix)
 
static quint8 read8 (const uchar *data)
 
static quint16 read16 (const uchar *data)
 
static quint32 read32 (const uchar *data)
 
static QString getMessage (const uchar *m, const uchar *end, const char *context, const char *sourceText, const char *comment, uint numerus)
 

Variables

static const int MagicLength = 16
 
static const uchar magic [MagicLength]
 

Function Documentation

◆ dotQmLiteral()

static QString dotQmLiteral ( )
inlinestatic

Definition at line 60 of file qtranslator.cpp.

References QStringLiteral.

Referenced by find_translation(), and QTranslator::load().

+ Here is the caller graph for this function:

◆ elfHash()

static uint elfHash ( const char * name)
static

Definition at line 91 of file qtranslator.cpp.

References elfHash_continue(), elfHash_finish(), and hash.

Referenced by QTranslatorPrivate::do_translate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ elfHash_continue()

static void elfHash_continue ( const char * name,
uint & h )
static

Definition at line 71 of file qtranslator.cpp.

Referenced by QTranslatorPrivate::do_translate(), and elfHash().

+ Here is the caller graph for this function:

◆ elfHash_finish()

static void elfHash_finish ( uint & h)
static

Definition at line 85 of file qtranslator.cpp.

Referenced by QTranslatorPrivate::do_translate(), and elfHash().

+ Here is the caller graph for this function:

◆ find_translation()

static QString find_translation ( const QLocale & locale,
const QString & filename,
const QString & prefix,
const QString & directory,
const QString & suffix )
static

Definition at line 606 of file qtranslator.cpp.

References directory, dotQmLiteral(), i, is_readable_file(), QString::isNull(), isRelative(), QString::size(), QString::toLower(), and QLocale::Underscore.

Referenced by QTranslator::load().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMessage()

static QString getMessage ( const uchar * m,
const uchar * end,
const char * context,
const char * sourceText,
const char * comment,
uint numerus )
static

Definition at line 855 of file qtranslator.cpp.

References context, QString::data(), match(), read32(), read8(), QString::size(), str, tag, and Qt::Uninitialized.

Referenced by QTranslatorPrivate::do_translate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_readable_file()

static Q_NEVER_INLINE bool is_readable_file ( const QString & name)
static

Definition at line 600 of file qtranslator.cpp.

Referenced by find_translation().

+ Here is the caller graph for this function:

◆ isValidNumerusRules()

static bool isValidNumerusRules ( const uchar * rules,
uint rulesSize )
static

Definition at line 105 of file qtranslator.cpp.

References opcode, Q_AND, Q_BETWEEN, Q_EQ, Q_LEQ, Q_LT, Q_NEWRULE, Q_OP_MASK, and Q_OR.

Referenced by QTranslatorPrivate::do_load().

+ Here is the caller graph for this function:

◆ match()

static bool match ( const uchar * found,
uint foundLen,
const char * target,
uint targetLen )
static

Definition at line 62 of file qtranslator.cpp.

Referenced by QBluetoothServiceDiscoveryAgentPrivate::QBluetoothServiceDiscoveryAgentPrivate(), QVncIntegration::QVncIntegration(), QTapTestLogger::addIncident(), Parser::addIncludesRecursive(), AVFImageCapture::applySettings(), architectureFromName(), arrayLength(), QDBusAbstractInterface::callWithArgumentList(), SyncScanner::checkLineForSymbols(), QPlatformFileDialogHelper::cleanFilterList(), detectMenuRole(), QTranslatorPrivate::do_translate(), QQuickShortcut::event(), QSSGQmlUtilities::expandComponents(), findDependencyInfo(), Parser::findEnumValues(), QFontDatabasePrivate::findFont(), Widget::firstIndexOfFunction(), QEglFSDeviceIntegration::framebufferIndex(), LocalFileApi::Type::fromQt(), QGraphicsAnchorLayoutPrivate::getGraphParts(), QT_BEGIN_NAMESPACE::getKeyFromCode(), getMessage(), QBenchmarkValgrindUtils::getNewestFileName(), src_gui_text_qsyntaxhighlighter::MyHighlighter::highlightBlock(), QPlaceManagerEngineNokiaV2::icon(), QIntegrityFbScreen::initialize(), QBsdFbScreen::initialize(), QLinuxFbScreen::initialize(), QVncScreen::initialize(), QAbstractItemView::keyboardSearch(), QTreeView::keyboardSearch(), Widget::lastIndexOfFunction(), main(), QKeySequence::matches(), matches(), maybeEscapeFirstChar(), QV4::RegExpPrototype::method_match(), QV4::StringPrototype::method_match(), QV4::RegExpPrototype::method_replace(), QOCIDriver::open(), QtPrivate::q_boyer_moore_searcher_hashed_needle< RandomIt1, Hash, BinaryPredicate >::operator()(), QtPrivate::q_boyer_moore_searcher< RandomIt1, Hash, BinaryPredicate >::operator()(), QRegularExpressionMatch::operator<<(), QRegularExpressionMatch::operator=(), QRegularExpressionMatch::operator=(), Parser::parse(), parseDateString(), SyncScanner::parseHeader(), parseIconEntryInfo(), Parser::parseMetadata(), parseProvider(), parseTestArgs(), parseTracepoint(), SyncScanner::parseVersionScriptContent(), QSvgHandler::processingInstruction(), qFindPSQLVersion(), qt_find_best_framerate_match(), qt_find_supported_framerate_range(), qt_idForPointSize(), qt_idForPpdKey(), qt_idForSize(), qt_idForWindowsID(), qt_strip_filters(), QString::remove(), QDomDocumentPrivate::saveDocument(), QColorDialogPrivate::selectColor(), and sequenceLength().

◆ numerusHelper()

static uint numerusHelper ( int n,
const uchar * rules,
uint rulesSize )
static

Definition at line 173 of file qtranslator.cpp.

References i, opcode, Q_AND, Q_ASSERT, Q_BETWEEN, Q_EQ, Q_LEAD_1000, Q_LEQ, Q_LT, Q_MOD_10, Q_MOD_100, Q_NOT, Q_OP_MASK, and Q_OR.

Referenced by QTranslatorPrivate::do_translate().

+ Here is the caller graph for this function:

◆ read16()

static quint16 read16 ( const uchar * data)
static

Definition at line 769 of file qtranslator.cpp.

Referenced by QTranslatorPrivate::do_translate().

+ Here is the caller graph for this function:

◆ read32()

static quint32 read32 ( const uchar * data)
static

Definition at line 774 of file qtranslator.cpp.

Referenced by QTranslatorPrivate::do_load(), QTranslatorPrivate::do_translate(), and getMessage().

+ Here is the caller graph for this function:

◆ read8()

static quint8 read8 ( const uchar * data)
static

Definition at line 764 of file qtranslator.cpp.

References qFromBigEndian< quint8 >().

Referenced by QTranslatorPrivate::do_load(), QTranslatorPrivate::do_translate(), and getMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ magic

const uchar magic[MagicLength]
static
Initial value:
= {
0x3c, 0xb8, 0x64, 0x18, 0xca, 0xef, 0x9c, 0x95,
0xcd, 0x21, 0x1c, 0xbf, 0x60, 0xa1, 0xbd, 0xdd
}

Definition at line 55 of file qtranslator.cpp.

Referenced by QTranslatorPrivate::do_load(), isDigit(), isDigit(), QTranslator::load(), parseIconEntryData(), wrapInFunction(), and QQsbCollection::writeEndHeader().

◆ MagicLength

const int MagicLength = 16
static