Kaydet (Commit) e2931bce authored tarafından Noel Grandin's avatar Noel Grandin

convert RTMethodMode to scoped enum

Change-Id: I81599570698eb92abf14fa6386d8545c2031e863
üst 0833143c
......@@ -302,7 +302,7 @@ bool AstService::dump(RegistryKey& rKey)
}
if (m_defaultConstructor) {
writer.setMethodData(
constructorIndex++, emptyStr, RT_MODE_TWOWAY,
constructorIndex++, emptyStr, RTMethodMode::TWOWAY,
emptyStr, OUString("void"),
0, 0);
}
......@@ -374,10 +374,10 @@ bool AstAttribute::dumpBlob(
OStringToOUString(getType()->getRelativName(), RTL_TEXTENCODING_UTF8),
RTConstValue());
dumpExceptions(
rBlob, m_getDocumentation, m_getExceptions, RT_MODE_ATTRIBUTE_GET,
rBlob, m_getDocumentation, m_getExceptions, RTMethodMode::ATTRIBUTE_GET,
methodIndex);
dumpExceptions(
rBlob, m_setDocumentation, m_setExceptions, RT_MODE_ATTRIBUTE_SET,
rBlob, m_setDocumentation, m_setExceptions, RTMethodMode::ATTRIBUTE_SET,
methodIndex);
return true;
......
......@@ -42,7 +42,7 @@ bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index)
{
sal_uInt16 nParam = getNodeCount(NT_parameter);
sal_uInt16 nExcep = nExceptions();
RTMethodMode methodMode = RT_MODE_TWOWAY;
RTMethodMode methodMode = RTMethodMode::TWOWAY;
OUString returnTypeName;
if (m_pReturnType == 0) {
......
......@@ -232,21 +232,21 @@ union RTConstValueUnion {
A method can be synchron or asynchron (oneway). The const attribute for
methods was removed so that the const values are deprecated.
*/
enum RTMethodMode {
enum class RTMethodMode {
/// indicates an invalid mode
RT_MODE_INVALID,
INVALID,
/// indicates the asynchronous mode of a method
RT_MODE_ONEWAY,
ONEWAY,
/// @deprecated
RT_MODE_ONEWAY_CONST,
ONEWAY_CONST,
/// indicated the synchronous mode of a method
RT_MODE_TWOWAY,
TWOWAY,
/// @deprecated
RT_MODE_TWOWAY_CONST,
TWOWAY_CONST,
/**
Indicates an extended attribute getter (that has a 'raises' clause) of an
......@@ -254,7 +254,7 @@ enum RTMethodMode {
@since UDK 3.2.0
*/
RT_MODE_ATTRIBUTE_GET,
ATTRIBUTE_GET,
/**
Indicates an extended attribute setter (that has a 'raises' clause) of an
......@@ -262,7 +262,7 @@ enum RTMethodMode {
@since UDK 3.2.0
*/
RT_MODE_ATTRIBUTE_SET
ATTRIBUTE_SET
};
/** specifies the mode of a parameter.
......
......@@ -1132,7 +1132,7 @@ const sal_Char* MethodList::getMethodReturnType(sal_uInt16 index)
RTMethodMode MethodList::getMethodMode(sal_uInt16 index)
{
RTMethodMode aMode = RT_MODE_INVALID;
RTMethodMode aMode = RTMethodMode::INVALID;
if ((m_numOfEntries > 0) && (index <= m_numOfEntries))
{
......@@ -1730,7 +1730,7 @@ RTMethodMode TYPEREG_CALLTYPE typereg_reader_getMethodFlags(void * hEntry, sal_u
{
TypeRegistryEntry* pEntry = static_cast<TypeRegistryEntry*>(hEntry);
if (pEntry == NULL) return RT_MODE_INVALID;
if (pEntry == NULL) return RTMethodMode::INVALID;
return pEntry->m_pMethods->getMethodMode(index);
}
......
......@@ -538,7 +538,7 @@ protected:
};
MethodEntry::MethodEntry()
: m_mode(RT_MODE_INVALID)
: m_mode(RTMethodMode::INVALID)
, m_paramCount(0)
, m_params(NULL)
, m_excCount(0)
......
......@@ -294,19 +294,19 @@ void dumpType(typereg::Reader const & reader, OString const & indent) {
printf("\n");
printf("%s flags: ", indent.getStr());
switch (reader.getMethodFlags(i)) {
case RT_MODE_ONEWAY:
case RTMethodMode::ONEWAY:
printf("oneway");
break;
case RT_MODE_TWOWAY:
case RTMethodMode::TWOWAY:
printf("synchronous");
break;
case RT_MODE_ATTRIBUTE_GET:
case RTMethodMode::ATTRIBUTE_GET:
printf("attribute get");
break;
case RT_MODE_ATTRIBUTE_SET:
case RTMethodMode::ATTRIBUTE_SET:
printf("attribute set");
break;
......
......@@ -235,7 +235,7 @@ void test_coreReflection()
OUString("DummyFile"), RTFieldAccess::CONST, aConst);
writer.setMethodData(0, OUString("methodA"),
OUString("double"), RT_MODE_TWOWAY, 2, 1,
OUString("double"), RTMethodMode::TWOWAY, 2, 1,
OUString("Hallo ich bin die methodA"));
writer.setParamData(0, 0, OUString("ModuleA/StructA"),
OUString("aStruct"), RT_PARAM_IN);
......
......@@ -700,13 +700,13 @@ static char const * getMethodMode(RTMethodMode methodMode)
{
switch ( methodMode )
{
case RT_MODE_ONEWAY:
case RTMethodMode::ONEWAY:
return "ONEWAY";
case RT_MODE_ONEWAY_CONST:
case RTMethodMode::ONEWAY_CONST:
return "ONEWAY,CONST";
case RT_MODE_TWOWAY:
case RTMethodMode::TWOWAY:
return "NONE";
case RT_MODE_TWOWAY_CONST:
case RTMethodMode::TWOWAY_CONST:
return "CONST";
default:
return "INVALID";
......
......@@ -258,7 +258,7 @@ rtl::Reference< Entity > readEntity(
for (sal_uInt16 k = 0; k != methodCount; ++k) {
if (reader.getMethodName(k) == attrName) {
switch (reader.getMethodFlags(k)) {
case RT_MODE_ATTRIBUTE_GET:
case RTMethodMode::ATTRIBUTE_GET:
{
sal_uInt16 m
= reader.getMethodExceptionCount(k);
......@@ -272,7 +272,7 @@ rtl::Reference< Entity > readEntity(
}
break;
}
case RT_MODE_ATTRIBUTE_SET:
case RTMethodMode::ATTRIBUTE_SET:
{
sal_uInt16 m
= reader.getMethodExceptionCount(k);
......@@ -307,8 +307,8 @@ rtl::Reference< Entity > readEntity(
std::vector< InterfaceTypeEntity::Method > meths;
for (sal_uInt16 j = 0; j != methodCount; ++j) {
RTMethodMode flags = reader.getMethodFlags(j);
if (flags != RT_MODE_ATTRIBUTE_GET
&& flags != RT_MODE_ATTRIBUTE_SET)
if (flags != RTMethodMode::ATTRIBUTE_GET
&& flags != RTMethodMode::ATTRIBUTE_SET)
{
std::vector< InterfaceTypeEntity::Method::Parameter >
params;
......@@ -598,7 +598,7 @@ rtl::Reference< Entity > readEntity(
std::vector< SingleInterfaceBasedServiceEntity::Constructor >
ctors;
sal_uInt16 n = reader.getMethodCount();
if (n == 1 && reader.getMethodFlags(0) == RT_MODE_TWOWAY
if (n == 1 && reader.getMethodFlags(0) == RTMethodMode::TWOWAY
&& reader.getMethodName(0).isEmpty()
&& reader.getMethodReturnTypeName(0) == "void"
&& reader.getMethodParameterCount(0) == 0
......@@ -608,11 +608,11 @@ rtl::Reference< Entity > readEntity(
SingleInterfaceBasedServiceEntity::Constructor());
} else {
for (sal_uInt16 j = 0; j != n; ++j) {
if (reader.getMethodFlags(j) != RT_MODE_TWOWAY) {
if (reader.getMethodFlags(j) != RTMethodMode::TWOWAY) {
throw FileFormatException(
key.getRegistryName(),
("legacy format: unexpected mode "
+ OUString::number(reader.getMethodFlags(j))
+ OUString::number(static_cast<int>(reader.getMethodFlags(j)))
+ " of constructor " + reader.getMethodName(j)
+ " in service with key " + sub.getName()));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment