Skip to content

Commit

Permalink
Merge pull request #2505 from ericoporto/agspak-with-ignore
Browse files Browse the repository at this point in the history
Tools: agspak with ignore file support
  • Loading branch information
ivan-mogilko authored Aug 24, 2024
2 parents 5e8ffad + 100e308 commit cf90cd6
Show file tree
Hide file tree
Showing 12 changed files with 1,330 additions and 41 deletions.
33 changes: 33 additions & 0 deletions Common/util/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "util/stream.h"
#include "util/string.h"
#include "util/string_compat.h"
#include "utf8.h"

namespace AGS
{
Expand Down Expand Up @@ -368,6 +369,20 @@ String String::Upper() const
return str;
}

String String::LowerUTF8() const
{
String str = *this;
str.MakeLowerUTF8();
return str;
}

String String::UpperUTF8() const
{
String str = *this;
str.MakeUpperUTF8();
return str;
}

String String::Left(size_t count) const
{
count = std::min(count, _len);
Expand Down Expand Up @@ -715,6 +730,24 @@ void String::MakeUpper()
}
}

void String::MakeLowerUTF8()
{
if (_len != 0)
{
BecomeUnique();
Utf8::CStrToLower(_cstr);
}
}

void String::MakeUpperUTF8()
{
if (_len != 0)
{
BecomeUnique();
Utf8::CStrToUpper(_cstr);
}
}

void String::MergeSequences(char c)
{
if (_len <= 1)
Expand Down
10 changes: 10 additions & 0 deletions Common/util/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ class String
// Creates an uppercased copy of the string
String Upper() const;

// Creates a lowercased copy of the utf-8 string
String LowerUTF8() const;
// Creates an uppercased copy of the utf-8 string
String UpperUTF8() const;

// Extract N leftmost characters as a new string
String Left(size_t count) const;
// Extract up to N characters starting from given index
Expand Down Expand Up @@ -304,6 +309,10 @@ class String
void MakeLower();
// Convert string to uppercase equivalent
void MakeUpper();
// Convert utf-8 string to lowercase equivalent
void MakeLowerUTF8();
// Convert utf-8 string to uppercase equivalent
void MakeUpperUTF8();
// Merges sequences of same characters into one
void MergeSequences(char c = 0);
// Prepend* methods add content before the string's head, increasing its length
Expand Down Expand Up @@ -435,6 +444,7 @@ class String
char *_buf; // reference-counted data (raw ptr)
BufHeader *_bufHead; // the header of a reference-counted data
};

};

} // namespace Common
Expand Down
Loading

0 comments on commit cf90cd6

Please sign in to comment.