Share ArrayString and Str helper methods.

Placing these string helper methods allows us to re-use them in
the relevant place of the shader translator.

BUG=angle:466

Change-Id: Idd638542027d3b1035bc79fc941e80bf436c82af
Reviewed-on: https://chromium-review.googlesource.com/206567
Reviewed-by: Nicolas Capens <capn@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/common/angleutils.h b/src/common/angleutils.h
index 1cec920..ec9afe8 100644
--- a/src/common/angleutils.h
+++ b/src/common/angleutils.h
@@ -14,6 +14,7 @@
 #include <stddef.h>
 #include <string>
 #include <set>
+#include <sstream>
 
 // A macro to disallow the copy constructor and operator= functions
 // This must be used in the private: declarations for a class
@@ -115,6 +116,31 @@
     return strings.insert(str).first->c_str();
 }
 
+inline std::string ArrayString(unsigned int i)
+{
+    // We assume UINT_MAX and GL_INVALID_INDEX are equal
+    // See DynamicHLSL.cpp
+    if (i == UINT_MAX)
+    {
+        return "";
+    }
+
+    std::stringstream strstr;
+
+    strstr << "[";
+    strstr << i;
+    strstr << "]";
+
+    return strstr.str();
+}
+
+inline std::string Str(int i)
+{
+    std::stringstream strstr;
+    strstr << i;
+    return strstr.str();
+}
+
 #if defined(_MSC_VER)
 #define snprintf _snprintf
 #endif