1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00
vcmi/mapeditor
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
..
icons Add line and fill brushes 2023-10-14 02:58:13 +02:00
inspector Remove std::vector<boo> from Json Serializer, simplify affected code 2023-11-15 15:55:18 +02:00
mapsettings Fix build 2023-11-15 15:55:19 +02:00
resourceExtractor Replace redundant types with auto for the lvalues of template factory functions for smart pointers 2024-01-17 12:50:00 +00:00
translation Update Chinese translation for mapeditor 2024-01-13 17:57:36 +08:00
Animation.cpp Replace redundant types with auto for the lvalues of template factory functions for smart pointers 2024-01-17 12:50:00 +00:00
Animation.h Fix animations in editor which use copy-pasted code from client 2023-06-20 19:37:27 +03:00
BitmapHandler.cpp Always use ResourcePath for referencing images and animations 2023-09-04 18:22:34 +03:00
BitmapHandler.h mapeditor: use vcmi_endian.h 2023-02-03 00:39:44 +03:00
CMakeLists.txt add Chinese mapeditor translation into its CMakeFiles.txt 2024-01-13 17:27:28 +08:00
generatorprogress.cpp Code review changes 2022-09-25 00:55:05 +04:00
generatorprogress.h Code review changes 2022-09-25 00:55:05 +04:00
generatorprogress.ui
graphics.cpp Replace redundant types with auto for the lvalues of template factory functions for smart pointers 2024-01-17 12:50:00 +00:00
graphics.h Add portraits delegate 2023-10-13 20:15:29 +02:00
jsonutils.cpp Reorganization of boost filesystem usage 2023-07-28 19:12:04 +03:00
jsonutils.h Map editor can be built during single-app build 2022-12-05 22:28:01 +02:00
launcherdirs.cpp
launcherdirs.h
main.cpp Apply suggestions from code review 2022-10-08 22:55:15 +04:00
mainwindow.cpp Use auto instead of redundant type in initializations using new 2024-01-16 21:40:53 +00:00
mainwindow.h Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
mainwindow.ui Fixes for map editor 2023-10-24 23:58:26 +02:00
mapcontroller.cpp Update editor and tests 2023-12-22 17:56:43 +02:00
mapcontroller.h Mod compatibility check is now in a separate class and not part of 2023-11-08 21:27:05 +02:00
mapeditor.ico
mapeditor.rc
maphandler.cpp Remove duplicate semicolons 2024-01-16 19:02:39 +00:00
maphandler.h Redesign map editor rendering 2023-10-20 01:25:06 +02:00
mapview.cpp Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
mapview.h Add line and fill brushes 2023-10-14 02:58:13 +02:00
objectbrowser.cpp Use auto instead of redundant type in initializations using new 2024-01-16 21:40:53 +00:00
objectbrowser.h Renamed Terrain.h/cpp -> TerrainHandler.h/cpp 2023-01-10 00:01:35 +02:00
playerparams.cpp Improvements to type safety of Identifier class 2023-10-04 18:05:23 +03:00
playerparams.h Town picker in player settings implemented 2023-09-11 20:37:26 +02:00
playerparams.ui Object picker implemented 2023-09-11 20:37:26 +02:00
playersettings.cpp Remove excessive CMap.h includes 2023-05-31 23:18:38 +03:00
playersettings.h Code polishing 2022-10-13 01:51:55 +04:00
playersettings.ui Allow single player on map and fix player params initialization 2023-04-02 14:31:57 +04:00
scenelayer.cpp Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
scenelayer.h Define each identifier in a dedicated statement 2024-01-10 00:22:23 +00:00
StdInc.cpp convert line endings from CRLF (Windows) to LF (Linux/Unix) 2023-10-19 16:23:21 +02:00
StdInc.h convert line endings from CRLF (Windows) to LF (Linux/Unix) 2023-10-19 16:23:21 +02:00
validator.cpp Remove std::vector<boo> from Json Serializer, simplify affected code 2023-11-15 15:55:18 +02:00
validator.h Remove excessive CMap.h includes 2023-05-31 23:18:38 +03:00
validator.ui
vcmieditor.desktop add Linux icons for the map editor 2022-10-22 23:03:01 +03:00
windownewmap.cpp Works more or less 2023-10-28 20:30:38 +02:00
windownewmap.h Support teams in map editor 2023-04-30 12:49:45 +04:00
windownewmap.ui Support teams in map editor 2023-04-30 12:49:45 +04:00