1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/client/lobby
Alexander Wilms 73019c204d Replace redundant types with auto for the lvalues of template factory functions for smart pointers
grep -r --include \*.h --include \*.cpp "= std::" * | grep -v auto | grep -Po ".*[^ ]+ [^ ]+ [^ ]*[ ]*=.*;" | grep -v "auto\|int\|char\|bool\|float|\double\|for\|if\|googletest\|fuzzylite\|size_t\|using\|return" | grep -v double | grep -v si64 | grep -v si32 | grep -v ui32 | grep \< | grep -v float | tr -d '\t' | grep -v assert > redundant_types.txt

import re

with open("redundant_types.txt") as f:
    for line in f:
        line = line.strip()
        path = line.split(":", 1)[0]
        original_code = ":".join(line.split(":")[1:]).strip()

        print()
        print(path)
        print(original_code)
        prefix = "auto "
        if original_code.startswith("static"):
            static = True
        else:
            static = False

        cpp_type = " ".join(original_code.split("=")[0].strip().split(" ")[0:-1])
        print(cpp_type)

        if static:
            new_code = "static auto "+ " ".join(original_code.split(" ")[2:])
        else:
            new_code = "auto "+ " ".join(original_code.split(" ")[1:])
        print(new_code)

        if True:
            with open(path, "r") as f:
                filedata = f.read()

            filedata = filedata.replace(original_code, new_code)

            with open(path, "w") as f:
                f.write(filedata)
2024-01-17 12:50:00 +00:00
..
CBonusSelection.cpp Fixed invalid text ID in description of "start with hero" campaign bonus 2023-12-23 18:13:31 +02:00
CBonusSelection.h Replaced clickLeft with clickPressed clickReleased methods 2023-07-08 14:33:04 +03:00
CCampaignInfoScreen.cpp Remove excessive CMap.h includes 2023-05-31 23:18:38 +03:00
CCampaignInfoScreen.h Fix crash when clicking scenario info during campaign gameplay. 2022-05-10 09:48:05 +03:00
CLobbyScreen.cpp extra option tab 2023-12-28 19:41:01 +01:00
CLobbyScreen.h Revert "Auxiliary commit to revert individual files from fb4db41891e157f4f7d72ee759141754d2df680c" 2023-04-13 12:45:10 +04:00
CSavingScreen.cpp Add game pause 2023-10-08 16:03:57 +02:00
CSavingScreen.h Add game pause 2023-10-08 16:03:57 +02:00
CScenarioInfoScreen.cpp Always use ResourcePath for referencing images and animations 2023-09-04 18:22:34 +03:00
CScenarioInfoScreen.h Gui cleanup4 (#446) 2018-07-25 01:36:48 +03:00
CSelectionBase.cpp Fix invisible chat in pregame. Fixed positioning of chat box 2023-12-23 18:12:55 +02:00
CSelectionBase.h extra option tab 2023-12-28 19:41:01 +01:00
ExtraOptionsTab.cpp extra option tab 2023-12-28 19:41:01 +01:00
ExtraOptionsTab.h extra option tab 2023-12-28 19:41:01 +01:00
OptionsTab.cpp Replace redundant types with auto for the lvalues of template factory functions for smart pointers 2024-01-17 12:50:00 +00:00
OptionsTab.h Moved some code from OptionTab to separate class, OptionTabBase 2023-11-13 19:06:56 +02:00
OptionsTabBase.cpp unlimited replay option 2023-12-28 20:48:19 +01:00
OptionsTabBase.h Updated layout and localizations 2023-12-07 16:36:44 +02:00
RandomMapTab.cpp Workaround for vcmi-extras bug 2023-12-22 18:40:29 +02:00
RandomMapTab.h Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
SelectionTab.cpp Replace redundant types with auto for the lvalues of template factory functions for smart pointers 2024-01-17 12:50:00 +00:00
SelectionTab.h show random maps 2023-10-21 02:12:34 +02:00
TurnOptionsTab.cpp Initial version of Turn Options tab screen 2023-11-13 19:06:56 +02:00
TurnOptionsTab.h Initial version of Turn Options tab screen 2023-11-13 19:06:56 +02:00