Convert XmlReader::Text to scoped enum

Change-Id: I4741b13fcf887a95b85886cb41f8236e128e81a2
Reviewed-on: https://gerrit.libreoffice.org/25364
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-05-23 14:51:43 +02:00 committed by Noel Grandin
parent 111de438ea
commit 6bda2bf6fe
8 changed files with 38 additions and 38 deletions

View File

@ -265,13 +265,13 @@ xmlreader::XmlReader::Text ValueParser::getTextMode() const {
return
(type_ == TYPE_STRING || type_ == TYPE_STRING_LIST ||
!separator_.isEmpty())
? xmlreader::XmlReader::TEXT_RAW
: xmlreader::XmlReader::TEXT_NORMALIZED;
? xmlreader::XmlReader::Text::Raw
: xmlreader::XmlReader::Text::Normalized;
default:
break;
}
}
return xmlreader::XmlReader::TEXT_NONE;
return xmlreader::XmlReader::Text::NONE;
}
bool ValueParser::startElement(

View File

@ -47,7 +47,7 @@ XcdParser::~XcdParser() {}
xmlreader::XmlReader::Text XcdParser::getTextMode() {
return nestedParser_.is()
? nestedParser_->getTextMode() : xmlreader::XmlReader::TEXT_NONE;
? nestedParser_->getTextMode() : xmlreader::XmlReader::Text::NONE;
}
bool XcdParser::startElement(

View File

@ -153,7 +153,7 @@ Parser::Parser(
xmlreader::Span name;
int nsId;
xmlreader::XmlReader::Result res = reader_.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
switch (state) {
case STATE_BEGIN:
if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId

View File

@ -46,7 +46,7 @@ public:
enum { NAMESPACE_NONE = -2, NAMESPACE_UNKNOWN = -1, NAMESPACE_XML = 0 };
enum Text { TEXT_NONE, TEXT_RAW, TEXT_NORMALIZED };
enum class Text { NONE, Raw, Normalized };
enum Result { RESULT_BEGIN, RESULT_END, RESULT_TEXT, RESULT_DONE };

View File

@ -38,7 +38,7 @@ static inline void lcl_assertEndingItem(xmlreader::XmlReader& reader)
int nsId;
xmlreader::Span name;
xmlreader::XmlReader::Result res;
res = reader.nextItem(xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
res = reader.nextItem(xmlreader::XmlReader::Text::NONE, &name, &nsId);
assert(res == xmlreader::XmlReader::RESULT_END);
(void) res;
}
@ -49,9 +49,9 @@ static inline OUString lcl_getValue(xmlreader::XmlReader& reader,
int nsId;
xmlreader::Span name;
xmlreader::XmlReader::Result res;
res = reader.nextItem(xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
res = reader.nextItem(xmlreader::XmlReader::Text::NONE, &name, &nsId);
assert(res == xmlreader::XmlReader::RESULT_BEGIN && name.equals(span));
res = reader.nextItem(xmlreader::XmlReader::TEXT_RAW, &name, &nsId);
res = reader.nextItem(xmlreader::XmlReader::Text::Raw, &name, &nsId);
assert(res == xmlreader::XmlReader::RESULT_TEXT);
(void) res; (void) span;
OUString sTmp = name.convertFromUtf8();
@ -86,12 +86,12 @@ SwLabelConfig::SwLabelConfig() :
// fill m_aLabels and m_aManufacturers with the predefined labels
res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
assert(
res == xmlreader::XmlReader::RESULT_BEGIN
&& name.equals("manufacturers"));
res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
while (res != xmlreader::XmlReader::RESULT_END)
{
// Opening manufacturer
@ -108,7 +108,7 @@ SwLabelConfig::SwLabelConfig() :
for(;;) {
// Opening label or ending manufacturer
res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_END)
break;
assert(
@ -127,10 +127,10 @@ SwLabelConfig::SwLabelConfig() :
}
// Get next manufacturer or end
res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
};
res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
assert(res == xmlreader::XmlReader::RESULT_DONE);
// add to m_aLabels and m_aManufacturers the custom labels

View File

@ -162,7 +162,7 @@ void WinBlocklistParser::handleDevices(wgl::DriverInfo& rDriver, xmlreader::XmlR
int nsId;
xmlreader::XmlReader::Result res = rReader.nextItem(
xmlreader::XmlReader::TEXT_NORMALIZED, &name, &nsId);
xmlreader::XmlReader::Text::Normalized, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_BEGIN)
{
@ -282,7 +282,7 @@ void WinBlocklistParser::handleList(xmlreader::XmlReader& rReader)
while (true)
{
xmlreader::XmlReader::Result res = rReader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_BEGIN)
{
@ -318,7 +318,7 @@ void WinBlocklistParser::handleContent(xmlreader::XmlReader& rReader)
int nsId;
xmlreader::XmlReader::Result res = rReader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_BEGIN)
{

View File

@ -546,7 +546,7 @@ void VclBuilder::handleTranslations(xmlreader::XmlReader &reader)
while(true)
{
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_RAW, &name, &nsId);
xmlreader::XmlReader::Text::Raw, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_BEGIN)
{
@ -1900,7 +1900,7 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read
int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_BEGIN)
{
@ -2052,7 +2052,7 @@ void VclBuilder::handleChild(vcl::Window *pParent, xmlreader::XmlReader &reader)
while(true)
{
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_BEGIN)
{
@ -2234,7 +2234,7 @@ void VclBuilder::handleRow(xmlreader::XmlReader &reader, const OString &rID, sal
int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2263,7 +2263,7 @@ void VclBuilder::handleRow(xmlreader::XmlReader &reader, const OString &rID, sal
}
reader.nextItem(
xmlreader::XmlReader::TEXT_RAW, &name, &nsId);
xmlreader::XmlReader::Text::Raw, &name, &nsId);
if (!bTranslated)
sValue = OString(name.begin, name.length);
@ -2297,7 +2297,7 @@ void VclBuilder::handleListStore(xmlreader::XmlReader &reader, const OString &rI
int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2334,7 +2334,7 @@ void VclBuilder::handleAtkObject(xmlreader::XmlReader &reader, const OString &rI
int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2380,7 +2380,7 @@ std::vector<OString> VclBuilder::handleItems(xmlreader::XmlReader &reader, const
int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2403,7 +2403,7 @@ std::vector<OString> VclBuilder::handleItems(xmlreader::XmlReader &reader, const
}
reader.nextItem(
xmlreader::XmlReader::TEXT_RAW, &name, &nsId);
xmlreader::XmlReader::Text::Raw, &name, &nsId);
if (!bTranslated)
sValue = OString(name.begin, name.length);
@ -2445,7 +2445,7 @@ void VclBuilder::handleMenu(xmlreader::XmlReader &reader, const OString &rID)
int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2485,7 +2485,7 @@ void VclBuilder::handleMenuChild(PopupMenu *pParent, xmlreader::XmlReader &reade
while(true)
{
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_BEGIN)
{
@ -2547,7 +2547,7 @@ void VclBuilder::handleMenuObject(PopupMenu *pParent, xmlreader::XmlReader &read
while(true)
{
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2586,7 +2586,7 @@ void VclBuilder::handleSizeGroup(xmlreader::XmlReader &reader, const OString &rI
int nsId;
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2799,7 +2799,7 @@ VclPtr<vcl::Window> VclBuilder::handleObject(vcl::Window *pParent, xmlreader::Xm
while(true)
{
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2877,7 +2877,7 @@ void VclBuilder::handlePacking(vcl::Window *pCurrent, vcl::Window *pParent, xmlr
while(true)
{
xmlreader::XmlReader::Result res = reader.nextItem(
xmlreader::XmlReader::TEXT_NONE, &name, &nsId);
xmlreader::XmlReader::Text::NONE, &name, &nsId);
if (res == xmlreader::XmlReader::RESULT_DONE)
break;
@ -2933,7 +2933,7 @@ void VclBuilder::applyPackingProperty(vcl::Window *pCurrent,
OString sKey(name.begin, name.length);
sKey = sKey.replace('_', '-');
reader.nextItem(
xmlreader::XmlReader::TEXT_RAW, &name, &nsId);
xmlreader::XmlReader::Text::Raw, &name, &nsId);
OString sValue(name.begin, name.length);
if (sKey == "expand")
@ -3041,7 +3041,7 @@ void VclBuilder::collectProperty(xmlreader::XmlReader &reader, const OString &rI
}
reader.nextItem(xmlreader::XmlReader::TEXT_RAW, &name, &nsId);
reader.nextItem(xmlreader::XmlReader::Text::Raw, &name, &nsId);
if (!bTranslated)
sValue = OString(name.begin, name.length);
@ -3076,7 +3076,7 @@ void VclBuilder::handleActionWidget(xmlreader::XmlReader &reader)
}
}
reader.nextItem(xmlreader::XmlReader::TEXT_RAW, &name, &nsId);
reader.nextItem(xmlreader::XmlReader::Text::Raw, &name, &nsId);
OString sID = OString(name.begin, name.length);
sal_Int32 nDelim = sID.indexOf(':');
if (nDelim != -1)

View File

@ -144,11 +144,11 @@ XmlReader::Result XmlReader::nextItem(Text reportText, Span * data, int * nsId)
switch (state_) {
case STATE_CONTENT:
switch (reportText) {
case TEXT_NONE:
case Text::NONE:
return handleSkippedText(data, nsId);
case TEXT_RAW:
case Text::Raw:
return handleRawText(data);
case TEXT_NORMALIZED:
case Text::Normalized:
return handleNormalizedText(data);
}
case STATE_START_TAG: