Removed last RTL_CONST* macros from codemaker

Also, change ".equals" fro "==" and drop a useless function.

Change-Id: I5ce4fd2cc7c62a18e059e945b42cc01425802aa0
Reviewed-on: https://gerrit.libreoffice.org/2605
Reviewed-by: Olivier Hallot <olivier.hallot@alta.org.br>
Tested-by: Olivier Hallot <olivier.hallot@alta.org.br>
This commit is contained in:
Marcos Paulo de Souza
2013-03-08 14:17:51 -03:00
committed by Olivier Hallot
parent d7ca9b5cbc
commit 9edeb948a2
7 changed files with 60 additions and 80 deletions

View File

@@ -62,10 +62,6 @@ rtl::OString convertString(rtl::OUString const & string) {
return s;
}
OString errorMsg(OString const & desc, OString const & type) {
return desc + type;
}
codemaker::UnoType::Sort decomposeAndResolve(
TypeManager const & manager, rtl::OString const & type,
bool resolveTypedefs, bool allowVoid, bool allowExtraEntities,
@@ -78,7 +74,7 @@ codemaker::UnoType::Sort decomposeAndResolve(
sal_Int32 n = 0;
*name = codemaker::UnoType::decompose(t, &n, arguments);
if (n > SAL_MAX_INT32 - *rank) {
throw CannotDumpException(errorMsg("Bad type information: ", type));
throw CannotDumpException("Bad type information: " + type);
//TODO
}
*rank += n;
@@ -90,7 +86,7 @@ codemaker::UnoType::Sort decomposeAndResolve(
switch (sort) {
case codemaker::UnoType::SORT_VOID:
if (!allowVoid) {
throw CannotDumpException( errorMsg("Bad type information: ", type));
throw CannotDumpException("Bad type information: " + type);
//TODO
}
default:
@@ -113,7 +109,7 @@ codemaker::UnoType::Sort decomposeAndResolve(
|| (static_cast< sal_uInt16 >(arguments->size())
!= reader.getReferenceCount())))
{
throw CannotDumpException(errorMsg("Bad type information: ", type));
throw CannotDumpException("Bad type information: " + type);
//TODO
}
return sort;
@@ -124,7 +120,7 @@ codemaker::UnoType::Sort decomposeAndResolve(
case RT_TYPE_SINGLETON:
case RT_TYPE_CONSTANTS:
if (!allowExtraEntities) {
throw CannotDumpException(errorMsg("Bad type information: ", type));
throw CannotDumpException("Bad type information: " + type);
//TODO
}
checkNoTypeArguments(*arguments);
@@ -146,7 +142,7 @@ codemaker::UnoType::Sort decomposeAndResolve(
}
}
default:
throw CannotDumpException(errorMsg("Bad type information: ", type));
throw CannotDumpException("Bad type information: " + type);
//TODO
}
}

View File

@@ -56,35 +56,35 @@ sal_Int32 TypeManager::release()
sal_Bool TypeManager::isBaseType(const ::rtl::OString& name)
{
if ( name.equals(OString("short")) )
if ( name == "short" )
return sal_True;
if ( name.equals(OString("unsigned short")) )
if ( name == "unsigned short" )
return sal_True;
if ( name.equals(OString("long")) )
if ( name == "long" )
return sal_True;
if ( name.equals(OString("unsigned long")) )
if ( name == "unsigned long" )
return sal_True;
if ( name.equals(OString("hyper")) )
if ( name == "hyper" )
return sal_True;
if ( name.equals(OString("unsigned hyper")) )
if ( name == "unsigned hyper" )
return sal_True;
if ( name.equals(OString("string")) )
if ( name == "string" )
return sal_True;
if ( name.equals(OString("boolean")) )
if ( name == "boolean" )
return sal_True;
if ( name.equals(OString("char")) )
if ( name == "char" )
return sal_True;
if ( name.equals(OString("byte")) )
if ( name == "byte" )
return sal_True;
if ( name.equals(OString("any")) )
if ( name == "any" )
return sal_True;
if ( name.equals(OString("type")) )
if ( name == "type" )
return sal_True;
if ( name.equals(OString("float")) )
if ( name == "float" )
return sal_True;
if ( name.equals(OString("double")) )
if ( name == "double" )
return sal_True;
if ( name.equals(OString("void")) )
if ( name == "void" )
return sal_True;
return sal_False;
@@ -355,10 +355,10 @@ RegistryKeyList RegistryTypeManager::getTypeKeys(const ::rtl::OString& name_) co
{
RegistryKeyList keyList= RegistryKeyList();
OString tmpName;
if ( name_.equals("/") || name_.equals(m_pImpl->m_base) ) {
if ( name_ == "/" || name_ == m_pImpl->m_base ) {
tmpName = m_pImpl->m_base;
} else {
if ( m_pImpl->m_base.equals("/") )
if ( m_pImpl->m_base == "/" )
tmpName = name_;
else
tmpName = m_pImpl->m_base + "/" + name_;

View File

@@ -187,7 +187,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
if (tmpName == "*")
{
// produce this type and his scope
if (typeName.equals("*"))
if (typeName == "*")
{
tmpName = "/";
} else

View File

@@ -136,7 +136,7 @@ bool isBootstrapType(rtl::OString const & name) {
"com/sun/star/util/XMacroExpander"
}; // cf. cppuhelper/unotypes/Makefile UNOTYPES (plus missing dependencies)
for (std::size_t i = 0; i < SAL_N_ELEMENTS(names); ++i) {
if (name.equals(names[i])) {
if (name == names[i]) {
return true;
}
}
@@ -315,7 +315,7 @@ sal_Bool CppuType::dumpFile(CppuOptions* pOptions,
OString sTmpExt(".tml");
sal_Bool bHdl = sal_True; ;
if (sExtension.equals(".hpp")) {
if (sExtension == ".hpp") {
sTmpExt = ".tmp";
bHdl = sal_False;
}
@@ -389,7 +389,7 @@ void CppuType::dumpDependedTypes(
OString CppuType::dumpHeaderDefine(
FileStream& o, char const * prefix, sal_Bool bExtended)
{
if (m_typeName.equals("/"))
if (m_typeName == "/")
{
bExtended = sal_False;
m_typeName = "global";
@@ -535,7 +535,7 @@ void CppuType::dumpHFileContent(
}
void CppuType::dumpGetCppuType(FileStream & out) {
if (m_typeName.equals("com/sun/star/uno/XInterface")) {
if (m_typeName == "com/sun/star/uno/XInterface") {
out << indent()
<< ("inline ::com::sun::star::uno::Type const & SAL_CALL"
" getCppuType(SAL_UNUSED_PARAMETER ");
@@ -547,7 +547,7 @@ void CppuType::dumpGetCppuType(FileStream & out) {
" >::get();\n");
dec();
out << indent() << "}\n";
} else if (m_typeName.equals("com/sun/star/uno/Exception")) {
} else if (m_typeName == "com/sun/star/uno/Exception") {
out << indent()
<< ("inline ::com::sun::star::uno::Type const & SAL_CALL"
" getCppuType(SAL_UNUSED_PARAMETER ");
@@ -604,7 +604,7 @@ void CppuType::dumpNormalGetCppuType(FileStream& o)
sal_Bool bIsBaseException = sal_False;
if (!superType.isEmpty())
{
if ( superType.equals("com/sun/star/uno/Exception") )
if ( superType == "com/sun/star/uno/Exception" )
{
bIsBaseException = sal_True;
} else
@@ -953,35 +953,35 @@ OString CppuType::getTypeClass(const OString& type, sal_Bool bCStyle)
return bCStyle ? "typelib_TypeClass_SERVICE" : "::com::sun::star::uno::TypeClass_SERVICE";
case RT_TYPE_INVALID:
{
if (type.equals("long"))
if (type == "long")
return bCStyle ? "typelib_TypeClass_LONG" : "::com::sun::star::uno::TypeClass_LONG";
if (type.equals("short"))
if (type == "short")
return bCStyle ? "typelib_TypeClass_SHORT" : "::com::sun::star::uno::TypeClass_SHORT";
if (type.equals("hyper"))
if (type == "hyper")
return bCStyle ? "typelib_TypeClass_HYPER" : "::com::sun::star::uno::TypeClass_HYPER";
if (type.equals("string"))
if (type == "string")
return bCStyle ? "typelib_TypeClass_STRING" : "::com::sun::star::uno::TypeClass_STRING";
if (type.equals("boolean"))
if (type == "boolean")
return bCStyle ? "typelib_TypeClass_BOOLEAN" : "::com::sun::star::uno::TypeClass_BOOLEAN";
if (type.equals("char"))
if (type == "char")
return bCStyle ? "typelib_TypeClass_CHAR" : "::com::sun::star::uno::TypeClass_CHAR";
if (type.equals("byte"))
if (type == "byte")
return bCStyle ? "typelib_TypeClass_BYTE" : "::com::sun::star::uno::TypeClass_BYTE";
if (type.equals("any"))
if (type == "any")
return bCStyle ? "typelib_TypeClass_ANY" : "::com::sun::star::uno::TypeClass_ANY";
if (type.equals("type"))
if (type == "type")
return bCStyle ? "typelib_TypeClass_TYPE" : "::com::sun::star::uno::TypeClass_TYPE";
if (type.equals("float"))
if (type == "float")
return bCStyle ? "typelib_TypeClass_FLOAT" : "::com::sun::star::uno::TypeClass_FLOAT";
if (type.equals("double"))
if (type == "double")
return bCStyle ? "typelib_TypeClass_DOUBLE" : "::com::sun::star::uno::TypeClass_DOUBLE";
if (type.equals("void"))
if (type == "void")
return bCStyle ? "typelib_TypeClass_VOID" : "::com::sun::star::uno::TypeClass_VOID";
if (type.equals("unsigned long"))
if (type == "unsigned long")
return bCStyle ? "typelib_TypeClass_UNSIGNED_LONG" : "::com::sun::star::uno::TypeClass_UNSIGNED_LONG";
if (type.equals("unsigned short"))
if (type == "unsigned short")
return bCStyle ? "typelib_TypeClass_UNSIGNED_SHORT" : "::com::sun::star::uno::TypeClass_UNSIGNED_SHORT";
if (type.equals("unsigned hyper"))
if (type == "unsigned hyper")
return bCStyle ? "typelib_TypeClass_UNSIGNED_HYPER" : "::com::sun::star::uno::TypeClass_UNSIGNED_HYPER";
}
break;
@@ -1521,7 +1521,7 @@ void InterfaceType::dumpMethods(FileStream& o)
m_reader.getMethodReturnTypeName(i), RTL_TEXTENCODING_UTF8);
paramCount = m_reader.getMethodParameterCount(i);
if ( methodName.equals("acquire") || methodName.equals("release") )
if ( methodName == "acquire" || methodName == "release" )
{
bWithRunTimeExcp = sal_False;
}
@@ -2051,7 +2051,7 @@ void InterfaceType::dumpCppuMethods(FileStream& o, sal_uInt32& index)
sal_True);
paramCount = m_reader.getMethodParameterCount(i);
if ( methodName.equals("acquire") || methodName.equals("release") )
if ( methodName == "acquire" || methodName == "release" )
{
bWithRuntimeException = sal_False;
}
@@ -2454,7 +2454,7 @@ bool ModuleType::dumpFiles(
CppuOptions * options, rtl::OString const & outPath)
{
rtl::OString tmpName(m_typeName);
if (tmpName.equals("/")) {
if (tmpName == "/") {
tmpName = "global";
} else {
tmpName += "/" + m_typeName.copy(m_typeName.lastIndexOf('/') + 1);
@@ -2937,8 +2937,8 @@ void StructureType::dumpComprehensiveGetCppuType(FileStream & out)
inc();
if (isPolymorphic()) {
out << indent() << "::rtl::OUStringBuffer the_buffer;\n" << indent()
<< "the_buffer.appendAscii(RTL_CONSTASCII_STRINGPARAM(\""
<< m_typeName.replace('/', '.') << "<\"));\n";
<< "the_buffer.append(\""
<< m_typeName.replace('/', '.') << "<\");\n";
sal_uInt16 n = m_reader.getReferenceCount();
for (sal_uInt16 i = 0; i < n; ++i) {
out << indent()
@@ -3321,7 +3321,7 @@ void ExceptionType::dumpDeclaration(FileStream& o)
dumpType(o, fieldType);
o << " " << fieldName;
if (i == 0 && !superType.isEmpty() &&
!fieldType.equals("double") && !fieldType.equals("hyper") && !fieldType.equals("unsigned hyper"))
!(fieldType == "double") && !(fieldType == "hyper") && !(fieldType == "unsigned hyper"))
{
o << " CPPU_GCC3_ALIGN( " << scopedCppName(superType) << " )";
}
@@ -4289,7 +4289,7 @@ bool produceType(const OString& typeName,
CppuOptions* pOptions)
throw( CannotDumpException )
{
if (typeName.equals("/") || typeName.equals(typeMgr.getBase()) ||
if (typeName == "/" || typeName == typeMgr.getBase() ||
TypeManager::isBaseType(typeName) || generated.contains(typeName))
{
return true;
@@ -4425,7 +4425,7 @@ bool produceType(RegistryKey& rTypeKey, bool bIsExtraType,
{
OString typeName = typeMgr.getTypeName(rTypeKey);
if (typeName.equals("/") ||typeName.equals(typeMgr.getBase()) ||
if (typeName == "/" ||typeName == typeMgr.getBase() ||
TypeManager::isBaseType(typeName) || generated.contains(typeName))
{
return true;

View File

@@ -475,9 +475,7 @@ ClassFile::ClassFile(
m_superClass = addClassInfo(superClass);
if (!signature.isEmpty()) {
++m_attributesCount;
appendU2(
m_attributes,
addUtf8Info(rtl::OString(RTL_CONSTASCII_STRINGPARAM("Signature"))));
appendU2(m_attributes, addUtf8Info("Signature"));
appendU4(m_attributes, 2);
appendU2(m_attributes, addUtf8Info(signature));
}
@@ -582,10 +580,7 @@ void ClassFile::addField(
((constantValueIndex == 0 ? 0 : 1)
+ (signature.isEmpty() ? 0 : 1)));
if (constantValueIndex != 0) {
appendU2(
m_fields,
addUtf8Info(
rtl::OString(RTL_CONSTASCII_STRINGPARAM("ConstantValue"))));
appendU2(m_fields, addUtf8Info("ConstantValue"));
appendU4(m_fields, 2);
appendU2(m_fields, constantValueIndex);
}
@@ -624,9 +619,7 @@ void ClassFile::addMethod(
{
throw CannotDumpException("Code block is too big for Java class file format");
}
appendU2(
m_methods,
addUtf8Info(rtl::OString(RTL_CONSTASCII_STRINGPARAM("Code"))));
appendU2(m_methods, addUtf8Info("Code"));
appendU4(
m_methods,
(2 + 2 + 4 + static_cast< sal_uInt32 >(codeSize) + 2
@@ -640,10 +633,7 @@ void ClassFile::addMethod(
appendU2(m_methods, 0);
}
if (!exceptions.empty()) {
appendU2(
m_methods,
addUtf8Info(
rtl::OString(RTL_CONSTASCII_STRINGPARAM("Exceptions"))));
appendU2(m_methods, addUtf8Info("Exceptions"));
appendU4(
m_methods,
static_cast< sal_uInt32 >(2 + 2 * static_cast< sal_uInt32 >(excs)));
@@ -848,9 +838,7 @@ void ClassFile::appendSignatureAttribute(
std::vector< unsigned char > & stream, rtl::OString const & signature)
{
if (!signature.isEmpty()) {
appendU2(
stream,
addUtf8Info(rtl::OString(RTL_CONSTASCII_STRINGPARAM("Signature"))));
appendU2(stream, addUtf8Info("Signature"));
appendU4(stream, 2);
appendU2(stream, addUtf8Info(signature));
}

View File

@@ -179,7 +179,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
if (tmpName == "*")
{
// produce this type and his scope.
if (typeName.equals("*"))
if (typeName == "*")
{
tmpName = "/";
} else

View File

@@ -2474,9 +2474,7 @@ bool produceType(
codemaker::GeneratedTypeSet & generated, JavaOptions * options)
{
OSL_ASSERT(options != 0);
if (type.equals("/")
|| type.equals(manager.getBase())
|| generated.contains(type))
if (type == "/" || type == manager.getBase() || generated.contains(type))
{
return true;
}
@@ -2548,9 +2546,7 @@ bool produceType(
::rtl::OString typeName = manager.getTypeName(rTypeKey);
OSL_ASSERT(options != 0);
if (typeName.equals("/")
|| typeName.equals(manager.getBase())
|| generated.contains(typeName))
if (typeName == "/" || typeName == manager.getBase() || generated.contains(typeName))
{
return true;
}