text_entity: Add enum for used Unicode codepoints

It's better to use the named constants instead of magic character codes.
This commit is contained in:
leha-bot 2018-04-21 18:38:54 +03:00 committed by Alex
parent 49b3469963
commit c237414cc6
1 changed files with 14 additions and 3 deletions

View File

@ -24,6 +24,17 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "lang/lang_tag.h"
namespace TextUtilities {
// note: these names are taken from Unicode Specification.
// All spaces in this names are replaced to SwitchingCase, all dashes ('-')
// are replaced to underscore ('_')
enum UnicodePoints
{
Left_PointingDoubleAngleQuotationMark = 171,
Right_PointingDoubleAngleQuotationMark = 187,
EmDash = 8212,
};
namespace {
QString ExpressionDomain() {
@ -2121,9 +2132,9 @@ void PrepareForSending(TextWithEntities &result, qint32 flags) {
}
if (cMessageFormatting()) {
ReplaceStringWithChar(qstr("--"), QChar(8212), result, true);
ReplaceStringWithChar(qstr("<<"), QChar(171), result);
ReplaceStringWithChar(qstr(">>"), QChar(187), result);
ReplaceStringWithChar(qstr("--"), QChar(EmDash), result, true);
ReplaceStringWithChar(qstr("<<"), QChar(Left_PointingDoubleAngleQuotationMark), result);
ReplaceStringWithChar(qstr(">>"), QChar(Right_PointingDoubleAngleQuotationMark), result);
}
if (cReplaceEmojis()) {