mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Convert countNonEmptyPropertiesMaps to a global function count_nonempty_properties_maps
This commit is contained in:
parent
9678cc4ac3
commit
f976c9f195
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -1164,7 +1164,7 @@ static void ase_file_write_user_data_chunk(FILE* f, FileOp* fop,
|
||||
{
|
||||
ChunkWriter chunk(f, frame_header, ASE_FILE_CHUNK_USER_DATA);
|
||||
|
||||
size_t nmaps = userData->countNonEmptyPropertiesMaps();
|
||||
size_t nmaps = count_nonempty_properties_maps(userData->propertiesMaps());
|
||||
int flags = 0;
|
||||
if (!userData->text().empty())
|
||||
flags |= ASE_USER_DATA_FLAG_HAS_TEXT;
|
||||
|
@ -109,14 +109,6 @@ namespace doc {
|
||||
Properties& properties() { return properties(std::string()); }
|
||||
Properties& properties(const std::string& groupKey) { return m_propertiesMaps[groupKey]; }
|
||||
|
||||
size_t countNonEmptyPropertiesMaps() const {
|
||||
size_t i = 0;
|
||||
for (const auto& it : m_propertiesMaps)
|
||||
if (!it.second.empty())
|
||||
++i;
|
||||
return i;
|
||||
}
|
||||
|
||||
void setText(const std::string& text) { m_text = text; }
|
||||
void setColor(color_t color) { m_color = color; }
|
||||
|
||||
@ -155,6 +147,8 @@ namespace doc {
|
||||
return *value;
|
||||
}
|
||||
|
||||
size_t count_nonempty_properties_maps(const UserData::PropertiesMaps& propertiesMaps);
|
||||
|
||||
} // namespace doc
|
||||
|
||||
#endif
|
||||
|
@ -35,4 +35,12 @@ UserData read_user_data(std::istream& is)
|
||||
return userData;
|
||||
}
|
||||
|
||||
size_t count_nonempty_properties_maps(const UserData::PropertiesMaps& propertiesMaps) {
|
||||
size_t i = 0;
|
||||
for (const auto& it : propertiesMaps)
|
||||
if (!it.second.empty())
|
||||
++i;
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user