From b653f875b0e3f6086762043cc18554dc8bd33af6 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sat, 4 Jan 2025 17:56:14 +0000 Subject: [PATCH] Codechange: Space between `template` and `<` (#13278) Make it all consistent so it matches CODINGSTYLE. --- src/cargoaction.cpp | 10 +++++----- src/cargoaction.h | 6 +++--- src/cargopacket.cpp | 8 ++++---- src/cargopacket.h | 14 +++++++------- src/command.cpp | 2 +- src/command_func.h | 8 ++++---- src/command_type.h | 2 +- src/core/multimap.hpp | 22 +++++++++++----------- src/core/smallstack_type.hpp | 2 +- src/economy.cpp | 2 +- src/framerate_gui.cpp | 2 +- src/gfx_layout.h | 2 +- src/linkgraph/demands.cpp | 2 +- src/linkgraph/demands.h | 2 +- src/linkgraph/mcf.cpp | 2 +- src/linkgraph/mcf.h | 4 ++-- src/misc/endian_buffer.hpp | 4 ++-- src/music/midifile.cpp | 2 +- src/network/network_command.cpp | 4 ++-- src/network/network_gui.cpp | 2 +- src/saveload/saveload.cpp | 2 +- src/script/api/script_list.hpp | 10 +++++----- src/script/api/script_object.hpp | 6 +++--- src/script/api/script_station.cpp | 6 +++--- src/script/api/script_station.hpp | 6 +++--- src/script/api/script_stationlist.cpp | 8 ++++---- src/script/api/script_stationlist.hpp | 4 ++-- src/settings_gui.cpp | 2 +- src/station_base.h | 2 +- src/station_gui.cpp | 10 +++++----- src/thread.h | 2 +- src/timer/timer_game_calendar.cpp | 8 ++++---- src/timer/timer_game_economy.cpp | 8 ++++---- src/timer/timer_game_realtime.cpp | 8 ++++---- src/timer/timer_game_tick.cpp | 8 ++++---- src/timer/timer_window.cpp | 8 ++++---- src/viewport_func.h | 6 +++--- src/window_func.h | 8 ++++---- src/window_gui.h | 10 +++++----- 39 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/cargoaction.cpp b/src/cargoaction.cpp index e6d32aac89..b5ff2273d9 100644 --- a/src/cargoaction.cpp +++ b/src/cargoaction.cpp @@ -20,7 +20,7 @@ * @return Either new packet if splitting was necessary or the given one * otherwise. */ -template +template CargoPacket *CargoMovement::Preprocess(CargoPacket *cp) { if (this->max_move < cp->Count()) { @@ -38,7 +38,7 @@ CargoPacket *CargoMovement::Preprocess(CargoPacket *cp) * @param cp Packet to be removed completely or partially. * @return Amount of cargo to be removed. */ -template +template uint CargoRemoval::Preprocess(CargoPacket *cp) { if (this->max_move >= cp->Count()) { @@ -57,7 +57,7 @@ uint CargoRemoval::Preprocess(CargoPacket *cp) * @param remove Amount of cargo to be removed. * @return True if the packet was deleted, False if it was reduced. */ -template +template bool CargoRemoval::Postprocess(CargoPacket *cp, uint remove) { if (remove == cp->Count()) { @@ -75,7 +75,7 @@ bool CargoRemoval::Postprocess(CargoPacket *cp, uint remove) * @return True if the packet was completely delivered, false if only part of * it was. */ -template<> +template <> bool CargoRemoval::operator()(CargoPacket *cp) { uint remove = this->Preprocess(cp); @@ -89,7 +89,7 @@ bool CargoRemoval::operator()(CargoPacket *cp) * @return True if the packet was completely delivered, false if only part of * it was. */ -template<> +template <> bool CargoRemoval::operator()(CargoPacket *cp) { uint remove = this->Preprocess(cp); diff --git a/src/cargoaction.h b/src/cargoaction.h index c9bb7351b3..dc43f47986 100644 --- a/src/cargoaction.h +++ b/src/cargoaction.h @@ -16,7 +16,7 @@ * Abstract action of removing cargo from a vehicle or a station. * @tparam Tsource CargoList subclass to remove cargo from. */ -template +template class CargoRemoval { protected: Tsource *source; ///< Source of the cargo. @@ -52,7 +52,7 @@ public: * @tparam Tsource CargoList subclass to remove cargo from. * @tparam Tdest CargoList subclass to add cargo to. */ -template +template class CargoMovement { protected: Tsource *source; ///< Source of the cargo. @@ -117,7 +117,7 @@ public: }; /** Action of rerouting cargo between different cargo lists and/or next hops. */ -template +template class CargoReroute : public CargoMovement { protected: StationID avoid; diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index ce4afa0abf..6636ed7679 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -291,7 +291,7 @@ void VehicleCargoList::Append(CargoPacket *cp, MoveToAction action) * will be kept and the loop will be aborted. * @param action Action instance to be applied. */ -template +template void VehicleCargoList::ShiftCargo(Taction action) { Iterator it(this->packets.begin()); @@ -313,7 +313,7 @@ void VehicleCargoList::ShiftCargo(Taction action) * will be kept and the loop will be aborted. * @param action Action instance to be applied. */ -template +template void VehicleCargoList::PopCargo(Taction action) { if (this->packets.empty()) return; @@ -550,7 +550,7 @@ void VehicleCargoList::InvalidateCache() * @param max_move Maximum amount of cargo to reassign. * @return Amount of cargo actually reassigned. */ -template +template uint VehicleCargoList::Reassign(uint max_move) { static_assert(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER); @@ -567,7 +567,7 @@ uint VehicleCargoList::Reassign(uint max_move) * @param max_move Maximum amount of cargo to reassign. * @return Amount of cargo actually reassigned. */ -template<> +template <> uint VehicleCargoList::Reassign(uint max_move) { max_move = std::min(this->action_counts[MTA_DELIVER], max_move); diff --git a/src/cargopacket.h b/src/cargopacket.h index b97a521a10..b7e6acb32f 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -356,10 +356,10 @@ protected: Money feeder_share; ///< Cache for the feeder share. uint action_counts[NUM_MOVE_TO_ACTION]; ///< Counts of cargo to be transferred, delivered, kept and loaded. - template + template void ShiftCargo(Taction action); - template + template void PopCargo(Taction action); /** @@ -393,7 +393,7 @@ public: friend class CargoShift; friend class CargoTransfer; friend class CargoDelivery; - template + template friend class CargoRemoval; friend class CargoReturn; friend class VehicleCargoReroute; @@ -495,7 +495,7 @@ public: * amount of cargo to be moved. Second parameter is destination (if * applicable), return value is amount of cargo actually moved. */ - template + template uint Reassign(uint max_move); uint Return(uint max_move, StationCargoList *dest, StationID next_station, TileIndex current_tile); uint Unload(uint max_move, StationCargoList *dest, CargoID cargo, CargoPayment *payment, TileIndex current_tile); @@ -541,7 +541,7 @@ public: friend class CargoLoad; friend class CargoTransfer; - template + template friend class CargoRemoval; friend class CargoReservation; friend class CargoReturn; @@ -549,10 +549,10 @@ public: static void InvalidateAllFrom(SourceType src_type, SourceID src); - template + template bool ShiftCargo(Taction &action, StationID next); - template + template uint ShiftCargo(Taction action, StationIDStack next, bool include_invalid); void Append(CargoPacket *cp, StationID next); diff --git a/src/command.cpp b/src/command.cpp index b975c51fbb..b5865ad4ae 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -82,7 +82,7 @@ struct CommandInfo { template inline constexpr CommandInfo CommandFromTrait() noexcept { return { T::name, T::flags, T::type }; }; -template +template inline constexpr auto MakeCommandsFromTraits(std::integer_sequence) noexcept { return std::array{{ CommandFromTrait(i)>>()... }}; } diff --git a/src/command_func.h b/src/command_func.h index 7a65950c6a..2879ecf520 100644 --- a/src/command_func.h +++ b/src/command_func.h @@ -80,7 +80,7 @@ private: # define SILENCE_GCC_FUNCTION_POINTER_CAST #endif -template struct CommandHelper; +template struct CommandHelper; class CommandHelperBase { protected: @@ -254,7 +254,7 @@ protected: } /** Set all invalid ClientID's to the proper value. */ - template + template static inline void SetClientIds(Ttuple &values, std::index_sequence) { ((SetClientIdHelper(std::get(values))), ...); @@ -332,13 +332,13 @@ protected: } /** Check if all ClientID arguments are set to valid values. */ - template + template static inline bool AllClientIdsSet(Ttuple &values, std::index_sequence) { return (ClientIdIsSet(std::get(values)) && ...); } - template + template static inline Money ExtractAdditionalMoney([[maybe_unused]] Ttuple &values) { if constexpr (std::is_same_v, Money>) { diff --git a/src/command_type.h b/src/command_type.h index a6186c640f..5b6aca1123 100644 --- a/src/command_type.h +++ b/src/command_type.h @@ -453,7 +453,7 @@ struct CommandFunctionTraitHelper(*)(DoCommandFla template struct CommandTraits; #define DEF_CMD_TRAIT(cmd_, proc_, flags_, type_) \ - template<> struct CommandTraits { \ + template <> struct CommandTraits { \ using ProcType = decltype(&proc_); \ using Args = typename CommandFunctionTraitHelper::Args; \ using RetTypes = typename CommandFunctionTraitHelper::RetTypes; \ diff --git a/src/core/multimap.hpp b/src/core/multimap.hpp index 9a646414d1..3ebadbc494 100644 --- a/src/core/multimap.hpp +++ b/src/core/multimap.hpp @@ -10,7 +10,7 @@ #ifndef MULTIMAP_HPP #define MULTIMAP_HPP -template +template class MultiMap; /** @@ -21,7 +21,7 @@ class MultiMap; * @tparam Tvalue Value type of the MultMap. * @tparam Tcompare Comparator type for keys of the MultiMap. */ -template +template class MultiMapIterator { protected: friend class MultiMap; @@ -53,7 +53,7 @@ public: * @tparam Tnon_const Iterator type assignable to Tmap_iter (which might be const). * @param mi One such iterator. */ - template + template MultiMapIterator(Tnon_const mi) : map_iter(mi), list_valid(false) {} /** @@ -74,7 +74,7 @@ public: * @param mi One such iterator. * @return This iterator. */ - template + template Self &operator=(Tnon_const mi) { this->map_iter = mi; @@ -196,7 +196,7 @@ public: * @param iter2 Second iterator to compare. * @return If iter1 and iter2 are equal. */ -template +template bool operator==(const MultiMapIterator &iter1, const MultiMapIterator &iter2) { if (iter1.GetMapIter() != iter2.GetMapIter()) return false; @@ -213,7 +213,7 @@ bool operator==(const MultiMapIterator +template bool operator!=(const MultiMapIterator &iter1, const MultiMapIterator &iter2) { return !(iter1 == iter2); @@ -227,7 +227,7 @@ bool operator!=(const MultiMapIterator +template bool operator==(const MultiMapIterator &iter1, const Tmap_iter2 &iter2) { return !iter1.ListValid() && iter1.GetMapIter() == iter2; @@ -239,7 +239,7 @@ bool operator==(const MultiMapIterator +template bool operator!=(const MultiMapIterator &iter1, const Tmap_iter2 &iter2) { return iter1.ListValid() || iter1.GetMapIter() != iter2; @@ -251,7 +251,7 @@ bool operator!=(const MultiMapIterator +template bool operator==(const Tmap_iter2 &iter2, const MultiMapIterator &iter1) { return !iter1.ListValid() && iter1.GetMapIter() == iter2; @@ -263,7 +263,7 @@ bool operator==(const Tmap_iter2 &iter2, const MultiMapIterator +template bool operator!=(const Tmap_iter2 &iter2, const MultiMapIterator &iter1) { return iter1.ListValid() || iter1.GetMapIter() != iter2; @@ -277,7 +277,7 @@ bool operator!=(const Tmap_iter2 &iter2, const MultiMapIterator > +template > class MultiMap : public std::map, Tcompare > { public: typedef typename std::list List; diff --git a/src/core/smallstack_type.hpp b/src/core/smallstack_type.hpp index 503d027bf3..73951a77d0 100644 --- a/src/core/smallstack_type.hpp +++ b/src/core/smallstack_type.hpp @@ -17,7 +17,7 @@ * redefine operator new/delete. It also never zeroes memory and always reuses * it. */ -template +template class SimplePool { public: inline SimplePool() : first_unused(0), first_free(0) {} diff --git a/src/economy.cpp b/src/economy.cpp index df36851f44..55886801b1 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1361,7 +1361,7 @@ static uint GetLoadAmount(Vehicle *v) * @param action Instance of Taction. * @return false if any of the action invocations returned false, true otherwise. */ -template +template bool IterateVehicleParts(Vehicle *v, Taction action) { for (Vehicle *w = v; w != nullptr; diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index 58e8c8e3b6..8272df9487 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -889,7 +889,7 @@ struct FrametimeGraphWindow : Window { } /** Scale and interpolate a value from a source range into a destination range */ - template + template static inline T Scinterlate(T dst_min, T dst_max, T src_min, T src_max, T value) { T dst_diff = dst_max - dst_min; diff --git a/src/gfx_layout.h b/src/gfx_layout.h index 5408b3e0ce..10f584e6d5 100644 --- a/src/gfx_layout.h +++ b/src/gfx_layout.h @@ -154,7 +154,7 @@ class Layouter : public std::vector + template bool operator()(const Key1 &lhs, const Key2 &rhs) const { if (lhs.state_before.fontsize != rhs.state_before.fontsize) return lhs.state_before.fontsize < rhs.state_before.fontsize; diff --git a/src/linkgraph/demands.cpp b/src/linkgraph/demands.cpp index 851d82f82a..6e32b2d8b0 100644 --- a/src/linkgraph/demands.cpp +++ b/src/linkgraph/demands.cpp @@ -161,7 +161,7 @@ inline void Scaler::SetDemands(LinkGraphJob &job, NodeID from_id, NodeID to_id, * @param job Job to calculate the demands for. * @tparam Tscaler Scaler to be used for scaling demands. */ -template +template void DemandCalculator::CalcDemand(LinkGraphJob &job, Tscaler scaler) { NodeList supplies; diff --git a/src/linkgraph/demands.h b/src/linkgraph/demands.h index 52dd5cb097..5934fcb853 100644 --- a/src/linkgraph/demands.h +++ b/src/linkgraph/demands.h @@ -18,7 +18,7 @@ private: int32_t mod_dist; ///< Distance modifier, determines how much demands decrease with distance. int32_t accuracy; ///< Accuracy of the calculation. - template + template void CalcDemand(LinkGraphJob &job, Tscaler scaler); }; diff --git a/src/linkgraph/mcf.cpp b/src/linkgraph/mcf.cpp index b6160f22f4..c47684053e 100644 --- a/src/linkgraph/mcf.cpp +++ b/src/linkgraph/mcf.cpp @@ -253,7 +253,7 @@ bool CapacityAnnotation::IsBetter(const CapacityAnnotation *base, uint cap, * @param source_node Node where the algorithm starts. * @param paths Container for the paths to be calculated. */ -template +template void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths) { typedef std::set AnnoSet; diff --git a/src/linkgraph/mcf.h b/src/linkgraph/mcf.h index 990e9650ed..f88b157934 100644 --- a/src/linkgraph/mcf.h +++ b/src/linkgraph/mcf.h @@ -20,7 +20,7 @@ protected: max_saturation(job.Settings().short_path_saturation) {} - template + template void Dijkstra(NodeID from, PathVector &paths); uint PushFlow(Node &node, NodeID to, Path *path, uint accuracy, uint max_saturation); @@ -72,7 +72,7 @@ public: * Link graph handler for MCF. Creates MultiCommodityFlow instance according to * the template parameter. */ -template +template class MCFHandler : public ComponentHandler { public: diff --git a/src/misc/endian_buffer.hpp b/src/misc/endian_buffer.hpp index fd916e6a0d..7662ad8d5f 100644 --- a/src/misc/endian_buffer.hpp +++ b/src/misc/endian_buffer.hpp @@ -70,7 +70,7 @@ public: private: /** Helper function to write a tuple to the buffer. */ - template + template void WriteTuple(const Ttuple &values, std::index_sequence) { ((*this << std::get(values)), ...); @@ -164,7 +164,7 @@ public: private: /** Helper function to read a tuple from the buffer. */ - template + template void ReadTuple(Ttuple &values, std::index_sequence) { ((*this >> std::get(values)), ...); diff --git a/src/music/midifile.cpp b/src/music/midifile.cpp index e3ebce3e74..0fcd6aacda 100644 --- a/src/music/midifile.cpp +++ b/src/music/midifile.cpp @@ -333,7 +333,7 @@ static bool ReadTrackChunk(FileHandle &file, MidiFile &target) NOT_REACHED(); } -template +template bool TicktimeAscending(const T &a, const T &b) { return a.ticktime < b.ticktime; diff --git a/src/network/network_command.cpp b/src/network/network_command.cpp index 3c1f8e5e05..e38974a9c1 100644 --- a/src/network/network_command.cpp +++ b/src/network/network_command.cpp @@ -406,7 +406,7 @@ static inline void SetClientIdHelper(T &data, [[maybe_unused]] ClientID client_i } /** Set all invalid ClientID's to the proper value. */ -template +template static inline void SetClientIds(Ttuple &values, ClientID client_id, std::index_sequence) { ((SetClientIdHelper(std::get(values), client_id)), ...); @@ -446,7 +446,7 @@ static inline void SanitizeSingleStringHelper([[maybe_unused]] CommandFlags cmd_ } /** Helper function to perform validation on command data strings. */ -template +template static inline void SanitizeStringsHelper(CommandFlags cmd_flags, Ttuple &values, std::index_sequence) { ((SanitizeSingleStringHelper(cmd_flags, std::get(values))), ...); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 0b687ca031..62e8854b44 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1387,7 +1387,7 @@ public: /** * Template version of Button, with callback support. */ -template +template class Button : public ButtonCommon { private: typedef void (*ButtonCallback)(struct NetworkClientListWindow *w, Point pt, T id); ///< Callback function to call on click. diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index f15e4ee7b7..adfbba5a78 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1235,7 +1235,7 @@ void SlSaveLoadRef(void *ptr, VarType conv) /** * Template class to help with list-like types. */ -template typename Tstorage, typename Tvar, typename Tallocator = std::allocator> +template