Ticket #3011: 0002-Add-Path-string8-which-returns-a-UTF-8-encoded-std-s.patch

File 0002-Add-Path-string8-which-returns-a-UTF-8-encoded-std-s.patch, 869 bytes (added by Philip Taylor, 9 years ago)
  • source/lib/path.h

    From 544d20d4c0183c2b3a186e2f05b64298ceea1df8 Mon Sep 17 00:00:00 2001
    From: Philip Taylor <philip@zaynar.co.uk>
    Date: Tue, 20 Jan 2015 23:15:44 +0000
    Subject: [PATCH 02/13] Add Path::string8 (which returns a UTF-8 encoded
     std::string).
    
    This saves the hassle of writing utf8_from_wstring(path.string()) in places like log messages.
    ---
     source/lib/path.h | 7 +++++++
     1 file changed, 7 insertions(+)
    
    diff --git a/source/lib/path.h b/source/lib/path.h
    index 02083ec..7facfb6 100644
    a b  
    4141# include "boost/functional/hash.hpp"
    4242#endif
    4343
     44#include "lib/utf8.h"
     45
    4446#include <cstring>
    4547
    4648namespace ERR
    public:  
    125127        return path;
    126128    }
    127129
     130    std::string string8() const
     131    {
     132        return utf8_from_wstring(path);
     133    }
     134
    128135    bool operator<(const Path& rhs) const
    129136    {
    130137        return path < rhs.path;