targeted string re-work

Change-Id: Ia2115e70df8f64eb0dade6beb33ee64c358af767
This commit is contained in:
Norbert Thiebaud
2012-06-02 16:59:01 -05:00
parent 13aaac50bc
commit ea489b3570
4 changed files with 28 additions and 33 deletions

View File

@@ -70,14 +70,14 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplNa
if (sImplName.equalsAscii(MYLISTENER_IMPLEMENTATIONNAME)) if (sImplName.equalsAscii(MYLISTENER_IMPLEMENTATIONNAME))
{ {
css::uno::Sequence< ::rtl::OUString > lNames(1); css::uno::Sequence< ::rtl::OUString > lNames(1);
lNames[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MYLISTENER_IMPLEMENTATIONNAME)); lNames[0] = ::rtl::OUString(MYLISTENER_IMPLEMENTATIONNAME);
xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyListener::st_createInstance, lNames); xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyListener::st_createInstance, lNames);
} }
else else
if (sImplName.equalsAscii(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME)) if (sImplName.equalsAscii(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME))
{ {
css::uno::Sequence< ::rtl::OUString > lNames(1); css::uno::Sequence< ::rtl::OUString > lNames(1);
lNames[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(MYPROTOCOLHANDLER_SERVICENAME)); lNames[0] = ::rtl::OUString(MYPROTOCOLHANDLER_SERVICENAME);
xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyProtocolHandler_createInstance, lNames); xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyProtocolHandler_createInstance, lNames);
} }

View File

