mirror of
https://github.com/minetest/irrlicht.git
synced 2025-07-01 15:50:27 +02:00
Reformat the code, using:
find -type f | # list all regular files grep -E '\.(h|cpp|mm)$' | # filter for source files grep -v '/mt_' | # filter out generated files grep -v '/vendor/' | # and vendored GL grep -v '/test/image_loader_test.cpp' | # and this file (has giant literals arrays) xargs -n 1 -P $(nproc) clang-format -i # reformat everything Co-authored-by: numzero <numzer0@yandex.ru>
This commit is contained in:
@ -15,12 +15,12 @@ namespace io
|
||||
|
||||
static const io::path emptyFileListEntry;
|
||||
|
||||
CFileList::CFileList(const io::path& path, bool ignoreCase, bool ignorePaths)
|
||||
: IgnorePaths(ignorePaths), IgnoreCase(ignoreCase), Path(path)
|
||||
CFileList::CFileList(const io::path &path, bool ignoreCase, bool ignorePaths) :
|
||||
IgnorePaths(ignorePaths), IgnoreCase(ignoreCase), Path(path)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CFileList");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Path.replace('\\', '/');
|
||||
}
|
||||
@ -40,7 +40,7 @@ void CFileList::sort()
|
||||
Files.sort();
|
||||
}
|
||||
|
||||
const io::path& CFileList::getFileName(u32 index) const
|
||||
const io::path &CFileList::getFileName(u32 index) const
|
||||
{
|
||||
if (index >= Files.size())
|
||||
return emptyFileListEntry;
|
||||
@ -48,9 +48,8 @@ const io::path& CFileList::getFileName(u32 index) const
|
||||
return Files[index].Name;
|
||||
}
|
||||
|
||||
|
||||
//! Gets the full name of a file in the list, path included, based on an index.
|
||||
const io::path& CFileList::getFullFileName(u32 index) const
|
||||
const io::path &CFileList::getFullFileName(u32 index) const
|
||||
{
|
||||
if (index >= Files.size())
|
||||
return emptyFileListEntry;
|
||||
@ -59,10 +58,10 @@ const io::path& CFileList::getFullFileName(u32 index) const
|
||||
}
|
||||
|
||||
//! adds a file or folder
|
||||
u32 CFileList::addItem(const io::path& fullPath, u32 offset, u32 size, bool isDirectory, u32 id)
|
||||
u32 CFileList::addItem(const io::path &fullPath, u32 offset, u32 size, bool isDirectory, u32 id)
|
||||
{
|
||||
SFileListEntry entry;
|
||||
entry.ID = id ? id : Files.size();
|
||||
entry.ID = id ? id : Files.size();
|
||||
entry.Offset = offset;
|
||||
entry.Size = size;
|
||||
entry.Name = fullPath;
|
||||
@ -70,10 +69,9 @@ u32 CFileList::addItem(const io::path& fullPath, u32 offset, u32 size, bool isDi
|
||||
entry.IsDirectory = isDirectory;
|
||||
|
||||
// remove trailing slash
|
||||
if (entry.Name.lastChar() == '/')
|
||||
{
|
||||
if (entry.Name.lastChar() == '/') {
|
||||
entry.IsDirectory = true;
|
||||
entry.Name[entry.Name.size()-1] = 0;
|
||||
entry.Name[entry.Name.size() - 1] = 0;
|
||||
entry.Name.validate();
|
||||
}
|
||||
|
||||
@ -87,7 +85,7 @@ u32 CFileList::addItem(const io::path& fullPath, u32 offset, u32 size, bool isDi
|
||||
if (IgnorePaths)
|
||||
entry.FullName = entry.Name;
|
||||
|
||||
//os::Printer::log(Path.c_str(), entry.FullName);
|
||||
// os::Printer::log(Path.c_str(), entry.FullName);
|
||||
|
||||
Files.push_back(entry);
|
||||
|
||||
@ -120,9 +118,8 @@ u32 CFileList::getFileOffset(u32 index) const
|
||||
return index < Files.size() ? Files[index].Offset : 0;
|
||||
}
|
||||
|
||||
|
||||
//! Searches for a file or folder within the list, returns the index
|
||||
s32 CFileList::findFile(const io::path& filename, bool isDirectory = false) const
|
||||
s32 CFileList::findFile(const io::path &filename, bool isDirectory = false) const
|
||||
{
|
||||
SFileListEntry entry;
|
||||
// we only need FullName to be set for the search
|
||||
@ -133,10 +130,9 @@ s32 CFileList::findFile(const io::path& filename, bool isDirectory = false) cons
|
||||
entry.FullName.replace('\\', '/');
|
||||
|
||||
// remove trailing slash
|
||||
if (entry.FullName.lastChar() == '/')
|
||||
{
|
||||
if (entry.FullName.lastChar() == '/') {
|
||||
entry.IsDirectory = true;
|
||||
entry.FullName[entry.FullName.size()-1] = 0;
|
||||
entry.FullName[entry.FullName.size() - 1] = 0;
|
||||
entry.FullName.validate();
|
||||
}
|
||||
|
||||
@ -149,14 +145,11 @@ s32 CFileList::findFile(const io::path& filename, bool isDirectory = false) cons
|
||||
return Files.binary_search(entry);
|
||||
}
|
||||
|
||||
|
||||
//! Returns the base path of the file list
|
||||
const io::path& CFileList::getPath() const
|
||||
const io::path &CFileList::getPath() const
|
||||
{
|
||||
return Path;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace irr
|
||||
} // end namespace io
|
||||
|
||||
|
Reference in New Issue
Block a user