| 728 | // File |
| 729 | |
| 730 | base::type::fstream_t* File::newFileStream(const std::string& filename) { |
| 731 | base::type::fstream_t *fs = new base::type::fstream_t(filename.c_str(), |
| 732 | base::type::fstream_t::out |
| 733 | #if !defined(ELPP_FRESH_LOG_FILE) |
| 734 | | base::type::fstream_t::app |
| 735 | #endif |
| 736 | ); |
| 737 | #if defined(ELPP_UNICODE) |
| 738 | std::locale elppUnicodeLocale(""); |
| 739 | # if ELPP_OS_WINDOWS |
| 740 | std::locale elppUnicodeLocaleWindows(elppUnicodeLocale, new std::codecvt_utf8_utf16<wchar_t>); |
| 741 | elppUnicodeLocale = elppUnicodeLocaleWindows; |
| 742 | # endif // ELPP_OS_WINDOWS |
| 743 | fs->imbue(elppUnicodeLocale); |
| 744 | #endif // defined(ELPP_UNICODE) |
| 745 | if (fs->is_open()) { |
| 746 | fs->flush(); |
| 747 | } else { |
| 748 | base::utils::safeDelete(fs); |
| 749 | ELPP_INTERNAL_ERROR("Bad file [" << filename << "]", true); |
| 750 | } |
| 751 | return fs; |
| 752 | } |
| 753 | |
| 754 | std::size_t File::getSizeOfFile(base::type::fstream_t* fs) { |
| 755 | if (fs == nullptr) { |
nothing calls this directly
no test coverage detected