diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-05-16 09:24:31 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-05-16 09:25:53 +0200 |
commit | df18d5878c71d8d38a43dd04c0e907f9385addb4 (patch) | |
tree | 72d8da1543c6835594f37b6d75cb194fc6f775b1 /configmgr | |
parent | Uploading libvisio 0.0.27 (diff) | |
download | core-df18d5878c71d8d38a43dd04c0e907f9385addb4.tar.gz core-df18d5878c71d8d38a43dd04c0e907f9385addb4.zip |
Some string literal clean up
Change-Id: I108882af13fa97fa094547ec4efb468f988f337d
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/valueparser.cxx | 16 | ||||
-rw-r--r-- | configmgr/source/xcdparser.cxx | 17 | ||||
-rw-r--r-- | configmgr/source/xcsparser.cxx | 74 | ||||
-rw-r--r-- | configmgr/source/xcuparser.cxx | 230 | ||||
-rw-r--r-- | configmgr/source/xmldata.cxx | 45 |
5 files changed, 146 insertions, 236 deletions
diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx index 15b756c30dca..a8dad1922df9 100644 --- a/configmgr/source/valueparser.cxx +++ b/configmgr/source/valueparser.cxx @@ -30,7 +30,6 @@ #include "comphelper/sequenceasvector.hxx" #include "rtl/string.h" #include "rtl/string.hxx" -#include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" #include "xmlreader/span.hxx" @@ -68,15 +67,11 @@ bool parseHexDigit(char c, int * value) { bool parseValue(xmlreader::Span const & text, sal_Bool * value) { assert(text.is() && value != 0); - if (text.equals(RTL_CONSTASCII_STRINGPARAM("true")) || - text.equals(RTL_CONSTASCII_STRINGPARAM("1"))) - { + if (text.equals("true") || text.equals("1")) { *value = true; return true; } - if (text.equals(RTL_CONSTASCII_STRINGPARAM("false")) || - text.equals(RTL_CONSTASCII_STRINGPARAM("0"))) - { + if (text.equals("false") || text.equals("0")) { *value = false; return true; } @@ -293,8 +288,7 @@ bool ValueParser::startElement( } switch (state_) { case STATE_TEXT: - if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("it")) && + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals("it") && isListType(type_) && separator_.isEmpty()) { pad_.clear(); @@ -306,7 +300,7 @@ bool ValueParser::startElement( // fall through case STATE_IT: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("unicode")) && + name.equals("unicode") && (type_ == TYPE_STRING || type_ == TYPE_STRING_LIST)) { sal_Int32 scalar = -1; @@ -317,7 +311,7 @@ bool ValueParser::startElement( break; } if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("scalar"))) + attrLn.equals("scalar")) { if (!parseValue(reader.getAttributeValue(true), &scalar)) { scalar = -1; diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx index 4213f6cb3839..ebf14feda7f2 100644 --- a/configmgr/source/xcdparser.cxx +++ b/configmgr/source/xcdparser.cxx @@ -26,8 +26,6 @@ #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/XInterface.hpp" -#include "rtl/string.h" -#include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "xmlreader/span.hxx" #include "xmlreader/xmlreader.hxx" @@ -65,16 +63,14 @@ bool XcdParser::startElement( } switch (state_) { case STATE_START: - if (nsId == ParseManager::NAMESPACE_OOR && - name.equals(RTL_CONSTASCII_STRINGPARAM("data"))) - { + if (nsId == ParseManager::NAMESPACE_OOR && name.equals("data")) { state_ = STATE_DEPENDENCIES; return true; } break; case STATE_DEPENDENCIES: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("dependency"))) + name.equals("dependency")) { if (dependencyFile_.isEmpty()) { dependencyOptional_ = false; @@ -87,13 +83,12 @@ bool XcdParser::startElement( } if (attrNsId == xmlreader::XmlReader::NAMESPACE_NONE && //TODO: _OOR - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("file"))) + attrLn.equals("file")) { attrFile = reader.getAttributeValue(false); } else if ((attrNsId == xmlreader::XmlReader::NAMESPACE_NONE) && - attrLn.equals( - RTL_CONSTASCII_STRINGPARAM("optional"))) + attrLn.equals("optional")) { dependencyOptional_ = xmldata::parseBoolean( reader.getAttributeValue(true)); @@ -129,7 +124,7 @@ bool XcdParser::startElement( // fall through case STATE_COMPONENTS: if (nsId == ParseManager::NAMESPACE_OOR && - name.equals(RTL_CONSTASCII_STRINGPARAM("component-schema"))) + name.equals("component-schema")) { nestedParser_ = new XcsParser(layer_, data_); nesting_ = 1; @@ -137,7 +132,7 @@ bool XcdParser::startElement( reader, nsId, name, existingDependencies); } if (nsId == ParseManager::NAMESPACE_OOR && - name.equals(RTL_CONSTASCII_STRINGPARAM("component-data"))) + name.equals("component-data")) { nestedParser_ = new XcuParser(layer_ + 1, data_, 0, 0, 0); nesting_ = 1; diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx index c0b4296d4dda..b60cb1d5145e 100644 --- a/configmgr/source/xcsparser.cxx +++ b/configmgr/source/xcsparser.cxx @@ -29,9 +29,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "rtl/ref.hxx" #include "rtl/strbuf.hxx" -#include "rtl/string.h" #include "rtl/string.hxx" -#include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "xmlreader/span.hxx" #include "xmlreader/xmlreader.hxx" @@ -134,7 +132,8 @@ bool XcsParser::startElement( } if (state_ == STATE_START) { if (nsId == ParseManager::NAMESPACE_OOR && - name.equals(RTL_CONSTASCII_STRINGPARAM("component-schema"))) { + name.equals("component-schema")) + { handleComponentSchema(reader); state_ = STATE_COMPONENT_SCHEMA; ignoring_ = 0; @@ -146,10 +145,8 @@ bool XcsParser::startElement( // illegal content): if (ignoring_ > 0 || (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - (name.equals(RTL_CONSTASCII_STRINGPARAM("info")) || - name.equals(RTL_CONSTASCII_STRINGPARAM("import")) || - name.equals(RTL_CONSTASCII_STRINGPARAM("uses")) || - name.equals(RTL_CONSTASCII_STRINGPARAM("constraints"))))) + (name.equals("info") || name.equals("import") || + name.equals("uses") || name.equals("constraints")))) { assert(ignoring_ < LONG_MAX); ++ignoring_; @@ -158,7 +155,7 @@ bool XcsParser::startElement( switch (state_) { case STATE_COMPONENT_SCHEMA: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("templates"))) + name.equals("templates")) { state_ = STATE_TEMPLATES; return true; @@ -166,7 +163,7 @@ bool XcsParser::startElement( // fall through case STATE_TEMPLATES_DONE: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("component"))) + name.equals("component")) { state_ = STATE_COMPONENT; assert(elements_.empty()); @@ -181,13 +178,13 @@ bool XcsParser::startElement( case STATE_TEMPLATES: if (elements_.empty()) { if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("group"))) + name.equals("group")) { handleGroup(reader, true); return true; } if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("set"))) + name.equals("set")) { handleSet(reader, true); return true; @@ -201,7 +198,7 @@ bool XcsParser::startElement( case Node::KIND_PROPERTY: case Node::KIND_LOCALIZED_PROPERTY: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("value"))) + name.equals("value")) { handlePropValue(reader, elements_.top().node); return true; @@ -209,25 +206,25 @@ bool XcsParser::startElement( break; case Node::KIND_GROUP: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) + name.equals("prop")) { handleProp(reader); return true; } if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("node-ref"))) + name.equals("node-ref")) { handleNodeRef(reader); return true; } if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("group"))) + name.equals("group")) { handleGroup(reader, false); return true; } if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("set"))) + name.equals("set")) { handleSet(reader, false); return true; @@ -235,7 +232,7 @@ bool XcsParser::startElement( break; case Node::KIND_SET: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("item"))) + name.equals("item")) { handleSetItem( reader, @@ -356,8 +353,7 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("package"))) + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("package")) { if (hasPackage) { throw css::uno::RuntimeException( @@ -370,7 +366,7 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { xmlreader::Span s(reader.getAttributeValue(false)); buf.insert(0, s.begin, s.length); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) + attrLn.equals("name")) { if (hasName) { throw css::uno::RuntimeException( @@ -411,17 +407,15 @@ void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) { if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) - { + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("name")) { hasName = true; name = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component"))) + attrLn.equals("component")) { component = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type"))) + attrLn.equals("node-type")) { hasNodeType = true; nodeType = reader.getAttributeValue(false).convertFromUtf8(); @@ -464,22 +458,20 @@ void XcsParser::handleProp(xmlreader::XmlReader & reader) { if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) - { + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("name")) { hasName = true; name = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type"))) + attrLn.equals("type")) { valueParser_.type_ = xmldata::parseType( reader, reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("localized"))) + attrLn.equals("localized")) { localized = xmldata::parseBoolean(reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("nillable"))) + attrLn.equals("nillable")) { nillable = xmldata::parseBoolean(reader.getAttributeValue(true)); } @@ -520,7 +512,7 @@ void XcsParser::handlePropValue( break; } if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("separator"))) + attrLn.equals("separator")) { attrSeparator = reader.getAttributeValue(false); if (attrSeparator.length == 0) { @@ -546,13 +538,11 @@ void XcsParser::handleGroup(xmlreader::XmlReader & reader, bool isTemplate) { if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) - { + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("name")) { hasName = true; name = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("extensible"))) + attrLn.equals("extensible")) { extensible = xmldata::parseBoolean(reader.getAttributeValue(true)); } @@ -586,17 +576,15 @@ void XcsParser::handleSet(xmlreader::XmlReader & reader, bool isTemplate) { if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) - { + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("name")) { hasName = true; name = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component"))) + attrLn.equals("component")) { component = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type"))) + attrLn.equals("node-type")) { hasNodeType = true; nodeType = reader.getAttributeValue(false).convertFromUtf8(); @@ -632,11 +620,11 @@ void XcsParser::handleSetItem(xmlreader::XmlReader & reader, SetNode * set) { break; } if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component"))) + attrLn.equals("component")) { component = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type"))) + attrLn.equals("node-type")) { hasNodeType = true; nodeType = reader.getAttributeValue(false).convertFromUtf8(); diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index c8a2acfd1850..e77025fb70b2 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -80,33 +80,27 @@ bool XcuParser::startElement( } if (state_.empty()) { if (nsId == ParseManager::NAMESPACE_OOR && - name.equals(RTL_CONSTASCII_STRINGPARAM("component-data"))) + name.equals("component-data")) { handleComponentData(reader); - } else if (nsId == ParseManager::NAMESPACE_OOR && - name.equals(RTL_CONSTASCII_STRINGPARAM("items"))) + } else if (nsId == ParseManager::NAMESPACE_OOR && name.equals("items")) { state_.push(State(rtl::Reference< Node >(), false)); } else { throw css::uno::RuntimeException( - (OUString("bad root element <") + - name.convertFromUtf8() + - OUString("> in ") + + ("bad root element <" + name.convertFromUtf8() + "> in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } } else if (state_.top().ignore) { state_.push(State(false)); } else if (!state_.top().node.is()) { - if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("item"))) + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals("item")) { handleItem(reader); } else { throw css::uno::RuntimeException( - (OUString("bad items node member <") + - name.convertFromUtf8() + - OUString("> in ") + + ("bad items node member <" + name.convertFromUtf8() + "> in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } @@ -114,23 +108,21 @@ bool XcuParser::startElement( switch (state_.top().node->kind()) { case Node::KIND_PROPERTY: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("value"))) + name.equals("value")) { handlePropValue( reader, dynamic_cast< PropertyNode * >(state_.top().node.get())); } else { throw css::uno::RuntimeException( - (OUString("bad property node member <") + - name.convertFromUtf8() + - OUString("> in ") + - reader.getUrl()), + ("bad property node member <" + name.convertFromUtf8() + + "> in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } break; case Node::KIND_LOCALIZED_PROPERTY: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("value"))) + name.equals("value")) { handleLocpropValue( reader, @@ -138,48 +130,42 @@ bool XcuParser::startElement( state_.top().node.get())); } else { throw css::uno::RuntimeException( - (OUString("bad localized property node member <") + - name.convertFromUtf8() + - OUString("> in ") + - reader.getUrl()), + ("bad localized property node member <" + + name.convertFromUtf8() + "> in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } break; case Node::KIND_LOCALIZED_VALUE: throw css::uno::RuntimeException( - (OUString("bad member <") + - name.convertFromUtf8() + - OUString("> in ") + + ("bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); case Node::KIND_GROUP: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) + name.equals("prop")) { handleGroupProp( reader, dynamic_cast< GroupNode * >(state_.top().node.get())); } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("node"))) + name.equals("node")) { handleGroupNode(reader, state_.top().node); } else { throw css::uno::RuntimeException( - (OUString("bad group node member <") + - name.convertFromUtf8() + - OUString("> in ") + - reader.getUrl()), + ("bad group node member <" + name.convertFromUtf8() + + "> in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } break; case Node::KIND_SET: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("node"))) + name.equals("node")) { handleSetNode( reader, dynamic_cast< SetNode * >(state_.top().node.get())); } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && - name.equals(RTL_CONSTASCII_STRINGPARAM("prop"))) + name.equals("prop")) { SAL_WARN( "configmgr", @@ -188,10 +174,8 @@ bool XcuParser::startElement( state_.push(State(true)); // ignored } else { throw css::uno::RuntimeException( - (OUString("bad set node member <") + - name.convertFromUtf8() + - OUString("> in ") + - reader.getUrl()), + ("bad set node member <" + name.convertFromUtf8() + + "> in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } break; @@ -234,21 +218,20 @@ void XcuParser::characters(xmlreader::Span const & text) { XcuParser::Operation XcuParser::parseOperation(xmlreader::Span const & text) { assert(text.is()); - if (text.equals(RTL_CONSTASCII_STRINGPARAM("modify"))) { + if (text.equals("modify")) { return OPERATION_MODIFY; } - if (text.equals(RTL_CONSTASCII_STRINGPARAM("replace"))) { + if (text.equals("replace")) { return OPERATION_REPLACE; } - if (text.equals(RTL_CONSTASCII_STRINGPARAM("fuse"))) { + if (text.equals("fuse")) { return OPERATION_FUSE; } - if (text.equals(RTL_CONSTASCII_STRINGPARAM("remove"))) { + if (text.equals("remove")) { return OPERATION_REMOVE; } throw css::uno::RuntimeException( - (OUString("invalid op ") + - text.convertFromUtf8()), + "invalid op " + text.convertFromUtf8(), css::uno::Reference< css::uno::XInterface >()); } @@ -265,13 +248,11 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("package"))) + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("package")) { if (hasPackage) { throw css::uno::RuntimeException( - (OUString("multiple component-update package attributes" - " in ") + + ("multiple component-update package attributes in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } @@ -279,11 +260,11 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { xmlreader::Span s(reader.getAttributeValue(false)); buf.insert(0, s.begin, s.length); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) + attrLn.equals("name")) { if (hasName) { throw css::uno::RuntimeException( - (OUString("multiple component-update name attributes in ") + + ("multiple component-update name attributes in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } @@ -291,25 +272,23 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { xmlreader::Span s(reader.getAttributeValue(false)); buf.append(s.begin, s.length); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) + attrLn.equals("op")) { op = parseOperation(reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("finalized"))) + attrLn.equals("finalized")) { finalized = xmldata::parseBoolean(reader.getAttributeValue(true)); } } if (!hasPackage) { throw css::uno::RuntimeException( - (OUString("no component-data package attribute in ") + - reader.getUrl()), + "no component-data package attribute in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } if (!hasName) { throw css::uno::RuntimeException( - (OUString("no component-data name attribute in ") + - reader.getUrl()), + "no component-data name attribute in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()). @@ -340,8 +319,7 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { break; default: throw css::uno::RuntimeException( - (OUString("invalid operation on root node in ") + - reader.getUrl()), + "invalid operation on root node in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } int finalizedLayer = std::min( @@ -359,16 +337,13 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) { if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("path"))) - { + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("path")) { attrPath = reader.getAttributeValue(false); } } if (!attrPath.is()) { throw css::uno::RuntimeException( - (OUString("missing path attribute in ") + - reader.getUrl()), + "missing path attribute in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } OUString path(attrPath.convertFromUtf8()); @@ -425,41 +400,36 @@ void XcuParser::handlePropValue( if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_XSI && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("nil"))) - { + if (attrNsId == ParseManager::NAMESPACE_XSI && attrLn.equals("nil")) { nil = xmldata::parseBoolean(reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type"))) + attrLn.equals("type")) { Type type = xmldata::parseType( reader, reader.getAttributeValue(true)); if (valueParser_.type_ != TYPE_ANY && type != valueParser_.type_) { throw css::uno::RuntimeException( - (OUString("invalid value type in ") + - reader.getUrl()), + "invalid value type in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } valueParser_.type_ = type; } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("separator"))) + attrLn.equals("separator")) { xmlreader::Span s(reader.getAttributeValue(false)); if (s.length == 0) { throw css::uno::RuntimeException( - (OUString("bad oor:separator attribute in ") + - reader.getUrl()), + "bad oor:separator attribute in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } separator = OString(s.begin, s.length); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("external"))) + attrLn.equals("external")) { external = reader.getAttributeValue(true).convertFromUtf8(); if (external.isEmpty()) { throw css::uno::RuntimeException( - (OUString("bad oor:external attribute value in ") + - reader.getUrl()), + "bad oor:external attribute value in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } } @@ -467,13 +437,12 @@ void XcuParser::handlePropValue( if (nil) { if (!prop->isNillable()) { throw css::uno::RuntimeException( - (OUString("xsi:nil attribute for non-nillable prop in ") + - reader.getUrl()), + "xsi:nil attribute for non-nillable prop in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } if (!external.isEmpty()) { throw css::uno::RuntimeException( - (OUString("xsi:nil and oor:external attributes for prop in ") + + ("xsi:nil and oor:external attributes for prop in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } @@ -502,38 +471,36 @@ void XcuParser::handleLocpropValue( break; } if (attrNsId == xmlreader::XmlReader::NAMESPACE_XML && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("lang"))) + attrLn.equals("lang")) { name = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_XSI && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("nil"))) + attrLn.equals("nil")) { nil = xmldata::parseBoolean(reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type"))) + attrLn.equals("type")) { Type type = xmldata::parseType( reader, reader.getAttributeValue(true)); if (valueParser_.type_ != TYPE_ANY && type != valueParser_.type_) { throw css::uno::RuntimeException( - (OUString("invalid value type in ") + - reader.getUrl()), + "invalid value type in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } valueParser_.type_ = type; } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("separator"))) + attrLn.equals("separator")) { xmlreader::Span s(reader.getAttributeValue(false)); if (s.length == 0) { throw css::uno::RuntimeException( - (OUString("bad oor:separator attribute in ") + - reader.getUrl()), + "bad oor:separator attribute in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } separator = OString(s.begin, s.length); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) + attrLn.equals("op")) { op = parseOperation(reader.getAttributeValue(true)); } @@ -555,8 +522,7 @@ void XcuParser::handleLocpropValue( } if (nil && !locprop->isNillable()) { throw css::uno::RuntimeException( - (OUString("xsi:nil attribute for non-nillable prop in ") + - reader.getUrl()), + "xsi:nil attribute for non-nillable prop in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } switch (op) { @@ -597,8 +563,7 @@ void XcuParser::handleLocpropValue( break; default: throw css::uno::RuntimeException( - (OUString("bad op attribute for value element in ") + - reader.getUrl()), + "bad op attribute for value element in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } } @@ -617,29 +582,26 @@ void XcuParser::handleGroupProp( if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) - { + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("name")) { hasName = true; name = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("type"))) + attrLn.equals("type")) { type = xmldata::parseType(reader, reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) + attrLn.equals("op")) { op = parseOperation(reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("finalized"))) + attrLn.equals("finalized")) { finalized = xmldata::parseBoolean(reader.getAttributeValue(true)); } } if (!hasName) { throw css::uno::RuntimeException( - (OUString("no prop name attribute in ") + - reader.getUrl()), + "no prop name attribute in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } if (trackPath_) { @@ -670,9 +632,7 @@ void XcuParser::handleGroupProp( break; default: throw css::uno::RuntimeException( - (OUString("inappropriate prop ") + - name + OUString(" in ") + - reader.getUrl()), + "inappropriate prop " + name + " in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } } @@ -688,10 +648,9 @@ void XcuParser::handleUnknownGroupProp( if (group->isExtensible()) { if (type == TYPE_ERROR) { throw css::uno::RuntimeException( - (OUString("missing type attribute for prop ") + - name + OUString(" in ") + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + ("missing type attribute for prop " + name + " in " + + reader.getUrl()), + css::uno::Reference< css::uno::XInterface >()); } valueParser_.type_ = type; rtl::Reference< Node > prop( @@ -735,9 +694,7 @@ void XcuParser::handlePlainGroupProp( type != property->getStaticType()) { throw css::uno::RuntimeException( - (OUString("invalid type for prop ") + - name + OUString(" in ") + - reader.getUrl()), + "invalid type for prop " + name + " in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } valueParser_.type_ = type == TYPE_ERROR ? property->getStaticType() : type; @@ -755,8 +712,7 @@ void XcuParser::handlePlainGroupProp( case OPERATION_REMOVE: if (!property->isExtension()) { throw css::uno::RuntimeException( - (OUString("invalid remove of non-extension prop ") + - name + OUString(" in ") + + ("invalid remove of non-extension prop " + name + " in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } @@ -783,9 +739,7 @@ void XcuParser::handleLocalizedGroupProp( type != property->getStaticType()) { throw css::uno::RuntimeException( - (OUString("invalid type for prop ") + - name + OUString(" in ") + - reader.getUrl()), + "invalid type for prop " + name + " in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } valueParser_.type_ = type == TYPE_ERROR ? property->getStaticType() : type; @@ -815,8 +769,7 @@ void XcuParser::handleLocalizedGroupProp( break; case OPERATION_REMOVE: throw css::uno::RuntimeException( - (OUString("invalid remove of non-extension prop ") + - name + OUString(" in ") + + ("invalid remove of non-extension prop " + name + " in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } @@ -835,25 +788,22 @@ void XcuParser::handleGroupNode( if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) - { + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("name")) { hasName = true; name = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) + attrLn.equals("op")) { op = parseOperation(reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("finalized"))) + attrLn.equals("finalized")) { finalized = xmldata::parseBoolean(reader.getAttributeValue(true)); } } if (!hasName) { throw css::uno::RuntimeException( - (OUString("no node name attribute in ") + - reader.getUrl()), + "no node name attribute in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } if (trackPath_) { @@ -876,16 +826,13 @@ void XcuParser::handleGroupNode( Node::Kind kind = child->kind(); if (kind != Node::KIND_GROUP && kind != Node::KIND_SET) { throw css::uno::RuntimeException( - (OUString("bad <node> \"") + - name + - OUString("\" of non group/set kind in ") + + ("bad <node> \"" + name + "\" of non group/set kind in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } if (op != OPERATION_MODIFY && op != OPERATION_FUSE) { throw css::uno::RuntimeException( - (OUString("invalid operation on group node in ") + - reader.getUrl()), + "invalid operation on group node in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } int finalizedLayer = std::min( @@ -913,38 +860,35 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { if (!reader.nextAttribute(&attrNsId, &attrLn)) { break; } - if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("name"))) - { + if (attrNsId == ParseManager::NAMESPACE_OOR && attrLn.equals("name")) { hasName = true; name = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("component"))) + attrLn.equals("component")) { component = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("node-type"))) + attrLn.equals("node-type")) { hasNodeType = true; nodeType = reader.getAttributeValue(false).convertFromUtf8(); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("op"))) + attrLn.equals("op")) { op = parseOperation(reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("finalized"))) + attrLn.equals("finalized")) { finalized = xmldata::parseBoolean(reader.getAttributeValue(true)); } else if (attrNsId == ParseManager::NAMESPACE_OOR && - attrLn.equals(RTL_CONSTASCII_STRINGPARAM("mandatory"))) + attrLn.equals("mandatory")) { mandatory = xmldata::parseBoolean(reader.getAttributeValue(true)); } } if (!hasName) { throw css::uno::RuntimeException( - (OUString("no node name attribute in ") + - reader.getUrl()), + "no node name attribute in " + reader.getUrl(), css::uno::Reference< css::uno::XInterface >()); } if (trackPath_) { @@ -960,22 +904,16 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { component, hasNodeType, nodeType, &set->getDefaultTemplateName())); if (!set->isValidTemplate(templateName)) { throw css::uno::RuntimeException( - (OUString("set member node ") + - name + - OUString(" references invalid template ") + - templateName + OUString(" in ") + - reader.getUrl()), + ("set member node " + name + " references invalid template " + + templateName + " in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } rtl::Reference< Node > tmpl( data_.getTemplate(valueParser_.getLayer(), templateName)); if (!tmpl.is()) { throw css::uno::RuntimeException( - (OUString("set member node ") + - name + - OUString(" references undefined template ") + - templateName + OUString(" in ") + - reader.getUrl()), + ("set member node " + name + " references undefined template " + + templateName + " in " + reader.getUrl()), css::uno::Reference< css::uno::XInterface >()); } int finalizedLayer = finalized ? valueParser_.getLayer() : Data::NO_LAYER; diff --git a/configmgr/source/xmldata.cxx b/configmgr/source/xmldata.cxx index a5dc0896a05f..577e1e68d38b 100644 --- a/configmgr/source/xmldata.cxx +++ b/configmgr/source/xmldata.cxx @@ -29,10 +29,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "osl/file.hxx" #include "rtl/ref.hxx" -#include "rtl/strbuf.hxx" #include "rtl/string.h" -#include "rtl/ustrbuf.hxx" -#include "rtl/ustring.h" #include "rtl/ustring.hxx" #include "sal/types.h" #include "xmlreader/span.hxx" @@ -63,79 +60,79 @@ Type parseType( switch (reader.getNamespaceId(xmlreader::Span(text.begin, i))) { case ParseManager::NAMESPACE_OOR: if (xmlreader::Span(text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("any"))) + equals("any")) { return TYPE_ANY; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("boolean-list"))) + equals("boolean-list")) { return TYPE_BOOLEAN_LIST; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("short-list"))) + equals("short-list")) { return TYPE_SHORT_LIST; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("int-list"))) + equals("int-list")) { return TYPE_INT_LIST; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("long-list"))) + equals("long-list")) { return TYPE_LONG_LIST; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("double-list"))) + equals("double-list")) { return TYPE_DOUBLE_LIST; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("string-list"))) + equals("string-list")) { return TYPE_STRING_LIST; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("hexBinary-list"))) + equals("hexBinary-list")) { return TYPE_HEXBINARY_LIST; } break; case ParseManager::NAMESPACE_XS: if (xmlreader::Span(text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("boolean"))) + equals("boolean")) { return TYPE_BOOLEAN; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("short"))) + equals("short")) { return TYPE_SHORT; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("int"))) + equals("int")) { return TYPE_INT; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("long"))) + equals("long")) { return TYPE_LONG; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("double"))) + equals("double")) { return TYPE_DOUBLE; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("string"))) + equals("string")) { return TYPE_STRING; } else if (xmlreader::Span( text.begin + i + 1, text.length - (i + 1)). - equals(RTL_CONSTASCII_STRINGPARAM("hexBinary"))) + equals("hexBinary")) { return TYPE_HEXBINARY; } @@ -145,22 +142,20 @@ Type parseType( } } throw css::uno::RuntimeException( - (OUString("invalid type ") + - text.convertFromUtf8()), + "invalid type " + text.convertFromUtf8(), css::uno::Reference< css::uno::XInterface >()); } bool parseBoolean(xmlreader::Span const & text) { assert(text.is()); - if (text.equals(RTL_CONSTASCII_STRINGPARAM("true"))) { + if (text.equals("true")) { return true; } - if (text.equals(RTL_CONSTASCII_STRINGPARAM("false"))) { + if (text.equals("false")) { return false; } throw css::uno::RuntimeException( - (OUString("invalid boolean ") + - text.convertFromUtf8()), + "invalid boolean " + text.convertFromUtf8(), css::uno::Reference< css::uno::XInterface >()); } @@ -173,7 +168,7 @@ OUString parseTemplateReference( return *defaultTemplateName; } throw css::uno::RuntimeException( - OUString("missing node-type attribute"), + "missing node-type attribute", css::uno::Reference< css::uno::XInterface >()); } return Data::fullTemplateName(component, nodeType); |