aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2010-01-29 23:54:05 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-05 17:17:46 +0100
commit4e71abc1c94647e600e6db322636707bdb9f5817 (patch)
tree0c532e7829ad5c9fab13db97c923dc3d70930abc /src/utils
parente3f328e4a24e2161fba58585e9f607c429b24c1b (diff)
downloadusdx-4e71abc1c94647e600e6db322636707bdb9f5817.tar.gz
usdx-4e71abc1c94647e600e6db322636707bdb9f5817.tar.xz
usdx-4e71abc1c94647e600e6db322636707bdb9f5817.zip
changed to boost::filesystem::wifstream to support wpath
wifstream from boost could be created with a boost::filesystem::wpath to support Unicode paths
Diffstat (limited to '')
-rw-r--r--src/utils/file.cpp7
-rw-r--r--src/utils/file.hpp7
2 files changed, 11 insertions, 3 deletions
diff --git a/src/utils/file.cpp b/src/utils/file.cpp
index a7fc87e8..f97fc2e4 100644
--- a/src/utils/file.cpp
+++ b/src/utils/file.cpp
@@ -39,6 +39,13 @@ namespace usdx
file.imbue(loc);
}
+ File::File(const boost::filesystem::wpath& path) : file(path, std::wifstream::in)
+ {
+ std::locale global_loc = std::locale();
+ std::locale loc(global_loc, new boost::program_options::detail::utf8_codecvt_facet());
+ file.imbue(loc);
+ }
+
File::~File(void)
{
file.close();
diff --git a/src/utils/file.hpp b/src/utils/file.hpp
index d08d7eb5..87aba35c 100644
--- a/src/utils/file.hpp
+++ b/src/utils/file.hpp
@@ -27,17 +27,18 @@
#ifndef FILE_HPP
#define FILE_HPP
-#include <iostream>
-#include <fstream>
+#include <boost/filesystem.hpp>
+#include <boost/filesystem/fstream.hpp>
namespace usdx
{
class File
{
private:
- std::wifstream file;
+ boost::filesystem::wifstream file;
public:
File(const std::string& filename);
+ File(const boost::filesystem::wpath& path);
virtual ~File(void);
std::wistream &stream(void);