本文整理汇总了C++中TranslatorMessage::setOldSourceText方法的典型用法代码示例。如果您正苦于以下问题:C++ TranslatorMessage::setOldSourceText方法的具体用法?C++ TranslatorMessage::setOldSourceText怎么用?C++ TranslatorMessage::setOldSourceText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TranslatorMessage
的用法示例。
在下文中一共展示了TranslatorMessage::setOldSourceText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
//.........这里部分代码省略.........
// ignore these, just whitespace
} else if (elementStarts(strname)) {
// <name>
context = readElementText();
// </name>
} else if (elementStarts(strmessage)) {
// <message>
TranslatorMessage::References refs;
QString currentMsgFile = currentFile;
TranslatorMessage msg;
msg.setId(attributes().value(strid).toString());
msg.setContext(context);
msg.setType(TranslatorMessage::Finished);
msg.setPlural(attributes().value(strnumerus) == stryes);
const QStringRef &utf8Attr = attributes().value(strutf8);
msg.setNonUtf8(utf8Attr == strboth);
msg.setUtf8(msg.isNonUtf8() || utf8Attr == strtrue
|| attributes().value(strencoding) == strUtf8);
while (!atEnd()) {
readNext();
if (isEndElement()) {
// </message> found, finish local loop
msg.setReferences(refs);
translator.append(msg);
break;
} else if (isWhiteSpace()) {
// ignore these, just whitespace
} else if (elementStarts(strsource)) {
// <source>...</source>
msg.setSourceText(readContents());
} else if (elementStarts(stroldsource)) {
// <oldsource>...</oldsource>
msg.setOldSourceText(readContents());
} else if (elementStarts(stroldcomment)) {
// <oldcomment>...</oldcomment>
msg.setOldComment(readContents());
} else if (elementStarts(strextracomment)) {
// <extracomment>...</extracomment>
msg.setExtraComment(readContents());
} else if (elementStarts(strtranslatorcomment)) {
// <translatorcomment>...</translatorcomment>
msg.setTranslatorComment(readContents());
} else if (elementStarts(strlocation)) {
// <location/>
QXmlStreamAttributes atts = attributes();
QString fileName = atts.value(strfilename).toString();
if (fileName.isEmpty()) {
fileName = currentMsgFile;
} else {
if (refs.isEmpty())
currentFile = fileName;
currentMsgFile = fileName;
}
const QString lin = atts.value(strline).toString();
if (lin.isEmpty()) {
translator.setLocationsType(Translator::RelativeLocations);
refs.append(TranslatorMessage::Reference(fileName, -1));
} else {
bool bOK;
int lineNo = lin.toInt(&bOK);
if (bOK) {
if (lin.startsWith(QLatin1Char('+')) || lin.startsWith(QLatin1Char('-'))) {
lineNo = (currentLine[fileName] += lineNo);
translator.setLocationsType(Translator::RelativeLocations);
} else {