mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:20:04 +00:00
Load color tables from settings
This commit is contained in:
parent
bcae7d9825
commit
b241703b40
16 changed files with 324 additions and 17 deletions
42
wxdata/source/scwx/util/streams.cpp
Normal file
42
wxdata/source/scwx/util/streams.cpp
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include <scwx/util/streams.hpp>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
|
||||
std::istream& getline(std::istream& is, std::string& t)
|
||||
{
|
||||
t.clear();
|
||||
|
||||
std::istream::sentry sentry(is, true);
|
||||
std::streambuf* sb = is.rdbuf();
|
||||
|
||||
while (true)
|
||||
{
|
||||
int c = sb->sbumpc();
|
||||
switch (c)
|
||||
{
|
||||
case '\n': return is;
|
||||
|
||||
case '\r':
|
||||
if (sb->sgetc() == '\n')
|
||||
{
|
||||
sb->sbumpc();
|
||||
}
|
||||
return is;
|
||||
|
||||
case std::streambuf::traits_type::eof():
|
||||
if (t.empty())
|
||||
{
|
||||
is.setstate(std::ios::eofbit);
|
||||
}
|
||||
return is;
|
||||
|
||||
default: t += static_cast<char>(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace util
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue