mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Removed escape_hash_filter::mPrevious, removed usage of boost::replace_all
This commit is contained in:
parent
af3e1f92ec
commit
70d578d050
2 changed files with 10 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
|||
#include "escape.hpp"
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace Files
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ namespace Files
|
|||
const int escape_hash_filter::sEscapeIdentifier = 'a';
|
||||
const int escape_hash_filter::sHashIdentifier = 'h';
|
||||
|
||||
escape_hash_filter::escape_hash_filter() : mNext(), mPrevious(), mSeenNonWhitespace(false), mFinishLine(false)
|
||||
escape_hash_filter::escape_hash_filter() : mSeenNonWhitespace(false), mFinishLine(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,14 @@ namespace Files
|
|||
|
||||
std::string EscapeHashString::processString(const std::string & str)
|
||||
{
|
||||
std::string temp = boost::replace_all_copy<std::string>(str, std::string() + (char)escape_hash_filter::sEscape + (char)escape_hash_filter::sHashIdentifier, "#");
|
||||
auto format = std::string(1, (char)escape_hash_filter::sEscape);
|
||||
boost::replace_all(temp, std::string() + (char)escape_hash_filter::sEscape + (char)escape_hash_filter::sEscapeIdentifier, format);
|
||||
std::string temp = str;
|
||||
|
||||
static const char hash[] = { escape_hash_filter::sEscape, escape_hash_filter::sHashIdentifier };
|
||||
Misc::StringUtils::replaceAll(temp, hash, "#", 2, 1);
|
||||
|
||||
static const char escape[] = { escape_hash_filter::sEscape, escape_hash_filter::sEscapeIdentifier };
|
||||
Misc::StringUtils::replaceAll(temp, escape, "@", 2, 1);
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ namespace Files
|
|||
|
||||
private:
|
||||
std::queue<int> mNext;
|
||||
int mPrevious;
|
||||
|
||||
bool mSeenNonWhitespace;
|
||||
bool mFinishLine;
|
||||
|
@ -42,11 +41,9 @@ namespace Files
|
|||
if (mNext.empty())
|
||||
{
|
||||
int character = boost::iostreams::get(src);
|
||||
bool record = true;
|
||||
if (character == boost::iostreams::WOULD_BLOCK)
|
||||
{
|
||||
mNext.push(character);
|
||||
record = false;
|
||||
}
|
||||
else if (character == EOF)
|
||||
{
|
||||
|
@ -79,12 +76,6 @@ namespace Files
|
|||
}
|
||||
}
|
||||
else if (character == sEscape)
|
||||
{
|
||||
mNext.push(sEscape);
|
||||
mNext.push(sEscapeIdentifier);
|
||||
record = false;
|
||||
}
|
||||
else if (mPrevious == sEscape)
|
||||
{
|
||||
mNext.push(sEscape);
|
||||
mNext.push(sEscapeIdentifier);
|
||||
|
@ -95,8 +86,6 @@ namespace Files
|
|||
}
|
||||
if (!mSeenNonWhitespace && !isspace(character))
|
||||
mSeenNonWhitespace = true;
|
||||
if (record)
|
||||
mPrevious = character;
|
||||
}
|
||||
int retval = mNext.front();
|
||||
mNext.pop();
|
||||
|
|
Loading…
Reference in a new issue