[mapguide-commits] r10170 - branches/4.0/MgDev/Bindings/src/IMake

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sat Aug 9 12:54:47 PDT 2025


Author: jng
Date: 2025-08-09 12:54:47 -0700 (Sat, 09 Aug 2025)
New Revision: 10170

Modified:
   branches/4.0/MgDev/Bindings/src/IMake/IMake.cpp
Log:
IMake improvements:
 - Be smarter about linkifying Mg class references. If the "Mg" search is preceded by an alphabetical char, it is obviously not a Mg class name and no linkification should proceed.
 - Fix case where closing </summary> was not being written

Modified: branches/4.0/MgDev/Bindings/src/IMake/IMake.cpp
===================================================================
--- branches/4.0/MgDev/Bindings/src/IMake/IMake.cpp	2025-08-09 18:55:08 UTC (rev 10169)
+++ branches/4.0/MgDev/Bindings/src/IMake/IMake.cpp	2025-08-09 19:54:47 UTC (rev 10170)
@@ -14,7 +14,7 @@
     java
 };
 
-static char version[] = "1.6.0";
+static char version[] = "1.6.1";
 static char EXTERNAL_API_DOCUMENTATION[] = "(NOTE: This API is not officially supported and may be subject to removal in a future release without warning. Use with caution.)";
 
 static string module;
@@ -576,10 +576,14 @@
 
 bool stringReplace(string& str, const string& find, const string& replace)
 {
-    size_t start_pos = str.find(find);
-    if(start_pos == string::npos)
+    if (find.empty())
         return false;
-    str.replace(start_pos, find.length(), replace);
+
+    size_t start_pos = 0;
+    while ((start_pos = str.find(find, start_pos)) != string::npos) {
+        str.replace(start_pos, find.length(), replace);
+        start_pos += replace.length(); // Move past the replaced text
+    }
     return true;
 }
 
@@ -636,6 +640,15 @@
         //TODO: Resolve :: to member links. Right now it just linkifies the Mg class name
         size_t idx = elems[i].find("Mg");
         if (idx != std::string::npos) {
+            // Don't proceed if our found "Mg" string is preceded by an alphabetical char, implying
+            // it is part of something else that shouldn't be linkfied. (eg. Doc for a parameter named
+            // "sMgrs" should be skipped), for such cases, just output the original element as-is.
+            if (idx > 0) {
+                if (isalpha(elems[i][idx - 1])) {
+                    output.append(elems[i]);
+                    continue;
+                }
+            }
             std::string prefix;
             std::string mgClassName;
             std::string suffix;
@@ -1054,8 +1067,9 @@
             csharpDoc.append(EXTERNAL_API_DOCUMENTATION);
             csharpDoc.append("\n");
         } else {
-            csharpDoc.append("///TODO: API Documentation is missing or failed to translate doxygen brief directive (message inserted by IMake.exe)\n///</summary>\n");
+            csharpDoc.append("///TODO: API Documentation is missing or failed to translate doxygen brief directive (message inserted by IMake.exe)\n");
         }
+        csharpDoc.append("///</summary>\n");
     }
 
     if (paramParts.size() > 0) {



More information about the mapguide-commits mailing list