Heart 1.4.984.b4712811
Heart is base back end library for your c++ Qt projects.
Loading...
Searching...
No Matches
translatablestring.h
Go to the documentation of this file.
1//#
2//# Copyright (C) 2025-2027 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8
9
10#ifndef TRANSLATABLESTRING_H
11#define TRANSLATABLESTRING_H
12#include <streammultiversion.h>
13
14
15namespace QH {
16
21class HEARTSHARED_EXPORT TranslatableString: public StreamMultiversion
22{
23public:
24 TranslatableString(int data );
25
26 TranslatableString(const QString& data = "",
27 bool isKey = true);
28
29 TranslatableString(const QList<TranslatableString>& pack);
30
31
36
37 bool operator==(const TranslatableString& other) const;
38
39 // ValidableObject interface
40 bool isValid() const override;
41
42 bool isEmpty() const;
43
48 QString text() const;
49
54 const QString& rawText() const;
55
60 uint32_t calcCrc32Hash() const;
61
67 static TranslatableString tr(const QString& source);
68
74 TranslatableString& setArgs(const QList<TranslatableString> &newArgs);
76
77 TranslatableString& arg(int newArg);
78
79protected:
80 QDataStream &fromStream(QDataStream &stream) override;
81 QDataStream &toStream(QDataStream &stream) const override;
82
83private:
84 QString _data;
85 bool _isKey = false;
86 QList<TranslatableString> _args;
87 QList<TranslatableString> _pack;
88
89};
90}
91
92
93#endif // TRANSLATABLESTRING_H
static TranslatableString tr(const QString &source)
tr this method create a string translation wrapper and save translation key for lupdate tool
TranslatableString & setArgs(const QList< TranslatableString > &newArgs)
setArgs this method set args for translation.
QDataStream & toStream(QDataStream &stream) const override
fromStream This method should be write all members of the current object to the stream object.
QString text() const
text this method return translated text.
bool operator==(const TranslatableString &other) const
TranslatableString & operator=(const TranslatableString &)=default
bool isValid() const override
const QString & rawText() const
rawText return raw key source.
TranslatableString(TranslatableString &&)=default
QDataStream & fromStream(QDataStream &stream) override
fromStream This method should be read all bytes from the stream object and full the current object.
TranslatableString & operator=(TranslatableString &&)=default
uint32_t calcCrc32Hash() const
calcCrc32Hash this method calc hash from raw text.
TranslatableString & arg(const TranslatableString &newArg)
TranslatableString(const TranslatableString &)=default
The QH namespace - QuasarApp Heart namespace. This namespace contains all classes of the Heart librar...
Definition heart.cpp:13