Skip to content

Refactor Filters and Generic Combo#208

Merged
Sebanisu merged 15 commits intomainfrom
develop
Oct 9, 2025
Merged

Refactor Filters and Generic Combo#208
Sebanisu merged 15 commits intomainfrom
develop

Conversation

@Sebanisu
Copy link
Copy Markdown
Owner

@Sebanisu Sebanisu commented Oct 6, 2025

Generic Combo Classes Refactor

  • API Update: Updated all four GenericCombo classes (GenericCombo, GenericComboWithFilter, GenericComboWithMultiFilter, and GenericComboWithCustomFilter) to use std::span for passing ranges (values, strings, tooltips, and filters) instead of lambdas. Removed ValueLambdaT (and potentially other lambda types) as the classes now directly accept value ranges via std::span, simplifying the interface, reducing runtime overhead, and improving clarity with precomputed data.
  • Type Safety: Added a requires clause to GenericComboWithMultiFilter (and potentially other relevant classes) to ensure the filter type supports an update method with a vector of values from the provided range, enhancing compile-time validation.

Filter System Refactor

  • New Filter Class: Replaced ff_8::filter_old with ff_8::filter for Compact and Flatten in Selections.hpp, modernizing the filter implementation.
  • Updated Filter Checks: Changed filter checks in tile.cpp from map->filter().deswizzle.enabled() to map->filter().enabled<ff_8::FilterTag::Deswizzle>() (and similar for FullFileName and Swizzle) for type-safe, templated access.
  • Improved Filter Updates: In batch.cpp, updated filter updates to use templated update method with chained .enable() calls (e.g., filters.update<ff_8::FilterTag::Deswizzle>(...)), improving consistency and conciseness.
  • Major Filter Overhaul: Significant changes in filter.hpp (350 additions, 240 deletions) to support the new filter class and std::span-based API.

Benefits

  • Type Safety: Templated methods and requires clause ensure compile-time validation.
  • Performance: std::span reduces overhead by avoiding lambda calls and data copies.
  • Clarity: Direct range passing via std::span simplifies the API across all GenericCombo classes.
  • Consistency: Unified filter class and methods improve maintainability.
  • Modern C++: Adopts C++20 features like std::span and requires.

@Sebanisu Sebanisu added this to the Oct-2025 milestone Oct 6, 2025
@Sebanisu Sebanisu self-assigned this Oct 6, 2025
@Sebanisu Sebanisu added the enhancement New feature or request label Oct 6, 2025
@Sebanisu Sebanisu changed the title Refactor Filters Refactor Filters and Generic Combo Oct 9, 2025
@Sebanisu Sebanisu merged commit 2dca25c into main Oct 9, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant