unodevtools: Use appropriate OUString functions on string constants

Change-Id: I70a86543c0269cbaeefc9cbe1da30c2ad7e48333
This commit is contained in:
Stephan Bergmann
2014-12-16 17:31:18 +01:00
parent a11c68174b
commit 102ae9f11a
3 changed files with 18 additions and 18 deletions

View File

@@ -51,7 +51,7 @@ void generateIncludes(std::ostream & o,
} }
if (propertyhelper.getLength() > 1) { if (propertyhelper.getLength() > 1) {
if (propertyhelper.equals("_")) if (propertyhelper == "_")
o << "#include \"cppuhelper/rpopshlp.hxx\"\n"; o << "#include \"cppuhelper/rpopshlp.hxx\"\n";
else else
o << "#include \"cppuhelper/propertysetmixin.hxx\"\n"; o << "#include \"cppuhelper/propertysetmixin.hxx\"\n";
@@ -882,7 +882,7 @@ void generateMethodBodies(std::ostream& o,
std::set< OUString >::const_iterator iter = interfaces.begin(); std::set< OUString >::const_iterator iter = interfaces.begin();
codemaker::GeneratedTypeSet generated; codemaker::GeneratedTypeSet generated;
while (iter != interfaces.end()) { while (iter != interfaces.end()) {
if ( (*iter).equals("com.sun.star.lang.XServiceInfo") ) { if ( *iter == "com.sun.star.lang.XServiceInfo" ) {
generateXServiceInfoBodies(o, name, comphelpernamespace); generateXServiceInfoBodies(o, name, comphelpernamespace);
generated.add(u2b(*iter)); generated.add(u2b(*iter));
} else { } else {
@@ -930,7 +930,7 @@ void generateQueryInterface(std::ostream& o,
} else { } else {
o << "::queryInterface(type));\n"; o << "::queryInterface(type));\n";
o << " return a.hasValue() ? a\n : ("; o << " return a.hasValue() ? a\n : (";
if (propertyhelper.equals("_")) { if (propertyhelper == "_") {
o << "::cppu::OPropertySetHelper::queryInterface(type));\n"; o << "::cppu::OPropertySetHelper::queryInterface(type));\n";
} else { } else {
o << "::cppu::PropertySetMixin<\n "; o << "::cppu::PropertySetMixin<\n ";
@@ -1109,7 +1109,7 @@ void generateCalcAddin(ProgramOptions const & options,
// get the one and only add-in service for later use // get the one and only add-in service for later use
std::set< OUString >::const_iterator iter2 = services.begin(); std::set< OUString >::const_iterator iter2 = services.begin();
sAddinService = *iter2; sAddinService = *iter2;
if (sAddinService.equals("com.sun.star.sheet.AddIn")) { if (sAddinService == "com.sun.star.sheet.AddIn") {
sAddinService = *(++iter2); sAddinService = *(++iter2);
} }

View File

@@ -52,14 +52,14 @@ void generateImports(std::ostream & o, ProgramOptions const & options,
o << "import com.sun.star.registry.XRegistryKey;\n"; o << "import com.sun.star.registry.XRegistryKey;\n";
} }
if (!propertyhelper.equals("_")) { if (propertyhelper != "_") {
if (supportxcomponent) if (supportxcomponent)
o << "import com.sun.star.lib.uno.helper.ComponentBase;\n"; o << "import com.sun.star.lib.uno.helper.ComponentBase;\n";
else else
o << "import com.sun.star.lib.uno.helper.WeakBase;\n"; o << "import com.sun.star.lib.uno.helper.WeakBase;\n";
} }
if (!propertyhelper.isEmpty()) { if (!propertyhelper.isEmpty()) {
if (propertyhelper.equals("_")) { if (propertyhelper == "_") {
o << "import com.sun.star.lib.uno.helper.PropertySet;\n"; o << "import com.sun.star.lib.uno.helper.PropertySet;\n";
o << "import com.sun.star.beans.PropertyAttribute;\n"; o << "import com.sun.star.beans.PropertyAttribute;\n";
} else { } else {
@@ -503,18 +503,18 @@ void generateMethodBodies(std::ostream& o,
while (iter != interfaces.end()) { while (iter != interfaces.end()) {
OUString type(*iter); OUString type(*iter);
++iter; ++iter;
if (type.equals("com.sun.star.lang.XServiceInfo")) { if (type == "com.sun.star.lang.XServiceInfo") {
generateXServiceInfoBodies(o); generateXServiceInfoBodies(o);
generated.add(u2b(type)); generated.add(u2b(type));
} else { } else {
if (options.componenttype == 2) { if (options.componenttype == 2) {
if (type.equals("com.sun.star.lang.XServiceName")) { if (type == "com.sun.star.lang.XServiceName") {
o << " // com.sun.star.lang.XServiceName:\n" o << " // com.sun.star.lang.XServiceName:\n"
" public String getServiceName() {\n" " public String getServiceName() {\n"
" return sADDIN_SERVICENAME;\n }\n"; " return sADDIN_SERVICENAME;\n }\n";
generated.add(u2b(type)); generated.add(u2b(type));
continue; continue;
} else if (type.equals("com.sun.star.sheet.XAddIn")) { } else if (type == "com.sun.star.sheet.XAddIn") {
generateXAddInBodies(o, options); generateXAddInBodies(o, options);
generated.add(u2b(type)); generated.add(u2b(type));
@@ -524,26 +524,26 @@ void generateMethodBodies(std::ostream& o,
generated.add("com.sun.star.lang.XLocalizable"); generated.add("com.sun.star.lang.XLocalizable");
} }
continue; continue;
} else if (type.equals("com.sun.star.lang.XLocalizable")) { } else if (type == "com.sun.star.lang.XLocalizable") {
generateXLocalizableBodies(o); generateXLocalizableBodies(o);
generated.add(u2b(type)); generated.add(u2b(type));
continue; continue;
} else if (type.equals("com.sun.star.sheet.XCompatibilityNames")) { } else if (type == "com.sun.star.sheet.XCompatibilityNames") {
generateXCompatibilityNamesBodies(o); generateXCompatibilityNamesBodies(o);
generated.add(u2b(type)); generated.add(u2b(type));
continue; continue;
} }
} }
if (options.componenttype == 3) { if (options.componenttype == 3) {
if (type.equals("com.sun.star.lang.XInitialization")) { if (type == "com.sun.star.lang.XInitialization") {
generateXInitializationBodies(o); generateXInitializationBodies(o);
generated.add(u2b(type)); generated.add(u2b(type));
continue; continue;
} else if (type.equals("com.sun.star.frame.XDispatch")) { } else if (type == "com.sun.star.frame.XDispatch") {
generateXDispatchBodies(o, options); generateXDispatchBodies(o, options);
generated.add(u2b(type)); generated.add(u2b(type));
continue; continue;
} else if (type.equals("com.sun.star.frame.XDispatchProvider")) { } else if (type == "com.sun.star.frame.XDispatchProvider") {
generateXDispatchProviderBodies(o, options); generateXDispatchProviderBodies(o, options);
generated.add(u2b(type)); generated.add(u2b(type));
continue; continue;
@@ -712,7 +712,7 @@ void generateClassDefinition(std::ostream& o,
o << "\n\npublic final class " << classname << " extends "; o << "\n\npublic final class " << classname << " extends ";
if (!interfaces.empty()) { if (!interfaces.empty()) {
if (propertyhelper.equals("_")) { if (propertyhelper == "_") {
o << "PropertySet\n"; o << "PropertySet\n";
} else { } else {
if (supportxcomponent) if (supportxcomponent)
@@ -791,7 +791,7 @@ void generateClassDefinition(std::ostream& o,
} else { } else {
o << "\n public " << classname << "( XComponentContext context )\n" o << "\n public " << classname << "( XComponentContext context )\n"
" {\n m_xContext = context;\n"; " {\n m_xContext = context;\n";
if (propertyhelper.equals("_")) { if (propertyhelper == "_") {
registerProperties(o, properties, " "); registerProperties(o, properties, " ");
} else { } else {
if (propertyhelper.getLength() > 1) { if (propertyhelper.getLength() > 1) {

View File

@@ -279,7 +279,7 @@ void checkDefaultInterfaces(
interfaces.insert("com.sun.star.lang.XServiceInfo"); interfaces.insert("com.sun.star.lang.XServiceInfo");
} }
if ( propertyhelper.equals("_") ) { if ( propertyhelper == "_" ) {
interfaces.erase("com.sun.star.beans.XPropertySet"); interfaces.erase("com.sun.star.beans.XPropertySet");
interfaces.erase("com.sun.star.beans.XFastPropertySet"); interfaces.erase("com.sun.star.beans.XFastPropertySet");
interfaces.erase("com.sun.star.beans.XPropertyAccess"); interfaces.erase("com.sun.star.beans.XPropertyAccess");
@@ -406,7 +406,7 @@ bool checkXComponentSupport(rtl::Reference< TypeManager > const & manager,
std::set< OUString >::const_iterator iter = interfaces.begin(); std::set< OUString >::const_iterator iter = interfaces.begin();
while ( iter != interfaces.end() ) { while ( iter != interfaces.end() ) {
if ( (*iter).equals("com.sun.star.lang.XComponent") ) { if ( *iter == "com.sun.star.lang.XComponent" ) {
interfaces.erase("com.sun.star.lang.XComponent"); interfaces.erase("com.sun.star.lang.XComponent");
return true; return true;
} }