| 648 | // File |
| 649 | |
| 650 | base::type::fstream_t* File::newFileStream(const std::string& filename) { |
| 651 | base::type::fstream_t *fs = new base::type::fstream_t(filename.c_str(), |
| 652 | base::type::fstream_t::out |
| 653 | #if !defined(ELPP_FRESH_LOG_FILE) |
| 654 | | base::type::fstream_t::app |
| 655 | #endif |
| 656 | ); |
| 657 | #if defined(ELPP_UNICODE) |
| 658 | std::locale elppUnicodeLocale(""); |
| 659 | # if ELPP_OS_WINDOWS |
| 660 | std::locale elppUnicodeLocaleWindows(elppUnicodeLocale, new std::codecvt_utf8_utf16<wchar_t>); |
| 661 | elppUnicodeLocale = elppUnicodeLocaleWindows; |
| 662 | # endif // ELPP_OS_WINDOWS |
| 663 | fs->imbue(elppUnicodeLocale); |
| 664 | #endif // defined(ELPP_UNICODE) |
| 665 | if (fs->is_open()) { |
| 666 | fs->flush(); |
| 667 | } else { |
| 668 | base::utils::safeDelete(fs); |
| 669 | ELPP_INTERNAL_ERROR("Bad file [" << filename << "]", true); |
| 670 | } |
| 671 | return fs; |
| 672 | } |
| 673 | |
| 674 | std::size_t File::getSizeOfFile(base::type::fstream_t* fs) { |
| 675 | if (fs == nullptr) { |
nothing calls this directly
no test coverage detected