Don't expose ucstring to Lua, unless compatibility flag is set

develop
kaetemi 4 years ago
parent 0d2633b697
commit 2444d94f4f

@ -42,9 +42,13 @@ namespace NLGUI
UInt32, UInt32,
Float, Float,
String, String,
#ifdef RYZOM_LUA_UCSTRING
UCString, UCString,
#endif
StringRef, StringRef,
#ifdef RYZOM_LUA_UCSTRING
UCStringRef, UCStringRef,
#endif
RGBA, RGBA,
LuaMethod LuaMethod
}; // other types will be added when needed }; // other types will be added when needed
@ -79,9 +83,13 @@ namespace NLGUI
TGetUInt32 GetUInt32; TGetUInt32 GetUInt32;
TGetFloat GetFloat; TGetFloat GetFloat;
TGetString GetString; TGetString GetString;
#ifdef RYZOM_LUA_UCSTRING
TGetUCString GetUCString; TGetUCString GetUCString;
#endif
TGetStringRef GetStringRef; TGetStringRef GetStringRef;
#ifdef RYZOM_LUA_UCSTRING
TGetUCStringRef GetUCStringRef; TGetUCStringRef GetUCStringRef;
#endif
TGetRGBA GetRGBA; TGetRGBA GetRGBA;
TLuaMethod GetLuaMethod; // lua method can only be obtained, not written ... TLuaMethod GetLuaMethod; // lua method can only be obtained, not written ...
} GetMethod; } GetMethod;
@ -92,7 +100,9 @@ namespace NLGUI
TSetUInt32 SetUInt32; TSetUInt32 SetUInt32;
TSetFloat SetFloat; TSetFloat SetFloat;
TSetString SetString; TSetString SetString;
#ifdef RYZOM_LUA_UCSTRING
TSetUCString SetUCString; TSetUCString SetUCString;
#endif
TSetRGBA SetRGBA; TSetRGBA SetRGBA;
} SetMethod; } SetMethod;
// name of the property // name of the property

@ -553,15 +553,19 @@ namespace NLGUI
case CReflectedProperty::String: case CReflectedProperty::String:
result.setString ((elem->*(pRP->GetMethod.GetString))()); result.setString ((elem->*(pRP->GetMethod.GetString))());
break; break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
result.setString ((elem->*(pRP->GetMethod.GetUCString))().toUtf8()); result.setString ((elem->*(pRP->GetMethod.GetUCString))().toUtf8());
break; break;
#endif
case CReflectedProperty::StringRef: case CReflectedProperty::StringRef:
result.setString ((elem->*(pRP->GetMethod.GetStringRef))()); result.setString ((elem->*(pRP->GetMethod.GetStringRef))());
break; break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCStringRef: case CReflectedProperty::UCStringRef:
result.setString ((elem->*(pRP->GetMethod.GetUCStringRef))().toUtf8()); result.setString ((elem->*(pRP->GetMethod.GetUCStringRef))().toUtf8());
break; break;
#endif
case CReflectedProperty::RGBA: case CReflectedProperty::RGBA:
result.setRGBA ((elem->*(pRP->GetMethod.GetRGBA))()); result.setRGBA ((elem->*(pRP->GetMethod.GetRGBA))());
break; break;

@ -117,18 +117,18 @@ namespace NLGUI
return false; return false;
} }
break; break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
case CReflectedProperty::UCStringRef: case CReflectedProperty::UCStringRef:
#ifdef RYZOM_LUA_UCSTRING
if (valueToAffect.toString()) if (valueToAffect.toString())
{ {
(destElem.*(property.SetMethod.SetUCString))(ucstring::makeFromUtf8(valueToAffect.getString())); (destElem.*(property.SetMethod.SetUCString))(ucstring::makeFromUtf8(valueToAffect.getString()));
} }
else else
#endif
{ {
return false; return false;
} }
#endif
break; break;
case CReflectedProperty::RGBA: case CReflectedProperty::RGBA:
if (valueToAffect.toRGBA()) if (valueToAffect.toRGBA())

@ -1412,6 +1412,7 @@ namespace NLGUI
case CReflectedProperty::String: case CReflectedProperty::String:
ls.push( (reflectedObject.*(property.GetMethod.GetString))() ); ls.push( (reflectedObject.*(property.GetMethod.GetString))() );
break; break;
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
{ {
ucstring str = (reflectedObject.*(property.GetMethod.GetUCString))(); ucstring str = (reflectedObject.*(property.GetMethod.GetUCString))();
@ -1434,6 +1435,7 @@ namespace NLGUI
#endif #endif
} }
break; break;
#endif
case CReflectedProperty::StringRef: case CReflectedProperty::StringRef:
ls.push( (reflectedObject.*(property.GetMethod.GetStringRef))() ); ls.push( (reflectedObject.*(property.GetMethod.GetStringRef))() );
break; break;
@ -1508,6 +1510,7 @@ namespace NLGUI
(target.*(property.SetMethod.SetString))(val); (target.*(property.SetMethod.SetString))(val);
return; return;
} }
#ifdef RYZOM_LUA_UCSTRING
case CReflectedProperty::UCString: case CReflectedProperty::UCString:
case CReflectedProperty::UCStringRef: case CReflectedProperty::UCStringRef:
{ {
@ -1532,6 +1535,7 @@ namespace NLGUI
(target.*(property.SetMethod.SetUCString))(val); (target.*(property.SetMethod.SetUCString))(val);
return; return;
} }
#endif
case CReflectedProperty::RGBA: case CReflectedProperty::RGBA:
{ {
CRGBA color; CRGBA color;

@ -1863,8 +1863,9 @@ string getTarget(CCtrlBase * /* ctrl */, const string &targetName)
return ""; return "";
} }
#ifdef RYZOM_LUA_UCSTRING
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) // TODO: UTF-8 Lua ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName)
{ {
string sTmp = targetName; string sTmp = targetName;
std::vector<CInterfaceLink::CTargetInfo> targetsVector; std::vector<CInterfaceLink::CTargetInfo> targetsVector;
@ -1884,6 +1885,7 @@ ucstring getUCTarget(CCtrlBase * /* ctrl */, const string &targetName) // TODO:
return ((elem->*(pRP->GetMethod.GetUCString))()); return ((elem->*(pRP->GetMethod.GetUCString))());
return ucstring(""); // TODO: UTF-8 Lua return ucstring(""); // TODO: UTF-8 Lua
} }
#endif
/*// Ask the server to rename a character /*// Ask the server to rename a character
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -1955,7 +1957,11 @@ public:
string sDBLink = getParam(Params, "dblink"); string sDBLink = getParam(Params, "dblink");
CharNameValidDBLink = sDBLink; CharNameValidDBLink = sDBLink;
#ifdef RYZOM_LUA_UCSTRING
string sName = getUCTarget(NULL,sTarget).toUtf8(); // TODO: UTF-8 Lua string sName = getUCTarget(NULL,sTarget).toUtf8(); // TODO: UTF-8 Lua
#else
string sName = getTarget(NULL, sTarget);
#endif
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
if (sName.empty()) if (sName.empty())

Loading…
Cancel
Save