@@ -154,8 +154,8 @@ void generateCompHelperDefinition(std::ostream & o,
short nbrackets = generateNamespace(o, implname, true, nm); short nbrackets = generateNamespace(o, implname, true, nm);
o << "::rtl::OUString SAL_CALL _getImplementationName() {\n" o << "::rtl::OUString SAL_CALL _getImplementationName() {\n"
<< " return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\n" << " return ::rtl::OUString(\n"
<< " \"" << implname << "\"));\n}\n\n"; << " \"" << implname << "\");\n}\n\n";
o << "css::uno::Sequence< ::rtl::OUString > SAL_CALL " o << "css::uno::Sequence< ::rtl::OUString > SAL_CALL "
"_getSupportedServiceNames()\n{\n css::uno::Sequence< " "_getSupportedServiceNames()\n{\n css::uno::Sequence< "
@@ -166,8 +166,7 @@ void generateCompHelperDefinition(std::ostream & o,
while (iter != services.end()) while (iter != services.end())
{ {
o << " s[" << i++ << "] = ::rtl::OUString(" o << " s[" << i++ << "] = ::rtl::OUString("
<< "RTL_CONSTASCII_USTRINGPARAM(\n \"" << (*iter).replace('/','.') << "\");\n";
<< (*iter).replace('/','.') << "\"));\n";
++iter; ++iter;
} }
o << " return s;\n}\n\n"; o << " return s;\n}\n\n";
@@ -524,21 +523,20 @@ void generateAddinConstructorAndHelper(std::ostream& o,
o << " css::uno::Reference< css::lang::XMultiServiceFactory > xProvider" o << " css::uno::Reference< css::lang::XMultiServiceFactory > xProvider"
"(\n m_xContext->getServiceManager()->createInstanceWithContext" "(\n m_xContext->getServiceManager()->createInstanceWithContext"
"(\n ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\n " "(\n ::rtl::OUString(\n "
" \"com.sun.star.configuration.ConfigurationProvider\"))," " \"com.sun.star.configuration.ConfigurationProvider\"),"
"\n m_xContext ), css::uno::UNO_QUERY );\n\n"; "\n m_xContext ), css::uno::UNO_QUERY );\n\n";
o << " ::rtl::OUString sReadOnlyView(\n" o << " ::rtl::OUString sReadOnlyView(\n"
" RTL_CONSTASCII_USTRINGPARAM(\n" " \"com.sun.star.configuration.ConfigurationAccess\");\n\n";
" \"com.sun.star.configuration.ConfigurationAccess\"));\n\n";
o << " ::rtl::OUStringBuffer sPath(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\n" o << " ::rtl::OUStringBuffer sPath(::rtl::OUString(\n"
" \"/org.openoffice.Office.CalcAddIns/AddInInfo/\")));\n" " \"/org.openoffice.Office.CalcAddIns/AddInInfo/\"));\n"
" sPath.appendAscii(sADDIN_SERVICENAME);\n" " sPath.appendAscii(sADDIN_SERVICENAME);\n"
" sPath.appendAscii(\"/AddInFunctions\");\n\n" " sPath.appendAscii(\"/AddInFunctions\");\n\n"
" // create arguments: nodepath\n" " // create arguments: nodepath\n"
" css::beans::PropertyValue aArgument;\n" " css::beans::PropertyValue aArgument;\n"
" aArgument.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"nodepath\"));\n" " aArgument.Name = ::rtl::OUString(\"nodepath\");\n"
" aArgument.Value <<= sPath.makeStringAndClear();\n\n" " aArgument.Value <<= sPath.makeStringAndClear();\n\n"
" css::uno::Sequence< css::uno::Any > aArguments(1);\n" " css::uno::Sequence< css::uno::Any > aArguments(1);\n"
" aArguments[0] <<= aArgument;\n\n"; " aArguments[0] <<= aArgument;\n\n";
@@ -553,8 +551,8 @@ void generateAddinConstructorAndHelper(std::ostream& o,
o << " // extend arguments to create a view for all locales to get " o << " // extend arguments to create a view for all locales to get "
"simple\n // access to the compatibilityname property\n" "simple\n // access to the compatibilityname property\n"
" aArgument.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"locale\"));\n" " aArgument.Name = ::rtl::OUString(\"locale\");\n"
" aArgument.Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"*\"));\n" " aArgument.Value <<= ::rtl::OUString(\"*\");\n"
" aArguments.realloc(2);\n" " aArguments.realloc(2);\n"
" aArguments[1] <<= aArgument;\n\n" " aArguments[1] <<= aArgument;\n\n"
" // create view for all locales\n" " // create view for all locales\n"
@@ -578,7 +576,7 @@ void generateAddinConstructorAndHelper(std::ostream& o,
" m_xHAccess->getByHierarchicalName(\n" " m_xHAccess->getByHierarchicalName(\n"
" buf.makeStringAndClear()), css::uno::UNO_QUERY);\n" " buf.makeStringAndClear()), css::uno::UNO_QUERY);\n"
" xPropSet->getPropertyValue(\n " " xPropSet->getPropertyValue(\n "
"::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(propName))) >>= ret;\n }\n" "::rtl::OUString(propName)) >>= ret;\n }\n"
" catch ( const css::uno::RuntimeException & e ) {\n throw e;\n }\n" " catch ( const css::uno::RuntimeException & e ) {\n throw e;\n }\n"
" catch ( css::uno::Exception & ) {\n }\n return ret;\n"; " catch ( css::uno::Exception & ) {\n }\n return ret;\n";
} }

View File

@@ -328,11 +328,11 @@ void printSetPropertyMixinBody(std::ostream & o,
o << " v <<= " << buffer2.makeStringAndClear() << ";\n\n"; o << " v <<= " << buffer2.makeStringAndClear() << ";\n\n";
} }
o << " prepareSet(\n rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"" o << " prepareSet(\n rtl::OUString(\""
<< fieldname << "\")),\n css::uno::Any(), v, "; << fieldname << "\"),\n css::uno::Any(), v, ";
} else { } else {
o << " prepareSet(\n rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"" o << " prepareSet(\n rtl::OUString(\""
<< fieldname << "\")),\n css::uno::Any(), css::uno::Any(), "; << fieldname << "\"),\n css::uno::Any(), css::uno::Any(), ";
} }
if (bound) if (bound)
@@ -421,8 +421,8 @@ void printMethods(std::ostream & o,
o << "// ::com::sun::star::lang::XServiceName:\n" o << "// ::com::sun::star::lang::XServiceName:\n"
"::rtl::OUString SAL_CALL " << classname << "getServiceName() " "::rtl::OUString SAL_CALL " << classname << "getServiceName() "
"throw (css::uno::RuntimeException)\n{\n " "throw (css::uno::RuntimeException)\n{\n "
"return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" "return ::rtl::OUString("
"sADDIN_SERVICENAME));\n}\n"; "sADDIN_SERVICENAME);\n}\n";
generated.add(type); generated.add(type);
return; return;
} else if (type.equals("com/sun/star/sheet/XAddIn")) { } else if (type.equals("com/sun/star/sheet/XAddIn")) {
@@ -609,7 +609,7 @@ void printMethods(std::ostream & o,
o << ')'; o << ')';
printExceptionSpecification(o, options, manager, reader, method); printExceptionSpecification(o, options, manager, reader, method);
if (body) { if (body) {
static OUString s(RTL_CONSTASCII_USTRINGPARAM("void")); static OUString s("void");
if (defaultbody) { if (defaultbody) {
o << "\n{\n"; o << "\n{\n";
if (!reader.getMethodReturnTypeName(method).equals(s)) { if (!reader.getMethodReturnTypeName(method).equals(s)) {

View File

@@ -402,8 +402,7 @@ OString checkPropertyHelper(
bool checkXComponentSupport(TypeManager const & manager, bool checkXComponentSupport(TypeManager const & manager,
typereg::Reader const & reader) typereg::Reader const & reader)
{ {
static OUString s(RTL_CONSTASCII_USTRINGPARAM( static OUString s( "com/sun/star/lang/XComponent");
"com/sun/star/lang/XComponent"));
if ( reader.getTypeName().equals(s) ) if ( reader.getTypeName().equals(s) )
return true; return true;
@@ -456,8 +455,7 @@ sal_uInt16 checkAdditionalPropertyFlags(typereg::Reader const & reader,
sal_uInt16 flags = 0; sal_uInt16 flags = 0;
bool getterSupportsUnknown = false; bool getterSupportsUnknown = false;
OUString su(RTL_CONSTASCII_USTRINGPARAM( OUString su( "com/sun/star/beans/UnknownPropertyException");
"com/sun/star/beans/UnknownPropertyException"));
if ( method < reader.getMethodCount() if ( method < reader.getMethodCount()
&& reader.getMethodFlags(method) == RT_MODE_ATTRIBUTE_GET && reader.getMethodFlags(method) == RT_MODE_ATTRIBUTE_GET
&& reader.getMethodName(method) == reader.getFieldName(field) ) && reader.getMethodName(method) == reader.getFieldName(field) )
@@ -477,8 +475,7 @@ sal_uInt16 checkAdditionalPropertyFlags(typereg::Reader const & reader,
&& reader.getMethodName(method) == reader.getFieldName(field) ) && reader.getMethodName(method) == reader.getFieldName(field) )
{ {
if ( reader.getMethodExceptionCount(method) > 0 ) { if ( reader.getMethodExceptionCount(method) > 0 ) {
OUString s(RTL_CONSTASCII_USTRINGPARAM( OUString s( "com/sun/star/beans/PropertyVetoException");
"com/sun/star/beans/PropertyVetoException"));
for ( sal_uInt16 i = 0; i < reader.getMethodExceptionCount(method); for ( sal_uInt16 i = 0; i < reader.getMethodExceptionCount(method);
++i ) ++i )
{ {
@@ -670,9 +667,9 @@ void generateFunctionParamterMap(std::ostream& o,
for ( sal_uInt16 p = 0; p < reader.getMethodParameterCount(m); ++p ) { for ( sal_uInt16 p = 0; p < reader.getMethodParameterCount(m); ++p ) {
if ( options.language == 2 ) { if ( options.language == 2 ) {
o << " fpm[" << p o << " fpm[" << p
<< "] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"" << "] = ::rtl::OUString(\""
<< codemaker::convertString(reader.getMethodParameterName(m, p)) << codemaker::convertString(reader.getMethodParameterName(m, p))
<< "\"));\n"; << "\");\n";
} }
else { else {
if ( options.java5 ) if ( options.java5 )
@@ -689,8 +686,8 @@ void generateFunctionParamterMap(std::ostream& o,
} }
if ( options.language == 2 ) { if ( options.language == 2 ) {
o << " m_functionMap[::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(\"" o << " m_functionMap[::rtl::OUString(\""
<< sMethod << "\"))] = fpm;\n\n"; << sMethod << "\")] = fpm;\n\n";
} }
else { else {
o << " m_functionMap.put(\"" << sMethod << "\", fpm);\n\n"; o << " m_functionMap.put(\"" << sMethod << "\", fpm);\n\n";