Implement LowerFirstLetter at dali-csharp-binder 72/323372/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 28 Apr 2025 01:56:30 +0000 (10:56 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Mon, 28 Apr 2025 02:00:44 +0000 (11:00 +0900)
Since C# is not allow to change low-string without additional memory,
we'd better implement it at native side.

Change-Id: I681d94c8d597ee306673ccb0c5b42b25021ab747
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-csharp-binder/common/dali-wrap.cpp

index e28c3cfa2a59d8c4c237eb83a34245f1bd0ac731..662069a6c8156d52b14bbadaeb42c1c2ee9023b6 100644 (file)
 
 #include <dali-toolkit/devel-api/focus-manager/keyboard-focus-manager-devel.h>
 
+namespace
+{
+inline void LowerFirstLetter(std::string& str)
+{
+  if(str.size() > 0)
+  {
+    if(!(str[0] >= 'a' && str[0] <='z') &&
+        (str[0] < 'A' || str[0] > 'Z'))
+    {
+      // For debug. Some application input non-alphabet as name. We should defect and fix it.
+      DALI_LOG_ERROR("Input argument string not start with alphabet! : %s\n", str.c_str());
+    }
+    str[0] |= 0x20;
+  }
+}
+}
+
 
 SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
   { SWIG_CSharpApplicationException, NULL },
@@ -4863,8 +4880,12 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_new_Property__SWIG_2(void * jarg1, cha
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
     return 0;
   }
-  std::string arg2_str(jarg2);
-  arg2 = &arg2_str;
+  std::string arg2String(jarg2);
+
+  // NUI role! We should use lowercaseString here!
+  LowerFirstLetter(arg2String);
+
+  arg2 = &arg2String;
   {
     try {
       result = (Dali::Property *)new Dali::Property(*arg1,(std::string const &)*arg2);
@@ -8473,8 +8494,12 @@ SWIGEXPORT int SWIGSTDCALL CSharp_Dali_Handle_GetPropertyIndex(void * jarg1, cha
     SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
     return 0;
   }
-  std::string arg2_str(jarg2);
-  arg2 = &arg2_str;
+  std::string arg2String(jarg2);
+
+  // NUI role! We should use lowercaseString here!
+  LowerFirstLetter(arg2String);
+
+  arg2 = &arg2String;
   {
     try {
       result = (Dali::Property::Index)((Dali::Handle const *)arg1)->GetPropertyIndex((std::string const &)*arg2);