< prev index next >

modules/fxpackager/src/main/native/library/common/Helpers.cpp

Print this page
rev 9619 : imported patch 9-jake-fxpackager.patch

@@ -293,5 +293,45 @@
         result = name + TString(_T("=")) + value;
     }
 
     return result;
 }
+
+std::list<TString> Helpers::StringToArray(TString Value) {
+    std::list<TString> result;
+    TString line;
+
+    for (int index = 0; index < Value.length(); index++) {
+        TCHAR c = Value[index];
+
+//        Environment::NewLine;
+
+        switch (c) {
+            case '\n': {
+                result.push_back(line);
+                line = _T("");
+                break;
+            }
+
+            case '\r': {
+                result.push_back(line);
+                line = _T("");
+
+                if (Value[index + 1] == '\n')
+                    index++;
+
+                break;
+            }
+
+            default: {
+                line += c;
+            }
+        }
+    }
+
+    // The buffer may not have ended with a Carriage Return/Line Feed.
+    if (line.length() > 0) {
+        result.push_back(line);
+    }
+
+    return result;
+}
\ No newline at end of file
< prev index next >