X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fsourcemap.cpp;h=b81931e1143dfe24719833444257e7d235adedd5;hb=c4aeeced7b397d46772577775bd3a0d6c4706cba;hp=e74f1b67408367ab2ff2a3a28c6381b6aa54656e;hpb=9d798ac368bfd236a7632a3a15e51bd1112ea63d;p=libs%2Fgl.git diff --git a/source/glsl/sourcemap.cpp b/source/glsl/sourcemap.cpp index e74f1b67..b81931e1 100644 --- a/source/glsl/sourcemap.cpp +++ b/source/glsl/sourcemap.cpp @@ -13,7 +13,7 @@ SourceMap::SourceMap(): base_index(0) { } -void SourceMap::set_name(unsigned i, const std::string &n) +void SourceMap::set_name(unsigned i, const string &n) { if(source_names.empty()) base_index = i; @@ -29,6 +29,16 @@ void SourceMap::set_name(unsigned i, const std::string &n) source_names[i] = n; } +const string &SourceMap::get_name(unsigned i) const +{ + i -= base_index; + if(i lines = split(errors, '\n'); string translated; - for(vector::const_iterator i=lines.begin(); i!=lines.end(); ++i) + for(const string &l: lines) { - RegMatch m = r_message.match(*i); + RegMatch m = r_message.match(l); if(m) { unsigned index = 0; @@ -72,7 +82,7 @@ string SourceMap::translate_errors(const string &errors) const translated += format("%s:%d: %s", src, line, m[6].str); } else - translated += *i; + translated += l; translated += '\n'; }