1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

Unicode: s/codepoint/code_point/g

Unicode calls them "code points" so let's follow their style.
This commit is contained in:
Andreas Kling 2020-08-03 19:06:41 +02:00
parent b139fb9f38
commit ea9ac3155d
45 changed files with 449 additions and 449 deletions

View file

@ -37,25 +37,25 @@ Line::Line(u16 length)
Line::~Line()
{
if (m_utf32)
delete[] m_codepoints.as_u32;
delete[] m_code_pointss.as_u32;
else
delete[] m_codepoints.as_u8;
delete[] m_code_pointss.as_u8;
delete[] m_attributes;
}
template<typename CodepointType>
static CodepointType* create_new_codepoint_array(size_t new_length, const CodepointType* old_codepoints, size_t old_length)
static CodepointType* create_new_code_points_array(size_t new_length, const CodepointType* old_code_pointss, size_t old_length)
{
auto* new_codepoints = new CodepointType[new_length];
auto* new_code_pointss = new CodepointType[new_length];
for (size_t i = 0; i < new_length; ++i)
new_codepoints[i] = ' ';
if (old_codepoints) {
new_code_pointss[i] = ' ';
if (old_code_pointss) {
for (size_t i = 0; i < min(old_length, new_length); ++i) {
new_codepoints[i] = old_codepoints[i];
new_code_pointss[i] = old_code_pointss[i];
}
}
delete[] old_codepoints;
return new_codepoints;
delete[] old_code_pointss;
return new_code_pointss;
}
void Line::set_length(u16 new_length)
@ -64,9 +64,9 @@ void Line::set_length(u16 new_length)
return;
if (m_utf32)
m_codepoints.as_u32 = create_new_codepoint_array<u32>(new_length, m_codepoints.as_u32, m_length);
m_code_pointss.as_u32 = create_new_code_points_array<u32>(new_length, m_code_pointss.as_u32, m_length);
else
m_codepoints.as_u8 = create_new_codepoint_array<u8>(new_length, m_codepoints.as_u8, m_length);
m_code_pointss.as_u8 = create_new_code_points_array<u8>(new_length, m_code_pointss.as_u8, m_length);
auto* new_attributes = new Attribute[new_length];
if (m_attributes) {
@ -82,15 +82,15 @@ void Line::clear(Attribute attribute)
{
if (m_dirty) {
for (u16 i = 0; i < m_length; ++i) {
set_codepoint(i, ' ');
set_code_points(i, ' ');
m_attributes[i] = attribute;
}
return;
}
for (unsigned i = 0; i < m_length; ++i) {
if (codepoint(i) != ' ')
if (code_points(i) != ' ')
m_dirty = true;
set_codepoint(i, ' ');
set_code_points(i, ' ');
}
for (unsigned i = 0; i < m_length; ++i) {
if (m_attributes[i] != attribute)
@ -115,12 +115,12 @@ bool Line::has_only_one_background_color() const
void Line::convert_to_utf32()
{
ASSERT(!m_utf32);
auto* new_codepoints = new u32[m_length];
auto* new_code_pointss = new u32[m_length];
for (size_t i = 0; i < m_length; ++i) {
new_codepoints[i] = m_codepoints.as_u8[i];
new_code_pointss[i] = m_code_pointss.as_u8[i];
}
delete m_codepoints.as_u8;
m_codepoints.as_u32 = new_codepoints;
delete m_code_pointss.as_u8;
m_code_pointss.as_u32 = new_code_pointss;
m_utf32 = true;
}