]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/strutils.hxx
Use wide-string APIs on Windows.
[simgear.git] / simgear / misc / strutils.hxx
index 47f69bac4ae43b90e720d3df01a68cba67a97364..dd78863c373bffc8e14ebf67ae1d7f86ac5cdc2a 100644 (file)
@@ -38,6 +38,11 @@ typedef std::vector < std::string > string_list;
 namespace simgear {
   namespace strutils {
 
+       /**
+        * utf8ToLatin1() convert utf8 to latin, useful for accent character (i.e éâàîè...)
+        */
+       std::string utf8ToLatin1( std::string & s_utf8 );
+
 //     /** 
 //      * atof() wrapper for "string" type
 //      */
@@ -166,10 +171,20 @@ namespace simgear {
      */
     std::string convertWindowsLocal8BitToUtf8(const std::string& a);
 
-#if defined(SG_WINDOWS)
-    typedef std::vector<wchar_t> WCharVec;
-    WCharVec convertUtf8ToWString(const std::string& a);
-#endif
+      /**
+       *
+       */
+      std::string convertUtf8ToWindowsLocal8Bit(const std::string& a);
+
+    std::wstring convertUtf8ToWString(const std::string& a);
+       std::string convertWStringToUtf8(const std::wstring& w);
+
+    /**
+     * Get md5 hash of raw data.
+     */
+    std::string md5(const unsigned char* data, size_t num);
+    std::string md5(const char* data, size_t num);
+    std::string md5(const std::string& str);
 
     /**
      * convert base-64 encoded data to raw bytes (possibly with embedded
@@ -204,6 +219,14 @@ namespace simgear {
        */
       std::string sanitizePrintfFormat(const std::string& input);
 
+    /**
+     * Get the message corresponding to a given value of errno.
+     *
+     * Similar to strerror(), except it should be thread-safe and returns an
+     * std::string.
+     */
+    std::string error_string(int errnum);
+
   } // end namespace strutils
 } // end namespace simgear