Messaging subsystem rewrite, step I
[supertux.git] / src / tinygettext / tinygettext.cpp
index 5ea2c94..424e97c 100644 (file)
@@ -60,9 +60,8 @@ std::string convert(const std::string& text,
   out_len -= out_len_temp; // see above
   if (retval == (size_t) -1)
     {
-      msg_warning(strerror(errno));
-      msg_warning("Error: conversion from " << from_charset
-                << " to " << to_charset << " went wrong: " << retval);
+      msg_warning << strerror(errno) << std::endl;
+      msg_warning << "Error: conversion from " << from_charset << " to " << to_charset << " went wrong: " << retval << std::endl;
       return "";
     }
   iconv_close(cd);
@@ -238,7 +237,7 @@ DictionaryManager::get_dictionary(const std::string& spec)
     }
   else // Dictionary for languages lang isn't loaded, so we load it
     {
-      //msg_debug("get_dictionary: " << lang);
+      //msg_debug << "get_dictionary: " << lang << std::endl;
       Dictionary& dict = dictionaries[lang];
 
       dict.set_language(get_language_def(lang));
@@ -250,7 +249,7 @@ DictionaryManager::get_dictionary(const std::string& spec)
           char** files = PHYSFS_enumerateFiles(p->c_str());
           if(!files) 
             {
-              msg_warning("Error: enumerateFiles() failed on " << *p);
+              msg_warning << "Error: enumerateFiles() failed on " << *p << std::endl;
             }
           else
             {
@@ -262,8 +261,8 @@ DictionaryManager::get_dictionary(const std::string& spec)
                       IFileStream in(pofile);
                       read_po_file(dict, in);
                   } catch(std::exception& e) {
-                      msg_warning("Error: Failure file opening: " << pofile);
-                      msg_warning(e.what() << "");
+                      msg_warning << "Error: Failure file opening: " << pofile << std::endl;
+                      msg_warning << e.what() << "" << std::endl;
                   }
                 }
               }
@@ -285,7 +284,7 @@ DictionaryManager::get_languages()
       char** files = PHYSFS_enumerateFiles(p->c_str());
       if (!files)
         {
-          msg_warning("Error: opendir() failed on " << *p);
+          msg_warning << "Error: opendir() failed on " << *p << std::endl;
         }
       else
         {
@@ -406,10 +405,10 @@ Dictionary::translate(const std::string& msgid, const std::string& msgid2, int n
   else
     {
 #ifdef TRANSLATION_DEBUG
-      msg_warning("Couldn't translate: " << msgid);
-      msg_warning("Candidates: ");
+      msg_warning << "Couldn't translate: " << msgid << std::endl;
+      msg_warning << "Candidates: " << std::endl;
       for (PluralEntries::iterator i = plural_entries.begin(); i != plural_entries.end(); ++i)
-        msg_debug("'" << i->first << "'");
+        msg_debug << "'" << i->first << "'" << std::endl;
 #endif
 
       if (plural2_1(num)) // default to english rules
@@ -430,7 +429,7 @@ Dictionary::translate(const char* msgid)
   else
     {
 #ifdef TRANSLATION_DBEUG
-      msg_warning("Couldn't translate: " << msgid);
+      msg_warning << "Couldn't translate: " << msgid << std::endl;
 #endif
       return msgid;
     }
@@ -447,7 +446,7 @@ Dictionary::translate(const std::string& msgid)
   else
     {
 #ifdef TRANSLATION_DBEUG
-      msg_warning("Couldn't translate: " << msgid);
+      msg_warning << "Couldn't translate: " << msgid << std::endl;
 #endif
       return msgid;
     }
@@ -531,7 +530,7 @@ public:
 
     if (from_charset.empty() || from_charset == "CHARSET")
       {
-        msg_warning("Error: Charset not specified for .po, fallback to ISO-8859-1");
+        msg_warning << "Error: Charset not specified for .po, fallback to ISO-8859-1" << std::endl;
         from_charset = "ISO-8859-1";
       }
 
@@ -555,12 +554,11 @@ public:
           }
         else if (token.keyword.empty())
           {
-            //msg_warning("Got EOF, everything looks ok.");
+            //msg_warning << "Got EOF, everything looks ok." << std::endl;
           }
         else
           {
-            msg_warning("tinygettext: expected 'msgid' keyword, got " << token.keyword 
-                      << " at line " << line_num);
+            msg_warning << "tinygettext: expected 'msgid' keyword, got " << token.keyword << " at line " << line_num << std::endl;
           }
         break;
     
@@ -592,8 +590,7 @@ public:
           } 
         else
           {
-            msg_warning("tinygettext: expected 'msgstr' keyword, got " << token.keyword 
-                      << " at line " << line_num);
+            msg_warning << "tinygettext: expected 'msgstr' keyword, got " << token.keyword << " at line " << line_num << std::endl;
           }
         break;
 
@@ -603,7 +600,7 @@ public:
             int num;
             if (sscanf(token.keyword.c_str(), "msgstr[%d]", &num) != 1) 
               {
-                msg_warning("Error: Couldn't parse: " << token.keyword);
+                msg_warning << "Error: Couldn't parse: " << token.keyword << std::endl;
               } 
             else 
               {
@@ -642,7 +639,7 @@ public:
 
     while((c = getchar(in)) != EOF)
       {
-        //msg_debug("Lexing char: " << char(c) << " " << state);
+        //msg_debug << "Lexing char: " << char(c) << " " << state << std::endl;
         switch(state)
           {
           case READ_KEYWORD:
@@ -693,12 +690,12 @@ public:
                   else if (c == '"') token.content += '"';
                   else
                     {
-                      msg_warning("Unhandled escape character: " << char(c));
+                      msg_warning << "Unhandled escape character: " << char(c) << std::endl;
                     }
                 }
               else
                 {
-                  msg_warning("Unterminated string");
+                  msg_warning << "Unterminated string" << std::endl;
                 }
             } else if (c == '"') { // Content string is terminated
               state = READ_CONTENT;