[Shader Generator] using Raw String Literal 44/278644/2
authorAli Alzyod <ali198724@gmail.com>
Sat, 23 Jul 2022 12:27:45 +0000 (15:27 +0300)
committerAli Alzyoud <ali198724@gmail.com>
Mon, 25 Jul 2022 06:20:38 +0000 (06:20 +0000)
Using Raw String Literal to generate shader files.
This will simplify the file layout and will fix some compilation warnings about missing terminating strings.

Change-Id: I784bf595f18f9c1fb404e8e818317cc91dd19103

dali-toolkit/shader-generator/shader-generator.cpp

index d386fb3..a88333c 100644 (file)
@@ -144,11 +144,13 @@ void GenerateHeaderFile(
             << endl;
     outFile << "const std::string_view " << shaderVariableName << endl;
     outFile << "{" << endl;
             << endl;
     outFile << "const std::string_view " << shaderVariableName << endl;
     outFile << "{" << endl;
+    outFile << "R\"(" << endl;
     string line;
     while(getline(shaderFile, line))
     {
     string line;
     while(getline(shaderFile, line))
     {
-      outFile << "\"" << line << "\\n\"" << endl;
+      outFile << line << endl;
     }
     }
+    outFile << ")\"" << endl;
     outFile << "};" << endl;
     cout << " [OK]" << endl;
   }
     outFile << "};" << endl;
     cout << " [OK]" << endl;
   }