mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-15 01:07:58 -05:00
refactor: use std ranges functions where applicable
This commit is contained in:
@ -91,10 +91,9 @@ bool CommandsFileReader::ReadCommandsFile(IDataRepository* repository)
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
return std::all_of(m_post_processors.begin(),
|
||||
m_post_processors.end(),
|
||||
[repository](const std::unique_ptr<IPostProcessor>& postProcessor)
|
||||
{
|
||||
return postProcessor->PostProcess(repository);
|
||||
});
|
||||
return std::ranges::all_of(m_post_processors,
|
||||
[repository](const std::unique_ptr<IPostProcessor>& postProcessor)
|
||||
{
|
||||
return postProcessor->PostProcess(repository);
|
||||
});
|
||||
}
|
||||
|
@ -45,12 +45,11 @@ void SequenceAssetRef::ProcessMatch(CommandsParserState* state, SequenceResult<C
|
||||
if (!hasPointerRef)
|
||||
{
|
||||
const auto& modifiers = typeDecl->m_declaration_modifiers;
|
||||
hasPointerRef = std::any_of(modifiers.begin(),
|
||||
modifiers.end(),
|
||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||
{
|
||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||
});
|
||||
hasPointerRef = std::ranges::any_of(modifiers,
|
||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||
{
|
||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||
});
|
||||
}
|
||||
|
||||
if (typeDecl->m_type->GetType() == DataDefinitionType::TYPEDEF)
|
||||
|
@ -39,12 +39,11 @@ void SequenceString::ProcessMatch(CommandsParserState* state, SequenceResult<Com
|
||||
if (!hasPointerRef)
|
||||
{
|
||||
const auto& modifiers = typeDecl->m_declaration_modifiers;
|
||||
hasPointerRef = std::any_of(modifiers.begin(),
|
||||
modifiers.end(),
|
||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||
{
|
||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||
});
|
||||
hasPointerRef = std::ranges::any_of(modifiers,
|
||||
[](const std::unique_ptr<DeclarationModifier>& modifier)
|
||||
{
|
||||
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||
});
|
||||
}
|
||||
|
||||
if (typeDecl->m_type->GetType() == DataDefinitionType::TYPEDEF)
|
||||
|
@ -91,10 +91,9 @@ bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository)
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
return std::all_of(m_post_processors.begin(),
|
||||
m_post_processors.end(),
|
||||
[repository](const std::unique_ptr<IPostProcessor>& postProcessor)
|
||||
{
|
||||
return postProcessor->PostProcess(repository);
|
||||
});
|
||||
return std::ranges::all_of(m_post_processors,
|
||||
[repository](const std::unique_ptr<IPostProcessor>& postProcessor)
|
||||
{
|
||||
return postProcessor->PostProcess(repository);
|
||||
});
|
||||
}
|
||||
|
@ -29,10 +29,9 @@ bool CreateMemberInformationPostProcessor::PostProcess(IDataRepository* reposito
|
||||
{
|
||||
const auto& allStructureInformation = repository->GetAllStructureInformation();
|
||||
|
||||
return std::all_of(allStructureInformation.begin(),
|
||||
allStructureInformation.end(),
|
||||
[this, repository](StructureInformation* structure)
|
||||
{
|
||||
return CreateMemberInformationForStructure(repository, structure);
|
||||
});
|
||||
return std::ranges::all_of(allStructureInformation,
|
||||
[this, repository](StructureInformation* structure)
|
||||
{
|
||||
return CreateMemberInformationForStructure(repository, structure);
|
||||
});
|
||||
}
|
||||
|
@ -40,13 +40,12 @@ bool UnionsPostProcessor::PostProcess(IDataRepository* repository)
|
||||
{
|
||||
const auto& allInfos = repository->GetAllStructureInformation();
|
||||
|
||||
return std::all_of(allInfos.begin(),
|
||||
allInfos.end(),
|
||||
[](StructureInformation* info)
|
||||
{
|
||||
if (info->m_definition->GetType() != DataDefinitionType::UNION)
|
||||
return true;
|
||||
return std::ranges::all_of(allInfos,
|
||||
[](StructureInformation* info)
|
||||
{
|
||||
if (info->m_definition->GetType() != DataDefinitionType::UNION)
|
||||
return true;
|
||||
|
||||
return ProcessUnion(info);
|
||||
});
|
||||
return ProcessUnion(info);
|
||||
});
|
||||
}
|
||||
|
@ -63,11 +63,10 @@ bool UsagesPostProcessor::PostProcess(IDataRepository* repository)
|
||||
{
|
||||
const auto& allInfos = repository->GetAllStructureInformation();
|
||||
|
||||
return std::all_of(allInfos.begin(),
|
||||
allInfos.end(),
|
||||
[](StructureInformation* info)
|
||||
{
|
||||
const StructureComputations computations(info);
|
||||
return !computations.IsAsset() || ProcessAsset(info);
|
||||
});
|
||||
return std::ranges::all_of(allInfos,
|
||||
[](StructureInformation* info)
|
||||
{
|
||||
const StructureComputations computations(info);
|
||||
return !computations.IsAsset() || ProcessAsset(info);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user