Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qm.cpp File Reference

(12a311eb3492635e3d7307fd8ebd3aa1932c2443)

#include "translator.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDataStream>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringDecoder>
+ Include dependency graph for qm.cpp:

Go to the source code of this file.

Classes

class  ByteTranslatorMessage
 
class  Releaser
 
struct  Releaser::Offset
 

Functions

static uint elfHash (const QByteArray &ba)
 
 Q_DECLARE_TYPEINFO (ByteTranslatorMessage, Q_RELOCATABLE_TYPE)
 
static quint8 read8 (const uchar *data)
 
static quint32 read32 (const uchar *data)
 
static void fromBytes (const char *str, int len, QString *out, bool *utf8Fail)
 
bool loadQM (Translator &translator, QIODevice &dev, ConversionData &cd)
 
static bool containsStripped (const Translator &translator, const TranslatorMessage &msg)
 
bool saveQM (const Translator &translator, QIODevice &dev, ConversionData &cd)
 
int initQM ()
 

Variables

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

Function Documentation

◆ containsStripped()

static bool containsStripped ( const Translator & translator,
const TranslatorMessage & msg )
static

Definition at line 609 of file qm.cpp.

Referenced by saveQM().

+ Here is the caller graph for this function:

◆ elfHash()

static uint elfHash ( const QByteArray & ba)
static

Definition at line 52 of file qm.cpp.

◆ fromBytes()

static void fromBytes ( const char * str,
int len,
QString * out,
bool * utf8Fail )
static

Definition at line 428 of file qm.cpp.

◆ initQM()

int initQM ( )

Definition at line 705 of file qm.cpp.

References Translator::FileFormat::loader, loadQM(), Translator::FileFormat::priority, Translator::registerFileFormat(), saveQM(), Translator::FileFormat::saver, Translator::FileFormat::TranslationBinary, and Translator::FileFormat::untranslatedDescription.

+ Here is the call graph for this function:

◆ loadQM()

bool loadQM ( Translator & translator,
QIODevice & dev,
ConversionData & cd )

Definition at line 435 of file qm.cpp.

References Translator::append(), TranslatorMessage::Finished, MagicLength, TranslatorMessage::setPlural(), TranslatorMessage::setType(), QT_BEGIN_NAMESPACE::Tag_Comment, QT_BEGIN_NAMESPACE::Tag_Context, QT_BEGIN_NAMESPACE::Tag_End, QT_BEGIN_NAMESPACE::Tag_Obsolete1, QT_BEGIN_NAMESPACE::Tag_SourceText, and QT_BEGIN_NAMESPACE::Tag_Translation.

Referenced by initQM().

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

◆ Q_DECLARE_TYPEINFO()

Q_DECLARE_TYPEINFO ( ByteTranslatorMessage ,
Q_RELOCATABLE_TYPE  )

◆ read32()

static quint32 read32 ( const uchar * data)
static

Definition at line 423 of file qm.cpp.

◆ read8()

static quint8 read8 ( const uchar * data)
static

Definition at line 418 of file qm.cpp.

◆ saveQM()

bool saveQM ( const Translator & translator,
QIODevice & dev,
ConversionData & cd )

Definition at line 619 of file qm.cpp.

References containsStripped(), ConversionData::ignoreUnfinished(), ConversionData::isVerbose(), ConversionData::m_idBased, ConversionData::m_saveMode, Translator::message(), Translator::messageCount(), TranslatorMessage::Obsolete, Releaser::save(), Releaser::squeeze(), TranslatorMessage::type(), TranslatorMessage::Unfinished, and TranslatorMessage::Vanished.

Referenced by initQM().

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

Variable Documentation

◆ magic

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

Definition at line 22 of file qm.cpp.

◆ MagicLength

static QT_BEGIN_NAMESPACE const int MagicLength = 16
static

Definition at line 21 of file qm.cpp.

Referenced by loadQM(), and Releaser::save().