Original Post
Check out this string literal
t("\xFF")t("\xFF")t("\x00")t("\x00") t("This part is red ") t("\xFF")t("\x00")t("\xFF")t("\x00") t("This part is green");
Yes, I'm embedding an escape sequence for colorizing strings, but what a mess. I've got a lot of these to generate over the course of my project.
Something like this would be cooler
E(FF,00,00) t("This part is red ") E(00,FF,00) t("This part is green");
But I don't see any way to create the E(r,g,b) #define for that. Is it possible? What are some other ideas for escape sequences that would allow me the full range of color values (0-255) for each color channel? Its still early enough that I could change the sequence itself without too much hassle.
Sure, I could create a format string and build a parser
t("#This part is red #This part is green"), 0xFF0000, 0x00FF00
But that requires all my string literals that have escape sequences to be parsed at run-time.
I could build a parser that processed my source files before they are compiled, but that's a nightmare waiting to happen. Not the work to build the parser, that's simple enough, but the potential for failing to get files parsed as the years go by and not being able to check out every instance of a literal as it should appear in my engine.
Any thoughts are welcome.
* edited for formatting
[edited by - Tergiver on March 31, 2004 11:11:33 PM]