[mapguide-commits] r1348 - trunk/MgDev/Common/Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Mar 22 14:17:56 EDT 2007


Author: traianstanev
Date: 2007-03-22 14:17:56 -0400 (Thu, 22 Mar 2007)
New Revision: 1348

Modified:
   trunk/MgDev/Common/Stylization/FilterExecutor.cpp
Log:
Add string length function to expression engine. It's called Length() and is case sEnsItIvE!!!

Modified: trunk/MgDev/Common/Stylization/FilterExecutor.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/FilterExecutor.cpp	2007-03-22 18:17:17 UTC (rev 1347)
+++ trunk/MgDev/Common/Stylization/FilterExecutor.cpp	2007-03-22 18:17:56 UTC (rev 1348)
@@ -433,6 +433,24 @@
 
         m_retvals.push(m_pPool->ObtainStringValue(res, true));
     }
+    else if (wcscmp(name, L"Length") == 0)//From now on, functions need to be case sensitive for FDO compatibility
+    {
+        FdoPtr<FdoExpressionCollection> args = expr.GetArguments();
+
+        if (args->GetCount() != 1)
+            throw FdoException::Create(L"Invalid number of arguments.");
+
+        FdoPtr<FdoExpression> arg = args->GetItem(0);
+        arg->Process(this);
+
+        DataValue* argVal = m_retvals.pop();
+
+        size_t len = wcslen(argVal->GetAsString());
+
+        m_pPool->RelinquishDataValue(argVal);
+
+        m_retvals.push(m_pPool->ObtainInt64Value(len));
+    }
     else if (_wcsnicmp(name, L"SESSION", 7) == 0)
     {
         ExecuteSession(expr);



More information about the mapguide-commits mailing list