From 6e19ab2bbce0b113b628e6f8e9b5c0640053933e Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 4 Dec 2022 18:02:33 +0000 Subject: [PATCH] AK+Everywhere: Rename String to DeprecatedString We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^) --- AK/Base64.cpp | 2 +- AK/Base64.h | 4 +- AK/CMakeLists.txt | 2 +- AK/Demangle.h | 6 +- AK/{String.cpp => DeprecatedString.cpp} | 120 +++++----- AK/{String.h => DeprecatedString.h} | 127 ++++++----- AK/FlyString.cpp | 8 +- AK/FlyString.h | 8 +- AK/Format.cpp | 2 +- AK/Format.h | 2 +- AK/Forward.h | 4 +- AK/GenericLexer.cpp | 4 +- AK/GenericLexer.h | 4 +- AK/Hex.cpp | 2 +- AK/Hex.h | 4 +- AK/IPv4Address.h | 14 +- AK/IPv6Address.h | 10 +- AK/Iterator.h | 2 +- AK/JsonArray.h | 2 +- AK/JsonArraySerializer.h | 2 +- AK/JsonObject.h | 12 +- AK/JsonObjectSerializer.h | 2 +- AK/JsonParser.cpp | 2 +- AK/JsonParser.h | 2 +- AK/JsonPath.cpp | 2 +- AK/JsonPath.h | 12 +- AK/JsonValue.cpp | 4 +- AK/JsonValue.h | 10 +- AK/LexicalPath.cpp | 16 +- AK/LexicalPath.h | 24 +- AK/MACAddress.h | 6 +- AK/NumberFormat.h | 20 +- AK/ReverseIterator.h | 2 +- AK/ScopeLogger.h | 4 +- AK/SourceGenerator.h | 14 +- AK/StringBuilder.cpp | 10 +- AK/StringBuilder.h | 6 +- AK/StringUtils.cpp | 10 +- AK/StringUtils.h | 8 +- AK/StringView.cpp | 16 +- AK/StringView.h | 18 +- AK/URL.cpp | 44 ++-- AK/URL.h | 88 ++++---- AK/URLParser.cpp | 12 +- AK/UUID.cpp | 2 +- AK/UUID.h | 4 +- AK/Utf16View.cpp | 2 +- AK/Utf16View.h | 4 +- AK/Utf8View.h | 6 +- Base/usr/share/man/man5/clipboard.md | 8 +- Base/usr/share/man/man5/ipc.md | 4 +- Documentation/StringFormatting.md | 16 +- Kernel/API/Graphics.h | 4 +- Meta/Lagom/Fuzzers/FuzzCyrillicDecoder.cpp | 2 +- Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp | 2 +- Meta/Lagom/Fuzzers/FuzzHebrewDecoder.cpp | 2 +- Meta/Lagom/Fuzzers/FuzzLatin1Decoder.cpp | 2 +- Meta/Lagom/Fuzzers/FuzzLatin2Decoder.cpp | 2 +- .../Fuzzers/FuzzQuotedPrintableParser.cpp | 2 +- Meta/Lagom/Fuzzers/FuzzUTF16BEDecoder.cpp | 2 +- Meta/Lagom/Fuzzers/FuzzilliJs.cpp | 2 +- .../Tools/CodeGenerators/IPCCompiler/main.cpp | 64 +++--- .../CodeGenerators/LibEDID/GeneratePnpIDs.cpp | 22 +- .../LibLocale/GenerateDateTimeFormatData.cpp | 80 +++---- .../LibLocale/GenerateLocaleData.cpp | 130 +++++------ .../LibLocale/GenerateNumberFormatData.cpp | 58 ++--- .../LibLocale/GeneratePluralRulesData.cpp | 62 ++--- .../GenerateRelativeTimeFormatData.cpp | 22 +- .../LibTimeZone/GenerateTimeZoneData.cpp | 50 ++--- .../LibUnicode/GenerateEmojiData.cpp | 32 +-- .../LibUnicode/GenerateUnicodeData.cpp | 96 ++++---- .../CodeGenerators/LibUnicode/GeneratorUtil.h | 70 +++--- .../BindingsGenerator/IDLGenerators.cpp | 160 ++++++------- .../LibWeb/GenerateCSSPropertyID.cpp | 4 +- .../LibWeb/GenerateCSSTransformFunctions.cpp | 4 +- .../GenerateWindowOrWorkerInterfaces.cpp | 32 +-- .../CodeGenerators/LibWeb/GeneratorUtil.h | 8 +- .../StateMachineGenerator/main.cpp | 24 +- Meta/Lagom/Tools/ConfigureComponents/main.cpp | 46 ++-- Meta/Lagom/Tools/IPCMagicLinter/main.cpp | 8 +- Meta/Lagom/Wasm/js_repl.cpp | 8 +- ...Enable-java.lang.Process-on-serenity.patch | 2 +- Tests/AK/CMakeLists.txt | 2 +- Tests/AK/TestBase64.cpp | 6 +- Tests/AK/TestBinaryHeap.cpp | 4 +- Tests/AK/TestBinarySearch.cpp | 16 +- Tests/AK/TestCircularDeque.cpp | 6 +- Tests/AK/TestCircularQueue.cpp | 6 +- ...estString.cpp => TestDeprecatedString.cpp} | 124 +++++----- Tests/AK/TestDisjointChunks.cpp | 2 +- Tests/AK/TestFixedPoint.cpp | 10 +- Tests/AK/TestFormat.cpp | 212 +++++++++--------- Tests/AK/TestHashMap.cpp | 38 ++-- Tests/AK/TestHashTable.cpp | 44 ++-- Tests/AK/TestJSON.cpp | 8 +- Tests/AK/TestLexicalPath.cpp | 2 +- Tests/AK/TestMemory.cpp | 6 +- Tests/AK/TestNonnullRefPtr.cpp | 2 +- Tests/AK/TestOptional.cpp | 16 +- Tests/AK/TestQueue.cpp | 8 +- Tests/AK/TestRefPtr.cpp | 2 +- Tests/AK/TestStack.cpp | 2 +- Tests/AK/TestStringUtils.cpp | 10 +- Tests/AK/TestStringView.cpp | 30 +-- Tests/AK/TestTrie.cpp | 4 +- Tests/AK/TestTuple.cpp | 22 +- Tests/AK/TestUtf16.cpp | 4 +- Tests/AK/TestUtf8.cpp | 12 +- Tests/AK/TestVariant.cpp | 52 ++--- Tests/AK/TestVector.cpp | 24 +- Tests/AK/TestWeakPtr.cpp | 2 +- Tests/Kernel/TestKernelFilePermissions.cpp | 6 +- Tests/Kernel/TestKernelPledge.cpp | 4 +- Tests/Kernel/crash.cpp | 2 +- Tests/Kernel/fuzz-syscalls.cpp | 2 +- Tests/LibAudio/TestFLACSpec.cpp | 6 +- Tests/LibC/TestLibCInodeWatcher.cpp | 6 +- Tests/LibC/TestLibCMkTemp.cpp | 26 +-- Tests/LibC/TestMemmem.cpp | 2 +- Tests/LibC/TestMkDir.cpp | 6 +- Tests/LibC/TestPwd.cpp | 2 +- Tests/LibC/TestQsort.cpp | 6 +- Tests/LibC/TestRealpath.cpp | 10 +- Tests/LibC/TestSearch.cpp | 4 +- Tests/LibC/TestSnprintf.cpp | 2 +- Tests/LibC/TestStrlcpy.cpp | 2 +- Tests/LibC/TestStrtodAccuracy.cpp | 6 +- Tests/LibC/TestWchar.cpp | 4 +- Tests/LibCompress/TestBrotli.cpp | 12 +- Tests/LibCore/TestLibCoreArgsParser.cpp | 6 +- Tests/LibCore/TestLibCoreIODevice.cpp | 4 +- Tests/LibCpp/test-cpp-parser.cpp | 8 +- Tests/LibCpp/test-cpp-preprocessor.cpp | 6 +- Tests/LibCrypto/TestChecksum.cpp | 16 +- Tests/LibELF/test-elf.cpp | 10 +- Tests/LibGL/TestRender.cpp | 6 +- Tests/LibGfx/TestImageDecoder.cpp | 2 +- Tests/LibJS/test-js.cpp | 8 +- Tests/LibJS/test-test262.cpp | 26 +-- Tests/LibJS/test262-runner.cpp | 54 ++--- Tests/LibLocale/TestLocale.cpp | 4 +- Tests/LibMarkdown/TestCommonmark.cpp | 10 +- Tests/LibPDF/TestPDF.cpp | 4 +- Tests/LibRegex/Regex.cpp | 30 +-- Tests/LibRegex/RegexLibC.cpp | 88 ++++---- Tests/LibSQL/TestSqlExpressionParser.cpp | 6 +- Tests/LibSQL/TestSqlHashIndex.cpp | 10 +- Tests/LibSQL/TestSqlStatementExecution.cpp | 26 +-- Tests/LibSQL/TestSqlStatementParser.cpp | 16 +- Tests/LibSQL/TestSqlValueAndTuple.cpp | 4 +- Tests/LibTLS/TestTLSHandshake.cpp | 6 +- Tests/LibWasm/test-wasm.cpp | 8 +- Tests/LibWeb/TestHTMLTokenizer.cpp | 2 +- Tests/Spreadsheet/test-spreadsheet.cpp | 2 +- Userland/Applets/Audio/main.cpp | 2 +- .../ClipboardHistoryModel.cpp | 8 +- .../ClipboardHistory/ClipboardHistoryModel.h | 6 +- .../Applets/Keymap/KeymapStatusWidget.cpp | 2 +- Userland/Applets/Keymap/KeymapStatusWidget.h | 4 +- .../Applets/Keymap/KeymapStatusWindow.cpp | 2 +- Userland/Applets/Keymap/KeymapStatusWindow.h | 2 +- Userland/Applets/Network/main.cpp | 4 +- Userland/Applets/ResourceGraph/main.cpp | 8 +- .../Applications/3DFileViewer/MeshLoader.h | 2 +- .../3DFileViewer/WavefrontOBJLoader.cpp | 16 +- Userland/Applications/3DFileViewer/main.cpp | 22 +- Userland/Applications/Assistant/Providers.cpp | 14 +- Userland/Applications/Assistant/Providers.h | 36 +-- Userland/Applications/Assistant/main.cpp | 10 +- .../Browser/BookmarksBarWidget.cpp | 14 +- .../Applications/Browser/BookmarksBarWidget.h | 16 +- Userland/Applications/Browser/Browser.h | 16 +- .../Applications/Browser/BrowserWindow.cpp | 20 +- Userland/Applications/Browser/BrowserWindow.h | 4 +- .../Applications/Browser/ConsoleWidget.cpp | 2 +- Userland/Applications/Browser/ConsoleWidget.h | 6 +- Userland/Applications/Browser/CookieJar.cpp | 18 +- Userland/Applications/Browser/CookieJar.h | 24 +- .../Applications/Browser/CookiesModel.cpp | 4 +- Userland/Applications/Browser/CookiesModel.h | 2 +- .../Applications/Browser/DownloadWidget.cpp | 8 +- .../Applications/Browser/DownloadWidget.h | 2 +- .../Browser/ElementSizePreviewWidget.cpp | 4 +- Userland/Applications/Browser/History.cpp | 6 +- Userland/Applications/Browser/History.h | 8 +- Userland/Applications/Browser/IconBag.cpp | 2 +- .../Applications/Browser/InspectorWidget.cpp | 8 +- .../Applications/Browser/InspectorWidget.h | 22 +- .../Applications/Browser/StorageModel.cpp | 6 +- Userland/Applications/Browser/StorageModel.h | 6 +- .../Applications/Browser/StorageWidget.cpp | 4 +- Userland/Applications/Browser/StorageWidget.h | 4 +- Userland/Applications/Browser/Tab.cpp | 24 +- Userland/Applications/Browser/Tab.h | 22 +- .../Applications/Browser/WindowActions.cpp | 4 +- Userland/Applications/Browser/main.cpp | 22 +- .../BrowserSettings/BrowserSettingsWidget.cpp | 16 +- .../ContentFilterSettingsWidget.cpp | 8 +- .../ContentFilterSettingsWidget.h | 4 +- .../Calculator/CalculatorWidget.cpp | 4 +- .../Calculator/CalculatorWidget.h | 2 +- Userland/Applications/Calculator/Keypad.cpp | 6 +- Userland/Applications/Calculator/Keypad.h | 4 +- Userland/Applications/Calculator/main.cpp | 8 +- .../Applications/Calendar/AddEventDialog.cpp | 4 +- .../Applications/Calendar/AddEventDialog.h | 4 +- .../CharacterMap/CharacterMapWidget.cpp | 4 +- .../CharacterMap/CharacterMapWidget.h | 2 +- .../CharacterMap/CharacterSearchWidget.cpp | 4 +- .../CharacterMap/SearchCharacters.h | 4 +- Userland/Applications/CharacterMap/main.cpp | 4 +- .../ClockSettings/ClockSettingsWidget.h | 2 +- .../ClockSettings/TimeZoneSettingsWidget.cpp | 2 +- .../ClockSettings/TimeZoneSettingsWidget.h | 6 +- Userland/Applications/CrashReporter/main.cpp | 26 +-- Userland/Applications/Debugger/main.cpp | 12 +- .../BackgroundSettingsWidget.cpp | 6 +- .../BackgroundSettingsWidget.h | 2 +- .../DisplaySettings/DesktopSettingsWidget.cpp | 2 +- .../DisplaySettings/EffectsSettingsWidget.cpp | 2 +- .../DisplaySettings/EffectsSettingsWidget.h | 2 +- .../DisplaySettings/MonitorSettingsWidget.cpp | 34 +-- .../DisplaySettings/MonitorSettingsWidget.h | 4 +- .../DisplaySettings/MonitorWidget.cpp | 4 +- .../DisplaySettings/MonitorWidget.h | 10 +- .../DisplaySettings/ThemePreviewWidget.cpp | 2 +- .../DisplaySettings/ThemePreviewWidget.h | 2 +- .../DisplaySettings/ThemesSettingsWidget.cpp | 2 +- .../DisplaySettings/ThemesSettingsWidget.h | 4 +- .../Escalator/EscalatorWindow.cpp | 8 +- .../Applications/Escalator/EscalatorWindow.h | 2 +- Userland/Applications/Escalator/main.cpp | 4 +- .../FileManager/DirectoryView.cpp | 44 ++-- .../Applications/FileManager/DirectoryView.h | 18 +- .../FileOperationProgressWidget.cpp | 18 +- .../FileManager/FileOperationProgressWidget.h | 2 +- .../Applications/FileManager/FileUtils.cpp | 10 +- Userland/Applications/FileManager/FileUtils.h | 6 +- .../FileManager/PropertiesWindow.cpp | 28 +-- .../FileManager/PropertiesWindow.h | 18 +- Userland/Applications/FileManager/main.cpp | 98 ++++---- .../Applications/FontEditor/MainWidget.cpp | 38 ++-- Userland/Applications/FontEditor/MainWidget.h | 16 +- .../Applications/FontEditor/NewFontDialog.cpp | 4 +- .../Applications/FontEditor/NewFontDialog.h | 8 +- .../GamesSettings/CardSettingsWidget.cpp | 4 +- .../GamesSettings/CardSettingsWidget.h | 4 +- Userland/Applications/Help/History.cpp | 2 +- Userland/Applications/Help/History.h | 6 +- Userland/Applications/Help/MainWidget.cpp | 24 +- Userland/Applications/Help/MainWidget.h | 2 +- Userland/Applications/Help/ManualModel.cpp | 12 +- Userland/Applications/Help/ManualModel.h | 12 +- Userland/Applications/Help/ManualNode.h | 4 +- Userland/Applications/Help/ManualPageNode.cpp | 4 +- Userland/Applications/Help/ManualPageNode.h | 6 +- .../Applications/Help/ManualSectionNode.cpp | 8 +- .../Applications/Help/ManualSectionNode.h | 14 +- Userland/Applications/Help/main.cpp | 4 +- .../Applications/HexEditor/FindDialog.cpp | 10 +- Userland/Applications/HexEditor/FindDialog.h | 8 +- .../HexEditor/GoToOffsetDialog.cpp | 16 +- .../Applications/HexEditor/GoToOffsetDialog.h | 4 +- Userland/Applications/HexEditor/HexDocument.h | 2 +- Userland/Applications/HexEditor/HexEditor.cpp | 8 +- .../HexEditor/HexEditorWidget.cpp | 48 ++-- .../Applications/HexEditor/HexEditorWidget.h | 8 +- .../HexEditor/SearchResultsModel.h | 8 +- .../HexEditor/ValueInspectorModel.h | 10 +- .../Applications/ImageViewer/ViewWidget.cpp | 12 +- .../Applications/ImageViewer/ViewWidget.h | 12 +- Userland/Applications/ImageViewer/main.cpp | 8 +- .../KeyboardMapper/KeyPositions.h | 4 +- .../KeyboardMapper/KeyboardMapperWidget.cpp | 12 +- .../KeyboardMapper/KeyboardMapperWidget.h | 8 +- Userland/Applications/KeyboardMapper/main.cpp | 6 +- .../KeyboardSettingsWidget.cpp | 36 +-- .../KeyboardSettings/KeyboardSettingsWidget.h | 6 +- Userland/Applications/Magnifier/main.cpp | 2 +- Userland/Applications/Mail/AccountHolder.cpp | 2 +- Userland/Applications/Mail/AccountHolder.h | 22 +- Userland/Applications/Mail/InboxModel.cpp | 2 +- Userland/Applications/Mail/InboxModel.h | 6 +- Userland/Applications/Mail/MailWidget.cpp | 34 +-- .../MailSettings/MailSettingsWidget.cpp | 2 +- .../MailSettings/MailSettingsWidget.h | 8 +- .../MouseSettings/HighlightPreviewWidget.cpp | 6 +- .../MouseSettings/MouseWidget.cpp | 4 +- .../MouseSettings/ThemeWidget.cpp | 8 +- .../Applications/MouseSettings/ThemeWidget.h | 12 +- .../NetworkSettings/NetworkSettingsWidget.cpp | 14 +- .../NetworkSettings/NetworkSettingsWidget.h | 12 +- .../Applications/NetworkSettings/main.cpp | 2 +- .../Applications/PDFViewer/NumericInput.cpp | 4 +- .../PDFViewer/PDFViewerWidget.cpp | 4 +- .../PartitionEditor/PartitionModel.cpp | 4 +- .../PartitionEditor/PartitionModel.h | 4 +- .../Applications/PartitionEditor/main.cpp | 8 +- Userland/Applications/Piano/KnobsWidget.cpp | 4 +- Userland/Applications/Piano/PlayerWidget.cpp | 4 +- Userland/Applications/Piano/PlayerWidget.h | 2 +- .../Piano/ProcessorParameterWidget/Dropdown.h | 6 +- .../ParameterWidget.cpp | 4 +- .../Piano/ProcessorParameterWidget/Slider.cpp | 6 +- Userland/Applications/Piano/RollWidget.cpp | 2 +- Userland/Applications/Piano/SamplerWidget.cpp | 2 +- Userland/Applications/Piano/main.cpp | 4 +- .../PixelPaint/CreateNewImageDialog.h | 4 +- .../PixelPaint/CreateNewLayerDialog.h | 4 +- .../PixelPaint/EditGuideDialog.cpp | 2 +- .../Applications/PixelPaint/EditGuideDialog.h | 6 +- .../Applications/PixelPaint/FilterTreeModel.h | 2 +- Userland/Applications/PixelPaint/IconBag.cpp | 2 +- Userland/Applications/PixelPaint/Image.cpp | 2 +- Userland/Applications/PixelPaint/Image.h | 6 +- .../Applications/PixelPaint/ImageEditor.cpp | 20 +- .../Applications/PixelPaint/ImageEditor.h | 18 +- .../PixelPaint/ImageProcessor.cpp | 2 +- Userland/Applications/PixelPaint/Layer.cpp | 8 +- Userland/Applications/PixelPaint/Layer.h | 14 +- .../Applications/PixelPaint/LevelsDialog.cpp | 2 +- .../Applications/PixelPaint/MainWidget.cpp | 22 +- .../Applications/PixelPaint/PaletteWidget.cpp | 12 +- .../Applications/PixelPaint/PaletteWidget.h | 6 +- .../Applications/PixelPaint/ProjectLoader.cpp | 2 +- .../Applications/PixelPaint/ToolboxWidget.cpp | 2 +- .../PixelPaint/Tools/GuideTool.cpp | 6 +- .../PixelPaint/Tools/RectangleSelectTool.cpp | 2 +- .../PixelPaint/Tools/RectangleSelectTool.h | 2 +- .../PixelPaint/Tools/WandSelectTool.cpp | 2 +- .../PixelPaint/Tools/WandSelectTool.h | 2 +- .../Applications/Presenter/Presentation.cpp | 8 +- .../Applications/Presenter/Presentation.h | 10 +- .../Presenter/PresenterWidget.cpp | 4 +- Userland/Applications/Presenter/Slide.cpp | 2 +- Userland/Applications/Presenter/Slide.h | 6 +- Userland/Applications/Presenter/SlideObject.h | 14 +- Userland/Applications/Presenter/main.cpp | 2 +- Userland/Applications/Run/RunWindow.cpp | 16 +- Userland/Applications/Run/RunWindow.h | 10 +- Userland/Applications/Settings/main.cpp | 4 +- .../Applications/SoundPlayer/M3UParser.cpp | 4 +- Userland/Applications/SoundPlayer/M3UParser.h | 26 +-- Userland/Applications/SoundPlayer/Player.cpp | 4 +- Userland/Applications/SoundPlayer/Player.h | 8 +- .../Applications/SoundPlayer/Playlist.cpp | 2 +- .../SoundPlayer/PlaylistWidget.cpp | 16 +- .../Applications/SoundPlayer/PlaylistWidget.h | 6 +- .../SoundPlayerWidgetAdvancedView.cpp | 10 +- Userland/Applications/SoundPlayer/main.cpp | 2 +- .../SpaceAnalyzer/TreeMapWidget.cpp | 2 +- .../SpaceAnalyzer/TreeMapWidget.h | 2 +- Userland/Applications/SpaceAnalyzer/main.cpp | 38 ++-- Userland/Applications/Spreadsheet/Cell.cpp | 6 +- Userland/Applications/Spreadsheet/Cell.h | 20 +- .../Spreadsheet/CellType/Date.cpp | 6 +- .../Applications/Spreadsheet/CellType/Date.h | 4 +- .../Spreadsheet/CellType/Format.cpp | 4 +- .../Spreadsheet/CellType/Format.h | 2 +- .../Spreadsheet/CellType/Identity.cpp | 4 +- .../Spreadsheet/CellType/Identity.h | 4 +- .../Spreadsheet/CellType/Numeric.cpp | 8 +- .../Spreadsheet/CellType/Numeric.h | 4 +- .../Spreadsheet/CellType/String.cpp | 4 +- .../Spreadsheet/CellType/String.h | 4 +- .../Spreadsheet/CellType/Type.cpp | 2 +- .../Applications/Spreadsheet/CellType/Type.h | 12 +- .../Spreadsheet/CellTypeDialog.cpp | 14 +- .../Applications/Spreadsheet/CellTypeDialog.h | 2 +- .../Spreadsheet/ConditionalFormatting.h | 4 +- .../Applications/Spreadsheet/ExportDialog.cpp | 40 ++-- .../Applications/Spreadsheet/ExportDialog.h | 14 +- .../Applications/Spreadsheet/HelpWindow.cpp | 16 +- .../Applications/Spreadsheet/HelpWindow.h | 2 +- .../Applications/Spreadsheet/ImportDialog.cpp | 28 +-- .../Applications/Spreadsheet/ImportDialog.h | 4 +- .../Spreadsheet/JSIntegration.cpp | 8 +- .../Applications/Spreadsheet/JSIntegration.h | 2 +- Userland/Applications/Spreadsheet/Position.h | 4 +- .../Applications/Spreadsheet/Readers/XSV.cpp | 6 +- .../Applications/Spreadsheet/Readers/XSV.h | 12 +- .../Applications/Spreadsheet/Spreadsheet.cpp | 34 +-- .../Applications/Spreadsheet/Spreadsheet.h | 30 +-- .../Spreadsheet/SpreadsheetModel.cpp | 10 +- .../Spreadsheet/SpreadsheetModel.h | 6 +- .../Spreadsheet/SpreadsheetWidget.cpp | 12 +- .../Spreadsheet/SpreadsheetWidget.h | 4 +- .../Applications/Spreadsheet/Workbook.cpp | 8 +- Userland/Applications/Spreadsheet/Workbook.h | 12 +- .../Writers/Test/TestXSVWriter.cpp | 2 +- .../Applications/Spreadsheet/Writers/XSV.h | 10 +- .../Applications/SystemMonitor/GraphWidget.h | 2 +- .../SystemMonitor/MemoryStatsWidget.cpp | 18 +- .../SystemMonitor/MemoryStatsWidget.h | 6 +- .../SystemMonitor/NetworkStatisticsWidget.cpp | 6 +- .../ProcessFileDescriptorMapWidget.cpp | 2 +- .../SystemMonitor/ProcessMemoryMapWidget.cpp | 4 +- .../SystemMonitor/ProcessModel.cpp | 14 +- .../Applications/SystemMonitor/ProcessModel.h | 18 +- .../ProcessUnveiledPathsWidget.cpp | 2 +- .../SystemMonitor/ThreadStackWidget.cpp | 4 +- Userland/Applications/SystemMonitor/main.cpp | 44 ++-- Userland/Applications/Terminal/main.cpp | 18 +- .../TerminalSettingsWidget.cpp | 6 +- .../TerminalSettings/TerminalSettingsWidget.h | 6 +- .../Applications/TextEditor/FileArgument.cpp | 2 +- .../Applications/TextEditor/FileArgument.h | 8 +- .../Applications/TextEditor/MainWidget.cpp | 16 +- Userland/Applications/TextEditor/MainWidget.h | 8 +- .../Applications/ThemeEditor/MainWidget.cpp | 10 +- .../Applications/ThemeEditor/MainWidget.h | 12 +- Userland/Applications/ThemeEditor/main.cpp | 4 +- .../VideoPlayer/VideoPlayerWidget.cpp | 4 +- .../VideoPlayer/VideoPlayerWidget.h | 2 +- .../Applications/Welcome/WelcomeWidget.cpp | 6 +- Userland/Applications/Welcome/WelcomeWidget.h | 2 +- Userland/Demos/Cube/Cube.cpp | 2 +- Userland/Demos/Fire/Fire.cpp | 2 +- Userland/Demos/Mandelbrot/Mandelbrot.cpp | 12 +- Userland/Demos/ModelGallery/BasicModel.cpp | 2 +- Userland/Demos/ModelGallery/BasicModel.h | 6 +- Userland/Demos/ModelGallery/GalleryWidget.cpp | 4 +- Userland/Demos/VirGLDemo/VirGLDemo.cpp | 2 +- .../Demos/WidgetGallery/DemoWizardDialog.h | 2 +- Userland/Demos/WidgetGallery/GalleryModels.h | 12 +- .../Demos/WidgetGallery/GalleryWidget.cpp | 14 +- Userland/Demos/WidgetGallery/GalleryWidget.h | 6 +- Userland/DevTools/GMLPlayground/main.cpp | 14 +- .../HackStudio/AutoCompleteResponse.h | 2 +- Userland/DevTools/HackStudio/CodeDocument.cpp | 4 +- Userland/DevTools/HackStudio/CodeDocument.h | 12 +- .../HackStudio/Debugger/BacktraceModel.cpp | 2 +- .../HackStudio/Debugger/BacktraceModel.h | 4 +- .../HackStudio/Debugger/BreakpointCallback.h | 4 +- .../HackStudio/Debugger/DebugInfoWidget.cpp | 2 +- .../DevTools/HackStudio/Debugger/Debugger.cpp | 12 +- .../DevTools/HackStudio/Debugger/Debugger.h | 18 +- .../HackStudio/Debugger/DisassemblyModel.cpp | 4 +- .../HackStudio/Debugger/DisassemblyModel.h | 4 +- .../HackStudio/Debugger/DisassemblyWidget.cpp | 2 +- .../HackStudio/Debugger/DisassemblyWidget.h | 10 +- .../HackStudio/Debugger/RegistersModel.cpp | 4 +- .../HackStudio/Debugger/RegistersModel.h | 4 +- .../HackStudio/Debugger/VariablesModel.cpp | 18 +- .../Dialogs/Git/GitCommitDialog.cpp | 2 +- .../HackStudio/Dialogs/Git/GitCommitDialog.h | 2 +- .../HackStudio/Dialogs/NewProjectDialog.cpp | 18 +- .../HackStudio/Dialogs/NewProjectDialog.h | 8 +- .../Dialogs/ProjectTemplatesModel.cpp | 2 +- .../Dialogs/ProjectTemplatesModel.h | 2 +- Userland/DevTools/HackStudio/Editor.cpp | 18 +- Userland/DevTools/HackStudio/Editor.h | 8 +- .../DevTools/HackStudio/EditorWrapper.cpp | 8 +- Userland/DevTools/HackStudio/EditorWrapper.h | 16 +- .../DevTools/HackStudio/FindInFilesWidget.cpp | 6 +- .../DevTools/HackStudio/GMLPreviewWidget.cpp | 8 +- .../DevTools/HackStudio/GMLPreviewWidget.h | 4 +- .../DevTools/HackStudio/Git/DiffViewer.cpp | 10 +- Userland/DevTools/HackStudio/Git/DiffViewer.h | 12 +- .../DevTools/HackStudio/Git/GitFilesModel.cpp | 4 +- .../DevTools/HackStudio/Git/GitFilesModel.h | 8 +- .../DevTools/HackStudio/Git/GitFilesView.h | 2 +- Userland/DevTools/HackStudio/Git/GitRepo.cpp | 36 +-- Userland/DevTools/HackStudio/Git/GitRepo.h | 38 ++-- .../DevTools/HackStudio/Git/GitWidget.cpp | 12 +- Userland/DevTools/HackStudio/Git/GitWidget.h | 14 +- Userland/DevTools/HackStudio/HackStudio.h | 8 +- .../DevTools/HackStudio/HackStudioWidget.cpp | 118 +++++----- .../DevTools/HackStudio/HackStudioWidget.h | 38 ++-- Userland/DevTools/HackStudio/Language.cpp | 4 +- Userland/DevTools/HackStudio/Language.h | 6 +- .../DevTools/HackStudio/LanguageClient.cpp | 40 ++-- Userland/DevTools/HackStudio/LanguageClient.h | 52 ++--- .../LanguageClients/ConnectionsToServer.h | 32 +-- .../LanguageServers/ConnectionFromClient.cpp | 12 +- .../LanguageServers/ConnectionFromClient.h | 12 +- .../Cpp/ConnectionFromClient.h | 4 +- .../HackStudio/LanguageServers/FileDB.cpp | 24 +- .../HackStudio/LanguageServers/FileDB.h | 28 +-- .../LanguageServers/LanguageClient.ipc | 6 +- .../LanguageServers/LanguageServer.ipc | 12 +- .../Shell/ConnectionFromClient.h | 4 +- Userland/DevTools/HackStudio/Locator.cpp | 8 +- Userland/DevTools/HackStudio/Project.cpp | 10 +- Userland/DevTools/HackStudio/Project.h | 14 +- .../DevTools/HackStudio/ProjectBuilder.cpp | 40 ++-- Userland/DevTools/HackStudio/ProjectBuilder.h | 24 +- .../DevTools/HackStudio/ProjectConfig.cpp | 4 +- Userland/DevTools/HackStudio/ProjectConfig.h | 8 +- .../HackStudio/ProjectDeclarations.cpp | 2 +- .../DevTools/HackStudio/ProjectDeclarations.h | 6 +- Userland/DevTools/HackStudio/ProjectFile.cpp | 2 +- Userland/DevTools/HackStudio/ProjectFile.h | 10 +- .../DevTools/HackStudio/ProjectTemplate.cpp | 24 +- .../DevTools/HackStudio/ProjectTemplate.h | 26 +-- .../DevTools/HackStudio/TerminalWrapper.cpp | 8 +- .../DevTools/HackStudio/TerminalWrapper.h | 2 +- Userland/DevTools/HackStudio/ToDoEntries.cpp | 2 +- Userland/DevTools/HackStudio/ToDoEntries.h | 6 +- .../DevTools/HackStudio/ToDoEntriesWidget.cpp | 6 +- Userland/DevTools/HackStudio/main.cpp | 12 +- Userland/DevTools/Inspector/RemoteObject.h | 6 +- .../Inspector/RemoteObjectGraphModel.cpp | 2 +- .../Inspector/RemoteObjectPropertyModel.cpp | 8 +- .../Inspector/RemoteObjectPropertyModel.h | 2 +- Userland/DevTools/Inspector/RemoteProcess.h | 4 +- Userland/DevTools/Inspector/main.cpp | 6 +- .../DevTools/Profiler/DisassemblyModel.cpp | 6 +- Userland/DevTools/Profiler/DisassemblyModel.h | 4 +- .../Profiler/FilesystemEventModel.cpp | 6 +- .../DevTools/Profiler/FilesystemEventModel.h | 16 +- Userland/DevTools/Profiler/FlameGraphView.cpp | 6 +- Userland/DevTools/Profiler/FlameGraphView.h | 2 +- .../Profiler/IndividualSampleModel.cpp | 4 +- .../DevTools/Profiler/IndividualSampleModel.h | 2 +- Userland/DevTools/Profiler/Process.cpp | 22 +- Userland/DevTools/Profiler/Process.h | 14 +- Userland/DevTools/Profiler/Profile.cpp | 14 +- Userland/DevTools/Profiler/Profile.h | 22 +- Userland/DevTools/Profiler/ProfileModel.cpp | 8 +- Userland/DevTools/Profiler/ProfileModel.h | 2 +- Userland/DevTools/Profiler/SamplesModel.cpp | 2 +- Userland/DevTools/Profiler/SamplesModel.h | 2 +- Userland/DevTools/Profiler/SignpostsModel.cpp | 2 +- Userland/DevTools/Profiler/SignpostsModel.h | 2 +- Userland/DevTools/Profiler/SourceModel.cpp | 10 +- Userland/DevTools/Profiler/SourceModel.h | 6 +- Userland/DevTools/Profiler/TimelineHeader.cpp | 2 +- Userland/DevTools/Profiler/TimelineHeader.h | 2 +- Userland/DevTools/Profiler/TimelineTrack.cpp | 2 +- Userland/DevTools/Profiler/main.cpp | 22 +- Userland/DevTools/SQLStudio/MainWidget.cpp | 30 +-- Userland/DevTools/SQLStudio/MainWidget.h | 6 +- Userland/DevTools/SQLStudio/ScriptEditor.cpp | 2 +- Userland/DevTools/SQLStudio/ScriptEditor.h | 4 +- .../DevTools/UserspaceEmulator/Emulator.cpp | 30 +-- .../DevTools/UserspaceEmulator/Emulator.h | 26 +-- .../UserspaceEmulator/Emulator_syscalls.cpp | 26 +-- .../DevTools/UserspaceEmulator/MmapRegion.cpp | 12 +- .../DevTools/UserspaceEmulator/MmapRegion.h | 12 +- Userland/DevTools/UserspaceEmulator/SoftFPU.h | 2 +- Userland/DevTools/UserspaceEmulator/main.cpp | 18 +- Userland/DynamicLoader/main.cpp | 2 +- Userland/Games/2048/BoardView.cpp | 6 +- Userland/Games/2048/Game.cpp | 2 +- Userland/Games/2048/GameSizeDialog.cpp | 4 +- Userland/Games/2048/main.cpp | 6 +- Userland/Games/BrickGame/BrickGame.cpp | 8 +- Userland/Games/BrickGame/BrickGame.h | 2 +- Userland/Games/Chess/ChessWidget.cpp | 34 +-- Userland/Games/Chess/ChessWidget.h | 8 +- Userland/Games/Chess/Engine.cpp | 2 +- Userland/Games/Chess/main.cpp | 2 +- Userland/Games/FlappyBug/Game.cpp | 4 +- Userland/Games/Flood/SettingsDialog.cpp | 4 +- Userland/Games/Flood/SettingsDialog.h | 2 +- Userland/Games/Flood/main.cpp | 12 +- Userland/Games/GameOfLife/BoardWidget.cpp | 30 +-- Userland/Games/GameOfLife/Pattern.cpp | 6 +- Userland/Games/GameOfLife/Pattern.h | 6 +- Userland/Games/Hearts/Game.cpp | 10 +- Userland/Games/Hearts/Game.h | 6 +- Userland/Games/Hearts/Player.h | 2 +- Userland/Games/Hearts/ScoreCard.cpp | 2 +- Userland/Games/Hearts/SettingsDialog.cpp | 2 +- Userland/Games/Hearts/SettingsDialog.h | 6 +- Userland/Games/Hearts/main.cpp | 2 +- Userland/Games/MasterWord/WordGame.cpp | 10 +- Userland/Games/MasterWord/WordGame.h | 12 +- Userland/Games/MasterWord/main.cpp | 6 +- Userland/Games/Minesweeper/Field.cpp | 8 +- Userland/Games/Snake/SnakeGame.cpp | 6 +- Userland/Games/Snake/SnakeGame.h | 4 +- Userland/Games/Solitaire/main.cpp | 14 +- Userland/Games/Spider/main.cpp | 12 +- Userland/Libraries/LibArchive/Tar.cpp | 2 +- Userland/Libraries/LibArchive/Tar.h | 4 +- Userland/Libraries/LibArchive/TarStream.cpp | 8 +- Userland/Libraries/LibArchive/TarStream.h | 6 +- Userland/Libraries/LibArchive/Zip.cpp | 2 +- Userland/Libraries/LibArchive/Zip.h | 4 +- Userland/Libraries/LibAudio/FlacLoader.cpp | 28 +-- Userland/Libraries/LibAudio/FlacLoader.h | 2 +- Userland/Libraries/LibAudio/GenericTypes.h | 4 +- Userland/Libraries/LibAudio/Loader.h | 4 +- Userland/Libraries/LibAudio/LoaderError.h | 4 +- Userland/Libraries/LibAudio/MP3Loader.h | 2 +- Userland/Libraries/LibAudio/SampleFormats.cpp | 4 +- Userland/Libraries/LibAudio/SampleFormats.h | 4 +- Userland/Libraries/LibAudio/WavLoader.cpp | 8 +- Userland/Libraries/LibAudio/WavLoader.h | 4 +- Userland/Libraries/LibAudio/WavWriter.cpp | 2 +- Userland/Libraries/LibAudio/WavWriter.h | 4 +- .../Libraries/LibC/bits/dlfcn_integration.h | 6 +- Userland/Libraries/LibC/dlfcn.cpp | 4 +- Userland/Libraries/LibC/grp.cpp | 2 +- Userland/Libraries/LibC/netdb.cpp | 16 +- Userland/Libraries/LibC/pwd.cpp | 2 +- Userland/Libraries/LibC/semaphore.cpp | 6 +- Userland/Libraries/LibC/shadow.cpp | 10 +- Userland/Libraries/LibC/stdio.cpp | 2 +- Userland/Libraries/LibC/syslog.cpp | 4 +- Userland/Libraries/LibC/termcap.cpp | 8 +- Userland/Libraries/LibC/time.cpp | 2 +- Userland/Libraries/LibC/unistd.cpp | 10 +- Userland/Libraries/LibCards/CardGame.cpp | 2 +- Userland/Libraries/LibCards/CardGame.h | 2 +- Userland/Libraries/LibCards/CardPainter.cpp | 2 +- Userland/Libraries/LibCards/CardPainter.h | 4 +- Userland/Libraries/LibChess/Chess.cpp | 30 +-- Userland/Libraries/LibChess/Chess.h | 14 +- Userland/Libraries/LibChess/UCICommand.cpp | 26 +-- Userland/Libraries/LibChess/UCICommand.h | 48 ++-- Userland/Libraries/LibChess/UCIEndpoint.cpp | 6 +- .../CodeComprehensionEngine.cpp | 4 +- .../CodeComprehensionEngine.h | 26 +-- .../Cpp/ConnectionFromClient.h | 4 +- .../Cpp/CppComprehensionEngine.cpp | 74 +++--- .../Cpp/CppComprehensionEngine.h | 56 ++--- .../LibCodeComprehension/Cpp/Tests.cpp | 18 +- .../Libraries/LibCodeComprehension/FileDB.cpp | 4 +- .../Libraries/LibCodeComprehension/FileDB.h | 10 +- .../Shell/ConnectionFromClient.h | 4 +- .../Shell/ShellComprehensionEngine.cpp | 30 +-- .../Shell/ShellComprehensionEngine.h | 30 +-- .../Libraries/LibCodeComprehension/Types.h | 16 +- Userland/Libraries/LibCompress/Gzip.cpp | 6 +- Userland/Libraries/LibCompress/Gzip.h | 2 +- Userland/Libraries/LibConfig/Client.cpp | 22 +- Userland/Libraries/LibConfig/Client.h | 34 +-- Userland/Libraries/LibConfig/Listener.cpp | 14 +- Userland/Libraries/LibConfig/Listener.h | 12 +- Userland/Libraries/LibCore/Account.cpp | 34 +-- Userland/Libraries/LibCore/Account.h | 26 +-- Userland/Libraries/LibCore/ArgsParser.cpp | 14 +- Userland/Libraries/LibCore/ArgsParser.h | 16 +- Userland/Libraries/LibCore/Command.cpp | 6 +- Userland/Libraries/LibCore/Command.h | 10 +- Userland/Libraries/LibCore/ConfigFile.cpp | 56 ++--- Userland/Libraries/LibCore/ConfigFile.h | 48 ++-- Userland/Libraries/LibCore/DateTime.cpp | 6 +- Userland/Libraries/LibCore/DateTime.h | 6 +- Userland/Libraries/LibCore/DirIterator.cpp | 10 +- Userland/Libraries/LibCore/DirIterator.h | 12 +- Userland/Libraries/LibCore/Directory.cpp | 2 +- Userland/Libraries/LibCore/Directory.h | 2 +- Userland/Libraries/LibCore/Event.h | 2 +- Userland/Libraries/LibCore/File.cpp | 76 +++---- Userland/Libraries/LibCore/File.h | 52 ++--- .../Libraries/LibCore/FilePermissionsMask.h | 2 +- Userland/Libraries/LibCore/FileWatcher.cpp | 22 +- Userland/Libraries/LibCore/FileWatcher.h | 14 +- Userland/Libraries/LibCore/Group.cpp | 12 +- Userland/Libraries/LibCore/Group.h | 16 +- Userland/Libraries/LibCore/IODevice.cpp | 6 +- Userland/Libraries/LibCore/IODevice.h | 4 +- Userland/Libraries/LibCore/LocalServer.cpp | 4 +- Userland/Libraries/LibCore/LocalServer.h | 4 +- Userland/Libraries/LibCore/MappedFile.cpp | 2 +- Userland/Libraries/LibCore/MimeData.cpp | 14 +- Userland/Libraries/LibCore/MimeData.h | 22 +- Userland/Libraries/LibCore/NetworkJob.h | 2 +- Userland/Libraries/LibCore/Object.cpp | 6 +- Userland/Libraries/LibCore/Object.h | 30 +-- Userland/Libraries/LibCore/Process.cpp | 18 +- Userland/Libraries/LibCore/Process.h | 6 +- .../LibCore/ProcessStatisticsReader.cpp | 6 +- .../LibCore/ProcessStatisticsReader.h | 22 +- Userland/Libraries/LibCore/Property.cpp | 2 +- Userland/Libraries/LibCore/Property.h | 6 +- .../Libraries/LibCore/SOCKSProxyClient.cpp | 4 +- Userland/Libraries/LibCore/SOCKSProxyClient.h | 6 +- .../Libraries/LibCore/SessionManagement.cpp | 8 +- .../Libraries/LibCore/SessionManagement.h | 2 +- .../Libraries/LibCore/SharedCircularQueue.h | 8 +- Userland/Libraries/LibCore/SocketAddress.h | 12 +- Userland/Libraries/LibCore/StandardPaths.cpp | 16 +- Userland/Libraries/LibCore/StandardPaths.h | 12 +- Userland/Libraries/LibCore/Stream.cpp | 10 +- Userland/Libraries/LibCore/Stream.h | 18 +- Userland/Libraries/LibCore/System.cpp | 74 +++--- Userland/Libraries/LibCore/System.h | 8 +- .../LibCore/SystemServerTakeover.cpp | 4 +- .../Libraries/LibCore/SystemServerTakeover.h | 2 +- Userland/Libraries/LibCore/TempFile.cpp | 4 +- Userland/Libraries/LibCore/TempFile.h | 8 +- Userland/Libraries/LibCore/Version.cpp | 6 +- Userland/Libraries/LibCore/Version.h | 2 +- Userland/Libraries/LibCoredump/Backtrace.cpp | 4 +- Userland/Libraries/LibCoredump/Backtrace.h | 8 +- Userland/Libraries/LibCoredump/Inspector.cpp | 4 +- Userland/Libraries/LibCoredump/Inspector.h | 2 +- Userland/Libraries/LibCoredump/Reader.cpp | 26 +-- Userland/Libraries/LibCoredump/Reader.h | 16 +- Userland/Libraries/LibCpp/AST.cpp | 24 +- Userland/Libraries/LibCpp/AST.h | 116 +++++----- Userland/Libraries/LibCpp/Lexer.cpp | 6 +- Userland/Libraries/LibCpp/Parser.cpp | 28 +-- Userland/Libraries/LibCpp/Parser.h | 16 +- Userland/Libraries/LibCpp/Preprocessor.cpp | 6 +- Userland/Libraries/LibCpp/Preprocessor.h | 22 +- .../LibCpp/SemanticSyntaxHighlighter.h | 2 +- Userland/Libraries/LibCpp/Token.cpp | 8 +- Userland/Libraries/LibCpp/Token.h | 4 +- Userland/Libraries/LibCrypt/crypt.cpp | 2 +- Userland/Libraries/LibCrypto/ASN1/ASN1.cpp | 6 +- Userland/Libraries/LibCrypto/ASN1/ASN1.h | 6 +- .../LibCrypto/Authentication/GHash.h | 4 +- .../Libraries/LibCrypto/Authentication/HMAC.h | 4 +- .../LibCrypto/BigFraction/BigFraction.cpp | 4 +- .../LibCrypto/BigFraction/BigFraction.h | 4 +- .../LibCrypto/BigInt/SignedBigInteger.cpp | 2 +- .../LibCrypto/BigInt/SignedBigInteger.h | 2 +- .../LibCrypto/BigInt/UnsignedBigInteger.cpp | 2 +- .../LibCrypto/BigInt/UnsignedBigInteger.h | 4 +- Userland/Libraries/LibCrypto/Cipher/AES.cpp | 4 +- Userland/Libraries/LibCrypto/Cipher/AES.h | 8 +- Userland/Libraries/LibCrypto/Cipher/Cipher.h | 2 +- .../Libraries/LibCrypto/Cipher/Mode/CBC.h | 4 +- .../Libraries/LibCrypto/Cipher/Mode/CTR.h | 4 +- .../Libraries/LibCrypto/Cipher/Mode/GCM.h | 4 +- .../Libraries/LibCrypto/Cipher/Mode/Mode.h | 2 +- .../Libraries/LibCrypto/Curves/SECP256r1.cpp | 2 +- .../Libraries/LibCrypto/Hash/HashFunction.h | 2 +- .../Libraries/LibCrypto/Hash/HashManager.h | 4 +- Userland/Libraries/LibCrypto/Hash/MD5.h | 4 +- Userland/Libraries/LibCrypto/Hash/SHA1.h | 4 +- Userland/Libraries/LibCrypto/Hash/SHA2.h | 14 +- Userland/Libraries/LibCrypto/PK/PK.h | 4 +- Userland/Libraries/LibCrypto/PK/RSA.h | 4 +- Userland/Libraries/LibDNS/Answer.cpp | 6 +- Userland/Libraries/LibDNS/Answer.h | 8 +- Userland/Libraries/LibDNS/Name.cpp | 2 +- Userland/Libraries/LibDNS/Name.h | 8 +- Userland/Libraries/LibDNS/Packet.cpp | 2 +- Userland/Libraries/LibDSP/Processor.h | 2 +- .../Libraries/LibDSP/ProcessorParameter.h | 18 +- Userland/Libraries/LibDebug/DebugInfo.cpp | 20 +- Userland/Libraries/LibDebug/DebugInfo.h | 22 +- Userland/Libraries/LibDebug/DebugSession.cpp | 18 +- Userland/Libraries/LibDebug/DebugSession.h | 20 +- .../Libraries/LibDebug/Dwarf/DwarfInfo.cpp | 2 +- Userland/Libraries/LibDebug/Dwarf/DwarfInfo.h | 2 +- .../Libraries/LibDebug/Dwarf/LineProgram.cpp | 4 +- .../Libraries/LibDebug/Dwarf/LineProgram.h | 4 +- Userland/Libraries/LibDebug/LoadedLibrary.h | 4 +- .../Libraries/LibDebug/ProcessInspector.cpp | 4 +- .../Libraries/LibDebug/ProcessInspector.h | 6 +- Userland/Libraries/LibDesktop/AppFile.cpp | 30 +-- Userland/Libraries/LibDesktop/AppFile.h | 20 +- Userland/Libraries/LibDesktop/Launcher.cpp | 10 +- Userland/Libraries/LibDesktop/Launcher.h | 16 +- .../Libraries/LibDeviceTree/Validation.cpp | 2 +- Userland/Libraries/LibDiff/Format.cpp | 4 +- Userland/Libraries/LibDiff/Format.h | 4 +- Userland/Libraries/LibDiff/Hunks.cpp | 8 +- Userland/Libraries/LibDiff/Hunks.h | 10 +- Userland/Libraries/LibEDID/DMT.cpp | 8 +- Userland/Libraries/LibEDID/DMT.h | 2 +- Userland/Libraries/LibEDID/EDID.cpp | 14 +- Userland/Libraries/LibEDID/EDID.h | 12 +- Userland/Libraries/LibELF/Core.h | 10 +- Userland/Libraries/LibELF/DynamicLinker.cpp | 46 ++-- Userland/Libraries/LibELF/DynamicLinker.h | 2 +- Userland/Libraries/LibELF/DynamicLoader.cpp | 20 +- Userland/Libraries/LibELF/DynamicLoader.h | 10 +- Userland/Libraries/LibELF/DynamicObject.cpp | 8 +- Userland/Libraries/LibELF/DynamicObject.h | 10 +- Userland/Libraries/LibELF/Image.cpp | 4 +- Userland/Libraries/LibELF/Image.h | 6 +- .../LibFileSystemAccessClient/Client.cpp | 18 +- .../LibFileSystemAccessClient/Client.h | 10 +- Userland/Libraries/LibGL/GLContext.cpp | 2 +- Userland/Libraries/LibGL/GLContext.h | 2 +- Userland/Libraries/LibGPU/DeviceInfo.h | 6 +- Userland/Libraries/LibGPU/Driver.cpp | 6 +- Userland/Libraries/LibGUI/AboutDialog.cpp | 2 +- Userland/Libraries/LibGUI/AboutDialog.h | 4 +- Userland/Libraries/LibGUI/AbstractButton.cpp | 4 +- Userland/Libraries/LibGUI/AbstractButton.h | 8 +- .../Libraries/LibGUI/AbstractThemePreview.cpp | 6 +- .../Libraries/LibGUI/AbstractThemePreview.h | 18 +- Userland/Libraries/LibGUI/AbstractView.h | 2 +- Userland/Libraries/LibGUI/Action.cpp | 34 +-- Userland/Libraries/LibGUI/Action.h | 48 ++-- Userland/Libraries/LibGUI/Application.cpp | 10 +- Userland/Libraries/LibGUI/Application.h | 18 +- Userland/Libraries/LibGUI/Breadcrumbbar.cpp | 4 +- Userland/Libraries/LibGUI/Breadcrumbbar.h | 10 +- Userland/Libraries/LibGUI/Button.cpp | 4 +- Userland/Libraries/LibGUI/Button.h | 6 +- Userland/Libraries/LibGUI/Calendar.cpp | 20 +- Userland/Libraries/LibGUI/Calendar.h | 14 +- Userland/Libraries/LibGUI/CheckBox.cpp | 2 +- Userland/Libraries/LibGUI/CheckBox.h | 2 +- Userland/Libraries/LibGUI/Clipboard.cpp | 18 +- Userland/Libraries/LibGUI/Clipboard.h | 18 +- Userland/Libraries/LibGUI/ColorInput.h | 6 +- Userland/Libraries/LibGUI/ColorPicker.cpp | 2 +- Userland/Libraries/LibGUI/ColorPicker.h | 2 +- Userland/Libraries/LibGUI/ComboBox.cpp | 6 +- Userland/Libraries/LibGUI/ComboBox.h | 8 +- Userland/Libraries/LibGUI/Command.h | 4 +- Userland/Libraries/LibGUI/CommandPalette.cpp | 8 +- Userland/Libraries/LibGUI/CommonActions.cpp | 6 +- .../LibGUI/CommonLocationsProvider.cpp | 6 +- .../LibGUI/CommonLocationsProvider.h | 8 +- .../ConnectionToWindowManagerServer.cpp | 4 +- .../LibGUI/ConnectionToWindowManagerServer.h | 4 +- .../LibGUI/ConnectionToWindowServer.cpp | 8 +- .../LibGUI/ConnectionToWindowServer.h | 8 +- Userland/Libraries/LibGUI/Desktop.cpp | 4 +- Userland/Libraries/LibGUI/Desktop.h | 6 +- Userland/Libraries/LibGUI/DragOperation.cpp | 4 +- Userland/Libraries/LibGUI/DragOperation.h | 4 +- Userland/Libraries/LibGUI/EditingEngine.cpp | 2 +- Userland/Libraries/LibGUI/EditingEngine.h | 2 +- Userland/Libraries/LibGUI/EmojiInputDialog.h | 6 +- Userland/Libraries/LibGUI/Event.cpp | 6 +- Userland/Libraries/LibGUI/Event.h | 26 +-- .../Libraries/LibGUI/FileIconProvider.cpp | 20 +- Userland/Libraries/LibGUI/FileIconProvider.h | 6 +- Userland/Libraries/LibGUI/FilePicker.cpp | 28 +-- Userland/Libraries/LibGUI/FilePicker.h | 14 +- Userland/Libraries/LibGUI/FileSystemModel.cpp | 42 ++-- Userland/Libraries/LibGUI/FileSystemModel.h | 42 ++-- .../Libraries/LibGUI/FilteringProxyModel.cpp | 2 +- .../Libraries/LibGUI/FilteringProxyModel.h | 6 +- Userland/Libraries/LibGUI/FontPicker.cpp | 4 +- Userland/Libraries/LibGUI/FontPicker.h | 8 +- Userland/Libraries/LibGUI/GML/AST.h | 20 +- .../LibGUI/GML/AutocompleteProvider.cpp | 18 +- Userland/Libraries/LibGUI/GML/Formatter.h | 4 +- Userland/Libraries/LibGUI/GroupBox.h | 4 +- Userland/Libraries/LibGUI/HeaderView.cpp | 2 +- Userland/Libraries/LibGUI/Icon.cpp | 6 +- Userland/Libraries/LibGUI/IconView.h | 2 +- .../LibGUI/IncrementalSearchBanner.cpp | 6 +- Userland/Libraries/LibGUI/InputBox.cpp | 6 +- Userland/Libraries/LibGUI/InputBox.h | 14 +- Userland/Libraries/LibGUI/ItemListModel.h | 2 +- Userland/Libraries/LibGUI/JsonArrayModel.cpp | 2 +- Userland/Libraries/LibGUI/JsonArrayModel.h | 20 +- Userland/Libraries/LibGUI/Label.cpp | 6 +- Userland/Libraries/LibGUI/Label.h | 10 +- Userland/Libraries/LibGUI/LinkLabel.cpp | 2 +- Userland/Libraries/LibGUI/LinkLabel.h | 2 +- Userland/Libraries/LibGUI/Menu.cpp | 8 +- Userland/Libraries/LibGUI/Menu.h | 10 +- Userland/Libraries/LibGUI/MenuItem.cpp | 2 +- Userland/Libraries/LibGUI/Menubar.cpp | 4 +- Userland/Libraries/LibGUI/Menubar.h | 4 +- Userland/Libraries/LibGUI/MessageBox.cpp | 4 +- Userland/Libraries/LibGUI/MessageBox.h | 4 +- Userland/Libraries/LibGUI/Model.cpp | 2 +- Userland/Libraries/LibGUI/Model.h | 6 +- Userland/Libraries/LibGUI/ModelIndex.cpp | 2 +- Userland/Libraries/LibGUI/Notification.h | 12 +- Userland/Libraries/LibGUI/OpacitySlider.cpp | 2 +- .../Libraries/LibGUI/PasswordInputDialog.cpp | 4 +- .../Libraries/LibGUI/PasswordInputDialog.h | 6 +- Userland/Libraries/LibGUI/Process.cpp | 6 +- Userland/Libraries/LibGUI/Process.h | 2 +- Userland/Libraries/LibGUI/ProcessChooser.h | 4 +- Userland/Libraries/LibGUI/Progressbar.cpp | 2 +- Userland/Libraries/LibGUI/Progressbar.h | 6 +- Userland/Libraries/LibGUI/RadioButton.cpp | 2 +- Userland/Libraries/LibGUI/RadioButton.h | 2 +- .../LibGUI/RunningProcessesModel.cpp | 2 +- .../Libraries/LibGUI/RunningProcessesModel.h | 4 +- .../LibGUI/ScrollableContainerWidget.cpp | 2 +- .../LibGUI/ScrollableContainerWidget.h | 2 +- Userland/Libraries/LibGUI/SettingsWindow.cpp | 2 +- Userland/Libraries/LibGUI/SettingsWindow.h | 4 +- Userland/Libraries/LibGUI/Shortcut.cpp | 8 +- Userland/Libraries/LibGUI/Shortcut.h | 2 +- .../Libraries/LibGUI/SortingProxyModel.cpp | 4 +- Userland/Libraries/LibGUI/SortingProxyModel.h | 4 +- Userland/Libraries/LibGUI/SpinBox.cpp | 4 +- Userland/Libraries/LibGUI/Statusbar.cpp | 8 +- Userland/Libraries/LibGUI/Statusbar.h | 16 +- Userland/Libraries/LibGUI/TabWidget.h | 6 +- Userland/Libraries/LibGUI/TableView.cpp | 6 +- Userland/Libraries/LibGUI/TextBox.cpp | 2 +- Userland/Libraries/LibGUI/TextBox.h | 6 +- Userland/Libraries/LibGUI/TextDocument.cpp | 26 +-- Userland/Libraries/LibGUI/TextDocument.h | 32 +-- Userland/Libraries/LibGUI/TextEditor.cpp | 14 +- Userland/Libraries/LibGUI/TextEditor.h | 14 +- Userland/Libraries/LibGUI/TextPosition.h | 2 +- Userland/Libraries/LibGUI/Toolbar.cpp | 6 +- Userland/Libraries/LibGUI/Tray.cpp | 2 +- Userland/Libraries/LibGUI/Tray.h | 8 +- Userland/Libraries/LibGUI/TreeViewModel.h | 12 +- Userland/Libraries/LibGUI/UIDimensions.h | 2 +- Userland/Libraries/LibGUI/UndoStack.cpp | 4 +- Userland/Libraries/LibGUI/UndoStack.h | 4 +- Userland/Libraries/LibGUI/ValueSlider.cpp | 8 +- Userland/Libraries/LibGUI/ValueSlider.h | 8 +- Userland/Libraries/LibGUI/Variant.h | 50 ++--- .../Libraries/LibGUI/VimEditingEngine.cpp | 2 +- Userland/Libraries/LibGUI/VimEditingEngine.h | 2 +- Userland/Libraries/LibGUI/Widget.cpp | 14 +- Userland/Libraries/LibGUI/Widget.h | 20 +- Userland/Libraries/LibGUI/Window.cpp | 8 +- Userland/Libraries/LibGUI/Window.h | 12 +- .../LibGUI/Wizards/CoverWizardPage.cpp | 4 +- .../LibGUI/Wizards/CoverWizardPage.h | 4 +- .../Libraries/LibGUI/Wizards/WizardDialog.cpp | 2 +- .../Libraries/LibGUI/Wizards/WizardPage.cpp | 6 +- .../Libraries/LibGUI/Wizards/WizardPage.h | 6 +- Userland/Libraries/LibGemini/Document.cpp | 4 +- Userland/Libraries/LibGemini/Document.h | 34 +-- Userland/Libraries/LibGemini/GeminiRequest.h | 2 +- .../Libraries/LibGemini/GeminiResponse.cpp | 2 +- Userland/Libraries/LibGemini/GeminiResponse.h | 10 +- Userland/Libraries/LibGemini/Job.cpp | 6 +- Userland/Libraries/LibGemini/Job.h | 4 +- Userland/Libraries/LibGemini/Line.cpp | 18 +- Userland/Libraries/LibGfx/BMPLoader.cpp | 4 +- Userland/Libraries/LibGfx/Bitmap.cpp | 6 +- Userland/Libraries/LibGfx/Bitmap.h | 2 +- Userland/Libraries/LibGfx/Color.cpp | 10 +- Userland/Libraries/LibGfx/Color.h | 4 +- Userland/Libraries/LibGfx/DDSLoader.cpp | 2 +- .../Libraries/LibGfx/FillPathImplementation.h | 2 +- Userland/Libraries/LibGfx/Font/BitmapFont.cpp | 16 +- Userland/Libraries/LibGfx/Font/BitmapFont.h | 28 +-- Userland/Libraries/LibGfx/Font/Emoji.cpp | 8 +- Userland/Libraries/LibGfx/Font/Font.h | 12 +- .../Libraries/LibGfx/Font/FontDatabase.cpp | 34 +-- Userland/Libraries/LibGfx/Font/FontDatabase.h | 22 +- Userland/Libraries/LibGfx/Font/ScaledFont.h | 10 +- .../Libraries/LibGfx/Font/TrueType/Font.cpp | 12 +- .../Libraries/LibGfx/Font/TrueType/Font.h | 6 +- .../Libraries/LibGfx/Font/TrueType/Tables.h | 12 +- Userland/Libraries/LibGfx/Font/Typeface.h | 2 +- Userland/Libraries/LibGfx/Font/VectorFont.h | 4 +- Userland/Libraries/LibGfx/Font/WOFF/Font.cpp | 2 +- Userland/Libraries/LibGfx/Font/WOFF/Font.h | 8 +- Userland/Libraries/LibGfx/Line.h | 12 +- Userland/Libraries/LibGfx/PNGWriter.cpp | 10 +- Userland/Libraries/LibGfx/Painter.cpp | 4 +- Userland/Libraries/LibGfx/Painter.h | 2 +- Userland/Libraries/LibGfx/Palette.cpp | 4 +- Userland/Libraries/LibGfx/Palette.h | 18 +- Userland/Libraries/LibGfx/Path.cpp | 2 +- Userland/Libraries/LibGfx/Path.h | 4 +- Userland/Libraries/LibGfx/Point.cpp | 10 +- Userland/Libraries/LibGfx/Point.h | 2 +- .../LibGfx/PortableImageLoaderCommon.h | 6 +- Userland/Libraries/LibGfx/QOIWriter.cpp | 2 +- Userland/Libraries/LibGfx/Rect.cpp | 10 +- Userland/Libraries/LibGfx/Rect.h | 2 +- Userland/Libraries/LibGfx/Size.cpp | 10 +- Userland/Libraries/LibGfx/Size.h | 2 +- Userland/Libraries/LibGfx/SystemTheme.cpp | 4 +- Userland/Libraries/LibGfx/SystemTheme.h | 8 +- Userland/Libraries/LibGfx/TextLayout.cpp | 6 +- Userland/Libraries/LibGfx/TextLayout.h | 8 +- Userland/Libraries/LibGfx/Triangle.cpp | 10 +- Userland/Libraries/LibGfx/Triangle.h | 2 +- Userland/Libraries/LibGfx/VectorN.h | 10 +- Userland/Libraries/LibHTTP/HttpRequest.cpp | 18 +- Userland/Libraries/LibHTTP/HttpRequest.h | 22 +- Userland/Libraries/LibHTTP/HttpResponse.cpp | 2 +- Userland/Libraries/LibHTTP/HttpResponse.h | 10 +- Userland/Libraries/LibHTTP/HttpsJob.cpp | 2 +- Userland/Libraries/LibHTTP/HttpsJob.h | 2 +- Userland/Libraries/LibHTTP/Job.cpp | 10 +- Userland/Libraries/LibHTTP/Job.h | 6 +- Userland/Libraries/LibIDL/IDLParser.cpp | 86 +++---- Userland/Libraries/LibIDL/IDLParser.h | 28 +-- Userland/Libraries/LibIDL/Types.h | 94 ++++---- Userland/Libraries/LibIMAP/Client.cpp | 24 +- Userland/Libraries/LibIMAP/Client.h | 6 +- Userland/Libraries/LibIMAP/Objects.cpp | 88 ++++---- Userland/Libraries/LibIMAP/Objects.h | 136 +++++------ Userland/Libraries/LibIMAP/Parser.cpp | 64 +++--- Userland/Libraries/LibIMAP/Parser.h | 6 +- Userland/Libraries/LibIPC/Decoder.cpp | 12 +- Userland/Libraries/LibIPC/Decoder.h | 4 +- Userland/Libraries/LibIPC/Dictionary.h | 10 +- Userland/Libraries/LibIPC/Encoder.cpp | 4 +- Userland/Libraries/LibIPC/Encoder.h | 2 +- Userland/Libraries/LibIPC/MultiServer.h | 2 +- Userland/Libraries/LibIPC/Stub.h | 6 +- Userland/Libraries/LibJS/AST.cpp | 56 ++--- Userland/Libraries/LibJS/AST.h | 50 ++--- .../Libraries/LibJS/Bytecode/ASTCodegen.cpp | 4 +- .../Libraries/LibJS/Bytecode/BasicBlock.cpp | 6 +- .../Libraries/LibJS/Bytecode/BasicBlock.h | 10 +- .../LibJS/Bytecode/CodeGenerationError.h | 2 +- .../Libraries/LibJS/Bytecode/Executable.h | 2 +- .../Libraries/LibJS/Bytecode/Generator.cpp | 4 +- Userland/Libraries/LibJS/Bytecode/Generator.h | 6 +- .../Libraries/LibJS/Bytecode/Instruction.h | 2 +- .../Libraries/LibJS/Bytecode/Interpreter.cpp | 2 +- .../Libraries/LibJS/Bytecode/Interpreter.h | 4 +- Userland/Libraries/LibJS/Bytecode/Op.cpp | 206 ++++++++--------- Userland/Libraries/LibJS/Bytecode/Op.h | 106 ++++----- .../Libraries/LibJS/Bytecode/StringTable.cpp | 4 +- .../Libraries/LibJS/Bytecode/StringTable.h | 8 +- Userland/Libraries/LibJS/Console.cpp | 26 +-- Userland/Libraries/LibJS/Console.h | 20 +- Userland/Libraries/LibJS/CyclicModule.cpp | 4 +- Userland/Libraries/LibJS/Interpreter.h | 2 +- Userland/Libraries/LibJS/Lexer.cpp | 8 +- Userland/Libraries/LibJS/Lexer.h | 14 +- Userland/Libraries/LibJS/MarkupGenerator.cpp | 24 +- Userland/Libraries/LibJS/MarkupGenerator.h | 14 +- Userland/Libraries/LibJS/Module.cpp | 2 +- Userland/Libraries/LibJS/Module.h | 4 +- Userland/Libraries/LibJS/Parser.cpp | 114 +++++----- Userland/Libraries/LibJS/Parser.h | 2 +- Userland/Libraries/LibJS/ParserError.cpp | 8 +- Userland/Libraries/LibJS/ParserError.h | 8 +- Userland/Libraries/LibJS/Print.cpp | 12 +- .../LibJS/Runtime/AbstractOperations.cpp | 2 +- .../LibJS/Runtime/AbstractOperations.h | 2 +- .../LibJS/Runtime/ArrayPrototype.cpp | 2 +- .../AsyncFromSyncIteratorPrototype.cpp | 4 +- .../Libraries/LibJS/Runtime/AsyncGenerator.h | 2 +- Userland/Libraries/LibJS/Runtime/BigInt.h | 2 +- .../LibJS/Runtime/BigIntConstructor.cpp | 2 +- .../Libraries/LibJS/Runtime/BoundFunction.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Date.cpp | 4 +- Userland/Libraries/LibJS/Runtime/Date.h | 2 +- .../LibJS/Runtime/DateConstructor.cpp | 4 +- .../Libraries/LibJS/Runtime/DatePrototype.cpp | 22 +- .../Libraries/LibJS/Runtime/DatePrototype.h | 8 +- .../Runtime/ECMAScriptFunctionObject.cpp | 8 +- .../LibJS/Runtime/ECMAScriptFunctionObject.h | 12 +- Userland/Libraries/LibJS/Runtime/Error.cpp | 6 +- Userland/Libraries/LibJS/Runtime/Error.h | 6 +- .../LibJS/Runtime/ErrorPrototype.cpp | 16 +- .../LibJS/Runtime/FunctionConstructor.cpp | 10 +- .../LibJS/Runtime/FunctionObject.cpp | 8 +- .../LibJS/Runtime/FunctionPrototype.cpp | 2 +- .../LibJS/Runtime/GeneratorObject.cpp | 6 +- .../Libraries/LibJS/Runtime/GeneratorObject.h | 8 +- .../Libraries/LibJS/Runtime/GlobalObject.cpp | 4 +- .../LibJS/Runtime/Intl/AbstractOperations.cpp | 36 +-- .../LibJS/Runtime/Intl/AbstractOperations.h | 50 ++--- .../Libraries/LibJS/Runtime/Intl/Collator.h | 14 +- .../Runtime/Intl/CollatorCompareFunction.cpp | 2 +- .../LibJS/Runtime/Intl/DateTimeFormat.cpp | 12 +- .../LibJS/Runtime/Intl/DateTimeFormat.h | 40 ++-- .../Intl/DateTimeFormatConstructor.cpp | 4 +- .../Runtime/Intl/DateTimeFormatFunction.cpp | 2 +- .../LibJS/Runtime/Intl/DisplayNames.h | 8 +- .../Runtime/Intl/DisplayNamesPrototype.cpp | 2 +- .../LibJS/Runtime/Intl/DurationFormat.cpp | 12 +- .../LibJS/Runtime/Intl/DurationFormat.h | 28 +-- .../Intl/DurationFormatConstructor.cpp | 4 +- .../LibJS/Runtime/Intl/ListFormat.cpp | 12 +- .../Libraries/LibJS/Runtime/Intl/ListFormat.h | 16 +- .../Libraries/LibJS/Runtime/Intl/Locale.cpp | 10 +- .../Libraries/LibJS/Runtime/Intl/Locale.h | 40 ++-- .../LibJS/Runtime/Intl/LocaleConstructor.cpp | 30 +-- .../LibJS/Runtime/Intl/MathematicalValue.cpp | 4 +- .../LibJS/Runtime/Intl/MathematicalValue.h | 2 +- .../LibJS/Runtime/Intl/NumberFormat.cpp | 36 +-- .../LibJS/Runtime/Intl/NumberFormat.h | 46 ++-- .../Runtime/Intl/NumberFormatFunction.cpp | 2 +- .../LibJS/Runtime/Intl/PluralRules.cpp | 2 +- .../LibJS/Runtime/Intl/PluralRules.h | 4 +- .../LibJS/Runtime/Intl/RelativeTimeFormat.cpp | 2 +- .../LibJS/Runtime/Intl/RelativeTimeFormat.h | 24 +- .../Libraries/LibJS/Runtime/Intl/Segmenter.h | 8 +- .../Libraries/LibJS/Runtime/JSONObject.cpp | 44 ++-- Userland/Libraries/LibJS/Runtime/JSONObject.h | 16 +- .../LibJS/Runtime/MapConstructor.cpp | 2 +- .../Libraries/LibJS/Runtime/ModuleRequest.h | 6 +- .../LibJS/Runtime/NumberPrototype.cpp | 44 ++-- Userland/Libraries/LibJS/Runtime/Object.cpp | 4 +- Userland/Libraries/LibJS/Runtime/Object.h | 2 +- .../LibJS/Runtime/ObjectConstructor.cpp | 2 +- .../LibJS/Runtime/ObjectPrototype.cpp | 8 +- .../LibJS/Runtime/PrimitiveString.cpp | 8 +- .../Libraries/LibJS/Runtime/PrimitiveString.h | 12 +- Userland/Libraries/LibJS/Runtime/Promise.cpp | 4 +- .../LibJS/Runtime/PromiseConstructor.cpp | 8 +- .../LibJS/Runtime/PropertyAttributes.h | 12 +- .../LibJS/Runtime/PropertyDescriptor.h | 16 +- .../Libraries/LibJS/Runtime/PropertyKey.h | 8 +- .../Libraries/LibJS/Runtime/ProxyObject.cpp | 2 +- .../Libraries/LibJS/Runtime/Reference.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Reference.h | 4 +- .../Runtime/RegExpLegacyStaticProperties.h | 2 +- .../Libraries/LibJS/Runtime/RegExpObject.cpp | 38 ++-- .../Libraries/LibJS/Runtime/RegExpObject.h | 22 +- .../LibJS/Runtime/RegExpPrototype.cpp | 6 +- .../Libraries/LibJS/Runtime/ShadowRealm.cpp | 4 +- .../Libraries/LibJS/Runtime/ShadowRealm.h | 2 +- .../LibJS/Runtime/StringConstructor.cpp | 2 +- .../LibJS/Runtime/StringIterator.cpp | 4 +- .../Libraries/LibJS/Runtime/StringIterator.h | 6 +- .../Libraries/LibJS/Runtime/StringObject.cpp | 4 +- .../Libraries/LibJS/Runtime/StringOrSymbol.h | 4 +- .../LibJS/Runtime/StringPrototype.cpp | 50 ++--- .../Libraries/LibJS/Runtime/StringPrototype.h | 2 +- Userland/Libraries/LibJS/Runtime/Symbol.cpp | 6 +- Userland/Libraries/LibJS/Runtime/Symbol.h | 16 +- .../Libraries/LibJS/Runtime/SymbolObject.h | 2 +- .../Runtime/Temporal/AbstractOperations.cpp | 78 +++---- .../Runtime/Temporal/AbstractOperations.h | 72 +++--- .../LibJS/Runtime/Temporal/Calendar.cpp | 32 +-- .../LibJS/Runtime/Temporal/Calendar.h | 22 +- .../LibJS/Runtime/Temporal/Duration.cpp | 12 +- .../LibJS/Runtime/Temporal/Duration.h | 8 +- .../LibJS/Runtime/Temporal/Instant.cpp | 8 +- .../LibJS/Runtime/Temporal/Instant.h | 4 +- .../LibJS/Runtime/Temporal/PlainDate.cpp | 14 +- .../LibJS/Runtime/Temporal/PlainDate.h | 4 +- .../LibJS/Runtime/Temporal/PlainDateTime.cpp | 4 +- .../LibJS/Runtime/Temporal/PlainDateTime.h | 2 +- .../LibJS/Runtime/Temporal/PlainMonthDay.cpp | 8 +- .../LibJS/Runtime/Temporal/PlainMonthDay.h | 2 +- .../LibJS/Runtime/Temporal/PlainTime.cpp | 4 +- .../LibJS/Runtime/Temporal/PlainTime.h | 2 +- .../LibJS/Runtime/Temporal/PlainYearMonth.cpp | 8 +- .../LibJS/Runtime/Temporal/PlainYearMonth.h | 2 +- .../LibJS/Runtime/Temporal/TimeZone.cpp | 18 +- .../LibJS/Runtime/Temporal/TimeZone.h | 18 +- .../LibJS/Runtime/Temporal/ZonedDateTime.cpp | 16 +- .../LibJS/Runtime/Temporal/ZonedDateTime.h | 2 +- Userland/Libraries/LibJS/Runtime/TypedArray.h | 2 +- .../LibJS/Runtime/TypedArrayPrototype.cpp | 8 +- .../Libraries/LibJS/Runtime/Utf16String.cpp | 2 +- .../Libraries/LibJS/Runtime/Utf16String.h | 4 +- Userland/Libraries/LibJS/Runtime/VM.cpp | 32 +-- Userland/Libraries/LibJS/Runtime/VM.h | 20 +- Userland/Libraries/LibJS/Runtime/Value.cpp | 20 +- Userland/Libraries/LibJS/Runtime/Value.h | 10 +- .../LibJS/Runtime/WeakMapConstructor.cpp | 2 +- Userland/Libraries/LibJS/Script.h | 2 +- Userland/Libraries/LibJS/SourceCode.cpp | 8 +- Userland/Libraries/LibJS/SourceCode.h | 14 +- Userland/Libraries/LibJS/SourceRange.h | 2 +- Userland/Libraries/LibJS/SourceTextModule.cpp | 4 +- Userland/Libraries/LibJS/Token.cpp | 10 +- Userland/Libraries/LibJS/Token.h | 12 +- .../Libraries/LibKeyboard/CharacterMap.cpp | 6 +- Userland/Libraries/LibKeyboard/CharacterMap.h | 10 +- .../LibKeyboard/CharacterMapFile.cpp | 4 +- .../Libraries/LibKeyboard/CharacterMapFile.h | 4 +- Userland/Libraries/LibLine/Editor.cpp | 52 ++--- Userland/Libraries/LibLine/Editor.h | 32 +-- .../Libraries/LibLine/InternalFunctions.cpp | 4 +- .../Libraries/LibLine/KeyCallbackMachine.h | 2 +- Userland/Libraries/LibLine/Style.h | 14 +- .../Libraries/LibLine/SuggestionDisplay.h | 2 +- .../Libraries/LibLine/SuggestionManager.cpp | 4 +- .../Libraries/LibLine/SuggestionManager.h | 14 +- .../LibLine/XtermSuggestionDisplay.cpp | 6 +- .../Libraries/LibLocale/DateTimeFormat.cpp | 6 +- Userland/Libraries/LibLocale/DateTimeFormat.h | 16 +- Userland/Libraries/LibLocale/Locale.cpp | 36 +-- Userland/Libraries/LibLocale/Locale.h | 40 ++-- Userland/Libraries/LibLocale/NumberFormat.cpp | 14 +- Userland/Libraries/LibLocale/NumberFormat.h | 8 +- Userland/Libraries/LibMarkdown/Block.h | 4 +- Userland/Libraries/LibMarkdown/BlockQuote.cpp | 4 +- Userland/Libraries/LibMarkdown/BlockQuote.h | 4 +- Userland/Libraries/LibMarkdown/CodeBlock.cpp | 4 +- Userland/Libraries/LibMarkdown/CodeBlock.h | 12 +- .../Libraries/LibMarkdown/CommentBlock.cpp | 4 +- Userland/Libraries/LibMarkdown/CommentBlock.h | 10 +- .../Libraries/LibMarkdown/ContainerBlock.cpp | 4 +- .../Libraries/LibMarkdown/ContainerBlock.h | 6 +- Userland/Libraries/LibMarkdown/Document.cpp | 6 +- Userland/Libraries/LibMarkdown/Document.h | 8 +- Userland/Libraries/LibMarkdown/Heading.cpp | 6 +- Userland/Libraries/LibMarkdown/Heading.h | 4 +- .../Libraries/LibMarkdown/HorizontalRule.cpp | 6 +- .../Libraries/LibMarkdown/HorizontalRule.h | 4 +- Userland/Libraries/LibMarkdown/List.cpp | 4 +- Userland/Libraries/LibMarkdown/List.h | 4 +- Userland/Libraries/LibMarkdown/Paragraph.cpp | 4 +- Userland/Libraries/LibMarkdown/Paragraph.h | 4 +- Userland/Libraries/LibMarkdown/Table.cpp | 4 +- Userland/Libraries/LibMarkdown/Table.h | 4 +- Userland/Libraries/LibMarkdown/Text.cpp | 4 +- Userland/Libraries/LibMarkdown/Text.h | 14 +- Userland/Libraries/LibMarkdown/Visitor.h | 2 +- Userland/Libraries/LibPCIDB/Database.cpp | 2 +- Userland/Libraries/LibPCIDB/Database.h | 4 +- Userland/Libraries/LibPDF/Document.cpp | 6 +- Userland/Libraries/LibPDF/Document.h | 4 +- Userland/Libraries/LibPDF/DocumentParser.cpp | 10 +- Userland/Libraries/LibPDF/Encoding.h | 6 +- Userland/Libraries/LibPDF/Encryption.cpp | 4 +- Userland/Libraries/LibPDF/Encryption.h | 6 +- Userland/Libraries/LibPDF/Error.h | 16 +- Userland/Libraries/LibPDF/Fonts/PDFFont.cpp | 4 +- Userland/Libraries/LibPDF/Fonts/PDFFont.h | 2 +- .../Libraries/LibPDF/Fonts/PS1FontProgram.cpp | 12 +- .../Libraries/LibPDF/Fonts/PS1FontProgram.h | 6 +- Userland/Libraries/LibPDF/Fonts/Type0Font.h | 4 +- Userland/Libraries/LibPDF/Object.h | 2 +- .../Libraries/LibPDF/ObjectDerivatives.cpp | 16 +- Userland/Libraries/LibPDF/ObjectDerivatives.h | 20 +- Userland/Libraries/LibPDF/Operator.h | 2 +- Userland/Libraries/LibPDF/Parser.cpp | 16 +- Userland/Libraries/LibPDF/Parser.h | 8 +- Userland/Libraries/LibPDF/Reader.h | 6 +- Userland/Libraries/LibPDF/Renderer.cpp | 2 +- Userland/Libraries/LibPDF/Renderer.h | 2 +- Userland/Libraries/LibPDF/Value.cpp | 14 +- Userland/Libraries/LibPDF/Value.h | 4 +- Userland/Libraries/LibPDF/XRefTable.h | 4 +- Userland/Libraries/LibProtocol/Request.cpp | 2 +- Userland/Libraries/LibProtocol/Request.h | 14 +- .../Libraries/LibProtocol/RequestClient.cpp | 10 +- .../Libraries/LibProtocol/RequestClient.h | 6 +- Userland/Libraries/LibProtocol/WebSocket.cpp | 4 +- Userland/Libraries/LibProtocol/WebSocket.h | 12 +- .../Libraries/LibProtocol/WebSocketClient.cpp | 8 +- .../Libraries/LibProtocol/WebSocketClient.h | 8 +- Userland/Libraries/LibRegex/C/Regex.cpp | 12 +- Userland/Libraries/LibRegex/RegexByteCode.cpp | 50 ++--- Userland/Libraries/LibRegex/RegexByteCode.h | 62 ++--- Userland/Libraries/LibRegex/RegexDebug.h | 6 +- Userland/Libraries/LibRegex/RegexError.h | 4 +- Userland/Libraries/LibRegex/RegexMatch.h | 14 +- Userland/Libraries/LibRegex/RegexMatcher.cpp | 8 +- Userland/Libraries/LibRegex/RegexMatcher.h | 10 +- Userland/Libraries/LibRegex/RegexParser.cpp | 4 +- Userland/Libraries/LibRegex/RegexParser.h | 2 +- Userland/Libraries/LibSQL/AST/AST.h | 200 ++++++++--------- Userland/Libraries/LibSQL/AST/Insert.cpp | 2 +- Userland/Libraries/LibSQL/AST/Lexer.cpp | 4 +- Userland/Libraries/LibSQL/AST/Lexer.h | 6 +- Userland/Libraries/LibSQL/AST/Parser.cpp | 76 +++---- Userland/Libraries/LibSQL/AST/Parser.h | 14 +- Userland/Libraries/LibSQL/AST/Token.cpp | 4 +- Userland/Libraries/LibSQL/AST/Token.h | 8 +- Userland/Libraries/LibSQL/BTree.h | 4 +- Userland/Libraries/LibSQL/Database.cpp | 14 +- Userland/Libraries/LibSQL/Database.h | 12 +- Userland/Libraries/LibSQL/Heap.cpp | 4 +- Userland/Libraries/LibSQL/Heap.h | 4 +- Userland/Libraries/LibSQL/Meta.cpp | 16 +- Userland/Libraries/LibSQL/Meta.h | 22 +- Userland/Libraries/LibSQL/Result.cpp | 2 +- Userland/Libraries/LibSQL/Result.h | 6 +- Userland/Libraries/LibSQL/SQLClient.cpp | 8 +- Userland/Libraries/LibSQL/SQLClient.h | 16 +- Userland/Libraries/LibSQL/Serializer.cpp | 6 +- Userland/Libraries/LibSQL/Serializer.h | 12 +- Userland/Libraries/LibSQL/TreeNode.cpp | 24 +- Userland/Libraries/LibSQL/Tuple.cpp | 12 +- Userland/Libraries/LibSQL/Tuple.h | 12 +- Userland/Libraries/LibSQL/TupleDescriptor.h | 18 +- Userland/Libraries/LibSQL/Type.h | 14 +- Userland/Libraries/LibSQL/Value.cpp | 30 +-- Userland/Libraries/LibSQL/Value.h | 10 +- Userland/Libraries/LibSoftGPU/Device.cpp | 12 +- .../LibSymbolication/Symbolication.cpp | 16 +- .../LibSymbolication/Symbolication.h | 8 +- Userland/Libraries/LibSyntax/Highlighter.h | 2 +- .../Libraries/LibSyntax/HighlighterClient.h | 6 +- Userland/Libraries/LibTLS/Certificate.h | 18 +- Userland/Libraries/LibTLS/HandshakeServer.cpp | 4 +- Userland/Libraries/LibTLS/Socket.cpp | 8 +- Userland/Libraries/LibTLS/TLSv12.h | 12 +- Userland/Libraries/LibTest/CrashTest.cpp | 2 +- Userland/Libraries/LibTest/CrashTest.h | 6 +- .../Libraries/LibTest/JavaScriptTestRunner.h | 60 ++--- .../LibTest/JavaScriptTestRunnerMain.cpp | 28 +-- Userland/Libraries/LibTest/Results.h | 10 +- Userland/Libraries/LibTest/TestCase.h | 8 +- Userland/Libraries/LibTest/TestRunner.h | 20 +- Userland/Libraries/LibTest/TestRunnerUtil.h | 4 +- Userland/Libraries/LibTest/TestSuite.cpp | 4 +- Userland/Libraries/LibTest/TestSuite.h | 8 +- Userland/Libraries/LibTextCodec/Decoder.cpp | 14 +- Userland/Libraries/LibTextCodec/Decoder.h | 12 +- Userland/Libraries/LibThreading/Thread.h | 6 +- Userland/Libraries/LibTimeZone/TimeZone.cpp | 6 +- Userland/Libraries/LibTimeZone/TimeZone.h | 4 +- Userland/Libraries/LibUSBDB/Database.cpp | 2 +- Userland/Libraries/LibUSBDB/Database.h | 4 +- .../Libraries/LibUnicode/CharacterTypes.cpp | 6 +- .../Libraries/LibUnicode/CharacterTypes.h | 8 +- Userland/Libraries/LibUnicode/Normalize.cpp | 2 +- Userland/Libraries/LibUnicode/Normalize.h | 4 +- Userland/Libraries/LibVT/Attribute.h | 6 +- Userland/Libraries/LibVT/Terminal.cpp | 6 +- Userland/Libraries/LibVT/Terminal.h | 6 +- Userland/Libraries/LibVT/TerminalWidget.cpp | 16 +- Userland/Libraries/LibVT/TerminalWidget.h | 20 +- .../LibVideo/Containers/Matroska/Document.h | 12 +- .../LibVideo/Containers/Matroska/Reader.cpp | 4 +- .../LibVideo/Containers/Matroska/Reader.h | 2 +- Userland/Libraries/LibVideo/DecoderError.h | 8 +- Userland/Libraries/LibVideo/PlaybackManager.h | 4 +- Userland/Libraries/LibVideo/VP9/Parser.cpp | 2 +- .../AbstractMachine/AbstractMachine.cpp | 16 +- .../LibWasm/AbstractMachine/AbstractMachine.h | 14 +- .../AbstractMachine/BytecodeInterpreter.cpp | 2 +- .../AbstractMachine/BytecodeInterpreter.h | 2 +- .../LibWasm/AbstractMachine/Interpreter.h | 2 +- .../LibWasm/AbstractMachine/Validator.cpp | 10 +- .../LibWasm/AbstractMachine/Validator.h | 18 +- Userland/Libraries/LibWasm/Parser/Parser.cpp | 6 +- .../Libraries/LibWasm/Printer/Printer.cpp | 28 +-- Userland/Libraries/LibWasm/Printer/Printer.h | 2 +- Userland/Libraries/LibWasm/Types.h | 24 +- .../LibWeb/Bindings/CSSNamespace.cpp | 2 +- .../Libraries/LibWeb/Bindings/FetchMethod.cpp | 42 ++-- .../LibWeb/Bindings/ImageConstructor.cpp | 4 +- .../Libraries/LibWeb/Bindings/Intrinsics.cpp | 4 +- .../Libraries/LibWeb/Bindings/Intrinsics.h | 16 +- .../LibWeb/Bindings/LegacyPlatformObject.cpp | 8 +- .../LibWeb/Bindings/LegacyPlatformObject.h | 2 +- .../LibWeb/Bindings/LocationObject.cpp | 26 +-- .../LibWeb/Bindings/MainThreadVM.cpp | 2 +- .../LibWeb/Bindings/PlatformObject.h | 16 +- Userland/Libraries/LibWeb/CSS/Angle.cpp | 4 +- Userland/Libraries/LibWeb/CSS/Angle.h | 4 +- .../Libraries/LibWeb/CSS/CSSConditionRule.h | 4 +- .../Libraries/LibWeb/CSS/CSSFontFaceRule.cpp | 2 +- .../Libraries/LibWeb/CSS/CSSFontFaceRule.h | 2 +- .../Libraries/LibWeb/CSS/CSSImportRule.cpp | 2 +- Userland/Libraries/LibWeb/CSS/CSSImportRule.h | 4 +- .../Libraries/LibWeb/CSS/CSSMediaRule.cpp | 6 +- Userland/Libraries/LibWeb/CSS/CSSMediaRule.h | 6 +- Userland/Libraries/LibWeb/CSS/CSSRule.cpp | 2 +- Userland/Libraries/LibWeb/CSS/CSSRule.h | 6 +- .../LibWeb/CSS/CSSStyleDeclaration.cpp | 32 +-- .../LibWeb/CSS/CSSStyleDeclaration.h | 40 ++-- .../Libraries/LibWeb/CSS/CSSStyleRule.cpp | 6 +- Userland/Libraries/LibWeb/CSS/CSSStyleRule.h | 4 +- Userland/Libraries/LibWeb/CSS/CSSStyleSheet.h | 2 +- .../Libraries/LibWeb/CSS/CSSSupportsRule.cpp | 6 +- .../Libraries/LibWeb/CSS/CSSSupportsRule.h | 6 +- .../Libraries/LibWeb/CSS/ComputedValues.h | 4 +- Userland/Libraries/LibWeb/CSS/Display.cpp | 2 +- Userland/Libraries/LibWeb/CSS/Display.h | 4 +- Userland/Libraries/LibWeb/CSS/Frequency.cpp | 4 +- Userland/Libraries/LibWeb/CSS/Frequency.h | 4 +- .../Libraries/LibWeb/CSS/GeneralEnclosed.h | 6 +- .../LibWeb/CSS/GridTrackPlacement.cpp | 10 +- .../Libraries/LibWeb/CSS/GridTrackPlacement.h | 12 +- .../Libraries/LibWeb/CSS/GridTrackSize.cpp | 16 +- Userland/Libraries/LibWeb/CSS/GridTrackSize.h | 16 +- Userland/Libraries/LibWeb/CSS/Length.cpp | 4 +- Userland/Libraries/LibWeb/CSS/Length.h | 4 +- Userland/Libraries/LibWeb/CSS/MediaList.cpp | 10 +- Userland/Libraries/LibWeb/CSS/MediaList.h | 10 +- Userland/Libraries/LibWeb/CSS/MediaQuery.cpp | 24 +- Userland/Libraries/LibWeb/CSS/MediaQuery.h | 10 +- .../Libraries/LibWeb/CSS/MediaQueryList.cpp | 2 +- .../Libraries/LibWeb/CSS/MediaQueryList.h | 2 +- .../LibWeb/CSS/MediaQueryListEvent.h | 6 +- Userland/Libraries/LibWeb/CSS/Number.h | 8 +- .../Libraries/LibWeb/CSS/Parser/Block.cpp | 2 +- Userland/Libraries/LibWeb/CSS/Parser/Block.h | 2 +- .../LibWeb/CSS/Parser/ComponentValue.cpp | 10 +- .../LibWeb/CSS/Parser/ComponentValue.h | 4 +- .../LibWeb/CSS/Parser/Declaration.cpp | 2 +- .../Libraries/LibWeb/CSS/Parser/Declaration.h | 4 +- .../LibWeb/CSS/Parser/DeclarationOrAtRule.cpp | 2 +- .../LibWeb/CSS/Parser/DeclarationOrAtRule.h | 2 +- .../Libraries/LibWeb/CSS/Parser/Function.cpp | 2 +- .../Libraries/LibWeb/CSS/Parser/Function.h | 4 +- .../Libraries/LibWeb/CSS/Parser/Parser.cpp | 32 +-- Userland/Libraries/LibWeb/CSS/Parser/Parser.h | 6 +- Userland/Libraries/LibWeb/CSS/Parser/Rule.cpp | 2 +- Userland/Libraries/LibWeb/CSS/Parser/Rule.h | 2 +- .../Libraries/LibWeb/CSS/Parser/Token.cpp | 44 ++-- Userland/Libraries/LibWeb/CSS/Parser/Token.h | 10 +- .../Libraries/LibWeb/CSS/Parser/Tokenizer.cpp | 8 +- .../Libraries/LibWeb/CSS/Parser/Tokenizer.h | 10 +- Userland/Libraries/LibWeb/CSS/Percentage.h | 8 +- .../LibWeb/CSS/PreferredColorScheme.cpp | 2 +- .../LibWeb/CSS/PreferredColorScheme.h | 4 +- Userland/Libraries/LibWeb/CSS/Ratio.cpp | 4 +- Userland/Libraries/LibWeb/CSS/Ratio.h | 4 +- Userland/Libraries/LibWeb/CSS/Resolution.cpp | 4 +- Userland/Libraries/LibWeb/CSS/Resolution.h | 4 +- .../CSS/ResolvedCSSStyleDeclaration.cpp | 8 +- .../LibWeb/CSS/ResolvedCSSStyleDeclaration.h | 6 +- Userland/Libraries/LibWeb/CSS/Selector.cpp | 6 +- Userland/Libraries/LibWeb/CSS/Selector.h | 14 +- Userland/Libraries/LibWeb/CSS/Serialize.cpp | 12 +- Userland/Libraries/LibWeb/CSS/Serialize.h | 14 +- Userland/Libraries/LibWeb/CSS/Size.cpp | 4 +- Userland/Libraries/LibWeb/CSS/Size.h | 2 +- .../Libraries/LibWeb/CSS/StyleComputer.cpp | 8 +- Userland/Libraries/LibWeb/CSS/StyleComputer.h | 8 +- Userland/Libraries/LibWeb/CSS/StyleSheet.h | 22 +- Userland/Libraries/LibWeb/CSS/StyleValue.cpp | 144 ++++++------ Userland/Libraries/LibWeb/CSS/StyleValue.h | 112 ++++----- Userland/Libraries/LibWeb/CSS/Supports.cpp | 26 +-- Userland/Libraries/LibWeb/CSS/Supports.h | 18 +- Userland/Libraries/LibWeb/CSS/Time.cpp | 4 +- Userland/Libraries/LibWeb/CSS/Time.h | 4 +- Userland/Libraries/LibWeb/CSS/UnicodeRange.h | 8 +- Userland/Libraries/LibWeb/Cookie/Cookie.h | 10 +- .../Libraries/LibWeb/Cookie/ParsedCookie.cpp | 4 +- .../Libraries/LibWeb/Cookie/ParsedCookie.h | 12 +- Userland/Libraries/LibWeb/Crypto/Crypto.cpp | 2 +- Userland/Libraries/LibWeb/Crypto/Crypto.h | 2 +- .../Libraries/LibWeb/Crypto/SubtleCrypto.cpp | 4 +- .../Libraries/LibWeb/Crypto/SubtleCrypto.h | 2 +- Userland/Libraries/LibWeb/DOM/Attr.cpp | 8 +- Userland/Libraries/LibWeb/DOM/Attr.h | 14 +- .../Libraries/LibWeb/DOM/CDATASection.cpp | 2 +- Userland/Libraries/LibWeb/DOM/CDATASection.h | 2 +- .../Libraries/LibWeb/DOM/CharacterData.cpp | 14 +- Userland/Libraries/LibWeb/DOM/CharacterData.h | 18 +- Userland/Libraries/LibWeb/DOM/ChildNode.h | 10 +- Userland/Libraries/LibWeb/DOM/Comment.cpp | 4 +- Userland/Libraries/LibWeb/DOM/Comment.h | 4 +- Userland/Libraries/LibWeb/DOM/CustomEvent.cpp | 2 +- Userland/Libraries/LibWeb/DOM/CustomEvent.h | 2 +- .../LibWeb/DOM/DOMImplementation.cpp | 6 +- .../Libraries/LibWeb/DOM/DOMImplementation.h | 6 +- .../Libraries/LibWeb/DOM/DOMTokenList.cpp | 24 +- Userland/Libraries/LibWeb/DOM/DOMTokenList.h | 18 +- Userland/Libraries/LibWeb/DOM/Document.cpp | 66 +++--- Userland/Libraries/LibWeb/DOM/Document.h | 94 ++++---- Userland/Libraries/LibWeb/DOM/DocumentType.h | 18 +- Userland/Libraries/LibWeb/DOM/Element.cpp | 30 +-- Userland/Libraries/LibWeb/DOM/Element.h | 36 +-- Userland/Libraries/LibWeb/DOM/Event.cpp | 4 +- Userland/Libraries/LibWeb/DOM/Event.h | 4 +- Userland/Libraries/LibWeb/DOM/EventTarget.cpp | 6 +- Userland/Libraries/LibWeb/DOM/EventTarget.h | 2 +- .../Libraries/LibWeb/DOM/HTMLCollection.cpp | 4 +- .../Libraries/LibWeb/DOM/HTMLCollection.h | 2 +- .../Libraries/LibWeb/DOM/MutationObserver.h | 2 +- .../Libraries/LibWeb/DOM/MutationRecord.cpp | 4 +- .../Libraries/LibWeb/DOM/MutationRecord.h | 16 +- .../Libraries/LibWeb/DOM/NamedNodeMap.cpp | 6 +- Userland/Libraries/LibWeb/DOM/NamedNodeMap.h | 4 +- Userland/Libraries/LibWeb/DOM/Node.cpp | 26 +-- Userland/Libraries/LibWeb/DOM/Node.h | 24 +- .../Libraries/LibWeb/DOM/NodeOperations.cpp | 8 +- .../Libraries/LibWeb/DOM/NodeOperations.h | 2 +- Userland/Libraries/LibWeb/DOM/ParentNode.cpp | 8 +- Userland/Libraries/LibWeb/DOM/ParentNode.h | 6 +- Userland/Libraries/LibWeb/DOM/Position.cpp | 6 +- Userland/Libraries/LibWeb/DOM/Position.h | 2 +- .../LibWeb/DOM/ProcessingInstruction.cpp | 2 +- .../LibWeb/DOM/ProcessingInstruction.h | 6 +- .../Libraries/LibWeb/DOM/QualifiedName.cpp | 2 +- Userland/Libraries/LibWeb/DOM/QualifiedName.h | 4 +- Userland/Libraries/LibWeb/DOM/Range.cpp | 10 +- Userland/Libraries/LibWeb/DOM/Range.h | 2 +- Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp | 4 +- Userland/Libraries/LibWeb/DOM/ShadowRoot.h | 6 +- Userland/Libraries/LibWeb/DOM/Text.cpp | 6 +- Userland/Libraries/LibWeb/DOM/Text.h | 8 +- .../Libraries/LibWeb/DOMParsing/InnerHTML.cpp | 4 +- .../Libraries/LibWeb/DOMParsing/InnerHTML.h | 4 +- .../LibWeb/DOMParsing/XMLSerializer.cpp | 78 +++---- .../LibWeb/DOMParsing/XMLSerializer.h | 4 +- Userland/Libraries/LibWeb/Dump.cpp | 6 +- .../Libraries/LibWeb/Encoding/TextDecoder.cpp | 4 +- .../Libraries/LibWeb/Encoding/TextDecoder.h | 2 +- .../Libraries/LibWeb/Encoding/TextEncoder.cpp | 4 +- .../Libraries/LibWeb/Encoding/TextEncoder.h | 2 +- Userland/Libraries/LibWeb/Fetch/Body.cpp | 6 +- Userland/Libraries/LibWeb/Fetch/BodyInit.cpp | 4 +- Userland/Libraries/LibWeb/Fetch/BodyInit.h | 4 +- .../LibWeb/Fetch/Fetching/Fetching.cpp | 18 +- Userland/Libraries/LibWeb/Fetch/Headers.cpp | 18 +- Userland/Libraries/LibWeb/Fetch/Headers.h | 16 +- .../Fetch/Infrastructure/FetchTimingInfo.h | 10 +- .../LibWeb/Fetch/Infrastructure/HTTP.cpp | 4 +- .../LibWeb/Fetch/Infrastructure/HTTP.h | 2 +- .../Fetch/Infrastructure/HTTP/Bodies.cpp | 2 +- .../Fetch/Infrastructure/HTTP/Headers.cpp | 10 +- .../Fetch/Infrastructure/HTTP/Headers.h | 4 +- .../Fetch/Infrastructure/HTTP/Requests.cpp | 6 +- .../Fetch/Infrastructure/HTTP/Requests.h | 22 +- .../Fetch/Infrastructure/HTTP/Responses.cpp | 4 +- .../Fetch/Infrastructure/HTTP/Responses.h | 8 +- Userland/Libraries/LibWeb/Fetch/Request.cpp | 22 +- Userland/Libraries/LibWeb/Fetch/Request.h | 16 +- Userland/Libraries/LibWeb/Fetch/Response.cpp | 10 +- Userland/Libraries/LibWeb/Fetch/Response.h | 8 +- Userland/Libraries/LibWeb/FileAPI/Blob.cpp | 18 +- Userland/Libraries/LibWeb/FileAPI/Blob.h | 18 +- Userland/Libraries/LibWeb/FileAPI/File.cpp | 8 +- Userland/Libraries/LibWeb/FileAPI/File.h | 10 +- Userland/Libraries/LibWeb/FontCache.h | 2 +- .../Libraries/LibWeb/HTML/BrowsingContext.cpp | 10 +- .../Libraries/LibWeb/HTML/BrowsingContext.h | 16 +- .../LibWeb/HTML/Canvas/CanvasDrawImage.h | 2 +- .../LibWeb/HTML/Canvas/CanvasDrawPath.h | 6 +- .../HTML/Canvas/CanvasFillStrokeStyles.h | 10 +- .../LibWeb/HTML/Canvas/CanvasPath.cpp | 6 +- .../Libraries/LibWeb/HTML/Canvas/CanvasText.h | 8 +- .../Libraries/LibWeb/HTML/CanvasGradient.cpp | 2 +- .../Libraries/LibWeb/HTML/CanvasGradient.h | 2 +- .../LibWeb/HTML/CanvasRenderingContext2D.cpp | 16 +- .../LibWeb/HTML/CanvasRenderingContext2D.h | 14 +- Userland/Libraries/LibWeb/HTML/CloseEvent.h | 6 +- .../HTML/CrossOrigin/AbstractOperations.cpp | 6 +- .../CrossOrigin/CrossOriginOpenerPolicy.h | 6 +- .../CrossOriginPropertyDescriptorMap.h | 2 +- Userland/Libraries/LibWeb/HTML/DOMParser.cpp | 2 +- Userland/Libraries/LibWeb/HTML/DOMParser.h | 2 +- .../Libraries/LibWeb/HTML/DOMStringMap.cpp | 12 +- Userland/Libraries/LibWeb/HTML/DOMStringMap.h | 14 +- Userland/Libraries/LibWeb/HTML/ErrorEvent.h | 12 +- .../Libraries/LibWeb/HTML/EventHandler.cpp | 2 +- Userland/Libraries/LibWeb/HTML/EventHandler.h | 6 +- Userland/Libraries/LibWeb/HTML/Focus.cpp | 2 +- Userland/Libraries/LibWeb/HTML/Focus.h | 4 +- .../LibWeb/HTML/HTMLAnchorElement.cpp | 8 +- .../Libraries/LibWeb/HTML/HTMLAnchorElement.h | 12 +- .../Libraries/LibWeb/HTML/HTMLAreaElement.cpp | 6 +- .../Libraries/LibWeb/HTML/HTMLAreaElement.h | 8 +- .../Libraries/LibWeb/HTML/HTMLBaseElement.cpp | 8 +- .../Libraries/LibWeb/HTML/HTMLBaseElement.h | 6 +- .../Libraries/LibWeb/HTML/HTMLBodyElement.cpp | 2 +- .../Libraries/LibWeb/HTML/HTMLBodyElement.h | 2 +- .../LibWeb/HTML/HTMLButtonElement.cpp | 4 +- .../Libraries/LibWeb/HTML/HTMLButtonElement.h | 4 +- .../LibWeb/HTML/HTMLCanvasElement.cpp | 8 +- .../Libraries/LibWeb/HTML/HTMLCanvasElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLElement.cpp | 12 +- Userland/Libraries/LibWeb/HTML/HTMLElement.h | 14 +- .../LibWeb/HTML/HTMLFieldSetElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLFormElement.cpp | 2 +- .../Libraries/LibWeb/HTML/HTMLFormElement.h | 4 +- .../LibWeb/HTML/HTMLFrameSetElement.cpp | 2 +- .../LibWeb/HTML/HTMLFrameSetElement.h | 2 +- .../LibWeb/HTML/HTMLHyperlinkElementUtils.cpp | 82 +++---- .../LibWeb/HTML/HTMLHyperlinkElementUtils.h | 52 ++--- .../LibWeb/HTML/HTMLIFrameElement.cpp | 4 +- .../Libraries/LibWeb/HTML/HTMLIFrameElement.h | 4 +- .../LibWeb/HTML/HTMLImageElement.cpp | 6 +- .../Libraries/LibWeb/HTML/HTMLImageElement.h | 6 +- .../LibWeb/HTML/HTMLInputElement.cpp | 30 +-- .../Libraries/LibWeb/HTML/HTMLInputElement.h | 20 +- .../Libraries/LibWeb/HTML/HTMLLabelElement.h | 2 +- .../Libraries/LibWeb/HTML/HTMLLinkElement.cpp | 2 +- .../Libraries/LibWeb/HTML/HTMLLinkElement.h | 8 +- .../LibWeb/HTML/HTMLMediaElement.cpp | 2 +- .../Libraries/LibWeb/HTML/HTMLMediaElement.h | 2 +- .../LibWeb/HTML/HTMLObjectElement.cpp | 10 +- .../Libraries/LibWeb/HTML/HTMLObjectElement.h | 10 +- .../LibWeb/HTML/HTMLOptionElement.cpp | 10 +- .../Libraries/LibWeb/HTML/HTMLOptionElement.h | 10 +- .../Libraries/LibWeb/HTML/HTMLOutputElement.h | 4 +- .../LibWeb/HTML/HTMLProgressElement.cpp | 4 +- .../LibWeb/HTML/HTMLScriptElement.cpp | 4 +- .../Libraries/LibWeb/HTML/HTMLScriptElement.h | 2 +- .../LibWeb/HTML/HTMLSelectElement.cpp | 6 +- .../Libraries/LibWeb/HTML/HTMLSelectElement.h | 2 +- .../LibWeb/HTML/HTMLStyleElement.cpp | 4 +- .../LibWeb/HTML/HTMLTableCellElement.cpp | 4 +- .../LibWeb/HTML/HTMLTextAreaElement.h | 4 +- Userland/Libraries/LibWeb/HTML/History.cpp | 6 +- Userland/Libraries/LibWeb/HTML/History.h | 6 +- Userland/Libraries/LibWeb/HTML/MessageEvent.h | 12 +- .../Libraries/LibWeb/HTML/NavigationParams.h | 2 +- .../Libraries/LibWeb/HTML/NavigatorID.cpp | 8 +- Userland/Libraries/LibWeb/HTML/NavigatorID.h | 22 +- .../Libraries/LibWeb/HTML/NavigatorLanguage.h | 8 +- Userland/Libraries/LibWeb/HTML/Origin.h | 20 +- .../HTML/Parser/HTMLEncodingDetection.cpp | 12 +- .../HTML/Parser/HTMLEncodingDetection.h | 8 +- .../LibWeb/HTML/Parser/HTMLParser.cpp | 12 +- .../Libraries/LibWeb/HTML/Parser/HTMLParser.h | 6 +- .../LibWeb/HTML/Parser/HTMLToken.cpp | 2 +- .../Libraries/LibWeb/HTML/Parser/HTMLToken.h | 22 +- .../LibWeb/HTML/Parser/HTMLTokenizer.cpp | 6 +- .../LibWeb/HTML/Parser/HTMLTokenizer.h | 12 +- Userland/Libraries/LibWeb/HTML/Path2D.cpp | 6 +- Userland/Libraries/LibWeb/HTML/Path2D.h | 4 +- .../LibWeb/HTML/Scripting/ClassicScript.cpp | 4 +- .../LibWeb/HTML/Scripting/ClassicScript.h | 4 +- .../LibWeb/HTML/Scripting/Environments.cpp | 2 +- .../LibWeb/HTML/Scripting/Environments.h | 6 +- .../LibWeb/HTML/Scripting/Fetching.cpp | 24 +- .../LibWeb/HTML/Scripting/Fetching.h | 10 +- .../LibWeb/HTML/Scripting/ImportMap.h | 2 +- .../LibWeb/HTML/Scripting/ModuleMap.cpp | 12 +- .../LibWeb/HTML/Scripting/ModuleMap.h | 18 +- .../LibWeb/HTML/Scripting/ModuleScript.cpp | 6 +- .../LibWeb/HTML/Scripting/ModuleScript.h | 6 +- .../LibWeb/HTML/Scripting/Script.cpp | 2 +- .../Libraries/LibWeb/HTML/Scripting/Script.h | 6 +- .../WindowEnvironmentSettingsObject.cpp | 6 +- .../WindowEnvironmentSettingsObject.h | 2 +- .../WorkerEnvironmentSettingsObject.h | 4 +- .../LibWeb/HTML/SessionHistoryEntry.h | 4 +- Userland/Libraries/LibWeb/HTML/Storage.cpp | 16 +- Userland/Libraries/LibWeb/HTML/Storage.h | 14 +- Userland/Libraries/LibWeb/HTML/Window.cpp | 48 ++-- Userland/Libraries/LibWeb/HTML/Window.h | 18 +- .../Libraries/LibWeb/HTML/WindowProxy.cpp | 8 +- Userland/Libraries/LibWeb/HTML/Worker.cpp | 2 +- Userland/Libraries/LibWeb/HTML/Worker.h | 6 +- .../LibWeb/HTML/WorkerDebugConsoleClient.cpp | 4 +- .../LibWeb/HTML/WorkerGlobalScope.cpp | 10 +- .../Libraries/LibWeb/HTML/WorkerGlobalScope.h | 8 +- .../Libraries/LibWeb/HTML/WorkerLocation.cpp | 30 +-- .../Libraries/LibWeb/HTML/WorkerLocation.h | 18 +- Userland/Libraries/LibWeb/Infra/JSON.cpp | 2 +- Userland/Libraries/LibWeb/Infra/JSON.h | 2 +- Userland/Libraries/LibWeb/Infra/Strings.cpp | 4 +- Userland/Libraries/LibWeb/Infra/Strings.h | 2 +- .../IntersectionObserver.h | 2 +- .../LibWeb/Layout/AvailableSpace.cpp | 8 +- .../Libraries/LibWeb/Layout/AvailableSpace.h | 6 +- .../LibWeb/Layout/GridFormattingContext.cpp | 2 +- .../LibWeb/Layout/GridFormattingContext.h | 2 +- .../LibWeb/Layout/ListItemMarkerBox.cpp | 12 +- .../LibWeb/Layout/ListItemMarkerBox.h | 4 +- Userland/Libraries/LibWeb/Layout/Node.cpp | 2 +- Userland/Libraries/LibWeb/Layout/Node.h | 2 +- Userland/Libraries/LibWeb/Layout/TextNode.cpp | 4 +- Userland/Libraries/LibWeb/Layout/TextNode.h | 4 +- .../Libraries/LibWeb/Loader/ContentFilter.cpp | 2 +- .../Libraries/LibWeb/Loader/ContentFilter.h | 4 +- .../Libraries/LibWeb/Loader/FileRequest.cpp | 4 +- .../Libraries/LibWeb/Loader/FileRequest.h | 8 +- .../Libraries/LibWeb/Loader/FrameLoader.cpp | 18 +- .../Libraries/LibWeb/Loader/FrameLoader.h | 8 +- .../Libraries/LibWeb/Loader/LoadRequest.cpp | 2 +- .../Libraries/LibWeb/Loader/LoadRequest.h | 14 +- .../Libraries/LibWeb/Loader/ProxyMappings.cpp | 2 +- .../Libraries/LibWeb/Loader/ProxyMappings.h | 6 +- Userland/Libraries/LibWeb/Loader/Resource.cpp | 10 +- Userland/Libraries/LibWeb/Loader/Resource.h | 20 +- .../LibWeb/Loader/ResourceLoader.cpp | 32 +-- .../Libraries/LibWeb/Loader/ResourceLoader.h | 20 +- .../Libraries/LibWeb/MimeSniff/MimeType.cpp | 16 +- .../Libraries/LibWeb/MimeSniff/MimeType.h | 24 +- Userland/Libraries/LibWeb/Page/Page.cpp | 8 +- Userland/Libraries/LibWeb/Page/Page.h | 38 ++-- .../Libraries/LibWeb/Platform/FontPlugin.h | 2 +- .../LibWeb/Platform/FontPluginSerenity.cpp | 4 +- .../LibWeb/Platform/FontPluginSerenity.h | 2 +- .../Libraries/LibWeb/SVG/AttributeParser.h | 2 +- .../Libraries/LibWeb/SVG/SVGCircleElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGCircleElement.h | 2 +- .../LibWeb/SVG/SVGEllipseElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGEllipseElement.h | 2 +- .../Libraries/LibWeb/SVG/SVGLineElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGLineElement.h | 2 +- .../Libraries/LibWeb/SVG/SVGPathElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGPathElement.h | 2 +- .../LibWeb/SVG/SVGPolygonElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGPolygonElement.h | 2 +- .../LibWeb/SVG/SVGPolylineElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGPolylineElement.h | 2 +- .../Libraries/LibWeb/SVG/SVGRectElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGRectElement.h | 2 +- .../Libraries/LibWeb/SVG/SVGSVGElement.cpp | 2 +- Userland/Libraries/LibWeb/SVG/SVGSVGElement.h | 2 +- .../Libraries/LibWeb/Selection/Selection.cpp | 6 +- .../Libraries/LibWeb/Selection/Selection.h | 4 +- .../LibWeb/UIEvents/KeyboardEvent.cpp | 6 +- .../Libraries/LibWeb/UIEvents/KeyboardEvent.h | 14 +- Userland/Libraries/LibWeb/UIEvents/UIEvent.h | 2 +- Userland/Libraries/LibWeb/URL/URL.cpp | 74 +++--- Userland/Libraries/LibWeb/URL/URL.h | 50 ++--- .../Libraries/LibWeb/URL/URLSearchParams.cpp | 32 +-- .../Libraries/LibWeb/URL/URLSearchParams.h | 24 +- .../LibWeb/WebAssembly/WebAssemblyObject.cpp | 6 +- .../LibWeb/WebAssembly/WebAssemblyObject.h | 2 +- .../LibWeb/WebDriver/Capabilities.cpp | 6 +- Userland/Libraries/LibWeb/WebDriver/Client.h | 2 +- Userland/Libraries/LibWeb/WebDriver/Error.cpp | 4 +- Userland/Libraries/LibWeb/WebDriver/Error.h | 10 +- .../LibWeb/WebDriver/ExecuteScript.cpp | 8 +- .../LibWeb/WebDriver/ExecuteScript.h | 4 +- .../LibWeb/WebGL/WebGLContextEvent.h | 6 +- .../WebGL/WebGLRenderingContextBase.cpp | 8 +- .../LibWeb/WebGL/WebGLRenderingContextBase.h | 4 +- .../LibWeb/WebIDL/AbstractOperations.h | 2 +- .../Libraries/LibWeb/WebIDL/ExceptionOr.h | 2 +- .../Libraries/LibWeb/WebSockets/WebSocket.cpp | 24 +- .../Libraries/LibWeb/WebSockets/WebSocket.h | 30 +-- .../Libraries/LibWeb/XHR/XMLHttpRequest.cpp | 26 +-- .../Libraries/LibWeb/XHR/XMLHttpRequest.h | 24 +- .../LibWeb/XML/XMLDocumentBuilder.cpp | 10 +- .../Libraries/LibWeb/XML/XMLDocumentBuilder.h | 10 +- .../Libraries/LibWebSocket/ConnectionInfo.cpp | 2 +- .../Libraries/LibWebSocket/ConnectionInfo.h | 24 +- .../LibWebSocket/Impl/WebSocketImpl.h | 4 +- .../Impl/WebSocketImplSerenity.cpp | 2 +- .../LibWebSocket/Impl/WebSocketImplSerenity.h | 2 +- Userland/Libraries/LibWebSocket/Message.h | 4 +- Userland/Libraries/LibWebSocket/WebSocket.cpp | 8 +- Userland/Libraries/LibWebSocket/WebSocket.h | 10 +- .../Libraries/LibWebView/DOMTreeModel.cpp | 4 +- .../LibWebView/OutOfProcessWebView.cpp | 54 ++--- .../LibWebView/OutOfProcessWebView.h | 78 +++---- .../LibWebView/RequestServerAdapter.cpp | 2 +- .../LibWebView/RequestServerAdapter.h | 2 +- .../LibWebView/StylePropertiesModel.cpp | 2 +- .../LibWebView/StylePropertiesModel.h | 6 +- .../Libraries/LibWebView/ViewImplementation.h | 34 +-- .../Libraries/LibWebView/WebContentClient.cpp | 32 +-- .../Libraries/LibWebView/WebContentClient.h | 32 +-- .../LibWebView/WebSocketClientAdapter.cpp | 6 +- .../LibWebView/WebSocketClientAdapter.h | 4 +- Userland/Libraries/LibX86/ELFSymbolProvider.h | 2 +- Userland/Libraries/LibX86/Instruction.cpp | 100 ++++----- Userland/Libraries/LibX86/Instruction.h | 44 ++-- Userland/Libraries/LibXML/DOM/Document.h | 8 +- .../LibXML/DOM/DocumentTypeDeclaration.h | 16 +- Userland/Libraries/LibXML/DOM/Node.h | 8 +- Userland/Libraries/LibXML/FundamentalTypes.h | 4 +- Userland/Libraries/LibXML/Parser/Parser.cpp | 68 +++--- Userland/Libraries/LibXML/Parser/Parser.h | 40 ++-- Userland/Services/ChessEngine/MCTSTree.cpp | 2 +- .../Services/Clipboard/ClipboardClient.ipc | 2 +- .../Services/Clipboard/ClipboardServer.ipc | 4 +- .../Clipboard/ConnectionFromClient.cpp | 2 +- .../Services/Clipboard/ConnectionFromClient.h | 2 +- Userland/Services/Clipboard/Storage.cpp | 2 +- Userland/Services/Clipboard/Storage.h | 12 +- .../Services/ConfigServer/ConfigClient.ipc | 12 +- .../Services/ConfigServer/ConfigServer.ipc | 26 +-- .../ConfigServer/ConnectionFromClient.cpp | 46 ++-- .../ConfigServer/ConnectionFromClient.h | 36 +-- Userland/Services/CrashDaemon/main.cpp | 4 +- Userland/Services/DHCPClient/DHCPv4.h | 2 +- Userland/Services/DHCPClient/DHCPv4Client.cpp | 6 +- Userland/Services/DHCPClient/DHCPv4Client.h | 8 +- Userland/Services/DHCPClient/main.cpp | 2 +- Userland/Services/FileOperation/main.cpp | 42 ++-- .../ConnectionFromClient.cpp | 20 +- .../ConnectionFromClient.h | 14 +- .../FileSystemAccessClient.ipc | 2 +- .../FileSystemAccessServer.ipc | 8 +- .../InspectorServer/ConnectionFromClient.cpp | 6 +- .../InspectorServer/ConnectionFromClient.h | 2 +- .../InspectorServer/InspectableProcess.cpp | 4 +- .../InspectorServer/InspectableProcess.h | 2 +- .../InspectorServer/InspectorServer.ipc | 6 +- .../LaunchServer/ConnectionFromClient.cpp | 10 +- .../LaunchServer/ConnectionFromClient.h | 8 +- .../Services/LaunchServer/LaunchServer.ipc | 10 +- Userland/Services/LaunchServer/Launcher.cpp | 58 ++--- Userland/Services/LaunchServer/Launcher.h | 46 ++-- Userland/Services/LoginServer/LoginWindow.h | 4 +- .../LookupServer/ConnectionFromClient.cpp | 14 +- .../LookupServer/ConnectionFromClient.h | 4 +- .../Services/LookupServer/LookupServer.cpp | 12 +- Userland/Services/LookupServer/LookupServer.h | 4 +- .../Services/LookupServer/LookupServer.ipc | 4 +- .../Services/LookupServer/MulticastDNS.cpp | 6 +- Userland/Services/NetworkServer/main.cpp | 8 +- .../ConnectionFromClient.cpp | 4 +- .../NotificationServer/ConnectionFromClient.h | 4 +- .../NotificationServer/NotificationServer.ipc | 4 +- .../NotificationServer/NotificationWindow.cpp | 6 +- .../NotificationServer/NotificationWindow.h | 6 +- .../Services/RequestServer/ConnectionCache.h | 4 +- .../RequestServer/ConnectionFromClient.cpp | 6 +- .../RequestServer/ConnectionFromClient.h | 6 +- .../Services/RequestServer/GeminiProtocol.cpp | 2 +- .../Services/RequestServer/GeminiProtocol.h | 2 +- .../Services/RequestServer/GeminiRequest.cpp | 4 +- .../Services/RequestServer/GeminiRequest.h | 2 +- Userland/Services/RequestServer/HttpCommon.h | 4 +- .../Services/RequestServer/HttpProtocol.cpp | 4 +- .../Services/RequestServer/HttpProtocol.h | 4 +- .../Services/RequestServer/HttpsProtocol.cpp | 4 +- .../Services/RequestServer/HttpsProtocol.h | 4 +- .../Services/RequestServer/HttpsRequest.cpp | 2 +- .../Services/RequestServer/HttpsRequest.h | 2 +- Userland/Services/RequestServer/Protocol.cpp | 8 +- Userland/Services/RequestServer/Protocol.h | 10 +- Userland/Services/RequestServer/Request.cpp | 4 +- Userland/Services/RequestServer/Request.h | 8 +- .../Services/RequestServer/RequestServer.ipc | 6 +- .../SQLServer/ConnectionFromClient.cpp | 8 +- .../Services/SQLServer/ConnectionFromClient.h | 4 +- .../Services/SQLServer/DatabaseConnection.cpp | 6 +- .../Services/SQLServer/DatabaseConnection.h | 6 +- Userland/Services/SQLServer/SQLClient.ipc | 8 +- Userland/Services/SQLServer/SQLServer.ipc | 4 +- Userland/Services/SQLServer/SQLStatement.cpp | 2 +- Userland/Services/SQLServer/SQLStatement.h | 8 +- .../ConnectionToClipboardServer.cpp | 14 +- .../SpiceAgent/ConnectionToClipboardServer.h | 2 +- Userland/Services/SpiceAgent/SpiceAgent.cpp | 4 +- Userland/Services/SpiceAgent/SpiceAgent.h | 2 +- Userland/Services/SystemServer/Service.cpp | 16 +- Userland/Services/SystemServer/Service.h | 18 +- Userland/Services/SystemServer/main.cpp | 20 +- Userland/Services/Taskbar/ClockWidget.cpp | 2 +- Userland/Services/Taskbar/ClockWidget.h | 4 +- .../Services/Taskbar/QuickLaunchWidget.cpp | 16 +- Userland/Services/Taskbar/QuickLaunchWidget.h | 32 +-- Userland/Services/Taskbar/ShutdownDialog.cpp | 4 +- Userland/Services/Taskbar/TaskbarWindow.cpp | 4 +- Userland/Services/Taskbar/TaskbarWindow.h | 4 +- Userland/Services/Taskbar/WindowList.h | 8 +- Userland/Services/Taskbar/main.cpp | 28 +-- Userland/Services/TelnetServer/Client.cpp | 2 +- Userland/Services/TelnetServer/Client.h | 2 +- Userland/Services/TelnetServer/Command.h | 8 +- Userland/Services/TelnetServer/Parser.cpp | 2 +- Userland/Services/TelnetServer/Parser.h | 4 +- Userland/Services/TelnetServer/main.cpp | 4 +- .../WebContent/ConnectionFromClient.cpp | 52 ++--- .../WebContent/ConnectionFromClient.h | 18 +- Userland/Services/WebContent/PageHost.cpp | 28 +-- Userland/Services/WebContent/PageHost.h | 28 +-- .../Services/WebContent/WebContentClient.ipc | 34 +-- .../WebContent/WebContentConsoleClient.cpp | 18 +- .../WebContent/WebContentConsoleClient.h | 8 +- .../Services/WebContent/WebContentServer.ipc | 28 +-- .../Services/WebContent/WebDriverClient.ipc | 32 +-- .../WebContent/WebDriverConnection.cpp | 102 ++++----- .../Services/WebContent/WebDriverConnection.h | 44 ++-- Userland/Services/WebDriver/Client.cpp | 4 +- Userland/Services/WebDriver/Session.cpp | 4 +- Userland/Services/WebDriver/Session.h | 2 +- Userland/Services/WebDriver/main.cpp | 4 +- Userland/Services/WebServer/Client.cpp | 16 +- Userland/Services/WebServer/Client.h | 6 +- Userland/Services/WebServer/Configuration.cpp | 2 +- Userland/Services/WebServer/Configuration.h | 10 +- Userland/Services/WebServer/main.cpp | 10 +- .../WebSocket/ConnectionFromClient.cpp | 12 +- .../Services/WebSocket/ConnectionFromClient.h | 8 +- .../Services/WebSocket/WebSocketClient.ipc | 2 +- .../Services/WebSocket/WebSocketServer.ipc | 6 +- .../Services/WindowServer/AppletManager.cpp | 2 +- Userland/Services/WindowServer/Compositor.cpp | 6 +- Userland/Services/WindowServer/Compositor.h | 4 +- .../WindowServer/ConnectionFromClient.cpp | 32 +-- .../WindowServer/ConnectionFromClient.h | 22 +- Userland/Services/WindowServer/Event.h | 4 +- .../WindowServer/HardwareScreenBackend.cpp | 4 +- .../WindowServer/HardwareScreenBackend.h | 6 +- .../Services/WindowServer/KeymapSwitcher.cpp | 4 +- .../Services/WindowServer/KeymapSwitcher.h | 10 +- Userland/Services/WindowServer/Menu.cpp | 2 +- Userland/Services/WindowServer/Menu.h | 8 +- Userland/Services/WindowServer/MenuItem.cpp | 2 +- Userland/Services/WindowServer/MenuItem.h | 16 +- Userland/Services/WindowServer/Overlays.cpp | 8 +- Userland/Services/WindowServer/Overlays.h | 6 +- Userland/Services/WindowServer/Screen.cpp | 6 +- Userland/Services/WindowServer/Screen.h | 2 +- Userland/Services/WindowServer/ScreenLayout.h | 10 +- .../Services/WindowServer/ScreenLayout.ipp | 34 +-- .../WindowServer/VirtualScreenBackend.h | 2 +- .../WindowServer/WMConnectionFromClient.cpp | 2 +- .../WindowServer/WMConnectionFromClient.h | 2 +- Userland/Services/WindowServer/Window.cpp | 16 +- Userland/Services/WindowServer/Window.h | 14 +- .../Services/WindowServer/WindowClient.ipc | 8 +- .../Services/WindowServer/WindowFrame.cpp | 18 +- Userland/Services/WindowServer/WindowFrame.h | 2 +- .../Services/WindowServer/WindowManager.cpp | 28 +-- .../Services/WindowServer/WindowManager.h | 12 +- .../WindowServer/WindowManagerClient.ipc | 4 +- .../WindowServer/WindowManagerServer.ipc | 2 +- .../Services/WindowServer/WindowServer.ipc | 36 +-- .../Services/WindowServer/WindowSwitcher.cpp | 2 +- Userland/Services/WindowServer/main.cpp | 8 +- Userland/Shell/AST.cpp | 160 ++++++------- Userland/Shell/AST.h | 144 ++++++------ Userland/Shell/Builtin.cpp | 40 ++-- Userland/Shell/Execution.h | 2 +- Userland/Shell/Formatter.cpp | 6 +- Userland/Shell/Formatter.h | 8 +- Userland/Shell/ImmediateFunctions.cpp | 18 +- Userland/Shell/Job.cpp | 2 +- Userland/Shell/Job.h | 10 +- Userland/Shell/Parser.cpp | 34 +-- Userland/Shell/Parser.h | 4 +- Userland/Shell/Shell.cpp | 104 ++++----- Userland/Shell/Shell.h | 86 +++---- Userland/Shell/main.cpp | 6 +- Userland/Utilities/allocate.cpp | 2 +- Userland/Utilities/arp.cpp | 6 +- Userland/Utilities/asctl.cpp | 2 +- Userland/Utilities/bt.cpp | 6 +- Userland/Utilities/checksum.cpp | 4 +- Userland/Utilities/chgrp.cpp | 6 +- Userland/Utilities/chown.cpp | 4 +- Userland/Utilities/cksum.cpp | 6 +- Userland/Utilities/cmp.cpp | 10 +- Userland/Utilities/comm.cpp | 26 +-- Userland/Utilities/config.cpp | 8 +- Userland/Utilities/copy.cpp | 6 +- Userland/Utilities/cp.cpp | 4 +- Userland/Utilities/cpp-preprocessor.cpp | 4 +- Userland/Utilities/cut.cpp | 26 +-- Userland/Utilities/date.cpp | 4 +- Userland/Utilities/dd.cpp | 2 +- Userland/Utilities/df.cpp | 4 +- Userland/Utilities/diff.cpp | 4 +- Userland/Utilities/dirname.cpp | 2 +- Userland/Utilities/disk_benchmark.cpp | 10 +- Userland/Utilities/du.cpp | 16 +- Userland/Utilities/echo.cpp | 6 +- Userland/Utilities/env.cpp | 2 +- Userland/Utilities/errno.cpp | 4 +- Userland/Utilities/expr.cpp | 28 +-- Userland/Utilities/fdtdump.cpp | 4 +- Userland/Utilities/fgrep.cpp | 2 +- Userland/Utilities/file.cpp | 26 +-- Userland/Utilities/find.cpp | 4 +- Userland/Utilities/fortune.cpp | 16 +- Userland/Utilities/functrace.cpp | 2 +- Userland/Utilities/gml-format.cpp | 2 +- Userland/Utilities/grep.cpp | 10 +- Userland/Utilities/gron.cpp | 12 +- Userland/Utilities/groups.cpp | 2 +- Userland/Utilities/gunzip.cpp | 6 +- Userland/Utilities/gzip.cpp | 4 +- Userland/Utilities/head.cpp | 6 +- Userland/Utilities/headless-browser.cpp | 44 ++-- Userland/Utilities/host.cpp | 2 +- Userland/Utilities/id.cpp | 2 +- Userland/Utilities/ifconfig.cpp | 2 +- Userland/Utilities/ini.cpp | 6 +- Userland/Utilities/install.cpp | 6 +- Userland/Utilities/js.cpp | 30 +-- Userland/Utilities/keymap.cpp | 12 +- Userland/Utilities/kill.cpp | 2 +- Userland/Utilities/killall.cpp | 6 +- Userland/Utilities/less.cpp | 22 +- Userland/Utilities/ln.cpp | 2 +- Userland/Utilities/ls.cpp | 26 +-- Userland/Utilities/lsblk.cpp | 14 +- Userland/Utilities/lsirq.cpp | 2 +- Userland/Utilities/lsof.cpp | 16 +- Userland/Utilities/lspci.cpp | 30 +-- Userland/Utilities/lsusb.cpp | 2 +- Userland/Utilities/man.cpp | 20 +- Userland/Utilities/markdown-check.cpp | 46 ++-- Userland/Utilities/md.cpp | 6 +- Userland/Utilities/mkdir.cpp | 4 +- Userland/Utilities/mkfifo.cpp | 2 +- Userland/Utilities/mktemp.cpp | 6 +- Userland/Utilities/mount.cpp | 4 +- Userland/Utilities/mv.cpp | 8 +- Userland/Utilities/netstat.cpp | 20 +- Userland/Utilities/nl.cpp | 4 +- Userland/Utilities/ntpquery.cpp | 2 +- Userland/Utilities/passwd.cpp | 2 +- Userland/Utilities/paste.cpp | 4 +- Userland/Utilities/pathchk.cpp | 4 +- Userland/Utilities/pidof.cpp | 4 +- Userland/Utilities/pledge.cpp | 4 +- Userland/Utilities/pmap.cpp | 6 +- Userland/Utilities/pmemdump.cpp | 4 +- Userland/Utilities/printf.cpp | 6 +- Userland/Utilities/pro.cpp | 8 +- Userland/Utilities/profile.cpp | 2 +- Userland/Utilities/ps.cpp | 26 +-- Userland/Utilities/pwd.cpp | 2 +- Userland/Utilities/readelf.cpp | 8 +- Userland/Utilities/reboot.cpp | 2 +- Userland/Utilities/rev.cpp | 4 +- Userland/Utilities/rmdir.cpp | 2 +- Userland/Utilities/route.cpp | 6 +- Userland/Utilities/run-tests.cpp | 50 ++--- Userland/Utilities/seq.cpp | 2 +- Userland/Utilities/shot.cpp | 2 +- Userland/Utilities/shuf.cpp | 2 +- Userland/Utilities/shutdown.cpp | 2 +- Userland/Utilities/sort.cpp | 4 +- Userland/Utilities/sql.cpp | 42 ++-- Userland/Utilities/stat.cpp | 2 +- Userland/Utilities/strace.cpp | 12 +- Userland/Utilities/stty.cpp | 4 +- Userland/Utilities/sysctl.cpp | 6 +- Userland/Utilities/tac.cpp | 4 +- Userland/Utilities/tar.cpp | 22 +- Userland/Utilities/telws.cpp | 6 +- Userland/Utilities/test-fuzz.cpp | 2 +- Userland/Utilities/test-imap.cpp | 6 +- Userland/Utilities/test.cpp | 16 +- Userland/Utilities/top.cpp | 10 +- Userland/Utilities/touch.cpp | 10 +- Userland/Utilities/tr.cpp | 4 +- Userland/Utilities/traceroute.cpp | 6 +- Userland/Utilities/tree.cpp | 24 +- Userland/Utilities/truncate.cpp | 2 +- Userland/Utilities/uname.cpp | 4 +- Userland/Utilities/uniq.cpp | 4 +- Userland/Utilities/unveil.cpp | 2 +- Userland/Utilities/unzip.cpp | 4 +- .../Utilities/update-cpp-test-results.cpp | 4 +- Userland/Utilities/useradd.cpp | 14 +- Userland/Utilities/userdel.cpp | 4 +- Userland/Utilities/w.cpp | 8 +- Userland/Utilities/wallpaper.cpp | 6 +- Userland/Utilities/wasm.cpp | 14 +- Userland/Utilities/watch.cpp | 10 +- Userland/Utilities/wc.cpp | 8 +- Userland/Utilities/xargs.cpp | 12 +- Userland/Utilities/xml.cpp | 12 +- Userland/Utilities/zip.cpp | 8 +- 2006 files changed, 11635 insertions(+), 11636 deletions(-) rename AK/{String.cpp => DeprecatedString.cpp} (68%) rename AK/{String.h => DeprecatedString.h} (63%) rename Tests/AK/{TestString.cpp => TestDeprecatedString.cpp} (64%) diff --git a/AK/Base64.cpp b/AK/Base64.cpp index d3b8f674506..7cdc01c343f 100644 --- a/AK/Base64.cpp +++ b/AK/Base64.cpp @@ -100,7 +100,7 @@ ErrorOr decode_base64(StringView input) return ByteBuffer::copy(output); } -String encode_base64(ReadonlyBytes input) +DeprecatedString encode_base64(ReadonlyBytes input) { StringBuilder output(calculate_base64_encoded_length(input)); diff --git a/AK/Base64.h b/AK/Base64.h index ae9c428125a..5635352d001 100644 --- a/AK/Base64.h +++ b/AK/Base64.h @@ -7,8 +7,8 @@ #pragma once #include +#include #include -#include #include namespace AK { @@ -19,7 +19,7 @@ namespace AK { [[nodiscard]] ErrorOr decode_base64(StringView); -[[nodiscard]] String encode_base64(ReadonlyBytes); +[[nodiscard]] DeprecatedString encode_base64(ReadonlyBytes); } #if USING_AK_GLOBALLY diff --git a/AK/CMakeLists.txt b/AK/CMakeLists.txt index 7da77103ac7..46ec2ee1a4c 100644 --- a/AK/CMakeLists.txt +++ b/AK/CMakeLists.txt @@ -1,6 +1,7 @@ set(AK_SOURCES Assertions.cpp Base64.cpp + DeprecatedString.cpp FloatingPointStringConversions.cpp FlyString.cpp Format.cpp @@ -14,7 +15,6 @@ set(AK_SOURCES LexicalPath.cpp Random.cpp StackInfo.cpp - String.cpp StringBuilder.cpp StringFloatingPointConversions.cpp StringImpl.cpp diff --git a/AK/Demangle.h b/AK/Demangle.h index 13554065688..b74481cc599 100644 --- a/AK/Demangle.h +++ b/AK/Demangle.h @@ -8,17 +8,17 @@ #ifndef KERNEL -# include +# include # include # include namespace AK { -inline String demangle(StringView name) +inline DeprecatedString demangle(StringView name) { int status = 0; auto* demangled_name = abi::__cxa_demangle(name.to_string().characters(), nullptr, nullptr, &status); - auto string = String(status == 0 ? StringView { demangled_name, strlen(demangled_name) } : name); + auto string = DeprecatedString(status == 0 ? StringView { demangled_name, strlen(demangled_name) } : name); if (status == 0) free(demangled_name); return string; diff --git a/AK/String.cpp b/AK/DeprecatedString.cpp similarity index 68% rename from AK/String.cpp rename to AK/DeprecatedString.cpp index 3c63b70b62a..9bc645be8ac 100644 --- a/AK/String.cpp +++ b/AK/DeprecatedString.cpp @@ -5,43 +5,43 @@ */ #include +#include #include #include #include #include #include -#include #include #include namespace AK { -bool String::operator==(FlyString const& fly_string) const +bool DeprecatedString::operator==(FlyString const& fly_string) const { return m_impl == fly_string.impl() || view() == fly_string.view(); } -bool String::operator==(String const& other) const +bool DeprecatedString::operator==(DeprecatedString const& other) const { return m_impl == other.impl() || view() == other.view(); } -bool String::operator==(StringView other) const +bool DeprecatedString::operator==(StringView other) const { return view() == other; } -bool String::operator<(String const& other) const +bool DeprecatedString::operator<(DeprecatedString const& other) const { return view() < other.view(); } -bool String::operator>(String const& other) const +bool DeprecatedString::operator>(DeprecatedString const& other) const { return view() > other.view(); } -bool String::copy_characters_to_buffer(char* buffer, size_t buffer_size) const +bool DeprecatedString::copy_characters_to_buffer(char* buffer, size_t buffer_size) const { // We must fit at least the NUL-terminator. VERIFY(buffer_size > 0); @@ -53,7 +53,7 @@ bool String::copy_characters_to_buffer(char* buffer, size_t buffer_size) const return characters_to_copy == length(); } -String String::isolated_copy() const +DeprecatedString DeprecatedString::isolated_copy() const { if (!m_impl) return {}; @@ -62,27 +62,27 @@ String String::isolated_copy() const char* buffer; auto impl = StringImpl::create_uninitialized(length(), buffer); memcpy(buffer, m_impl->characters(), m_impl->length()); - return String(move(*impl)); + return DeprecatedString(move(*impl)); } -String String::substring(size_t start, size_t length) const +DeprecatedString DeprecatedString::substring(size_t start, size_t length) const { if (!length) - return String::empty(); + return DeprecatedString::empty(); VERIFY(m_impl); VERIFY(!Checked::addition_would_overflow(start, length)); VERIFY(start + length <= m_impl->length()); return { characters() + start, length }; } -String String::substring(size_t start) const +DeprecatedString DeprecatedString::substring(size_t start) const { VERIFY(m_impl); VERIFY(start <= length()); return { characters() + start, length() - start }; } -StringView String::substring_view(size_t start, size_t length) const +StringView DeprecatedString::substring_view(size_t start, size_t length) const { VERIFY(m_impl); VERIFY(!Checked::addition_would_overflow(start, length)); @@ -90,24 +90,24 @@ StringView String::substring_view(size_t start, size_t length) const return { characters() + start, length }; } -StringView String::substring_view(size_t start) const +StringView DeprecatedString::substring_view(size_t start) const { VERIFY(m_impl); VERIFY(start <= length()); return { characters() + start, length() - start }; } -Vector String::split(char separator, SplitBehavior split_behavior) const +Vector DeprecatedString::split(char separator, SplitBehavior split_behavior) const { return split_limit(separator, 0, split_behavior); } -Vector String::split_limit(char separator, size_t limit, SplitBehavior split_behavior) const +Vector DeprecatedString::split_limit(char separator, size_t limit, SplitBehavior split_behavior) const { if (is_empty()) return {}; - Vector v; + Vector v; size_t substart = 0; bool keep_empty = has_flag(split_behavior, SplitBehavior::KeepEmpty); bool keep_separator = has_flag(split_behavior, SplitBehavior::KeepTrailingSeparator); @@ -126,7 +126,7 @@ Vector String::split_limit(char separator, size_t limit, SplitBehavior s return v; } -Vector String::split_view(Function separator, SplitBehavior split_behavior) const +Vector DeprecatedString::split_view(Function separator, SplitBehavior split_behavior) const { if (is_empty()) return {}; @@ -150,12 +150,12 @@ Vector String::split_view(Function separator, SplitBehav return v; } -Vector String::split_view(char const separator, SplitBehavior split_behavior) const +Vector DeprecatedString::split_view(char const separator, SplitBehavior split_behavior) const { return split_view([separator](char ch) { return ch == separator; }, split_behavior); } -ByteBuffer String::to_byte_buffer() const +ByteBuffer DeprecatedString::to_byte_buffer() const { if (!m_impl) return {}; @@ -164,65 +164,65 @@ ByteBuffer String::to_byte_buffer() const } template -Optional String::to_int(TrimWhitespace trim_whitespace) const +Optional DeprecatedString::to_int(TrimWhitespace trim_whitespace) const { return StringUtils::convert_to_int(view(), trim_whitespace); } -template Optional String::to_int(TrimWhitespace) const; -template Optional String::to_int(TrimWhitespace) const; -template Optional String::to_int(TrimWhitespace) const; -template Optional String::to_int(TrimWhitespace) const; +template Optional DeprecatedString::to_int(TrimWhitespace) const; +template Optional DeprecatedString::to_int(TrimWhitespace) const; +template Optional DeprecatedString::to_int(TrimWhitespace) const; +template Optional DeprecatedString::to_int(TrimWhitespace) const; template -Optional String::to_uint(TrimWhitespace trim_whitespace) const +Optional DeprecatedString::to_uint(TrimWhitespace trim_whitespace) const { return StringUtils::convert_to_uint(view(), trim_whitespace); } -template Optional String::to_uint(TrimWhitespace) const; -template Optional String::to_uint(TrimWhitespace) const; -template Optional String::to_uint(TrimWhitespace) const; -template Optional String::to_uint(TrimWhitespace) const; -template Optional String::to_uint(TrimWhitespace) const; +template Optional DeprecatedString::to_uint(TrimWhitespace) const; +template Optional DeprecatedString::to_uint(TrimWhitespace) const; +template Optional DeprecatedString::to_uint(TrimWhitespace) const; +template Optional DeprecatedString::to_uint(TrimWhitespace) const; +template Optional DeprecatedString::to_uint(TrimWhitespace) const; #ifndef KERNEL -Optional String::to_double(TrimWhitespace trim_whitespace) const +Optional DeprecatedString::to_double(TrimWhitespace trim_whitespace) const { return StringUtils::convert_to_floating_point(*this, trim_whitespace); } -Optional String::to_float(TrimWhitespace trim_whitespace) const +Optional DeprecatedString::to_float(TrimWhitespace trim_whitespace) const { return StringUtils::convert_to_floating_point(*this, trim_whitespace); } #endif -bool String::starts_with(StringView str, CaseSensitivity case_sensitivity) const +bool DeprecatedString::starts_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::starts_with(*this, str, case_sensitivity); } -bool String::starts_with(char ch) const +bool DeprecatedString::starts_with(char ch) const { if (is_empty()) return false; return characters()[0] == ch; } -bool String::ends_with(StringView str, CaseSensitivity case_sensitivity) const +bool DeprecatedString::ends_with(StringView str, CaseSensitivity case_sensitivity) const { return StringUtils::ends_with(*this, str, case_sensitivity); } -bool String::ends_with(char ch) const +bool DeprecatedString::ends_with(char ch) const { if (is_empty()) return false; return characters()[length() - 1] == ch; } -String String::repeated(char ch, size_t count) +DeprecatedString DeprecatedString::repeated(char ch, size_t count) { if (!count) return empty(); @@ -232,7 +232,7 @@ String String::repeated(char ch, size_t count) return *impl; } -String String::repeated(StringView string, size_t count) +DeprecatedString DeprecatedString::repeated(StringView string, size_t count) { if (!count || string.is_empty()) return empty(); @@ -243,7 +243,7 @@ String String::repeated(StringView string, size_t count) return *impl; } -String String::bijective_base_from(size_t value, unsigned base, StringView map) +DeprecatedString DeprecatedString::bijective_base_from(size_t value, unsigned base, StringView map) { if (map.is_null()) map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"sv; @@ -267,13 +267,13 @@ String String::bijective_base_from(size_t value, unsigned base, StringView map) for (size_t j = 0; j < i / 2; ++j) swap(buffer[j], buffer[i - j - 1]); - return String { ReadonlyBytes(buffer.data(), i) }; + return DeprecatedString { ReadonlyBytes(buffer.data(), i) }; } -String String::roman_number_from(size_t value) +DeprecatedString DeprecatedString::roman_number_from(size_t value) { if (value > 3999) - return String::number(value); + return DeprecatedString::number(value); StringBuilder builder; @@ -323,32 +323,32 @@ String String::roman_number_from(size_t value) return builder.to_string(); } -bool String::matches(StringView mask, Vector& mask_spans, CaseSensitivity case_sensitivity) const +bool DeprecatedString::matches(StringView mask, Vector& mask_spans, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity, &mask_spans); } -bool String::matches(StringView mask, CaseSensitivity case_sensitivity) const +bool DeprecatedString::matches(StringView mask, CaseSensitivity case_sensitivity) const { return StringUtils::matches(*this, mask, case_sensitivity); } -bool String::contains(StringView needle, CaseSensitivity case_sensitivity) const +bool DeprecatedString::contains(StringView needle, CaseSensitivity case_sensitivity) const { return StringUtils::contains(*this, needle, case_sensitivity); } -bool String::contains(char needle, CaseSensitivity case_sensitivity) const +bool DeprecatedString::contains(char needle, CaseSensitivity case_sensitivity) const { return StringUtils::contains(*this, StringView(&needle, 1), case_sensitivity); } -bool String::equals_ignoring_case(StringView other) const +bool DeprecatedString::equals_ignoring_case(StringView other) const { return StringUtils::equals_ignoring_case(view(), other); } -String String::reverse() const +DeprecatedString DeprecatedString::reverse() const { StringBuilder reversed_string(length()); for (size_t i = length(); i-- > 0;) { @@ -357,7 +357,7 @@ String String::reverse() const return reversed_string.to_string(); } -String escape_html_entities(StringView html) +DeprecatedString escape_html_entities(StringView html) { StringBuilder builder; for (size_t i = 0; i < html.length(); ++i) { @@ -375,46 +375,46 @@ String escape_html_entities(StringView html) return builder.to_string(); } -String::String(FlyString const& string) +DeprecatedString::DeprecatedString(FlyString const& string) : m_impl(string.impl()) { } -String String::to_lowercase() const +DeprecatedString DeprecatedString::to_lowercase() const { if (!m_impl) return {}; return m_impl->to_lowercase(); } -String String::to_uppercase() const +DeprecatedString DeprecatedString::to_uppercase() const { if (!m_impl) return {}; return m_impl->to_uppercase(); } -String String::to_snakecase() const +DeprecatedString DeprecatedString::to_snakecase() const { return StringUtils::to_snakecase(*this); } -String String::to_titlecase() const +DeprecatedString DeprecatedString::to_titlecase() const { return StringUtils::to_titlecase(*this); } -String String::invert_case() const +DeprecatedString DeprecatedString::invert_case() const { return StringUtils::invert_case(*this); } -bool String::operator==(char const* cstring) const +bool DeprecatedString::operator==(char const* cstring) const { return view() == cstring; } -InputStream& operator>>(InputStream& stream, String& string) +InputStream& operator>>(InputStream& stream, DeprecatedString& string) { StringBuilder builder; @@ -437,14 +437,14 @@ InputStream& operator>>(InputStream& stream, String& string) } } -String String::vformatted(StringView fmtstr, TypeErasedFormatParams& params) +DeprecatedString DeprecatedString::vformatted(StringView fmtstr, TypeErasedFormatParams& params) { StringBuilder builder; MUST(vformat(builder, fmtstr, params)); return builder.to_string(); } -Vector String::find_all(StringView needle) const +Vector DeprecatedString::find_all(StringView needle) const { return StringUtils::find_all(*this, needle); } diff --git a/AK/String.h b/AK/DeprecatedString.h similarity index 63% rename from AK/String.h rename to AK/DeprecatedString.h index a304f0d1da4..86934fb5256 100644 --- a/AK/String.h +++ b/AK/DeprecatedString.h @@ -17,92 +17,92 @@ namespace AK { -// String is a convenience wrapper around StringImpl, suitable for passing +// DeprecatedString is a convenience wrapper around StringImpl, suitable for passing // around as a value type. It's basically the same as passing around a // RefPtr, with a bit of syntactic sugar. // // Note that StringImpl is an immutable object that cannot shrink or grow. // Its allocation size is snugly tailored to the specific string it contains. -// Copying a String is very efficient, since the internal StringImpl is +// Copying a DeprecatedString is very efficient, since the internal StringImpl is // retainable and so copying only requires modifying the ref count. // -// There are three main ways to construct a new String: +// There are three main ways to construct a new DeprecatedString: // -// s = String("some literal"); +// s = DeprecatedString("some literal"); // -// s = String::formatted("{} little piggies", m_piggies); +// s = DeprecatedString::formatted("{} little piggies", m_piggies); // // StringBuilder builder; // builder.append("abc"); // builder.append("123"); // s = builder.to_string(); -class String { +class DeprecatedString { public: - ~String() = default; + ~DeprecatedString() = default; - String() = default; + DeprecatedString() = default; - String(StringView view) + DeprecatedString(StringView view) : m_impl(StringImpl::create(view.characters_without_null_termination(), view.length())) { } - String(String const& other) - : m_impl(const_cast(other).m_impl) + DeprecatedString(DeprecatedString const& other) + : m_impl(const_cast(other).m_impl) { } - String(String&& other) + DeprecatedString(DeprecatedString&& other) : m_impl(move(other.m_impl)) { } - String(char const* cstring, ShouldChomp shouldChomp = NoChomp) + DeprecatedString(char const* cstring, ShouldChomp shouldChomp = NoChomp) : m_impl(StringImpl::create(cstring, shouldChomp)) { } - String(char const* cstring, size_t length, ShouldChomp shouldChomp = NoChomp) + DeprecatedString(char const* cstring, size_t length, ShouldChomp shouldChomp = NoChomp) : m_impl(StringImpl::create(cstring, length, shouldChomp)) { } - explicit String(ReadonlyBytes bytes, ShouldChomp shouldChomp = NoChomp) + explicit DeprecatedString(ReadonlyBytes bytes, ShouldChomp shouldChomp = NoChomp) : m_impl(StringImpl::create(bytes, shouldChomp)) { } - String(StringImpl const& impl) + DeprecatedString(StringImpl const& impl) : m_impl(const_cast(impl)) { } - String(StringImpl const* impl) + DeprecatedString(StringImpl const* impl) : m_impl(const_cast(impl)) { } - String(RefPtr&& impl) + DeprecatedString(RefPtr&& impl) : m_impl(move(impl)) { } - String(NonnullRefPtr&& impl) + DeprecatedString(NonnullRefPtr&& impl) : m_impl(move(impl)) { } - String(FlyString const&); + DeprecatedString(FlyString const&); - [[nodiscard]] static String repeated(char, size_t count); - [[nodiscard]] static String repeated(StringView, size_t count); + [[nodiscard]] static DeprecatedString repeated(char, size_t count); + [[nodiscard]] static DeprecatedString repeated(StringView, size_t count); - [[nodiscard]] static String bijective_base_from(size_t value, unsigned base = 26, StringView map = {}); - [[nodiscard]] static String roman_number_from(size_t value); + [[nodiscard]] static DeprecatedString bijective_base_from(size_t value, unsigned base = 26, StringView map = {}); + [[nodiscard]] static DeprecatedString roman_number_from(size_t value); template - [[nodiscard]] static String join(SeparatorType const& separator, CollectionType const& collection, StringView fmtstr = "{}"sv) + [[nodiscard]] static DeprecatedString join(SeparatorType const& separator, CollectionType const& collection, StringView fmtstr = "{}"sv) { StringBuilder builder; builder.join(separator, collection, fmtstr); @@ -121,15 +121,15 @@ public: [[nodiscard]] Optional to_float(TrimWhitespace = TrimWhitespace::Yes) const; #endif - [[nodiscard]] String to_lowercase() const; - [[nodiscard]] String to_uppercase() const; - [[nodiscard]] String to_snakecase() const; - [[nodiscard]] String to_titlecase() const; - [[nodiscard]] String invert_case() const; + [[nodiscard]] DeprecatedString to_lowercase() const; + [[nodiscard]] DeprecatedString to_uppercase() const; + [[nodiscard]] DeprecatedString to_snakecase() const; + [[nodiscard]] DeprecatedString to_titlecase() const; + [[nodiscard]] DeprecatedString invert_case() const; [[nodiscard]] bool is_whitespace() const { return StringUtils::is_whitespace(*this); } - [[nodiscard]] String trim(StringView characters, TrimMode mode = TrimMode::Both) const + [[nodiscard]] DeprecatedString trim(StringView characters, TrimMode mode = TrimMode::Both) const { auto trimmed_view = StringUtils::trim(view(), characters, mode); if (view() == trimmed_view) @@ -137,7 +137,7 @@ public: return trimmed_view; } - [[nodiscard]] String trim_whitespace(TrimMode mode = TrimMode::Both) const + [[nodiscard]] DeprecatedString trim_whitespace(TrimMode mode = TrimMode::Both) const { auto trimmed_view = StringUtils::trim_whitespace(view(), mode); if (view() == trimmed_view) @@ -150,8 +150,8 @@ public: [[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] bool contains(char, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - [[nodiscard]] Vector split_limit(char separator, size_t limit, SplitBehavior = SplitBehavior::Nothing) const; - [[nodiscard]] Vector split(char separator, SplitBehavior = SplitBehavior::Nothing) const; + [[nodiscard]] Vector split_limit(char separator, size_t limit, SplitBehavior = SplitBehavior::Nothing) const; + [[nodiscard]] Vector split(char separator, SplitBehavior = SplitBehavior::Nothing) const; [[nodiscard]] Vector split_view(char separator, SplitBehavior = SplitBehavior::Nothing) const; [[nodiscard]] Vector split_view(Function separator, SplitBehavior = SplitBehavior::Nothing) const; @@ -165,8 +165,8 @@ public: [[nodiscard]] StringView find_last_split_view(char separator) const { return view().find_last_split_view(separator); } - [[nodiscard]] String substring(size_t start, size_t length) const; - [[nodiscard]] String substring(size_t start) const; + [[nodiscard]] DeprecatedString substring(size_t start, size_t length) const; + [[nodiscard]] DeprecatedString substring(size_t start) const; [[nodiscard]] StringView substring_view(size_t start, size_t length) const; [[nodiscard]] StringView substring_view(size_t start) const; @@ -192,7 +192,7 @@ public: return (*m_impl)[i]; } - using ConstIterator = SimpleIterator; + using ConstIterator = SimpleIterator; [[nodiscard]] constexpr ConstIterator begin() const { return ConstIterator::begin(*this); } [[nodiscard]] constexpr ConstIterator end() const { return ConstIterator::end(*this); } @@ -202,27 +202,27 @@ public: [[nodiscard]] bool starts_with(char) const; [[nodiscard]] bool ends_with(char) const; - bool operator==(String const&) const; + bool operator==(DeprecatedString const&) const; bool operator==(StringView) const; bool operator==(FlyString const&) const; - bool operator<(String const&) const; + bool operator<(DeprecatedString const&) const; bool operator<(char const*) const; - bool operator>=(String const& other) const { return !(*this < other); } + bool operator>=(DeprecatedString const& other) const { return !(*this < other); } bool operator>=(char const* other) const { return !(*this < other); } - bool operator>(String const&) const; + bool operator>(DeprecatedString const&) const; bool operator>(char const*) const; - bool operator<=(String const& other) const { return !(*this > other); } + bool operator<=(DeprecatedString const& other) const { return !(*this > other); } bool operator<=(char const* other) const { return !(*this > other); } bool operator==(char const* cstring) const; - [[nodiscard]] String isolated_copy() const; + [[nodiscard]] DeprecatedString isolated_copy() const; - [[nodiscard]] static String empty() + [[nodiscard]] static DeprecatedString empty() { return StringImpl::the_empty_stringimpl(); } @@ -230,27 +230,27 @@ public: [[nodiscard]] StringImpl* impl() { return m_impl.ptr(); } [[nodiscard]] StringImpl const* impl() const { return m_impl.ptr(); } - String& operator=(String&& other) + DeprecatedString& operator=(DeprecatedString&& other) { if (this != &other) m_impl = move(other.m_impl); return *this; } - String& operator=(String const& other) + DeprecatedString& operator=(DeprecatedString const& other) { if (this != &other) - m_impl = const_cast(other).m_impl; + m_impl = const_cast(other).m_impl; return *this; } - String& operator=(std::nullptr_t) + DeprecatedString& operator=(std::nullptr_t) { m_impl = nullptr; return *this; } - String& operator=(ReadonlyBytes bytes) + DeprecatedString& operator=(ReadonlyBytes bytes) { m_impl = StringImpl::create(bytes); return *this; @@ -266,24 +266,24 @@ public: [[nodiscard]] ByteBuffer to_byte_buffer() const; template - [[nodiscard]] static String copy(BufferType const& buffer, ShouldChomp should_chomp = NoChomp) + [[nodiscard]] static DeprecatedString copy(BufferType const& buffer, ShouldChomp should_chomp = NoChomp) { if (buffer.is_empty()) return empty(); - return String((char const*)buffer.data(), buffer.size(), should_chomp); + return DeprecatedString((char const*)buffer.data(), buffer.size(), should_chomp); } - [[nodiscard]] static String vformatted(StringView fmtstr, TypeErasedFormatParams&); + [[nodiscard]] static DeprecatedString vformatted(StringView fmtstr, TypeErasedFormatParams&); template - [[nodiscard]] static String formatted(CheckedFormatString&& fmtstr, Parameters const&... parameters) + [[nodiscard]] static DeprecatedString formatted(CheckedFormatString&& fmtstr, Parameters const&... parameters) { VariadicFormatParams variadic_format_parameters { parameters... }; return vformatted(fmtstr.view(), variadic_format_parameters); } template - [[nodiscard]] static String number(T value) + [[nodiscard]] static DeprecatedString number(T value) requires IsArithmetic { return formatted("{}", value); @@ -294,9 +294,9 @@ public: return { characters(), length() }; } - [[nodiscard]] String replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const { return StringUtils::replace(*this, needle, replacement, replace_mode); } + [[nodiscard]] DeprecatedString replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const { return StringUtils::replace(*this, needle, replacement, replace_mode); } [[nodiscard]] size_t count(StringView needle) const { return StringUtils::count(*this, needle); } - [[nodiscard]] String reverse() const; + [[nodiscard]] DeprecatedString reverse() const; template [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts&&... strings) const @@ -321,23 +321,22 @@ private: }; template<> -struct Traits : public GenericTraits { - static unsigned hash(String const& s) { return s.impl() ? s.impl()->hash() : 0; } +struct Traits : public GenericTraits { + static unsigned hash(DeprecatedString const& s) { return s.impl() ? s.impl()->hash() : 0; } }; -struct CaseInsensitiveStringTraits : public Traits { - static unsigned hash(String const& s) { return s.impl() ? s.impl()->case_insensitive_hash() : 0; } - static bool equals(String const& a, String const& b) { return a.equals_ignoring_case(b); } +struct CaseInsensitiveStringTraits : public Traits { + static unsigned hash(DeprecatedString const& s) { return s.impl() ? s.impl()->case_insensitive_hash() : 0; } + static bool equals(DeprecatedString const& a, DeprecatedString const& b) { return a.equals_ignoring_case(b); } }; -String escape_html_entities(StringView html); +DeprecatedString escape_html_entities(StringView html); -InputStream& operator>>(InputStream& stream, String& string); +InputStream& operator>>(InputStream& stream, DeprecatedString& string); } #if USING_AK_GLOBALLY using AK::CaseInsensitiveStringTraits; using AK::escape_html_entities; -using AK::String; #endif diff --git a/AK/FlyString.cpp b/AK/FlyString.cpp index 1c30af74184..fdbb2cf937c 100644 --- a/AK/FlyString.cpp +++ b/AK/FlyString.cpp @@ -4,11 +4,11 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include #include -#include #include #include @@ -36,7 +36,7 @@ void FlyString::did_destroy_impl(Badge, StringImpl& impl) fly_impls().remove(&impl); } -FlyString::FlyString(String const& string) +FlyString::FlyString(DeprecatedString const& string) { if (string.is_null()) return; @@ -124,10 +124,10 @@ bool FlyString::ends_with(StringView str, CaseSensitivity case_sensitivity) cons FlyString FlyString::to_lowercase() const { - return String(*m_impl).to_lowercase(); + return DeprecatedString(*m_impl).to_lowercase(); } -bool FlyString::operator==(String const& other) const +bool FlyString::operator==(DeprecatedString const& other) const { return m_impl == other.impl() || view() == other.view(); } diff --git a/AK/FlyString.h b/AK/FlyString.h index 03a3c58b077..5d5a1e6ed3e 100644 --- a/AK/FlyString.h +++ b/AK/FlyString.h @@ -7,7 +7,7 @@ #pragma once #include "AK/StringUtils.h" -#include +#include namespace AK { @@ -22,10 +22,10 @@ public: : m_impl(move(other.m_impl)) { } - FlyString(String const&); + FlyString(DeprecatedString const&); FlyString(StringView); FlyString(char const* string) - : FlyString(static_cast(string)) + : FlyString(static_cast(string)) { } @@ -54,7 +54,7 @@ public: bool operator==(FlyString const& other) const { return m_impl == other.m_impl; } - bool operator==(String const&) const; + bool operator==(DeprecatedString const&) const; bool operator==(StringView) const; diff --git a/AK/Format.cpp b/AK/Format.cpp index 5233096b28f..beb11799f6d 100644 --- a/AK/Format.cpp +++ b/AK/Format.cpp @@ -256,7 +256,7 @@ ErrorOr FormatBuilder::put_u64( size_t used_by_prefix = 0; if (align == Align::Right && zero_pad) { - // We want String::formatted("{:#08x}", 32) to produce '0x00000020' instead of '0x000020'. This + // We want DeprecatedString::formatted("{:#08x}", 32) to produce '0x00000020' instead of '0x000020'. This // behavior differs from both fmtlib and printf, but is more intuitive. used_by_prefix = 0; } else { diff --git a/AK/Format.h b/AK/Format.h index 16344172967..b493b3c5570 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -427,7 +427,7 @@ struct Formatter : Formatter { } }; template<> -struct Formatter : Formatter { +struct Formatter : Formatter { }; template<> struct Formatter : Formatter { diff --git a/AK/Forward.h b/AK/Forward.h index 9a26dabb227..a981707994f 100644 --- a/AK/Forward.h +++ b/AK/Forward.h @@ -24,7 +24,7 @@ class JsonArray; class JsonObject; class JsonValue; class StackInfo; -class String; +class DeprecatedString; class StringBuilder; class StringImpl; class StringView; @@ -155,6 +155,7 @@ using AK::ByteBuffer; using AK::Bytes; using AK::CircularDuplexStream; using AK::CircularQueue; +using AK::DeprecatedString; using AK::DoublyLinkedList; using AK::DuplexMemoryStream; using AK::Error; @@ -187,7 +188,6 @@ using AK::RefPtr; using AK::SinglyLinkedList; using AK::Span; using AK::StackInfo; -using AK::String; using AK::StringBuilder; using AK::StringImpl; using AK::StringView; diff --git a/AK/GenericLexer.cpp b/AK/GenericLexer.cpp index 29049257b41..16faba67902 100644 --- a/AK/GenericLexer.cpp +++ b/AK/GenericLexer.cpp @@ -10,7 +10,7 @@ #include #ifndef KERNEL -# include +# include # include #endif @@ -129,7 +129,7 @@ StringView GenericLexer::consume_quoted_string(char escape_char) } #ifndef KERNEL -String GenericLexer::consume_and_unescape_string(char escape_char) +DeprecatedString GenericLexer::consume_and_unescape_string(char escape_char) { auto view = consume_quoted_string(escape_char); if (view.is_null()) diff --git a/AK/GenericLexer.h b/AK/GenericLexer.h index 50d98adb57d..ee9a95e787f 100644 --- a/AK/GenericLexer.h +++ b/AK/GenericLexer.h @@ -84,7 +84,7 @@ public: } #ifndef KERNEL - bool consume_specific(String const& next) + bool consume_specific(DeprecatedString const& next) { return consume_specific(StringView { next }); } @@ -118,7 +118,7 @@ public: StringView consume_until(StringView); StringView consume_quoted_string(char escape_char = 0); #ifndef KERNEL - String consume_and_unescape_string(char escape_char = '\\'); + DeprecatedString consume_and_unescape_string(char escape_char = '\\'); #endif enum class UnicodeEscapeError { diff --git a/AK/Hex.cpp b/AK/Hex.cpp index 666dcdf70db..7b9dfccbb73 100644 --- a/AK/Hex.cpp +++ b/AK/Hex.cpp @@ -46,7 +46,7 @@ ErrorOr> encode_hex(const ReadonlyBytes input) return Kernel::KString::try_create(output.string_view()); } #else -String encode_hex(const ReadonlyBytes input) +DeprecatedString encode_hex(const ReadonlyBytes input) { StringBuilder output(input.size() * 2); diff --git a/AK/Hex.h b/AK/Hex.h index 0c1661a6bc4..203ca4d5c80 100644 --- a/AK/Hex.h +++ b/AK/Hex.h @@ -13,7 +13,7 @@ #ifdef KERNEL # include #else -# include +# include #endif namespace AK { @@ -34,7 +34,7 @@ ErrorOr decode_hex(StringView); #ifdef KERNEL ErrorOr> encode_hex(ReadonlyBytes); #else -String encode_hex(ReadonlyBytes); +DeprecatedString encode_hex(ReadonlyBytes); #endif } diff --git a/AK/IPv4Address.h b/AK/IPv4Address.h index 2bb0468009f..1b1461045c0 100644 --- a/AK/IPv4Address.h +++ b/AK/IPv4Address.h @@ -16,7 +16,7 @@ # include # include #else -# include +# include #endif namespace AK { @@ -65,18 +65,18 @@ public: octet(SubnetClass::D)); } #else - String to_string() const + DeprecatedString to_string() const { - return String::formatted("{}.{}.{}.{}", + return DeprecatedString::formatted("{}.{}.{}.{}", octet(SubnetClass::A), octet(SubnetClass::B), octet(SubnetClass::C), octet(SubnetClass::D)); } - String to_string_reversed() const + DeprecatedString to_string_reversed() const { - return String::formatted("{}.{}.{}.{}", + return DeprecatedString::formatted("{}.{}.{}.{}", octet(SubnetClass::D), octet(SubnetClass::C), octet(SubnetClass::B), @@ -166,10 +166,10 @@ struct Formatter : Formatter }; #else template<> -struct Formatter : Formatter { +struct Formatter : Formatter { ErrorOr format(FormatBuilder& builder, IPv4Address value) { - return Formatter::format(builder, value.to_string()); + return Formatter::format(builder, value.to_string()); } }; #endif diff --git a/AK/IPv6Address.h b/AK/IPv6Address.h index 148968e4ad9..5616ca3c1f4 100644 --- a/AK/IPv6Address.h +++ b/AK/IPv6Address.h @@ -16,7 +16,7 @@ # include # include #else -# include +# include #endif #include #include @@ -51,7 +51,7 @@ public: #ifdef KERNEL ErrorOr> to_string() const #else - String to_string() const + DeprecatedString to_string() const #endif { if (is_zero()) { @@ -69,7 +69,7 @@ public: #ifdef KERNEL return Kernel::KString::formatted("::ffff:{}.{}.{}.{}", m_data[12], m_data[13], m_data[14], m_data[15]); #else - return String::formatted("::ffff:{}.{}.{}.{}", m_data[12], m_data[13], m_data[14], m_data[15]); + return DeprecatedString::formatted("::ffff:{}.{}.{}.{}", m_data[12], m_data[13], m_data[14], m_data[15]); #endif } @@ -289,10 +289,10 @@ struct Formatter : Formatter }; #else template<> -struct Formatter : Formatter { +struct Formatter : Formatter { ErrorOr format(FormatBuilder& builder, IPv6Address const& value) { - return Formatter::format(builder, value.to_string()); + return Formatter::format(builder, value.to_string()); } }; #endif diff --git a/AK/Iterator.h b/AK/Iterator.h index 76b078386ad..594c2141bdb 100644 --- a/AK/Iterator.h +++ b/AK/Iterator.h @@ -71,7 +71,7 @@ private: { using RawContainerType = RemoveCV; - if constexpr (IsSame || IsSame) + if constexpr (IsSame || IsSame) return { container, container.length() }; else return { container, container.size() }; diff --git a/AK/JsonArray.h b/AK/JsonArray.h index 4a3b962bfa3..9cf205a138a 100644 --- a/AK/JsonArray.h +++ b/AK/JsonArray.h @@ -71,7 +71,7 @@ public: template void serialize(Builder&) const; - [[nodiscard]] String to_string() const { return serialized(); } + [[nodiscard]] DeprecatedString to_string() const { return serialized(); } template void for_each(Callback callback) const diff --git a/AK/JsonArraySerializer.h b/AK/JsonArraySerializer.h index e10d5d5e68b..ef45da294d3 100644 --- a/AK/JsonArraySerializer.h +++ b/AK/JsonArraySerializer.h @@ -68,7 +68,7 @@ public: } #ifndef KERNEL - ErrorOr add(String const& value) + ErrorOr add(DeprecatedString const& value) { TRY(begin_item()); if constexpr (IsLegacyBuilder) { diff --git a/AK/JsonObject.h b/AK/JsonObject.h index df638343c12..47772ad66fd 100644 --- a/AK/JsonObject.h +++ b/AK/JsonObject.h @@ -8,18 +8,18 @@ #pragma once #include +#include #include #include #include #include #include -#include namespace AK { class JsonObject { template - using CallbackErrorType = decltype(declval()(declval(), declval()).release_error()); + using CallbackErrorType = decltype(declval()(declval(), declval()).release_error()); public: JsonObject() = default; @@ -135,7 +135,7 @@ public: } #endif - void set(String const& key, JsonValue value) + void set(DeprecatedString const& key, JsonValue value) { m_members.set(key, move(value)); } @@ -147,7 +147,7 @@ public: callback(member.key, member.value); } - template Callback> + template Callback> ErrorOr> try_for_each_member(Callback&& callback) const { for (auto const& member : m_members) @@ -166,10 +166,10 @@ public: template void serialize(Builder&) const; - [[nodiscard]] String to_string() const { return serialized(); } + [[nodiscard]] DeprecatedString to_string() const { return serialized(); } private: - OrderedHashMap m_members; + OrderedHashMap m_members; }; template diff --git a/AK/JsonObjectSerializer.h b/AK/JsonObjectSerializer.h index fe705c2d719..d18524843bc 100644 --- a/AK/JsonObjectSerializer.h +++ b/AK/JsonObjectSerializer.h @@ -63,7 +63,7 @@ public: } #ifndef KERNEL - ErrorOr add(StringView key, String const& value) + ErrorOr add(StringView key, DeprecatedString const& value) { TRY(begin_item(key)); if constexpr (IsLegacyBuilder) { diff --git a/AK/JsonParser.cpp b/AK/JsonParser.cpp index bc141eab79d..a04de23eaca 100644 --- a/AK/JsonParser.cpp +++ b/AK/JsonParser.cpp @@ -18,7 +18,7 @@ constexpr bool is_space(int ch) return ch == '\t' || ch == '\n' || ch == '\r' || ch == ' '; } -ErrorOr JsonParser::consume_and_unescape_string() +ErrorOr JsonParser::consume_and_unescape_string() { if (!consume_specific('"')) return Error::from_string_literal("JsonParser: Expected '\"'"); diff --git a/AK/JsonParser.h b/AK/JsonParser.h index a8507cc2b08..38e9a65c9a4 100644 --- a/AK/JsonParser.h +++ b/AK/JsonParser.h @@ -23,7 +23,7 @@ public: private: ErrorOr parse_helper(); - ErrorOr consume_and_unescape_string(); + ErrorOr consume_and_unescape_string(); ErrorOr parse_array(); ErrorOr parse_object(); ErrorOr parse_number(); diff --git a/AK/JsonPath.cpp b/AK/JsonPath.cpp index 6a9f2dad370..ad0e0897279 100644 --- a/AK/JsonPath.cpp +++ b/AK/JsonPath.cpp @@ -31,7 +31,7 @@ JsonValue JsonPath::resolve(JsonValue const& top_root) const return root; } -String JsonPath::to_string() const +DeprecatedString JsonPath::to_string() const { StringBuilder builder; builder.append("{ ."sv); diff --git a/AK/JsonPath.h b/AK/JsonPath.h index e3ee801ceea..7733a27aa83 100644 --- a/AK/JsonPath.h +++ b/AK/JsonPath.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -34,7 +34,7 @@ public: } Kind kind() const { return m_kind; } - String const& key() const + DeprecatedString const& key() const { VERIFY(m_kind == Kind::Key); return m_key; @@ -46,13 +46,13 @@ public: return m_index; } - String to_string() const + DeprecatedString to_string() const { switch (m_kind) { case Kind::Key: return key(); case Kind::Index: - return String::number(index()); + return DeprecatedString::number(index()); default: return "*"; } @@ -78,7 +78,7 @@ public: private: Kind m_kind; - String m_key; + DeprecatedString m_key; size_t m_index { 0 }; JsonPathElement(Kind kind) @@ -90,7 +90,7 @@ private: class JsonPath : public Vector { public: JsonValue resolve(JsonValue const&) const; - String to_string() const; + DeprecatedString to_string() const; }; } diff --git a/AK/JsonValue.cpp b/AK/JsonValue.cpp index f11fd4bc11d..d7b04ec8f00 100644 --- a/AK/JsonValue.cpp +++ b/AK/JsonValue.cpp @@ -156,7 +156,7 @@ JsonValue::JsonValue(long long unsigned value) } JsonValue::JsonValue(char const* cstring) - : JsonValue(String(cstring)) + : JsonValue(DeprecatedString(cstring)) { } @@ -174,7 +174,7 @@ JsonValue::JsonValue(bool value) m_value.as_bool = value; } -JsonValue::JsonValue(String const& value) +JsonValue::JsonValue(DeprecatedString const& value) { if (value.is_null()) { m_type = Type::Null; diff --git a/AK/JsonValue.h b/AK/JsonValue.h index 46b6e652e23..c09b5d07838 100644 --- a/AK/JsonValue.h +++ b/AK/JsonValue.h @@ -11,7 +11,7 @@ #include #ifndef KERNEL -# include +# include #endif namespace AK { @@ -58,7 +58,7 @@ public: JsonValue(bool); JsonValue(char const*); #ifndef KERNEL - JsonValue(String const&); + JsonValue(DeprecatedString const&); #endif JsonValue(StringView); JsonValue(JsonArray const&); @@ -77,14 +77,14 @@ public: void serialize(Builder&) const; #ifndef KERNEL - String as_string_or(String const& alternative) const + DeprecatedString as_string_or(DeprecatedString const& alternative) const { if (is_string()) return as_string(); return alternative; } - String to_string() const + DeprecatedString to_string() const { if (is_string()) return as_string(); @@ -157,7 +157,7 @@ public: } #ifndef KERNEL - String as_string() const + DeprecatedString as_string() const { VERIFY(is_string()); return *m_value.as_string; diff --git a/AK/LexicalPath.cpp b/AK/LexicalPath.cpp index ed7c10c2dc8..412d26f49aa 100644 --- a/AK/LexicalPath.cpp +++ b/AK/LexicalPath.cpp @@ -14,7 +14,7 @@ namespace AK { char s_single_dot = '.'; -LexicalPath::LexicalPath(String path) +LexicalPath::LexicalPath(DeprecatedString path) : m_string(canonicalized_path(move(path))) { if (m_string.is_empty()) { @@ -58,9 +58,9 @@ LexicalPath::LexicalPath(String path) } } -Vector LexicalPath::parts() const +Vector LexicalPath::parts() const { - Vector vector; + Vector vector; vector.ensure_capacity(m_parts.size()); for (auto& part : m_parts) vector.unchecked_append(part); @@ -72,7 +72,7 @@ bool LexicalPath::has_extension(StringView extension) const return m_string.ends_with(extension, CaseSensitivity::CaseInsensitive); } -String LexicalPath::canonicalized_path(String path) +DeprecatedString LexicalPath::canonicalized_path(DeprecatedString path) { if (path.is_null()) return {}; @@ -88,7 +88,7 @@ String LexicalPath::canonicalized_path(String path) auto is_absolute = path[0] == '/'; auto parts = path.split_view('/'); size_t approximate_canonical_length = 0; - Vector canonical_parts; + Vector canonical_parts; for (auto& part : parts) { if (part == ".") @@ -121,7 +121,7 @@ String LexicalPath::canonicalized_path(String path) return builder.to_string(); } -String LexicalPath::absolute_path(String dir_path, String target) +DeprecatedString LexicalPath::absolute_path(DeprecatedString dir_path, DeprecatedString target) { if (LexicalPath(target).is_absolute()) { return LexicalPath::canonicalized_path(target); @@ -129,10 +129,10 @@ String LexicalPath::absolute_path(String dir_path, String target) return LexicalPath::canonicalized_path(join(dir_path, target).string()); } -String LexicalPath::relative_path(StringView a_path, StringView a_prefix) +DeprecatedString LexicalPath::relative_path(StringView a_path, StringView a_prefix) { if (!a_path.starts_with('/') || !a_prefix.starts_with('/')) { - // FIXME: This should probably VERIFY or return an Optional. + // FIXME: This should probably VERIFY or return an Optional. return ""sv; } diff --git a/AK/LexicalPath.h b/AK/LexicalPath.h index 5d2731e9308..f5e0ec71f94 100644 --- a/AK/LexicalPath.h +++ b/AK/LexicalPath.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include // On Linux distros that use mlibc `basename` is defined as a macro that expands to `__mlibc_gnu_basename` or `__mlibc_gnu_basename_c`, so we undefine it. @@ -19,10 +19,10 @@ namespace AK { class LexicalPath { public: - explicit LexicalPath(String); + explicit LexicalPath(DeprecatedString); bool is_absolute() const { return !m_string.is_empty() && m_string[0] == '/'; } - String const& string() const { return m_string; } + DeprecatedString const& string() const { return m_string; } StringView dirname() const { return m_dirname; } StringView basename() const { return m_basename; } @@ -30,7 +30,7 @@ public: StringView extension() const { return m_extension; } Vector const& parts_view() const { return m_parts; } - [[nodiscard]] Vector parts() const; + [[nodiscard]] Vector parts() const; bool has_extension(StringView) const; @@ -38,9 +38,9 @@ public: [[nodiscard]] LexicalPath prepend(StringView) const; [[nodiscard]] LexicalPath parent() const; - [[nodiscard]] static String canonicalized_path(String); - [[nodiscard]] static String absolute_path(String dir_path, String target); - [[nodiscard]] static String relative_path(StringView absolute_path, StringView prefix); + [[nodiscard]] static DeprecatedString canonicalized_path(DeprecatedString); + [[nodiscard]] static DeprecatedString absolute_path(DeprecatedString dir_path, DeprecatedString target); + [[nodiscard]] static DeprecatedString relative_path(StringView absolute_path, StringView prefix); template [[nodiscard]] static LexicalPath join(StringView first, S&&... rest) @@ -52,25 +52,25 @@ public: return LexicalPath { builder.to_string() }; } - [[nodiscard]] static String dirname(String path) + [[nodiscard]] static DeprecatedString dirname(DeprecatedString path) { auto lexical_path = LexicalPath(move(path)); return lexical_path.dirname(); } - [[nodiscard]] static String basename(String path) + [[nodiscard]] static DeprecatedString basename(DeprecatedString path) { auto lexical_path = LexicalPath(move(path)); return lexical_path.basename(); } - [[nodiscard]] static String title(String path) + [[nodiscard]] static DeprecatedString title(DeprecatedString path) { auto lexical_path = LexicalPath(move(path)); return lexical_path.title(); } - [[nodiscard]] static String extension(String path) + [[nodiscard]] static DeprecatedString extension(DeprecatedString path) { auto lexical_path = LexicalPath(move(path)); return lexical_path.extension(); @@ -78,7 +78,7 @@ public: private: Vector m_parts; - String m_string; + DeprecatedString m_string; StringView m_dirname; StringView m_basename; StringView m_title; diff --git a/AK/MACAddress.h b/AK/MACAddress.h index cc4cac931cb..3a969748fd4 100644 --- a/AK/MACAddress.h +++ b/AK/MACAddress.h @@ -15,7 +15,7 @@ #ifdef KERNEL # include #else -# include +# include #endif class [[gnu::packed]] MACAddress { @@ -64,9 +64,9 @@ public: return Kernel::KString::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]); } #else - String to_string() const + DeprecatedString to_string() const { - return String::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]); + return DeprecatedString::formatted("{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}", m_data[0], m_data[1], m_data[2], m_data[3], m_data[4], m_data[5]); } #endif diff --git a/AK/NumberFormat.h b/AK/NumberFormat.h index 55dacc7c9f5..3267d6af225 100644 --- a/AK/NumberFormat.h +++ b/AK/NumberFormat.h @@ -6,21 +6,21 @@ #pragma once -#include +#include namespace AK { // FIXME: Remove this hackery once printf() supports floats. -static String number_string_with_one_decimal(u64 number, u64 unit, char const* suffix) +static DeprecatedString number_string_with_one_decimal(u64 number, u64 unit, char const* suffix) { int decimal = (number % unit) * 10 / unit; - return String::formatted("{}.{} {}", number / unit, decimal, suffix); + return DeprecatedString::formatted("{}.{} {}", number / unit, decimal, suffix); } -static inline String human_readable_size(u64 size) +static inline DeprecatedString human_readable_size(u64 size) { if (size < 1 * KiB) - return String::formatted("{} B", size); + return DeprecatedString::formatted("{} B", size); if (size < 1 * MiB) return number_string_with_one_decimal(size, KiB, "KiB"); if (size < 1 * GiB) @@ -34,15 +34,15 @@ static inline String human_readable_size(u64 size) return number_string_with_one_decimal(size, EiB, "EiB"); } -static inline String human_readable_size_long(u64 size) +static inline DeprecatedString human_readable_size_long(u64 size) { if (size < 1 * KiB) - return String::formatted("{} bytes", size); + return DeprecatedString::formatted("{} bytes", size); else - return String::formatted("{} ({} bytes)", human_readable_size(size), size); + return DeprecatedString::formatted("{} ({} bytes)", human_readable_size(size), size); } -static inline String human_readable_time(i64 time_in_seconds) +static inline DeprecatedString human_readable_time(i64 time_in_seconds) { auto hours = time_in_seconds / 3600; time_in_seconds = time_in_seconds % 3600; @@ -63,7 +63,7 @@ static inline String human_readable_time(i64 time_in_seconds) return builder.to_string(); } -static inline String human_readable_digital_time(i64 time_in_seconds) +static inline DeprecatedString human_readable_digital_time(i64 time_in_seconds) { auto hours = time_in_seconds / 3600; time_in_seconds = time_in_seconds % 3600; diff --git a/AK/ReverseIterator.h b/AK/ReverseIterator.h index 04e0fc3defa..5aa0e714c39 100644 --- a/AK/ReverseIterator.h +++ b/AK/ReverseIterator.h @@ -66,7 +66,7 @@ private: static constexpr SimpleReverseIterator rbegin(Container& container) { using RawContainerType = RemoveCV; - if constexpr (IsSame || IsSame) + if constexpr (IsSame || IsSame) return { container, static_cast(container.length()) - 1 }; else return { container, static_cast(container.size()) - 1 }; diff --git a/AK/ScopeLogger.h b/AK/ScopeLogger.h index e6be2db10fc..3161e5b4089 100644 --- a/AK/ScopeLogger.h +++ b/AK/ScopeLogger.h @@ -7,8 +7,8 @@ #pragma once +#include #include -#include #include namespace AK { @@ -50,7 +50,7 @@ public: private: static inline size_t m_depth = 0; SourceLocation m_location; - String m_extra; + DeprecatedString m_extra; }; template<> diff --git a/AK/SourceGenerator.h b/AK/SourceGenerator.h index 1d2cb278165..0341bcdadb1 100644 --- a/AK/SourceGenerator.h +++ b/AK/SourceGenerator.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include namespace AK { @@ -17,7 +17,7 @@ class SourceGenerator { AK_MAKE_NONCOPYABLE(SourceGenerator); public: - using MappingType = HashMap; + using MappingType = HashMap; explicit SourceGenerator(StringBuilder& builder, char opening = '@', char closing = '@') : m_builder(builder) @@ -37,7 +37,7 @@ public: SourceGenerator fork() { return SourceGenerator { m_builder, m_mapping, m_opening, m_closing }; } - void set(StringView key, String value) + void set(StringView key, DeprecatedString value) { if (key.contains(m_opening) || key.contains(m_closing)) { warnln("SourceGenerator keys cannot contain the opening/closing delimiters `{}` and `{}`. (Keys are only wrapped in these when using them, not when setting them.)", m_opening, m_closing); @@ -46,7 +46,7 @@ public: m_mapping.set(key, move(value)); } - String get(StringView key) const + DeprecatedString get(StringView key) const { auto result = m_mapping.get(key); if (!result.has_value()) { @@ -57,7 +57,7 @@ public: } StringView as_string_view() const { return m_builder.string_view(); } - String as_string() const { return m_builder.build(); } + DeprecatedString as_string() const { return m_builder.build(); } void append(StringView pattern) { @@ -92,13 +92,13 @@ public: } template - String get(char const (&key)[N]) + DeprecatedString get(char const (&key)[N]) { return get(StringView { key, N - 1 }); } template - void set(char const (&key)[N], String value) + void set(char const (&key)[N], DeprecatedString value) { set(StringView { key, N - 1 }, value); } diff --git a/AK/StringBuilder.cpp b/AK/StringBuilder.cpp index 203eb28112e..b0c0e95edd5 100644 --- a/AK/StringBuilder.cpp +++ b/AK/StringBuilder.cpp @@ -14,7 +14,7 @@ #include #ifndef KERNEL -# include +# include # include #endif @@ -104,14 +104,14 @@ ByteBuffer StringBuilder::to_byte_buffer() const } #ifndef KERNEL -String StringBuilder::to_string() const +DeprecatedString StringBuilder::to_string() const { if (is_empty()) - return String::empty(); - return String((char const*)data(), length()); + return DeprecatedString::empty(); + return DeprecatedString((char const*)data(), length()); } -String StringBuilder::build() const +DeprecatedString StringBuilder::build() const { return to_string(); } diff --git a/AK/StringBuilder.h b/AK/StringBuilder.h index 0d5d69e969c..73e86a68156 100644 --- a/AK/StringBuilder.h +++ b/AK/StringBuilder.h @@ -16,7 +16,7 @@ namespace AK { class StringBuilder { public: - using OutputType = String; + using OutputType = DeprecatedString; explicit StringBuilder(size_t initial_capacity = inline_capacity); ~StringBuilder() = default; @@ -60,8 +60,8 @@ public: } #ifndef KERNEL - [[nodiscard]] String build() const; - [[nodiscard]] String to_string() const; + [[nodiscard]] DeprecatedString build() const; + [[nodiscard]] DeprecatedString to_string() const; #endif [[nodiscard]] ByteBuffer to_byte_buffer() const; diff --git a/AK/StringUtils.cpp b/AK/StringUtils.cpp index 28d4a6b0446..fea26be6b61 100644 --- a/AK/StringUtils.cpp +++ b/AK/StringUtils.cpp @@ -15,8 +15,8 @@ #include #ifndef KERNEL +# include # include -# include #endif namespace AK { @@ -450,7 +450,7 @@ Optional find_any_of(StringView haystack, StringView needles, SearchDire } #ifndef KERNEL -String to_snakecase(StringView str) +DeprecatedString to_snakecase(StringView str) { auto should_insert_underscore = [&](auto i, auto current_char) { if (i == 0) @@ -476,7 +476,7 @@ String to_snakecase(StringView str) return builder.to_string(); } -String to_titlecase(StringView str) +DeprecatedString to_titlecase(StringView str) { StringBuilder builder; bool next_is_upper = true; @@ -492,7 +492,7 @@ String to_titlecase(StringView str) return builder.to_string(); } -String invert_case(StringView str) +DeprecatedString invert_case(StringView str) { StringBuilder builder(str.length()); @@ -506,7 +506,7 @@ String invert_case(StringView str) return builder.to_string(); } -String replace(StringView str, StringView needle, StringView replacement, ReplaceMode replace_mode) +DeprecatedString replace(StringView str, StringView needle, StringView replacement, ReplaceMode replace_mode) { if (str.is_empty()) return str; diff --git a/AK/StringUtils.h b/AK/StringUtils.h index 8912e753ca5..a5313803237 100644 --- a/AK/StringUtils.h +++ b/AK/StringUtils.h @@ -98,11 +98,11 @@ enum class SearchDirection { }; Optional find_any_of(StringView haystack, StringView needles, SearchDirection); -String to_snakecase(StringView); -String to_titlecase(StringView); -String invert_case(StringView); +DeprecatedString to_snakecase(StringView); +DeprecatedString to_titlecase(StringView); +DeprecatedString invert_case(StringView); -String replace(StringView, StringView needle, StringView replacement, ReplaceMode); +DeprecatedString replace(StringView, StringView needle, StringView replacement, ReplaceMode); size_t count(StringView, StringView needle); } diff --git a/AK/StringView.cpp b/AK/StringView.cpp index 3840e7c7f5a..d7bf7e41d96 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -14,14 +14,14 @@ #include #ifndef KERNEL +# include # include -# include #endif namespace AK { #ifndef KERNEL -StringView::StringView(String const& string) +StringView::StringView(DeprecatedString const& string) : m_characters(string.characters()) , m_length(string.length()) { @@ -163,17 +163,17 @@ bool StringView::equals_ignoring_case(StringView other) const } #ifndef KERNEL -String StringView::to_lowercase_string() const +DeprecatedString StringView::to_lowercase_string() const { return StringImpl::create_lowercased(characters_without_null_termination(), length()); } -String StringView::to_uppercase_string() const +DeprecatedString StringView::to_uppercase_string() const { return StringImpl::create_uppercased(characters_without_null_termination(), length()); } -String StringView::to_titlecase_string() const +DeprecatedString StringView::to_titlecase_string() const { return StringUtils::to_titlecase(*this); } @@ -246,14 +246,14 @@ Optional StringView::to_float(TrimWhitespace trim_whitespace) const return StringUtils::convert_to_floating_point(*this, trim_whitespace); } -bool StringView::operator==(String const& string) const +bool StringView::operator==(DeprecatedString const& string) const { return *this == string.view(); } -String StringView::to_string() const { return String { *this }; } +DeprecatedString StringView::to_string() const { return DeprecatedString { *this }; } -String StringView::replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const +DeprecatedString StringView::replace(StringView needle, StringView replacement, ReplaceMode replace_mode) const { return StringUtils::replace(*this, needle, replacement, replace_mode); } diff --git a/AK/StringView.h b/AK/StringView.h index 3ae526ab505..dfd07d01434 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -42,13 +42,13 @@ public: StringView(ByteBuffer const&); #ifndef KERNEL - StringView(String const&); + StringView(DeprecatedString const&); StringView(FlyString const&); #endif explicit StringView(ByteBuffer&&) = delete; #ifndef KERNEL - explicit StringView(String&&) = delete; + explicit StringView(DeprecatedString&&) = delete; explicit StringView(FlyString&&) = delete; #endif @@ -97,9 +97,9 @@ public: [[nodiscard]] StringView trim_whitespace(TrimMode mode = TrimMode::Both) const { return StringUtils::trim_whitespace(*this, mode); } #ifndef KERNEL - [[nodiscard]] String to_lowercase_string() const; - [[nodiscard]] String to_uppercase_string() const; - [[nodiscard]] String to_titlecase_string() const; + [[nodiscard]] DeprecatedString to_lowercase_string() const; + [[nodiscard]] DeprecatedString to_uppercase_string() const; + [[nodiscard]] DeprecatedString to_titlecase_string() const; #endif [[nodiscard]] Optional find(char needle, size_t start = 0) const @@ -246,7 +246,7 @@ public: } #ifndef KERNEL - bool operator==(String const&) const; + bool operator==(DeprecatedString const&) const; #endif [[nodiscard]] constexpr int compare(StringView other) const @@ -288,7 +288,7 @@ public: constexpr bool operator>=(StringView other) const { return compare(other) >= 0; } #ifndef KERNEL - [[nodiscard]] String to_string() const; + [[nodiscard]] DeprecatedString to_string() const; #endif [[nodiscard]] bool is_whitespace() const @@ -297,7 +297,7 @@ public: } #ifndef KERNEL - [[nodiscard]] String replace(StringView needle, StringView replacement, ReplaceMode) const; + [[nodiscard]] DeprecatedString replace(StringView needle, StringView replacement, ReplaceMode) const; #endif [[nodiscard]] size_t count(StringView needle) const { @@ -323,7 +323,7 @@ public: } private: - friend class String; + friend class DeprecatedString; char const* m_characters { nullptr }; size_t m_length { 0 }; }; diff --git a/AK/URL.cpp b/AK/URL.cpp index 610acdf7448..115a5914cb9 100644 --- a/AK/URL.cpp +++ b/AK/URL.cpp @@ -27,7 +27,7 @@ URL::URL(StringView string) } } -String URL::path() const +DeprecatedString URL::path() const { if (cannot_be_a_base_url()) return paths()[0]; @@ -39,7 +39,7 @@ String URL::path() const return builder.to_string(); } -URL URL::complete_url(String const& string) const +URL URL::complete_url(DeprecatedString const& string) const { if (!is_valid()) return {}; @@ -47,25 +47,25 @@ URL URL::complete_url(String const& string) const return URLParser::parse(string, this); } -void URL::set_scheme(String scheme) +void URL::set_scheme(DeprecatedString scheme) { m_scheme = move(scheme); m_valid = compute_validity(); } -void URL::set_username(String username) +void URL::set_username(DeprecatedString username) { m_username = move(username); m_valid = compute_validity(); } -void URL::set_password(String password) +void URL::set_password(DeprecatedString password) { m_password = move(password); m_valid = compute_validity(); } -void URL::set_host(String host) +void URL::set_host(DeprecatedString host) { m_host = move(host); m_valid = compute_validity(); @@ -81,18 +81,18 @@ void URL::set_port(Optional port) m_valid = compute_validity(); } -void URL::set_paths(Vector paths) +void URL::set_paths(Vector paths) { m_paths = move(paths); m_valid = compute_validity(); } -void URL::set_query(String query) +void URL::set_query(DeprecatedString query) { m_query = move(query); } -void URL::set_fragment(String fragment) +void URL::set_fragment(DeprecatedString fragment) { m_fragment = move(fragment); } @@ -159,7 +159,7 @@ u16 URL::default_port_for_scheme(StringView scheme) return 0; } -URL URL::create_with_file_scheme(String const& path, String const& fragment, String const& hostname) +URL URL::create_with_file_scheme(DeprecatedString const& path, DeprecatedString const& fragment, DeprecatedString const& hostname) { LexicalPath lexical_path(path); if (!lexical_path.is_absolute()) @@ -169,7 +169,7 @@ URL URL::create_with_file_scheme(String const& path, String const& fragment, Str url.set_scheme("file"); // NOTE: If the hostname is localhost (or null, which implies localhost), it should be set to the empty string. // This is because a file URL always needs a non-null hostname. - url.set_host(hostname.is_null() || hostname == "localhost" ? String::empty() : hostname); + url.set_host(hostname.is_null() || hostname == "localhost" ? DeprecatedString::empty() : hostname); url.set_paths(lexical_path.parts()); // NOTE: To indicate that we want to end the path with a slash, we have to append an empty path segment. if (path.ends_with('/')) @@ -178,7 +178,7 @@ URL URL::create_with_file_scheme(String const& path, String const& fragment, Str return url; } -URL URL::create_with_help_scheme(String const& path, String const& fragment, String const& hostname) +URL URL::create_with_help_scheme(DeprecatedString const& path, DeprecatedString const& fragment, DeprecatedString const& hostname) { LexicalPath lexical_path(path); @@ -186,7 +186,7 @@ URL URL::create_with_help_scheme(String const& path, String const& fragment, Str url.set_scheme("help"); // NOTE: If the hostname is localhost (or null, which implies localhost), it should be set to the empty string. // This is because a file URL always needs a non-null hostname. - url.set_host(hostname.is_null() || hostname == "localhost" ? String::empty() : hostname); + url.set_host(hostname.is_null() || hostname == "localhost" ? DeprecatedString::empty() : hostname); url.set_paths(lexical_path.parts()); // NOTE: To indicate that we want to end the path with a slash, we have to append an empty path segment. if (path.ends_with('/')) @@ -195,13 +195,13 @@ URL URL::create_with_help_scheme(String const& path, String const& fragment, Str return url; } -URL URL::create_with_url_or_path(String const& url_or_path) +URL URL::create_with_url_or_path(DeprecatedString const& url_or_path) { URL url = url_or_path; if (url.is_valid()) return url; - String path = LexicalPath::canonicalized_path(url_or_path); + DeprecatedString path = LexicalPath::canonicalized_path(url_or_path); return URL::create_with_file_scheme(path); } @@ -211,7 +211,7 @@ bool URL::is_special_scheme(StringView scheme) return scheme.is_one_of("ftp", "file", "http", "https", "ws", "wss"); } -String URL::serialize_data_url() const +DeprecatedString URL::serialize_data_url() const { VERIFY(m_scheme == "data"); VERIFY(!m_data_mime_type.is_null()); @@ -230,7 +230,7 @@ String URL::serialize_data_url() const } // https://url.spec.whatwg.org/#concept-url-serializer -String URL::serialize(ExcludeFragment exclude_fragment) const +DeprecatedString URL::serialize(ExcludeFragment exclude_fragment) const { if (m_scheme == "data") return serialize_data_url(); @@ -283,7 +283,7 @@ String URL::serialize(ExcludeFragment exclude_fragment) const // NOTE: This does e.g. not display credentials. // FIXME: Parts of the URL other than the host should have their sequences of percent-encoded bytes replaced with code points // resulting from percent-decoding those sequences converted to bytes, unless that renders those sequences invisible. -String URL::serialize_for_display() const +DeprecatedString URL::serialize_for_display() const { VERIFY(m_valid); if (m_scheme == "data") @@ -325,7 +325,7 @@ String URL::serialize_for_display() const // https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin // https://url.spec.whatwg.org/#concept-url-origin -String URL::serialize_origin() const +DeprecatedString URL::serialize_origin() const { VERIFY(m_valid); @@ -360,7 +360,7 @@ bool URL::equals(URL const& other, ExcludeFragment exclude_fragments) const return serialize(exclude_fragments) == other.serialize(exclude_fragments); } -String URL::basename() const +DeprecatedString URL::basename() const { if (!m_valid) return {}; @@ -420,7 +420,7 @@ void URL::append_percent_encoded_if_necessary(StringBuilder& builder, u32 code_p builder.append_code_point(code_point); } -String URL::percent_encode(StringView input, URL::PercentEncodeSet set, SpaceAsPlus space_as_plus) +DeprecatedString URL::percent_encode(StringView input, URL::PercentEncodeSet set, SpaceAsPlus space_as_plus) { StringBuilder builder; for (auto code_point : Utf8View(input)) { @@ -432,7 +432,7 @@ String URL::percent_encode(StringView input, URL::PercentEncodeSet set, SpaceAsP return builder.to_string(); } -String URL::percent_decode(StringView input) +DeprecatedString URL::percent_decode(StringView input) { if (!input.contains('%')) return input; diff --git a/AK/URL.h b/AK/URL.h index 31244bf17c2..31a069809b4 100644 --- a/AK/URL.h +++ b/AK/URL.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -43,20 +43,20 @@ public: URL() = default; URL(StringView); - URL(String const& string) + URL(DeprecatedString const& string) : URL(string.view()) { } bool is_valid() const { return m_valid; } - String const& scheme() const { return m_scheme; } - String const& username() const { return m_username; } - String const& password() const { return m_password; } - String const& host() const { return m_host; } - Vector const& paths() const { return m_paths; } - String const& query() const { return m_query; } - String const& fragment() const { return m_fragment; } + DeprecatedString const& scheme() const { return m_scheme; } + DeprecatedString const& username() const { return m_username; } + DeprecatedString const& password() const { return m_password; } + DeprecatedString const& host() const { return m_host; } + Vector const& paths() const { return m_paths; } + DeprecatedString const& query() const { return m_query; } + DeprecatedString const& fragment() const { return m_fragment; } Optional port() const { return m_port; } u16 port_or_default() const { return m_port.value_or(default_port_for_scheme(m_scheme)); } bool cannot_be_a_base_url() const { return m_cannot_be_a_base_url; } @@ -65,39 +65,39 @@ public: bool includes_credentials() const { return !m_username.is_empty() || !m_password.is_empty(); } bool is_special() const { return is_special_scheme(m_scheme); } - void set_scheme(String); - void set_username(String); - void set_password(String); - void set_host(String); + void set_scheme(DeprecatedString); + void set_username(DeprecatedString); + void set_password(DeprecatedString); + void set_host(DeprecatedString); void set_port(Optional); - void set_paths(Vector); - void set_query(String); - void set_fragment(String); + void set_paths(Vector); + void set_query(DeprecatedString); + void set_fragment(DeprecatedString); void set_cannot_be_a_base_url(bool value) { m_cannot_be_a_base_url = value; } - void append_path(String path) { m_paths.append(move(path)); } + void append_path(DeprecatedString path) { m_paths.append(move(path)); } - String path() const; - String basename() const; + DeprecatedString path() const; + DeprecatedString basename() const; - String serialize(ExcludeFragment = ExcludeFragment::No) const; - String serialize_for_display() const; - String to_string() const { return serialize(); } + DeprecatedString serialize(ExcludeFragment = ExcludeFragment::No) const; + DeprecatedString serialize_for_display() const; + DeprecatedString to_string() const { return serialize(); } // HTML origin - String serialize_origin() const; + DeprecatedString serialize_origin() const; bool equals(URL const& other, ExcludeFragment = ExcludeFragment::No) const; - URL complete_url(String const&) const; + URL complete_url(DeprecatedString const&) const; bool data_payload_is_base64() const { return m_data_payload_is_base64; } - String const& data_mime_type() const { return m_data_mime_type; } - String const& data_payload() const { return m_data_payload; } + DeprecatedString const& data_mime_type() const { return m_data_mime_type; } + DeprecatedString const& data_payload() const { return m_data_payload; } - static URL create_with_url_or_path(String const&); - static URL create_with_file_scheme(String const& path, String const& fragment = {}, String const& hostname = {}); - static URL create_with_help_scheme(String const& path, String const& fragment = {}, String const& hostname = {}); - static URL create_with_data(String mime_type, String payload, bool is_base64 = false) { return URL(move(mime_type), move(payload), is_base64); }; + static URL create_with_url_or_path(DeprecatedString const&); + static URL create_with_file_scheme(DeprecatedString const& path, DeprecatedString const& fragment = {}, DeprecatedString const& hostname = {}); + static URL create_with_help_scheme(DeprecatedString const& path, DeprecatedString const& fragment = {}, DeprecatedString const& hostname = {}); + static URL create_with_data(DeprecatedString mime_type, DeprecatedString payload, bool is_base64 = false) { return URL(move(mime_type), move(payload), is_base64); }; static bool scheme_requires_port(StringView); static u16 default_port_for_scheme(StringView); @@ -107,15 +107,15 @@ public: No, Yes, }; - static String percent_encode(StringView input, PercentEncodeSet set = PercentEncodeSet::Userinfo, SpaceAsPlus = SpaceAsPlus::No); - static String percent_decode(StringView input); + static DeprecatedString percent_encode(StringView input, PercentEncodeSet set = PercentEncodeSet::Userinfo, SpaceAsPlus = SpaceAsPlus::No); + static DeprecatedString percent_decode(StringView input); bool operator==(URL const& other) const { return equals(other, ExcludeFragment::No); } static bool code_point_is_in_percent_encode_set(u32 code_point, URL::PercentEncodeSet); private: - URL(String&& data_mime_type, String&& data_payload, bool payload_is_base64) + URL(DeprecatedString&& data_mime_type, DeprecatedString&& data_payload, bool payload_is_base64) : m_valid(true) , m_scheme("data") , m_data_payload_is_base64(payload_is_base64) @@ -125,29 +125,29 @@ private: } bool compute_validity() const; - String serialize_data_url() const; + DeprecatedString serialize_data_url() const; static void append_percent_encoded_if_necessary(StringBuilder&, u32 code_point, PercentEncodeSet set = PercentEncodeSet::Userinfo); static void append_percent_encoded(StringBuilder&, u32 code_point); bool m_valid { false }; - String m_scheme; - String m_username; - String m_password; - String m_host; + DeprecatedString m_scheme; + DeprecatedString m_username; + DeprecatedString m_password; + DeprecatedString m_host; // NOTE: If the port is the default port for the scheme, m_port should be empty. Optional m_port; - String m_path; - Vector m_paths; - String m_query; - String m_fragment; + DeprecatedString m_path; + Vector m_paths; + DeprecatedString m_query; + DeprecatedString m_fragment; bool m_cannot_be_a_base_url { false }; bool m_data_payload_is_base64 { false }; - String m_data_mime_type; - String m_data_payload; + DeprecatedString m_data_mime_type; + DeprecatedString m_data_payload; }; template<> diff --git a/AK/URLParser.cpp b/AK/URLParser.cpp index eeca9d23df9..f618f322556 100644 --- a/AK/URLParser.cpp +++ b/AK/URLParser.cpp @@ -6,9 +6,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -30,7 +30,7 @@ static void report_validation_error(SourceLocation const& location = SourceLocat dbgln_if(URL_PARSER_DEBUG, "URLParser::parse: Validation error! {}", location); } -static Optional parse_opaque_host(StringView input) +static Optional parse_opaque_host(StringView input) { auto forbidden_host_characters_excluding_percent = "\0\t\n\r #/:<>?@[\\]^|"sv; for (auto character : forbidden_host_characters_excluding_percent) { @@ -44,7 +44,7 @@ static Optional parse_opaque_host(StringView input) return URL::percent_encode(input, URL::PercentEncodeSet::C0Control); } -static Optional parse_ipv4_address(StringView input) +static Optional parse_ipv4_address(StringView input) { // FIXME: Implement the correct IPv4 parser as specified by https://url.spec.whatwg.org/#concept-ipv4-parser. return input; @@ -52,7 +52,7 @@ static Optional parse_ipv4_address(StringView input) // https://url.spec.whatwg.org/#concept-host-parser // NOTE: This is a very bare-bones implementation. -static Optional parse_host(StringView input, bool is_not_special = false) +static Optional parse_host(StringView input, bool is_not_special = false) { if (input.starts_with('[')) { if (!input.ends_with(']')) { @@ -117,7 +117,7 @@ constexpr bool is_double_dot_path_segment(StringView input) } // https://url.spec.whatwg.org/#string-percent-encode-after-encoding -static String percent_encode_after_encoding(StringView input, URL::PercentEncodeSet percent_encode_set, bool space_as_plus = false) +static DeprecatedString percent_encode_after_encoding(StringView input, URL::PercentEncodeSet percent_encode_set, bool space_as_plus = false) { // NOTE: This is written somewhat ad-hoc since we don't yet implement the Encoding spec. @@ -241,7 +241,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional ur if (start_index >= end_index) return {}; - String processed_input = raw_input.substring_view(start_index, end_index - start_index); + DeprecatedString processed_input = raw_input.substring_view(start_index, end_index - start_index); // NOTE: This replaces all tab and newline characters with nothing. if (processed_input.contains("\t"sv) || processed_input.contains("\n"sv)) { diff --git a/AK/UUID.cpp b/AK/UUID.cpp index 72ca62ddafe..7394b797fe0 100644 --- a/AK/UUID.cpp +++ b/AK/UUID.cpp @@ -97,7 +97,7 @@ ErrorOr> UUID::to_string() const return Kernel::KString::try_create(builder.string_view()); } #else -String UUID::to_string() const +DeprecatedString UUID::to_string() const { StringBuilder builder(36); builder.append(encode_hex(m_uuid_buffer.span().trim(4)).view()); diff --git a/AK/UUID.h b/AK/UUID.h index 924909ac7f2..bd863fcb5ce 100644 --- a/AK/UUID.h +++ b/AK/UUID.h @@ -14,7 +14,7 @@ #ifdef KERNEL # include #else -# include +# include #endif namespace AK { @@ -36,7 +36,7 @@ public: #ifdef KERNEL ErrorOr> to_string() const; #else - String to_string() const; + DeprecatedString to_string() const; #endif bool is_zero() const; diff --git a/AK/Utf16View.cpp b/AK/Utf16View.cpp index 6d492edbda1..747417a61ff 100644 --- a/AK/Utf16View.cpp +++ b/AK/Utf16View.cpp @@ -79,7 +79,7 @@ u32 Utf16View::decode_surrogate_pair(u16 high_surrogate, u16 low_surrogate) return ((high_surrogate - high_surrogate_min) << 10) + (low_surrogate - low_surrogate_min) + first_supplementary_plane_code_point; } -String Utf16View::to_utf8(AllowInvalidCodeUnits allow_invalid_code_units) const +DeprecatedString Utf16View::to_utf8(AllowInvalidCodeUnits allow_invalid_code_units) const { StringBuilder builder; diff --git a/AK/Utf16View.h b/AK/Utf16View.h index 2319fd77939..1c8c0d76dbc 100644 --- a/AK/Utf16View.h +++ b/AK/Utf16View.h @@ -6,11 +6,11 @@ #pragma once +#include #include #include #include #include -#include #include #include @@ -72,7 +72,7 @@ public: No, }; - String to_utf8(AllowInvalidCodeUnits = AllowInvalidCodeUnits::No) const; + DeprecatedString to_utf8(AllowInvalidCodeUnits = AllowInvalidCodeUnits::No) const; bool is_null() const { return m_code_units.is_null(); } bool is_empty() const { return m_code_units.is_empty(); } diff --git a/AK/Utf8View.h b/AK/Utf8View.h index aa6722b92cb..3da4de526b6 100644 --- a/AK/Utf8View.h +++ b/AK/Utf8View.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -60,7 +60,7 @@ public: Utf8View() = default; - explicit Utf8View(String& string) + explicit Utf8View(DeprecatedString& string) : m_string(string.view()) { } @@ -72,7 +72,7 @@ public: ~Utf8View() = default; - explicit Utf8View(String&&) = delete; + explicit Utf8View(DeprecatedString&&) = delete; StringView as_string() const { return m_string; } diff --git a/Base/usr/share/man/man5/clipboard.md b/Base/usr/share/man/man5/clipboard.md index 80056e03d99..90d3ba0162e 100644 --- a/Base/usr/share/man/man5/clipboard.md +++ b/Base/usr/share/man/man5/clipboard.md @@ -5,17 +5,17 @@ clipboard - Data formats specific to Clipboard and drag & drop ## Clipboard The clipboard feature works through the Clipboard server, which generally acts as a global storage or three things: -- a `String` mime type, +- a `DeprecatedString` mime type, - a (potentially large) block of data, shared as an anonymous file, -- a `HashMap` of arbitrary metadata, depending on the mime type. +- a `HashMap` of arbitrary metadata, depending on the mime type. See also [`Userland/Libraries/LibGUI/Clipboard.h`](../../../../../Userland/Libraries/LibGUI/Clipboard.h). ## Drag & drop In contrast to the clipboard, the drag & drop feature works through WindowServer, and a bouquet of data is transmitted: -- a `[UTF8] String` to be displayed while dragging, -- a `HashMap` map that contains arbitrary data for a variety of possible mime types, +- a `[UTF8] DeprecatedString` to be displayed while dragging, +- a `HashMap` map that contains arbitrary data for a variety of possible mime types, - a `Gfx::ShareableBitmap` to be displayed while dragging Drag & drop is most prominently supported by File Manager, Spreadsheet, and Terminal. diff --git a/Base/usr/share/man/man5/ipc.md b/Base/usr/share/man/man5/ipc.md index 33163309e52..3df70a26ecf 100644 --- a/Base/usr/share/man/man5/ipc.md +++ b/Base/usr/share/man/man5/ipc.md @@ -31,7 +31,7 @@ Start from defining an endpoint in the IPC file in `MyServer.ipc`. ``` endpoint MyServer { - SyncAPI(String text) => (i32 status) + SyncAPI(DeprecatedString text) => (i32 status) AsyncAPI(i32 mode) =| } ``` @@ -42,7 +42,7 @@ Part of the generated C++ messages: class SyncAPI final : public IPC::Message { public: using ResponseType = SyncAPIResponse; - SyncAPI(const String& text) : m_text(text) {} + SyncAPI(const DeprecatedString& text) : m_text(text) {} virtual ~SyncAPI() override {} static OwnPtr decode(...); virtual IPC::MessageBuffer encode(...) const override; diff --git a/Documentation/StringFormatting.md b/Documentation/StringFormatting.md index 9b7598f8470..33f6265f50f 100644 --- a/Documentation/StringFormatting.md +++ b/Documentation/StringFormatting.md @@ -1,6 +1,6 @@ # String Formatting -Many places in Serenity allow you to format strings, similar to `printf()`, for example `String::formatted()` +Many places in Serenity allow you to format strings, similar to `printf()`, for example `DeprecatedString::formatted()` , `StringBuilder::appendff()`, or `dbgln()`. These are checked at compile time to ensure the format string matches the number of parameters. The syntax is largely based on the [C++ `std::formatter` syntax](https://en.cppreference.com/w/cpp/utility/format/formatter#Standard_format_specification) @@ -10,27 +10,27 @@ For basic usage, any occurrences of `{}` in the format string are replaced with form, in order: ```c++ -String::formatted("Well, {} my {} friends!", "hello", 42) == "Well, hello my 42 friends!"; +DeprecatedString::formatted("Well, {} my {} friends!", "hello", 42) == "Well, hello my 42 friends!"; ``` If you want to include a literal `{` in the output, use `{{`: ```c++ -String::formatted("{{ {}", "hello") == "{ hello"; +DeprecatedString::formatted("{{ {}", "hello") == "{ hello"; ``` You can refer to the arguments by index, if you want to repeat one or change the order: ```c++ -String::formatted("{2}{0}{1}", "a", "b", "c") == "cab"; +DeprecatedString::formatted("{2}{0}{1}", "a", "b", "c") == "cab"; ``` To control how the arguments are formatted, add colon after the optional index, and then add format specifier characters: ```c++ -String::formatted("{:.4}", "cool dude") == "cool"; -String::formatted("{0:.4}", "cool dude") == "cool"; +DeprecatedString::formatted("{:.4}", "cool dude") == "cool"; +DeprecatedString::formatted("{0:.4}", "cool dude") == "cool"; ``` ## Format specifiers @@ -135,6 +135,6 @@ type cannot be formatted. For example: ```c++ // B has a Formatter defined, but A does not. -String::formatted("{}", FormatIfSupported { A {} }) == "?"; -String::formatted("{}", FormatIfSupported { B {} }) == "B"; +DeprecatedString::formatted("{}", FormatIfSupported { A {} }) == "?"; +DeprecatedString::formatted("{}", FormatIfSupported { B {} }) == "B"; ``` diff --git a/Kernel/API/Graphics.h b/Kernel/API/Graphics.h index 50cd983a481..e5eb843b79f 100644 --- a/Kernel/API/Graphics.h +++ b/Kernel/API/Graphics.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include #include #include @@ -34,7 +34,7 @@ ALWAYS_INLINE int graphics_connector_get_head_edid(int fd, GraphicsHeadEDID* inf } auto minor_number = minor(display_connector_stat.st_rdev); - auto edid_fd = open(String::formatted("/sys/devices/graphics/connectors/{}/edid", minor_number).characters(), O_RDONLY); + auto edid_fd = open(DeprecatedString::formatted("/sys/devices/graphics/connectors/{}/edid", minor_number).characters(), O_RDONLY); if (edid_fd < 0) { return edid_fd; } diff --git a/Meta/Lagom/Fuzzers/FuzzCyrillicDecoder.cpp b/Meta/Lagom/Fuzzers/FuzzCyrillicDecoder.cpp index e5160bde573..8bbd7cc83c6 100644 --- a/Meta/Lagom/Fuzzers/FuzzCyrillicDecoder.cpp +++ b/Meta/Lagom/Fuzzers/FuzzCyrillicDecoder.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include diff --git a/Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp b/Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp index f066f445ae1..f72354e19c0 100644 --- a/Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp +++ b/Meta/Lagom/Fuzzers/FuzzGIFLoader.cpp @@ -5,8 +5,8 @@ */ #include +#include #include -#include #include #include #include diff --git a/Meta/Lagom/Fuzzers/FuzzHebrewDecoder.cpp b/Meta/Lagom/Fuzzers/FuzzHebrewDecoder.cpp index 162dfd6a7c4..98e123df48f 100644 --- a/Meta/Lagom/Fuzzers/FuzzHebrewDecoder.cpp +++ b/Meta/Lagom/Fuzzers/FuzzHebrewDecoder.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include diff --git a/Meta/Lagom/Fuzzers/FuzzLatin1Decoder.cpp b/Meta/Lagom/Fuzzers/FuzzLatin1Decoder.cpp index fefe5d341d2..97733bbc7a4 100644 --- a/Meta/Lagom/Fuzzers/FuzzLatin1Decoder.cpp +++ b/Meta/Lagom/Fuzzers/FuzzLatin1Decoder.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include diff --git a/Meta/Lagom/Fuzzers/FuzzLatin2Decoder.cpp b/Meta/Lagom/Fuzzers/FuzzLatin2Decoder.cpp index 5bdf6c7af0f..3ff3e14cebe 100644 --- a/Meta/Lagom/Fuzzers/FuzzLatin2Decoder.cpp +++ b/Meta/Lagom/Fuzzers/FuzzLatin2Decoder.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include diff --git a/Meta/Lagom/Fuzzers/FuzzQuotedPrintableParser.cpp b/Meta/Lagom/Fuzzers/FuzzQuotedPrintableParser.cpp index ad85fcb9def..c1bf58c3720 100644 --- a/Meta/Lagom/Fuzzers/FuzzQuotedPrintableParser.cpp +++ b/Meta/Lagom/Fuzzers/FuzzQuotedPrintableParser.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include diff --git a/Meta/Lagom/Fuzzers/FuzzUTF16BEDecoder.cpp b/Meta/Lagom/Fuzzers/FuzzUTF16BEDecoder.cpp index d1e3cf43d55..f054e793d54 100644 --- a/Meta/Lagom/Fuzzers/FuzzUTF16BEDecoder.cpp +++ b/Meta/Lagom/Fuzzers/FuzzUTF16BEDecoder.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include diff --git a/Meta/Lagom/Fuzzers/FuzzilliJs.cpp b/Meta/Lagom/Fuzzers/FuzzilliJs.cpp index f55840bcac4..423484ad828 100644 --- a/Meta/Lagom/Fuzzers/FuzzilliJs.cpp +++ b/Meta/Lagom/Fuzzers/FuzzilliJs.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include -#include #include #include #include diff --git a/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp b/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp index 9eebb2f916d..32fb7b5c70c 100644 --- a/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/IPCCompiler/main.cpp @@ -16,12 +16,12 @@ #include struct Parameter { - Vector attributes; - String type; - String name; + Vector attributes; + DeprecatedString type; + DeprecatedString name; }; -static String pascal_case(String const& identifier) +static DeprecatedString pascal_case(DeprecatedString const& identifier) { StringBuilder builder; bool was_new_word = true; @@ -40,12 +40,12 @@ static String pascal_case(String const& identifier) } struct Message { - String name; + DeprecatedString name; bool is_synchronous { false }; Vector inputs; Vector outputs; - String response_name() const + DeprecatedString response_name() const { StringBuilder builder; builder.append(pascal_case(name)); @@ -55,18 +55,18 @@ struct Message { }; struct Endpoint { - Vector includes; - String name; + Vector includes; + DeprecatedString name; u32 magic; Vector messages; }; -static bool is_primitive_type(String const& type) +static bool is_primitive_type(DeprecatedString const& type) { return type.is_one_of("u8", "i8", "u16", "i16", "u32", "i32", "u64", "i64", "bool", "double", "float", "int", "unsigned", "unsigned int"); } -static String message_name(String const& endpoint, String const& message, bool is_response) +static DeprecatedString message_name(DeprecatedString const& endpoint, DeprecatedString const& message, bool is_response) { StringBuilder builder; builder.append("Messages::"sv); @@ -121,7 +121,7 @@ Vector parse(ByteBuffer const& file_contents) consume_whitespace(); } } - // FIXME: This is not entirely correct. Types can have spaces, for example `HashMap`. + // FIXME: This is not entirely correct. Types can have spaces, for example `HashMap`. // Maybe we should use LibCpp::Parser for parsing types. parameter.type = lexer.consume_until([](char ch) { return isspace(ch); }); VERIFY(!lexer.is_eof()); @@ -191,7 +191,7 @@ Vector parse(ByteBuffer const& file_contents) }; auto parse_include = [&] { - String include; + DeprecatedString include; consume_whitespace(); include = lexer.consume_while([](char ch) { return ch != '\n'; }); consume_whitespace(); @@ -217,7 +217,7 @@ Vector parse(ByteBuffer const& file_contents) lexer.consume_specific("endpoint"); consume_whitespace(); endpoints.last().name = lexer.consume_while([](char ch) { return !isspace(ch); }); - endpoints.last().magic = Traits::hash(endpoints.last().name); + endpoints.last().magic = Traits::hash(endpoints.last().name); consume_whitespace(); assert_specific('{'); parse_messages(); @@ -231,22 +231,22 @@ Vector parse(ByteBuffer const& file_contents) return endpoints; } -HashMap build_message_ids_for_endpoint(SourceGenerator generator, Endpoint const& endpoint) +HashMap build_message_ids_for_endpoint(SourceGenerator generator, Endpoint const& endpoint) { - HashMap message_ids; + HashMap message_ids; generator.appendln("\nenum class MessageID : i32 {"); for (auto const& message : endpoint.messages) { message_ids.set(message.name, message_ids.size() + 1); generator.set("message.pascal_name", pascal_case(message.name)); - generator.set("message.id", String::number(message_ids.size())); + generator.set("message.id", DeprecatedString::number(message_ids.size())); generator.appendln(" @message.pascal_name@ = @message.id@,"); if (message.is_synchronous) { message_ids.set(message.response_name(), message_ids.size() + 1); generator.set("message.pascal_name", pascal_case(message.response_name())); - generator.set("message.id", String::number(message_ids.size())); + generator.set("message.id", DeprecatedString::number(message_ids.size())); generator.appendln(" @message.pascal_name@ = @message.id@,"); } @@ -255,7 +255,7 @@ HashMap build_message_ids_for_endpoint(SourceGenerator generator, E return message_ids; } -String constructor_for_message(String const& name, Vector const& parameters) +DeprecatedString constructor_for_message(DeprecatedString const& name, Vector const& parameters) { StringBuilder builder; builder.append(name); @@ -282,7 +282,7 @@ String constructor_for_message(String const& name, Vector const& para return builder.to_string(); } -void do_message(SourceGenerator message_generator, String const& name, Vector const& parameters, String const& response_type = {}) +void do_message(SourceGenerator message_generator, DeprecatedString const& name, Vector const& parameters, DeprecatedString const& response_type = {}) { auto pascal_name = pascal_case(name); message_generator.set("message.name", name); @@ -418,17 +418,17 @@ private: void do_message_for_proxy(SourceGenerator message_generator, Endpoint const& endpoint, Message const& message) { - auto do_implement_proxy = [&](String const& name, Vector const& parameters, bool is_synchronous, bool is_try) { - String return_type = "void"; + auto do_implement_proxy = [&](DeprecatedString const& name, Vector const& parameters, bool is_synchronous, bool is_try) { + DeprecatedString return_type = "void"; if (is_synchronous) { if (message.outputs.size() == 1) return_type = message.outputs[0].type; else if (!message.outputs.is_empty()) return_type = message_name(endpoint.name, message.name, true); } - String inner_return_type = return_type; + DeprecatedString inner_return_type = return_type; if (is_try) - return_type = String::formatted("IPC::IPCErrorOr<{}>", return_type); + return_type = DeprecatedString::formatted("IPC::IPCErrorOr<{}>", return_type); message_generator.set("message.name", message.name); message_generator.set("message.pascal_name", pascal_case(message.name)); @@ -527,14 +527,14 @@ void do_message_for_proxy(SourceGenerator message_generator, Endpoint const& end void build_endpoint(SourceGenerator generator, Endpoint const& endpoint) { generator.set("endpoint.name", endpoint.name); - generator.set("endpoint.magic", String::number(endpoint.magic)); + generator.set("endpoint.magic", DeprecatedString::number(endpoint.magic)); generator.appendln("\nnamespace Messages::@endpoint.name@ {"); - HashMap message_ids = build_message_ids_for_endpoint(generator.fork(), endpoint); + HashMap message_ids = build_message_ids_for_endpoint(generator.fork(), endpoint); for (auto const& message : endpoint.messages) { - String response_name; + DeprecatedString response_name; if (message.is_synchronous) { response_name = message.response_name(); do_message(generator.fork(), response_name, message.outputs); @@ -614,7 +614,7 @@ public: switch (message_id) {)~~~"); for (auto const& message : endpoint.messages) { - auto do_decode_message = [&](String const& name) { + auto do_decode_message = [&](DeprecatedString const& name) { auto message_generator = generator.fork(); message_generator.set("message.name", name); @@ -661,13 +661,13 @@ public: virtual ~@endpoint.name@Stub() override { } virtual u32 magic() const override { return @endpoint.magic@; } - virtual String name() const override { return "@endpoint.name@"; } + virtual DeprecatedString name() const override { return "@endpoint.name@"; } virtual OwnPtr handle(const IPC::Message& message) override { switch (message.message_id()) {)~~~"); for (auto const& message : endpoint.messages) { - auto do_handle_message = [&](String const& name, Vector const& parameters, bool returns_something) { + auto do_handle_message = [&](DeprecatedString const& name, Vector const& parameters, bool returns_something) { auto message_generator = generator.fork(); StringBuilder argument_generator; @@ -721,8 +721,8 @@ public: for (auto const& message : endpoint.messages) { auto message_generator = generator.fork(); - auto do_handle_message_decl = [&](String const& name, Vector const& parameters, bool is_response) { - String return_type = "void"; + auto do_handle_message_decl = [&](DeprecatedString const& name, Vector const& parameters, bool is_response) { + DeprecatedString return_type = "void"; if (message.is_synchronous && !message.outputs.is_empty() && !is_response) return_type = message_name(endpoint.name, message.name, true); message_generator.set("message.complex_return_type", return_type); @@ -731,7 +731,7 @@ public: message_generator.appendln(R"~~~( virtual @message.complex_return_type@ @handler_name@()~~~"); - auto make_argument_type = [](String const& type) { + auto make_argument_type = [](DeprecatedString const& type) { StringBuilder builder; bool const_ref = !is_primitive_type(type); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibEDID/GeneratePnpIDs.cpp b/Meta/Lagom/Tools/CodeGenerators/LibEDID/GeneratePnpIDs.cpp index aab3df4ecd3..d48b13dffea 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibEDID/GeneratePnpIDs.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibEDID/GeneratePnpIDs.cpp @@ -23,11 +23,11 @@ struct ApprovalDate { }; struct PnpIdData { - String manufacturer_name; + DeprecatedString manufacturer_name; ApprovalDate approval_date; }; -static ErrorOr decode_html_entities(StringView const& str) +static ErrorOr decode_html_entities(StringView const& str) { static constexpr struct { StringView entity_name; @@ -116,12 +116,12 @@ static ErrorOr parse_approval_date(StringView const& str) return ApprovalDate { .year = year.value(), .month = month.value(), .day = day.value() }; } -static ErrorOr> parse_pnp_ids_database(Core::Stream::File& pnp_ids_file) +static ErrorOr> parse_pnp_ids_database(Core::Stream::File& pnp_ids_file) { auto pnp_ids_file_bytes = TRY(pnp_ids_file.read_all()); StringView pnp_ids_file_contents(pnp_ids_file_bytes); - HashMap pnp_id_data; + HashMap pnp_id_data; for (size_t row_content_offset = 0;;) { static auto const row_start_tag = "> parse_pnp_ids_database(Core::Stream:: return Error::from_string_literal("Invalid row start tag"); auto row_string = pnp_ids_file_contents.substring_view(row_start_tag_end.value() + 1, row_end.value() - row_start_tag_end.value() - 1); - Vector columns; + Vector columns; for (size_t column_row_offset = 0;;) { static auto const column_start_tag = ""sv; auto column_start = row_string.find(column_start_tag, column_row_offset); @@ -181,12 +181,12 @@ static ErrorOr> parse_pnp_ids_database(Core::Stream:: return pnp_id_data; } -static ErrorOr generate_header(Core::Stream::File& file, HashMap const& pnp_ids) +static ErrorOr generate_header(Core::Stream::File& file, HashMap const& pnp_ids) { StringBuilder builder; SourceGenerator generator { builder }; - generator.set("pnp_id_count", String::formatted("{}", pnp_ids.size())); + generator.set("pnp_id_count", DeprecatedString::formatted("{}", pnp_ids.size())); generator.append(R"~~~( #pragma once @@ -215,7 +215,7 @@ namespace PnpIDs { return {}; } -static ErrorOr generate_source(Core::Stream::File& file, HashMap const& pnp_ids) +static ErrorOr generate_source(Core::Stream::File& file, HashMap const& pnp_ids) { StringBuilder builder; SourceGenerator generator { builder }; @@ -231,9 +231,9 @@ static constexpr PnpIDData s_pnp_ids[] = { for (auto& pnp_id_data : pnp_ids) { generator.set("manufacturer_id", pnp_id_data.key); generator.set("manufacturer_name", pnp_id_data.value.manufacturer_name); - generator.set("approval_year", String::formatted("{}", pnp_id_data.value.approval_date.year)); - generator.set("approval_month", String::formatted("{}", pnp_id_data.value.approval_date.month)); - generator.set("approval_day", String::formatted("{}", pnp_id_data.value.approval_date.day)); + generator.set("approval_year", DeprecatedString::formatted("{}", pnp_id_data.value.approval_date.year)); + generator.set("approval_month", DeprecatedString::formatted("{}", pnp_id_data.value.approval_date.month)); + generator.set("approval_day", DeprecatedString::formatted("{}", pnp_id_data.value.approval_date.day)); generator.append(R"~~~( { "@manufacturer_id@"sv, "@manufacturer_name@"sv, { @approval_year@, @approval_month@, @approval_day@ } }, diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateDateTimeFormatData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateDateTimeFormatData.cpp index 34083106cb6..df8f5257c57 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateDateTimeFormatData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateDateTimeFormatData.cpp @@ -7,6 +7,7 @@ #include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common. #include #include +#include #include #include #include @@ -17,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -487,7 +487,7 @@ struct AK::Formatter : Formatter { }; struct LocaleData { - HashMap calendars; + HashMap calendars; size_t time_zones { 0 }; size_t time_zone_formats { 0 }; @@ -513,27 +513,27 @@ struct CLDR { UniqueStorage unique_day_period_lists; UniqueStorage unique_hour_cycle_lists; - HashMap locales; + HashMap locales; - HashMap hour_cycles; - Vector hour_cycle_regions; + HashMap hour_cycles; + Vector hour_cycle_regions; - HashMap minimum_days; - Vector minimum_days_regions; + HashMap minimum_days; + Vector minimum_days_regions; - HashMap first_day; - Vector first_day_regions; + HashMap first_day; + Vector first_day_regions; - HashMap weekend_start; - Vector weekend_start_regions; + HashMap weekend_start; + Vector weekend_start_regions; - HashMap weekend_end; - Vector weekend_end_regions; + HashMap weekend_end; + Vector weekend_end_regions; - HashMap> meta_zones; - Vector time_zones { "UTC"sv }; + HashMap> meta_zones; + Vector time_zones { "UTC"sv }; - Vector calendars; + Vector calendars; }; static Optional day_period_from_string(StringView day_period) @@ -563,7 +563,7 @@ static Optional day_period_from_string(StringView day_period) return {}; } -static ErrorOr parse_hour_cycles(String core_path, CLDR& cldr) +static ErrorOr parse_hour_cycles(DeprecatedString core_path, CLDR& cldr) { // https://unicode.org/reports/tr35/tr35-dates.html#Time_Data LexicalPath time_data_path(move(core_path)); @@ -607,7 +607,7 @@ static ErrorOr parse_hour_cycles(String core_path, CLDR& cldr) return {}; } -static ErrorOr parse_week_data(String core_path, CLDR& cldr) +static ErrorOr parse_week_data(DeprecatedString core_path, CLDR& cldr) { // https://unicode.org/reports/tr35/tr35-dates.html#Week_Data LexicalPath week_data_path(move(core_path)); @@ -672,7 +672,7 @@ static ErrorOr parse_week_data(String core_path, CLDR& cldr) return {}; } -static ErrorOr parse_meta_zones(String core_path, CLDR& cldr) +static ErrorOr parse_meta_zones(DeprecatedString core_path, CLDR& cldr) { // https://unicode.org/reports/tr35/tr35-dates.html#Metazones LexicalPath meta_zone_path(move(core_path)); @@ -714,7 +714,7 @@ static constexpr auto is_char(char ch) // "{hour}:{minute} {ampm}" becomes "{hour}:{minute}" (remove the space before {ampm}) // "{ampm} {hour}" becomes "{hour}" (remove the space after {ampm}) // "{hour}:{minute} {ampm} {timeZoneName}" becomes "{hour}:{minute} {timeZoneName}" (remove one of the spaces around {ampm}) -static String remove_period_from_pattern(String pattern) +static DeprecatedString remove_period_from_pattern(DeprecatedString pattern) { auto is_surrounding_space = [&](auto code_point_iterator) { if (code_point_iterator.done()) @@ -751,15 +751,15 @@ static String remove_period_from_pattern(String pattern) after_removal = it; if (is_surrounding_space(before_removal) && !is_opening(after_removal)) { - pattern = String::formatted("{}{}", + pattern = DeprecatedString::formatted("{}{}", pattern.substring_view(0, *index - before_removal.underlying_code_point_length_in_bytes()), pattern.substring_view(*index + remove.length())); } else if (is_surrounding_space(after_removal) && !is_closing(before_removal)) { - pattern = String::formatted("{}{}", + pattern = DeprecatedString::formatted("{}{}", pattern.substring_view(0, *index), pattern.substring_view(*index + remove.length() + after_removal.underlying_code_point_length_in_bytes())); } else { - pattern = String::formatted("{}{}", + pattern = DeprecatedString::formatted("{}{}", pattern.substring_view(0, *index), pattern.substring_view(*index + remove.length())); } @@ -768,7 +768,7 @@ static String remove_period_from_pattern(String pattern) return pattern; } -static Optional parse_date_time_pattern_raw(String pattern, String skeleton, CLDR& cldr) +static Optional parse_date_time_pattern_raw(DeprecatedString pattern, DeprecatedString skeleton, CLDR& cldr) { // https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table using Locale::CalendarPatternStyle; @@ -987,7 +987,7 @@ static Optional parse_date_time_pattern_raw(String pattern, Str return format; } -static Optional parse_date_time_pattern(String pattern, String skeleton, CLDR& cldr) +static Optional parse_date_time_pattern(DeprecatedString pattern, DeprecatedString skeleton, CLDR& cldr) { auto format = parse_date_time_pattern_raw(move(pattern), move(skeleton), cldr); if (!format.has_value()) @@ -1377,7 +1377,7 @@ static void parse_calendar_symbols(Calendar& calendar, JsonObject const& calenda calendar.symbols = cldr.unique_calendar_symbols_lists.ensure(move(symbols_list)); } -static ErrorOr parse_calendars(String locale_calendars_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_calendars(DeprecatedString locale_calendars_path, CLDR& cldr, LocaleData& locale) { LexicalPath calendars_path(move(locale_calendars_path)); if (!calendars_path.basename().starts_with("ca-"sv)) @@ -1394,7 +1394,7 @@ static ErrorOr parse_calendars(String locale_calendars_path, CLDR& cldr, L auto format = patterns_object.get(name); auto skeleton = skeletons_object.get(name); - auto format_index = parse_date_time_pattern(format.as_string(), skeleton.as_string_or(String::empty()), cldr).value(); + auto format_index = parse_date_time_pattern(format.as_string(), skeleton.as_string_or(DeprecatedString::empty()), cldr).value(); if (patterns) patterns->append(cldr.unique_patterns.get(format_index)); @@ -1468,7 +1468,7 @@ static ErrorOr parse_calendars(String locale_calendars_path, CLDR& cldr, L return {}; } -static ErrorOr parse_time_zone_names(String locale_time_zone_names_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_time_zone_names(DeprecatedString locale_time_zone_names_path, CLDR& cldr, LocaleData& locale) { LexicalPath time_zone_names_path(move(locale_time_zone_names_path)); time_zone_names_path = time_zone_names_path.append("timeZoneNames.json"sv); @@ -1577,7 +1577,7 @@ static ErrorOr parse_time_zone_names(String locale_time_zone_names_path, C return {}; } -static ErrorOr parse_day_periods(String core_path, CLDR& cldr) +static ErrorOr parse_day_periods(DeprecatedString core_path, CLDR& cldr) { // https://unicode.org/reports/tr35/tr35-dates.html#Day_Period_Rule_Sets LexicalPath day_periods_path(move(core_path)); @@ -1633,7 +1633,7 @@ static ErrorOr parse_day_periods(String core_path, CLDR& cldr) return {}; } -static ErrorOr parse_all_locales(String core_path, String dates_path, CLDR& cldr) +static ErrorOr parse_all_locales(DeprecatedString core_path, DeprecatedString dates_path, CLDR& cldr) { TRY(parse_hour_cycles(core_path, cldr)); TRY(parse_week_data(core_path, cldr)); @@ -1641,7 +1641,7 @@ static ErrorOr parse_all_locales(String core_path, String dates_path, CLDR auto dates_iterator = TRY(path_to_dir_iterator(move(dates_path))); - auto remove_variants_from_path = [&](String path) -> ErrorOr { + auto remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr { auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path))); StringBuilder builder; @@ -1673,15 +1673,15 @@ static ErrorOr parse_all_locales(String core_path, String dates_path, CLDR return {}; } -static String format_identifier(StringView owner, String identifier) +static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier) { identifier = identifier.replace("-"sv, "_"sv, ReplaceMode::All); identifier = identifier.replace("/"sv, "_"sv, ReplaceMode::All); if (all_of(identifier, is_ascii_digit)) - return String::formatted("{}_{}", owner[0], identifier); + return DeprecatedString::formatted("{}_{}", owner[0], identifier); if (is_ascii_lower_alpha(identifier[0])) - return String::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1)); + return DeprecatedString::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1)); return identifier; } @@ -1937,9 +1937,9 @@ struct DayPeriodData { cldr.unique_day_period_lists.generate(generator, cldr.unique_day_periods.type_that_fits(), "s_day_period_lists"sv); cldr.unique_hour_cycle_lists.generate(generator, cldr.unique_hour_cycle_lists.type_that_fits(), "s_hour_cycle_lists"sv); - auto append_calendars = [&](String name, auto const& calendars) { + auto append_calendars = [&](DeprecatedString name, auto const& calendars) { generator.set("name", name); - generator.set("size", String::number(calendars.size())); + generator.set("size", DeprecatedString::number(calendars.size())); generator.append(R"~~~( static constexpr Array<@calendar_index_type@, @size@> @name@ { {)~~~"); @@ -1949,7 +1949,7 @@ static constexpr Array<@calendar_index_type@, @size@> @name@ { {)~~~"); auto calendar = calendars.find(calendar_key)->value; generator.append(first ? " "sv : ", "sv); - generator.append(String::number(calendar)); + generator.append(DeprecatedString::number(calendar)); first = false; } @@ -1959,7 +1959,7 @@ static constexpr Array<@calendar_index_type@, @size@> @name@ { {)~~~"); auto append_mapping = [&](auto const& keys, auto const& map, auto type, auto name, auto mapping_getter) { generator.set("type", type); generator.set("name", name); - generator.set("size", String::number(keys.size())); + generator.set("size", DeprecatedString::number(keys.size())); generator.append(R"~~~( static constexpr Array<@type@, @size@> @name@ { {)~~~"); @@ -1970,7 +1970,7 @@ static constexpr Array<@type@, @size@> @name@ { {)~~~"); auto mapping = mapping_getter(value); generator.append(first ? " "sv : ", "sv); - generator.append(String::number(mapping)); + generator.append(DeprecatedString::number(mapping)); first = false; } @@ -1992,7 +1992,7 @@ static constexpr Array<@type@, @size@> @name@ { {)~~~"); generator.append("\n"); auto append_from_string = [&](StringView enum_title, StringView enum_snake, auto const& values, Vector const& aliases = {}) { - HashValueMap hashes; + HashValueMap hashes; hashes.ensure_capacity(values.size()); for (auto const& value : values) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp index 7b338d30fbc..7e83227d6c2 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateLocaleData.cpp @@ -7,6 +7,7 @@ #include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common. #include #include +#include #include #include #include @@ -15,21 +16,20 @@ #include #include #include -#include #include #include #include #include #include -static String format_identifier(StringView owner, String identifier) +static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier) { identifier = identifier.replace("-"sv, "_"sv, ReplaceMode::All); if (all_of(identifier, is_ascii_digit)) - return String::formatted("{}_{}", owner[0], identifier); + return DeprecatedString::formatted("{}_{}", owner[0], identifier); if (is_ascii_lower_alpha(identifier[0])) - return String::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1)); + return DeprecatedString::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1)); return identifier; } @@ -153,9 +153,9 @@ using KeywordList = Vector; using ListPatternList = Vector; struct LocaleData { - String language; - Optional territory; - Optional variant; + DeprecatedString language; + Optional territory; + Optional variant; size_t display_patterns { 0 }; size_t languages { 0 }; size_t territories { 0 }; @@ -195,15 +195,15 @@ struct CLDR { UniqueStorage unique_list_pattern_lists; UniqueStorage unique_text_layouts; - HashMap locales; + HashMap locales; Vector locale_aliases; - Vector languages; - Vector territories; - Vector scripts; - Vector variants; - Vector currencies; - Vector date_fields; + Vector languages; + Vector territories; + Vector scripts; + Vector variants; + Vector currencies; + Vector date_fields; Vector date_field_aliases { // ECMA-402 and the CLDR refer to some date fields with different names. Defining these aliases // means we can remain agnostic about the naming differences elsewhere. @@ -212,17 +212,17 @@ struct CLDR { { "zone"sv, "timeZoneName"sv }, }; - HashMap> keywords; - HashMap> keyword_aliases; - HashMap keyword_names; + HashMap> keywords; + HashMap> keyword_aliases; + HashMap keyword_names; - Vector list_pattern_types; - Vector character_orders; - HashMap language_aliases; - HashMap territory_aliases; - HashMap script_aliases; - HashMap variant_aliases; - HashMap subdivision_aliases; + Vector list_pattern_types; + Vector character_orders; + HashMap language_aliases; + HashMap territory_aliases; + HashMap script_aliases; + HashMap variant_aliases; + HashMap subdivision_aliases; Vector complex_mappings; Vector likely_subtags; size_t max_variant_size { 0 }; @@ -245,7 +245,7 @@ static ErrorOr parse_language_mapping(CLDR& cldr, StringView ke return LanguageMapping { move(parsed_key), move(parsed_alias) }; } -static ErrorOr parse_core_aliases(String core_supplemental_path, CLDR& cldr) +static ErrorOr parse_core_aliases(DeprecatedString core_supplemental_path, CLDR& cldr) { LexicalPath core_aliases_path(move(core_supplemental_path)); core_aliases_path = core_aliases_path.append("aliases.json"sv); @@ -279,7 +279,7 @@ static ErrorOr parse_core_aliases(String core_supplemental_path, CLDR& cld return {}; } -static ErrorOr parse_likely_subtags(String core_supplemental_path, CLDR& cldr) +static ErrorOr parse_likely_subtags(DeprecatedString core_supplemental_path, CLDR& cldr) { LexicalPath likely_subtags_path(move(core_supplemental_path)); likely_subtags_path = likely_subtags_path.append("likelySubtags.json"sv); @@ -298,7 +298,7 @@ static ErrorOr parse_likely_subtags(String core_supplemental_path, CLDR& c return {}; } -static ErrorOr parse_identity(String locale_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_identity(DeprecatedString locale_path, CLDR& cldr, LocaleData& locale) { LexicalPath languages_path(move(locale_path)); // Note: Every JSON file defines identity data, so we can use any of them. languages_path = languages_path.append("languages.json"sv); @@ -335,7 +335,7 @@ static ErrorOr parse_identity(String locale_path, CLDR& cldr, LocaleData& return {}; } -static ErrorOr parse_locale_display_patterns(String locale_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_display_patterns(DeprecatedString locale_path, CLDR& cldr, LocaleData& locale) { LexicalPath locale_display_names_path(move(locale_path)); locale_display_names_path = locale_display_names_path.append("localeDisplayNames.json"sv); @@ -356,7 +356,7 @@ static ErrorOr parse_locale_display_patterns(String locale_path, CLDR& cld return {}; } -static ErrorOr preprocess_languages(String locale_path, CLDR& cldr) +static ErrorOr preprocess_languages(DeprecatedString locale_path, CLDR& cldr) { LexicalPath languages_path(move(locale_path)); languages_path = languages_path.append("languages.json"sv); @@ -375,7 +375,7 @@ static ErrorOr preprocess_languages(String locale_path, CLDR& cldr) return {}; } -static ErrorOr parse_unicode_extension_keywords(String bcp47_path, CLDR& cldr) +static ErrorOr parse_unicode_extension_keywords(DeprecatedString bcp47_path, CLDR& cldr) { constexpr auto desired_keywords = Array { "ca"sv, "co"sv, "hc"sv, "kf"sv, "kn"sv, "nu"sv }; auto keywords = TRY(read_json_file(bcp47_path)); @@ -426,7 +426,7 @@ static ErrorOr parse_unicode_extension_keywords(String bcp47_path, CLDR& c return {}; } -static Optional find_keyword_alias(StringView key, StringView calendar, CLDR& cldr) +static Optional find_keyword_alias(StringView key, StringView calendar, CLDR& cldr) { auto it = cldr.keyword_aliases.find(key); if (it == cldr.keyword_aliases.end()) @@ -439,7 +439,7 @@ static Optional find_keyword_alias(StringView key, StringView calendar, return alias->name; } -static ErrorOr parse_locale_languages(String locale_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_languages(DeprecatedString locale_path, CLDR& cldr, LocaleData& locale) { LexicalPath languages_path(move(locale_path)); languages_path = languages_path.append("languages.json"sv); @@ -465,7 +465,7 @@ static ErrorOr parse_locale_languages(String locale_path, CLDR& cldr, Loca return {}; } -static ErrorOr parse_locale_territories(String locale_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_territories(DeprecatedString locale_path, CLDR& cldr, LocaleData& locale) { LexicalPath territories_path(move(locale_path)); territories_path = territories_path.append("territories.json"sv); @@ -488,7 +488,7 @@ static ErrorOr parse_locale_territories(String locale_path, CLDR& cldr, Lo return {}; } -static ErrorOr parse_locale_scripts(String locale_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_scripts(DeprecatedString locale_path, CLDR& cldr, LocaleData& locale) { LexicalPath scripts_path(move(locale_path)); scripts_path = scripts_path.append("scripts.json"sv); @@ -511,7 +511,7 @@ static ErrorOr parse_locale_scripts(String locale_path, CLDR& cldr, Locale return {}; } -static ErrorOr parse_locale_list_patterns(String misc_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_list_patterns(DeprecatedString misc_path, CLDR& cldr, LocaleData& locale) { LexicalPath list_patterns_path(move(misc_path)); list_patterns_path = list_patterns_path.append("listPatterns.json"sv); @@ -562,7 +562,7 @@ static ErrorOr parse_locale_list_patterns(String misc_path, CLDR& cldr, Lo return {}; } -static ErrorOr parse_locale_layout(String misc_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_layout(DeprecatedString misc_path, CLDR& cldr, LocaleData& locale) { LexicalPath layout_path(move(misc_path)); layout_path = layout_path.append("layout.json"sv); @@ -594,7 +594,7 @@ static ErrorOr parse_locale_layout(String misc_path, CLDR& cldr, LocaleDat return {}; } -static ErrorOr parse_locale_currencies(String numbers_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_currencies(DeprecatedString numbers_path, CLDR& cldr, LocaleData& locale) { LexicalPath currencies_path(move(numbers_path)); currencies_path = currencies_path.append("currencies.json"sv); @@ -642,7 +642,7 @@ static ErrorOr parse_locale_currencies(String numbers_path, CLDR& cldr, Lo return {}; } -static ErrorOr parse_locale_calendars(String locale_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_calendars(DeprecatedString locale_path, CLDR& cldr, LocaleData& locale) { LexicalPath locale_display_names_path(move(locale_path)); locale_display_names_path = locale_display_names_path.append("localeDisplayNames.json"sv); @@ -673,7 +673,7 @@ static ErrorOr parse_locale_calendars(String locale_path, CLDR& cldr, Loca return {}; } -static ErrorOr parse_locale_date_fields(String dates_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_locale_date_fields(DeprecatedString dates_path, CLDR& cldr, LocaleData& locale) { LexicalPath date_fields_path(move(dates_path)); date_fields_path = date_fields_path.append("dateFields.json"sv); @@ -714,8 +714,8 @@ static ErrorOr parse_locale_date_fields(String dates_path, CLDR& cldr, Loc return; auto const& long_name = value.as_object().get("displayName"sv); - auto const& short_name = fields_object.as_object().get(String::formatted("{}-short", key)).as_object().get("displayName"sv); - auto const& narrow_name = fields_object.as_object().get(String::formatted("{}-narrow", key)).as_object().get("displayName"sv); + auto const& short_name = fields_object.as_object().get(DeprecatedString::formatted("{}-short", key)).as_object().get("displayName"sv); + auto const& narrow_name = fields_object.as_object().get(DeprecatedString::formatted("{}-narrow", key)).as_object().get("displayName"sv); auto index = cldr.date_fields.find_first_index(key).value(); long_date_fields[index] = cldr.unique_strings.ensure(long_name.as_string()); @@ -729,7 +729,7 @@ static ErrorOr parse_locale_date_fields(String dates_path, CLDR& cldr, Loc return {}; } -static ErrorOr parse_number_system_keywords(String locale_numbers_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_number_system_keywords(DeprecatedString locale_numbers_path, CLDR& cldr, LocaleData& locale) { LexicalPath numbers_path(move(locale_numbers_path)); numbers_path = numbers_path.append("numbers.json"sv); @@ -743,7 +743,7 @@ static ErrorOr parse_number_system_keywords(String locale_numbers_path, CL KeywordList keywords {}; - auto append_numbering_system = [&](String system_name) { + auto append_numbering_system = [&](DeprecatedString system_name) { if (auto system_alias = find_keyword_alias("nu"sv, system_name, cldr); system_alias.has_value()) system_name = system_alias.release_value(); @@ -768,7 +768,7 @@ static ErrorOr parse_number_system_keywords(String locale_numbers_path, CL return {}; } -static ErrorOr parse_calendar_keywords(String locale_dates_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_calendar_keywords(DeprecatedString locale_dates_path, CLDR& cldr, LocaleData& locale) { auto calendars_iterator = TRY(path_to_dir_iterator(locale_dates_path, {})); KeywordList keywords {}; @@ -833,7 +833,7 @@ static void fill_in_collation_keywords(CLDR& cldr, LocaleData& locale) locale.collation_numeric_keywords = kn_index; } -static ErrorOr parse_default_content_locales(String core_path, CLDR& cldr) +static ErrorOr parse_default_content_locales(DeprecatedString core_path, CLDR& cldr) { LexicalPath default_content_path(move(core_path)); default_content_path = default_content_path.append("defaultContent.json"sv); @@ -882,7 +882,7 @@ static ErrorOr define_aliases_without_scripts(CLDR& cldr) if ((parsed_locale.language == 0) || (parsed_locale.script == 0) || (parsed_locale.region == 0)) return {}; - auto locale_without_script = String::formatted("{}-{}", + auto locale_without_script = DeprecatedString::formatted("{}-{}", cldr.unique_strings.get(parsed_locale.language), cldr.unique_strings.get(parsed_locale.region)); @@ -907,7 +907,7 @@ static ErrorOr define_aliases_without_scripts(CLDR& cldr) return {}; } -static ErrorOr parse_all_locales(String bcp47_path, String core_path, String locale_names_path, String misc_path, String numbers_path, String dates_path, CLDR& cldr) +static ErrorOr parse_all_locales(DeprecatedString bcp47_path, DeprecatedString core_path, DeprecatedString locale_names_path, DeprecatedString misc_path, DeprecatedString numbers_path, DeprecatedString dates_path, CLDR& cldr) { auto bcp47_iterator = TRY(path_to_dir_iterator(move(bcp47_path), "bcp47"sv)); auto identity_iterator = TRY(path_to_dir_iterator(locale_names_path)); @@ -924,7 +924,7 @@ static ErrorOr parse_all_locales(String bcp47_path, String core_path, Stri TRY(parse_core_aliases(core_supplemental_path.string(), cldr)); TRY(parse_likely_subtags(core_supplemental_path.string(), cldr)); - auto remove_variants_from_path = [&](String path) -> ErrorOr { + auto remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr { auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path))); StringBuilder builder; @@ -1034,7 +1034,7 @@ namespace Locale { for (auto& keyword : cldr.keywords) { auto const& keyword_name = cldr.keyword_names.find(keyword.key)->value; - auto enum_name = String::formatted("Keyword{}", format_identifier({}, keyword_name)); + auto enum_name = DeprecatedString::formatted("Keyword{}", format_identifier({}, keyword_name)); if (auto aliases = cldr.keyword_aliases.find(keyword.key); aliases != cldr.keyword_aliases.end()) generate_enum(generator, format_identifier, enum_name, {}, keyword.value, aliases->value); @@ -1057,9 +1057,9 @@ static ErrorOr generate_unicode_locale_implementation(Core::Stream::Buffer StringBuilder builder; SourceGenerator generator { builder }; generator.set("string_index_type"sv, string_index_type); - generator.set("locales_size"sv, String::number(cldr.locales.size())); - generator.set("territories_size", String::number(cldr.territories.size())); - generator.set("variants_size", String::number(cldr.max_variant_size)); + generator.set("locales_size"sv, DeprecatedString::number(cldr.locales.size())); + generator.set("territories_size", DeprecatedString::number(cldr.territories.size())); + generator.set("variants_size", DeprecatedString::number(cldr.max_variant_size)); generator.append(R"~~~( #include @@ -1162,7 +1162,7 @@ Span get_available_keyword_values(StringView key) cldr.unique_text_layouts.generate(generator, "TextLayout"sv, "s_text_layouts"sv, 30); auto append_index = [&](auto index) { - generator.append(String::formatted(", {}", index)); + generator.append(DeprecatedString::formatted(", {}", index)); }; auto append_list_and_size = [&](auto const& list) { @@ -1175,16 +1175,16 @@ Span get_available_keyword_values(StringView key) generator.append(", {"); for (auto const& item : list) { generator.append(first ? " "sv : ", "sv); - generator.append(String::number(item)); + generator.append(DeprecatedString::number(item)); first = false; } - generator.append(String::formatted(" }}, {}", list.size())); + generator.append(DeprecatedString::formatted(" }}, {}", list.size())); }; auto append_mapping = [&](auto const& keys, auto const& map, auto type, auto name, auto mapping_getter) { generator.set("type", type); generator.set("name", name); - generator.set("size", String::number(keys.size())); + generator.set("size", DeprecatedString::number(keys.size())); generator.append(R"~~~( static constexpr Array<@type@, @size@> @name@ { {)~~~"); @@ -1195,7 +1195,7 @@ static constexpr Array<@type@, @size@> @name@ { {)~~~"); auto mapping = mapping_getter(value); generator.append(first ? " "sv : ", "sv); - generator.append(String::number(mapping)); + generator.append(DeprecatedString::number(mapping)); first = false; } @@ -1243,7 +1243,7 @@ struct CanonicalLanguageID { return language_id; } - bool matches_variants(Vector const& other_variants) const { + bool matches_variants(Vector const& other_variants) const { if (variants_size == 0) return true; if (other_variants.size() != variants_size) @@ -1272,7 +1272,7 @@ struct LanguageMapping { )~~~"); auto append_complex_mapping = [&](StringView name, auto& mappings) { - generator.set("size", String::number(mappings.size())); + generator.set("size", DeprecatedString::number(mappings.size())); generator.set("name"sv, name); generator.append(R"~~~( @@ -1292,14 +1292,14 @@ static constexpr Array s_@name@ { { }); for (auto const& mapping : mappings) { - generator.set("language"sv, String::number(mapping.key.language)); + generator.set("language"sv, DeprecatedString::number(mapping.key.language)); generator.append(" { { @language@"); append_index(mapping.key.script); append_index(mapping.key.region); append_list_and_size(mapping.key.variants); - generator.set("language"sv, String::number(mapping.alias.language)); + generator.set("language"sv, DeprecatedString::number(mapping.alias.language)); generator.append(" }, { @language@"); append_index(mapping.alias.script); @@ -1439,7 +1439,7 @@ Optional get_locale_@enum_snake@_mapping(StringView locale, StringVi }; auto append_from_string = [&](StringView enum_title, StringView enum_snake, auto const& values, Vector const& aliases = {}) { - HashValueMap hashes; + HashValueMap hashes; hashes.ensure_capacity(values.size()); for (auto const& value : values) @@ -1493,8 +1493,8 @@ Optional get_locale_@enum_snake@_mapping(StringView locale, StringVi for (auto const& keyword : cldr.keywords) { auto const& keyword_name = cldr.keyword_names.find(keyword.key)->value; - auto enum_name = String::formatted("Keyword{}", format_identifier({}, keyword_name)); - auto enum_snake = String::formatted("keyword_{}", keyword.key); + auto enum_name = DeprecatedString::formatted("Keyword{}", format_identifier({}, keyword_name)); + auto enum_snake = DeprecatedString::formatted("keyword_{}", keyword.key); if (auto aliases = cldr.keyword_aliases.find(keyword.key); aliases != cldr.keyword_aliases.end()) append_from_string(enum_name, enum_snake, keyword.value, aliases->value); @@ -1728,7 +1728,7 @@ Optional add_likely_subtags(LanguageID const& language_id) return maximized; } -Optional resolve_most_likely_territory(LanguageID const& language_id) +Optional resolve_most_likely_territory(LanguageID const& language_id) { if (auto const* likely_subtag = resolve_likely_subtag(language_id); likely_subtag != nullptr) return decode_string(likely_subtag->alias.region); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp index 351c861bc91..9bd837d7eb1 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateNumberFormatData.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -18,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -220,7 +220,7 @@ struct AK::Traits : public GenericTraits { struct LocaleData { Vector number_systems; - HashMap units {}; + HashMap units {}; u8 minimum_grouping_digits { 0 }; }; @@ -232,14 +232,14 @@ struct CLDR { UniqueStorage unique_systems; UniqueStorage unique_units; - HashMap> number_system_digits; - Vector number_systems; + HashMap> number_system_digits; + Vector number_systems; - HashMap locales; + HashMap locales; size_t max_identifier_count { 0 }; }; -static ErrorOr parse_number_system_digits(String core_supplemental_path, CLDR& cldr) +static ErrorOr parse_number_system_digits(DeprecatedString core_supplemental_path, CLDR& cldr) { LexicalPath number_systems_path(move(core_supplemental_path)); number_systems_path = number_systems_path.append("numberingSystems.json"sv); @@ -271,7 +271,7 @@ static ErrorOr parse_number_system_digits(String core_supplemental_path, C return {}; } -static String parse_identifiers(String pattern, StringView replacement, CLDR& cldr, NumberFormat& format) +static DeprecatedString parse_identifiers(DeprecatedString pattern, StringView replacement, CLDR& cldr, NumberFormat& format) { static constexpr Utf8View whitespace { "\u0020\u00a0\u200f"sv }; @@ -317,7 +317,7 @@ static String parse_identifiers(String pattern, StringView replacement, CLDR& cl cldr.max_identifier_count = max(cldr.max_identifier_count, format.identifier_indices.size()); } - pattern = String::formatted("{}{{{}:{}}}{}", + pattern = DeprecatedString::formatted("{}{{{}:{}}}{}", *start_index > 0 ? pattern.substring_view(0, *start_index) : ""sv, replacement, replacement_index, @@ -325,13 +325,13 @@ static String parse_identifiers(String pattern, StringView replacement, CLDR& cl } } -static void parse_number_pattern(Vector patterns, CLDR& cldr, NumberFormatType type, NumberFormat& format, NumberSystem* number_system_for_groupings = nullptr) +static void parse_number_pattern(Vector patterns, CLDR& cldr, NumberFormatType type, NumberFormat& format, NumberSystem* number_system_for_groupings = nullptr) { // https://unicode.org/reports/tr35/tr35-numbers.html#Number_Format_Patterns // https://cldr.unicode.org/translation/number-currency-formats/number-and-currency-patterns VERIFY((patterns.size() == 1) || (patterns.size() == 2)); - auto replace_patterns = [&](String pattern) { + auto replace_patterns = [&](DeprecatedString pattern) { static HashMap replacements = { { "{0}"sv, "{number}"sv }, { "{1}"sv, "{currency}"sv }, @@ -345,7 +345,7 @@ static void parse_number_pattern(Vector patterns, CLDR& cldr, NumberForm for (auto const& replacement : replacements) pattern = pattern.replace(replacement.key, replacement.value, ReplaceMode::All); - if (auto start_number_index = pattern.find_any_of("#0"sv, String::SearchDirection::Forward); start_number_index.has_value()) { + if (auto start_number_index = pattern.find_any_of("#0"sv, DeprecatedString::SearchDirection::Forward); start_number_index.has_value()) { auto end_number_index = *start_number_index + 1; for (; end_number_index < pattern.length(); ++end_number_index) { @@ -372,7 +372,7 @@ static void parse_number_pattern(Vector patterns, CLDR& cldr, NumberForm } } - pattern = String::formatted("{}{{number}}{}", + pattern = DeprecatedString::formatted("{}{{number}}{}", *start_number_index > 0 ? pattern.substring_view(0, *start_number_index) : ""sv, pattern.substring_view(end_number_index)); @@ -389,19 +389,19 @@ static void parse_number_pattern(Vector patterns, CLDR& cldr, NumberForm }; auto zero_format = replace_patterns(move(patterns[0])); - format.positive_format_index = cldr.unique_strings.ensure(String::formatted("{{plusSign}}{}", zero_format)); + format.positive_format_index = cldr.unique_strings.ensure(DeprecatedString::formatted("{{plusSign}}{}", zero_format)); if (patterns.size() == 2) { auto negative_format = replace_patterns(move(patterns[1])); format.negative_format_index = cldr.unique_strings.ensure(move(negative_format)); } else { - format.negative_format_index = cldr.unique_strings.ensure(String::formatted("{{minusSign}}{}", zero_format)); + format.negative_format_index = cldr.unique_strings.ensure(DeprecatedString::formatted("{{minusSign}}{}", zero_format)); } format.zero_format_index = cldr.unique_strings.ensure(move(zero_format)); } -static void parse_number_pattern(Vector patterns, CLDR& cldr, NumberFormatType type, size_t& format_index, NumberSystem* number_system_for_groupings = nullptr) +static void parse_number_pattern(Vector patterns, CLDR& cldr, NumberFormatType type, size_t& format_index, NumberSystem* number_system_for_groupings = nullptr) { NumberFormat format {}; parse_number_pattern(move(patterns), cldr, type, format, number_system_for_groupings); @@ -409,7 +409,7 @@ static void parse_number_pattern(Vector patterns, CLDR& cldr, NumberForm format_index = cldr.unique_formats.ensure(move(format)); } -static ErrorOr parse_number_systems(String locale_numbers_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_number_systems(DeprecatedString locale_numbers_path, CLDR& cldr, LocaleData& locale) { LexicalPath numbers_path(move(locale_numbers_path)); numbers_path = numbers_path.append("numbers.json"sv); @@ -522,7 +522,7 @@ static ErrorOr parse_number_systems(String locale_numbers_path, CLDR& cldr // The range separator does not appear in the symbols list, we have to extract it from // the range pattern. - auto misc_patterns_key = String::formatted("{}{}", misc_patterns_prefix, system); + auto misc_patterns_key = DeprecatedString::formatted("{}{}", misc_patterns_prefix, system); auto misc_patterns = locale_numbers_object.as_object().get(misc_patterns_key); auto range_separator = misc_patterns.as_object().get("range"sv).as_string(); @@ -594,7 +594,7 @@ static ErrorOr parse_number_systems(String locale_numbers_path, CLDR& cldr return {}; } -static ErrorOr parse_units(String locale_units_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_units(DeprecatedString locale_units_path, CLDR& cldr, LocaleData& locale) { LexicalPath units_path(move(locale_units_path)); units_path = units_path.append("units.json"sv); @@ -607,7 +607,7 @@ static ErrorOr parse_units(String locale_units_path, CLDR& cldr, LocaleDat auto const& short_object = locale_units_object.as_object().get("short"sv); auto const& narrow_object = locale_units_object.as_object().get("narrow"sv); - HashMap units; + HashMap units; auto ensure_unit = [&](auto const& unit) -> Unit& { return units.ensure(unit, [&]() { @@ -697,7 +697,7 @@ static ErrorOr parse_units(String locale_units_path, CLDR& cldr, LocaleDat return {}; } -static ErrorOr parse_all_locales(String core_path, String numbers_path, String units_path, CLDR& cldr) +static ErrorOr parse_all_locales(DeprecatedString core_path, DeprecatedString numbers_path, DeprecatedString units_path, CLDR& cldr) { auto numbers_iterator = TRY(path_to_dir_iterator(move(numbers_path))); auto units_iterator = TRY(path_to_dir_iterator(move(units_path))); @@ -708,7 +708,7 @@ static ErrorOr parse_all_locales(String core_path, String numbers_path, St TRY(parse_number_system_digits(core_supplemental_path.string(), cldr)); - auto remove_variants_from_path = [&](String path) -> ErrorOr { + auto remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr { auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path))); StringBuilder builder; @@ -740,7 +740,7 @@ static ErrorOr parse_all_locales(String core_path, String numbers_path, St return {}; } -static String format_identifier(StringView, String identifier) +static DeprecatedString format_identifier(StringView, DeprecatedString identifier) { return identifier.to_titlecase(); } @@ -776,7 +776,7 @@ static ErrorOr generate_unicode_locale_implementation(Core::Stream::Buffer generator.set("number_format_index_type"sv, cldr.unique_formats.type_that_fits()); generator.set("number_format_list_index_type"sv, cldr.unique_format_lists.type_that_fits()); generator.set("numeric_symbol_list_index_type"sv, cldr.unique_symbols.type_that_fits()); - generator.set("identifier_count", String::number(cldr.max_identifier_count)); + generator.set("identifier_count", DeprecatedString::number(cldr.max_identifier_count)); generator.append(R"~~~( #include @@ -860,22 +860,22 @@ struct Unit { auto locales = cldr.locales.keys(); quick_sort(locales); - generator.set("size", String::number(locales.size())); + generator.set("size", DeprecatedString::number(locales.size())); generator.append(R"~~~( static constexpr Array s_minimum_grouping_digits { { )~~~"); bool first = true; for (auto const& locale : locales) { generator.append(first ? " "sv : ", "sv); - generator.append(String::number(cldr.locales.find(locale)->value.minimum_grouping_digits)); + generator.append(DeprecatedString::number(cldr.locales.find(locale)->value.minimum_grouping_digits)); first = false; } generator.append(" } };\n"); - auto append_map = [&](String name, auto type, auto const& map) { + auto append_map = [&](DeprecatedString name, auto type, auto const& map) { generator.set("name", name); generator.set("type", type); - generator.set("size", String::number(map.size())); + generator.set("size", DeprecatedString::number(map.size())); generator.append(R"~~~( static constexpr Array<@type@, @size@> @name@ { {)~~~"); @@ -884,9 +884,9 @@ static constexpr Array<@type@, @size@> @name@ { {)~~~"); for (auto const& item : map) { generator.append(first ? " "sv : ", "sv); if constexpr (requires { item.value; }) - generator.append(String::number(item.value)); + generator.append(DeprecatedString::number(item.value)); else - generator.append(String::number(item)); + generator.append(DeprecatedString::number(item)); first = false; } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp index 5053862c705..40c4d843dcf 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GeneratePluralRulesData.cpp @@ -5,13 +5,13 @@ */ #include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common. +#include #include #include #include #include #include #include -#include #include #include #include @@ -19,14 +19,14 @@ #include #include -static String format_identifier(StringView owner, String identifier) +static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier) { identifier = identifier.replace("-"sv, "_"sv, ReplaceMode::All); if (all_of(identifier, is_ascii_digit)) - return String::formatted("{}_{}", owner[0], identifier); + return DeprecatedString::formatted("{}_{}", owner[0], identifier); if (is_ascii_lower_alpha(identifier[0])) - return String::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1)); + return DeprecatedString::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1)); return identifier; } @@ -39,20 +39,20 @@ struct Relation { Inequality, }; - String const& modulus_variable_name() const + DeprecatedString const& modulus_variable_name() const { VERIFY(modulus.has_value()); if (!cached_modulus_variable_name.has_value()) - cached_modulus_variable_name = String::formatted("mod_{}_{}", symbol, *modulus); + cached_modulus_variable_name = DeprecatedString::formatted("mod_{}_{}", symbol, *modulus); return *cached_modulus_variable_name; } - String const& exponential_variable_name() const + DeprecatedString const& exponential_variable_name() const { if (!cached_exponential_variable_name.has_value()) - cached_exponential_variable_name = String::formatted("exp_{}", symbol); + cached_exponential_variable_name = DeprecatedString::formatted("exp_{}", symbol); return *cached_exponential_variable_name; } @@ -65,25 +65,25 @@ struct Relation { else if (symbol == 'e' || symbol == 'c') generator.append(exponential_variable_name()); else - generator.append(String::formatted("ops.{}", Locale::PluralOperands::symbol_to_variable_name(symbol))); + generator.append(DeprecatedString::formatted("ops.{}", Locale::PluralOperands::symbol_to_variable_name(symbol))); }; auto append_value = [&](u32 value) { append_variable_name(); generator.append(" == "sv); - generator.append(String::number(value)); + generator.append(DeprecatedString::number(value)); }; auto append_range = [&](auto const& range) { // This check avoids generating "0 <= unsigned_value", which is always true. if (range[0] != 0 || Locale::PluralOperands::symbol_requires_floating_point_modulus(symbol)) { - generator.append(String::formatted("{} <= ", range[0])); + generator.append(DeprecatedString::formatted("{} <= ", range[0])); append_variable_name(); generator.append(" && "sv); } append_variable_name(); - generator.append(String::formatted(" <= {}", range[1])); + generator.append(DeprecatedString::formatted(" <= {}", range[1])); }; if (type == Type::Inequality) @@ -106,7 +106,7 @@ struct Relation { generator.append(")"sv); } - void generate_precomputed_variables(SourceGenerator& generator, HashTable& generated_variables) const + void generate_precomputed_variables(SourceGenerator& generator, HashTable& generated_variables) const { // FIXME: How do we handle the exponential symbols? They seem unused by ECMA-402. if (symbol == 'e' || symbol == 'c') { @@ -128,7 +128,7 @@ struct Relation { generated_variables.set(variable); generator.set("variable"sv, move(variable)); generator.set("operand"sv, Locale::PluralOperands::symbol_to_variable_name(symbol)); - generator.set("modulus"sv, String::number(*modulus)); + generator.set("modulus"sv, DeprecatedString::number(*modulus)); if (Locale::PluralOperands::symbol_requires_floating_point_modulus(symbol)) { generator.append(R"~~~( @@ -145,8 +145,8 @@ struct Relation { Vector comparators; private: - mutable Optional cached_modulus_variable_name; - mutable Optional cached_exponential_variable_name; + mutable Optional cached_modulus_variable_name; + mutable Optional cached_exponential_variable_name; }; struct Condition { @@ -171,7 +171,7 @@ struct Condition { } } - void generate_precomputed_variables(SourceGenerator& generator, HashTable& generated_variables) const + void generate_precomputed_variables(SourceGenerator& generator, HashTable& generated_variables) const { for (auto const& conjunctions : relations) { for (auto const& relation : conjunctions) @@ -183,18 +183,18 @@ struct Condition { }; struct Range { - String start; - String end; - String category; + DeprecatedString start; + DeprecatedString end; + DeprecatedString category; }; -using Conditions = HashMap; +using Conditions = HashMap; using Ranges = Vector; struct LocaleData { - static String generated_method_name(StringView form, StringView locale) + static DeprecatedString generated_method_name(StringView form, StringView locale) { - return String::formatted("{}_plurality_{}", form, format_identifier({}, locale)); + return DeprecatedString::formatted("{}_plurality_{}", form, format_identifier({}, locale)); } Conditions& rules_for_form(StringView form) @@ -214,7 +214,7 @@ struct LocaleData { struct CLDR { UniqueStringStorage unique_strings; - HashMap locales; + HashMap locales; }; static Relation parse_relation(StringView relation) @@ -322,7 +322,7 @@ static void parse_condition(StringView category, StringView rule, Conditions& ru }); } -static ErrorOr parse_plural_rules(String core_supplemental_path, StringView file_name, CLDR& cldr) +static ErrorOr parse_plural_rules(DeprecatedString core_supplemental_path, StringView file_name, CLDR& cldr) { static constexpr auto form_prefix = "plurals-type-"sv; static constexpr auto rule_prefix = "pluralRule-count-"sv; @@ -357,7 +357,7 @@ static ErrorOr parse_plural_rules(String core_supplemental_path, StringVie } // https://unicode.org/reports/tr35/tr35-numbers.html#Plural_Ranges -static ErrorOr parse_plural_ranges(String core_supplemental_path, CLDR& cldr) +static ErrorOr parse_plural_ranges(DeprecatedString core_supplemental_path, CLDR& cldr) { static constexpr auto start_segment = "-start-"sv; static constexpr auto end_segment = "-end-"sv; @@ -393,7 +393,7 @@ static ErrorOr parse_plural_ranges(String core_supplemental_path, CLDR& cl return {}; } -static ErrorOr parse_all_locales(String core_path, String locale_names_path, CLDR& cldr) +static ErrorOr parse_all_locales(DeprecatedString core_path, DeprecatedString locale_names_path, CLDR& cldr) { auto identity_iterator = TRY(path_to_dir_iterator(move(locale_names_path))); @@ -401,7 +401,7 @@ static ErrorOr parse_all_locales(String core_path, String locale_names_pat core_supplemental_path = core_supplemental_path.append("supplemental"sv); VERIFY(Core::File::is_directory(core_supplemental_path.string())); - auto remove_variants_from_path = [&](String path) -> ErrorOr { + auto remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr { auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path))); StringBuilder builder; @@ -486,7 +486,7 @@ static PluralCategory default_range(PluralCategory, PluralCategory end) return; generator.set("method"sv, LocaleData::generated_method_name(form, locale)); - HashTable generated_variables; + HashTable generated_variables; generator.append(R"~~~( static PluralCategory @method@([[maybe_unused]] PluralOperands ops) @@ -541,7 +541,7 @@ static PluralCategory @method@(PluralCategory start, PluralCategory end) generator.set("type"sv, type); generator.set("form"sv, form); generator.set("default"sv, default_); - generator.set("size"sv, String::number(locales.size())); + generator.set("size"sv, DeprecatedString::number(locales.size())); generator.append(R"~~~( static constexpr Array<@type@, @size@> s_@form@_functions { {)~~~"); @@ -566,7 +566,7 @@ static constexpr Array<@type@, @size@> s_@form@_functions { {)~~~"); auto append_categories = [&](auto const& name, auto const& rules) { generator.set("name", name); - generator.set("size", String::number(rules.size() + 1)); + generator.set("size", DeprecatedString::number(rules.size() + 1)); generator.append(R"~~~( static constexpr Array @name@ { { PluralCategory::Other)~~~"); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateRelativeTimeFormatData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateRelativeTimeFormatData.cpp index b1bf7bdc05a..8673f3fe1d1 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateRelativeTimeFormatData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibLocale/GenerateRelativeTimeFormatData.cpp @@ -5,6 +5,7 @@ */ #include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common. +#include #include #include #include @@ -12,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -40,9 +40,9 @@ struct RelativeTimeFormat { && (pattern == other.pattern); } - String time_unit; - String style; - String plurality; + DeprecatedString time_unit; + DeprecatedString style; + DeprecatedString plurality; size_t tense_or_number { 0 }; size_t pattern { 0 }; }; @@ -74,10 +74,10 @@ struct CLDR { UniqueStringStorage unique_strings; UniqueStorage unique_formats; - HashMap locales; + HashMap locales; }; -static ErrorOr parse_date_fields(String locale_dates_path, CLDR& cldr, LocaleData& locale) +static ErrorOr parse_date_fields(DeprecatedString locale_dates_path, CLDR& cldr, LocaleData& locale) { LexicalPath date_fields_path(move(locale_dates_path)); date_fields_path = date_fields_path.append("dateFields.json"sv); @@ -136,11 +136,11 @@ static ErrorOr parse_date_fields(String locale_dates_path, CLDR& cldr, Loc return {}; } -static ErrorOr parse_all_locales(String dates_path, CLDR& cldr) +static ErrorOr parse_all_locales(DeprecatedString dates_path, CLDR& cldr) { auto dates_iterator = TRY(path_to_dir_iterator(move(dates_path))); - auto remove_variants_from_path = [&](String path) -> ErrorOr { + auto remove_variants_from_path = [&](DeprecatedString path) -> ErrorOr { auto parsed_locale = TRY(CanonicalLanguageID::parse(cldr.unique_strings, LexicalPath::basename(path))); StringBuilder builder; @@ -227,9 +227,9 @@ struct RelativeTimeFormatImpl { cldr.unique_formats.generate(generator, "RelativeTimeFormatImpl"sv, "s_relative_time_formats"sv, 10); - auto append_list = [&](String name, auto const& list) { + auto append_list = [&](DeprecatedString name, auto const& list) { generator.set("name", name); - generator.set("size", String::number(list.size())); + generator.set("size", DeprecatedString::number(list.size())); generator.append(R"~~~( static constexpr Array<@relative_time_format_index_type@, @size@> @name@ { {)~~~"); @@ -237,7 +237,7 @@ static constexpr Array<@relative_time_format_index_type@, @size@> @name@ { {)~~~ bool first = true; for (auto index : list) { generator.append(first ? " "sv : ", "sv); - generator.append(String::number(index)); + generator.append(DeprecatedString::number(index)); first = false; } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp index aa331c37dc5..4ae9ab8f072 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibTimeZone/GenerateTimeZoneData.cpp @@ -6,10 +6,10 @@ #include "../LibUnicode/GeneratorUtil.h" // FIXME: Move this somewhere common. #include +#include #include #include #include -#include #include #include #include @@ -36,7 +36,7 @@ struct TimeZoneOffset { i64 offset { 0 }; Optional until; - Optional dst_rule; + Optional dst_rule; Optional dst_rule_index; i64 dst_offset { 0 }; @@ -56,17 +56,17 @@ struct DaylightSavingsOffset { struct TimeZoneData { UniqueStringStorage unique_strings; - HashMap> time_zones; - Vector time_zone_names; + HashMap> time_zones; + Vector time_zone_names; Vector time_zone_aliases; - HashMap> dst_offsets; - Vector dst_offset_names; + HashMap> dst_offsets; + Vector dst_offset_names; - HashMap time_zone_coordinates; + HashMap time_zone_coordinates; - HashMap> time_zone_regions; - Vector time_zone_region_names; + HashMap> time_zone_regions; + Vector time_zone_region_names; }; } @@ -110,10 +110,10 @@ struct AK::Formatter : Formatter { ErrorOr format(FormatBuilder& builder, DaylightSavingsOffset const& dst_offset) { auto format_time = [&](auto year) { - return String::formatted("AK::Time::from_timestamp({}, 1, 1, 0, 0, 0, 0)", year); + return DeprecatedString::formatted("AK::Time::from_timestamp({}, 1, 1, 0, 0, 0, 0)", year); }; - static String max_year_as_time("max_year_as_time"sv); + static DeprecatedString max_year_as_time("max_year_as_time"sv); return Formatter::format(builder, "{{ {}, {}, {}, {}, {} }}"sv, @@ -422,7 +422,7 @@ static void set_dst_rule_indices(TimeZoneData& time_zone_data) } } -static String format_identifier(StringView owner, String identifier) +static DeprecatedString format_identifier(StringView owner, DeprecatedString identifier) { constexpr auto gmt_time_zones = Array { "Etc/GMT"sv, "GMT"sv }; @@ -431,9 +431,9 @@ static String format_identifier(StringView owner, String identifier) auto offset = identifier.substring_view(gmt_time_zone.length()); if (offset.starts_with('+')) - identifier = String::formatted("{}_Ahead_{}", gmt_time_zone, offset.substring_view(1)); + identifier = DeprecatedString::formatted("{}_Ahead_{}", gmt_time_zone, offset.substring_view(1)); else if (offset.starts_with('-')) - identifier = String::formatted("{}_Behind_{}", gmt_time_zone, offset.substring_view(1)); + identifier = DeprecatedString::formatted("{}_Behind_{}", gmt_time_zone, offset.substring_view(1)); } } @@ -441,9 +441,9 @@ static String format_identifier(StringView owner, String identifier) identifier = identifier.replace("/"sv, "_"sv, ReplaceMode::All); if (all_of(identifier, is_ascii_digit)) - return String::formatted("{}_{}", owner[0], identifier); + return DeprecatedString::formatted("{}_{}", owner[0], identifier); if (is_ascii_lower_alpha(identifier[0])) - return String::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1)); + return DeprecatedString::formatted("{:c}{}", to_ascii_uppercase(identifier[0]), identifier.substring_view(1)); return identifier; } @@ -551,14 +551,14 @@ struct DaylightSavingsOffset { auto append_offsets = [&](auto const& name, auto type, auto const& offsets) { generator.set("name", name); generator.set("type", type); - generator.set("size", String::number(offsets.size())); + generator.set("size", DeprecatedString::number(offsets.size())); generator.append(R"~~~( static constexpr Array<@type@, @size@> @name@ { { )~~~"); for (auto const& offset : offsets) - generator.append(String::formatted(" {},\n", offset)); + generator.append(DeprecatedString::formatted(" {},\n", offset)); generator.append("} };\n"); }; @@ -580,7 +580,7 @@ static constexpr Array<@type@, @size@> @name@ { { auto const& time_zones = time_zone_data.time_zone_regions.find(value)->value; generator.set("name", name); - generator.set("size", String::number(time_zones.size())); + generator.set("size", DeprecatedString::number(time_zones.size())); generator.append(R"~~~( static constexpr Array<@string_index_type@, @size@> @name@ { {)~~~"); @@ -588,14 +588,14 @@ static constexpr Array<@string_index_type@, @size@> @name@ { {)~~~"); bool first = true; for (auto const& time_zone : time_zones) { generator.append(first ? " "sv : ", "sv); - generator.append(String::number(time_zone)); + generator.append(DeprecatedString::number(time_zone)); first = false; } generator.append(" } };"); }); - generator.set("size", String::number(time_zone_data.time_zone_names.size())); + generator.set("size", DeprecatedString::number(time_zone_data.time_zone_names.size())); generator.append(R"~~~( static constexpr Array s_time_zone_locations { { )~~~"); @@ -603,12 +603,12 @@ static constexpr Array s_time_zone_locations { { for (auto const& time_zone : time_zone_data.time_zone_names) { auto location = time_zone_data.time_zone_coordinates.get(time_zone).value_or({}); - generator.append(String::formatted(" {},\n", location)); + generator.append(DeprecatedString::formatted(" {},\n", location)); } generator.append("} };\n"); auto append_string_conversions = [&](StringView enum_title, StringView enum_snake, auto const& values, Vector const& aliases = {}) { - HashValueMap hashes; + HashValueMap hashes; hashes.ensure_capacity(values.size()); auto hash = [](auto const& value) { @@ -731,10 +731,10 @@ Optional> get_named_time_zone_offsets(TimeZone time_zone, auto const& time_zone_offset = find_time_zone_offset(time_zone, time); Array named_offsets; - auto format_name = [](auto format, auto offset) -> String { + auto format_name = [](auto format, auto offset) -> DeprecatedString { if (offset == 0) return decode_string(format).replace("{}"sv, ""sv, ReplaceMode::FirstOnly); - return String::formatted(decode_string(format), decode_string(offset)); + return DeprecatedString::formatted(decode_string(format), decode_string(offset)); }; auto set_named_offset = [&](auto& named_offset, auto dst_offset, auto in_dst, auto format, auto offset) { diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp index 485deac41b3..a8f356f686d 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateEmojiData.cpp @@ -6,8 +6,8 @@ #include "GeneratorUtil.h" #include +#include #include -#include #include #include #include @@ -17,13 +17,13 @@ struct Emoji { size_t name { 0 }; - Optional image_path; + Optional image_path; Unicode::EmojiGroup group; - String subgroup; + DeprecatedString subgroup; u32 display_order { 0 }; Vector code_points; - String encoded_code_points; - String status; + DeprecatedString encoded_code_points; + DeprecatedString status; size_t code_point_array_index { 0 }; }; @@ -44,7 +44,7 @@ static void set_image_path_for_emoji(StringView emoji_resource_path, Emoji& emoj builder.appendff("U+{:X}", code_point); } - auto path = String::formatted("{}/{}.png", emoji_resource_path, builder.build()); + auto path = DeprecatedString::formatted("{}/{}.png", emoji_resource_path, builder.build()); if (Core::Stream::File::exists(path)) emoji.image_path = move(path); } @@ -57,7 +57,7 @@ static ErrorOr parse_emoji_test_data(Core::Stream::BufferedFile& file, Emo Array buffer; Unicode::EmojiGroup group; - String subgroup; + DeprecatedString subgroup; u32 display_order { 0 }; while (TRY(file.can_read_line())) { @@ -178,7 +178,7 @@ static ErrorOr generate_emoji_data_implementation(Core::Stream::BufferedFi SourceGenerator generator { builder }; generator.set("string_index_type"sv, emoji_data.unique_strings.type_that_fits()); - generator.set("emojis_size"sv, String::number(emoji_data.emojis.size())); + generator.set("emojis_size"sv, DeprecatedString::number(emoji_data.emojis.size())); generator.append(R"~~~( #include @@ -198,7 +198,7 @@ namespace Unicode { for (auto const& emoji : emoji_data.emojis) { total_code_point_count += emoji.code_points.size(); } - generator.set("total_code_point_count", String::number(total_code_point_count)); + generator.set("total_code_point_count", DeprecatedString::number(total_code_point_count)); generator.append(R"~~~( static constexpr Array s_emoji_code_points { {)~~~"); @@ -207,7 +207,7 @@ static constexpr Array s_emoji_code_points { {)~~ for (auto const& emoji : emoji_data.emojis) { for (auto code_point : emoji.code_points) { generator.append(first ? " "sv : ", "sv); - generator.append(String::formatted("{:#x}", code_point)); + generator.append(DeprecatedString::formatted("{:#x}", code_point)); first = false; } } @@ -245,11 +245,11 @@ struct EmojiData { static constexpr Array s_emojis { {)~~~"); for (auto const& emoji : emoji_data.emojis) { - generator.set("name"sv, String::number(emoji.name)); - generator.set("group"sv, String::number(to_underlying(emoji.group))); - generator.set("display_order"sv, String::number(emoji.display_order)); - generator.set("code_point_start"sv, String::number(emoji.code_point_array_index)); - generator.set("code_point_count"sv, String::number(emoji.code_points.size())); + generator.set("name"sv, DeprecatedString::number(emoji.name)); + generator.set("group"sv, DeprecatedString::number(to_underlying(emoji.group))); + generator.set("display_order"sv, DeprecatedString::number(emoji.display_order)); + generator.set("code_point_start"sv, DeprecatedString::number(emoji.code_point_array_index)); + generator.set("code_point_count"sv, DeprecatedString::number(emoji.code_points.size())); generator.append(R"~~~( { @name@, @group@, @display_order@, @code_point_start@, @code_point_count@ },)~~~"); @@ -312,7 +312,7 @@ static ErrorOr generate_emoji_installation(Core::Stream::BufferedFile& fil generator.append("@emoji@"sv); generator.append(" - "sv); - generator.append(String::join(" "sv, emoji.code_points, "U+{:X}"sv)); + generator.append(DeprecatedString::join(" "sv, emoji.code_points, "U+{:X}"sv)); generator.append(" @name@ (@status@)\n"sv); } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp index d9c16d5fd9f..82cb41784d1 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GenerateUnicodeData.cpp @@ -8,12 +8,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include #include @@ -37,21 +37,21 @@ struct SpecialCasing { Vector lowercase_mapping; Vector uppercase_mapping; Vector titlecase_mapping; - String locale; - String condition; + DeprecatedString locale; + DeprecatedString condition; }; // Field descriptions: https://www.unicode.org/reports/tr44/#Character_Decomposition_Mappings struct CodePointDecomposition { // `tag` is a string since it's used for codegen as an enum value. - String tag { "Canonical"sv }; + DeprecatedString tag { "Canonical"sv }; size_t decomposition_index { 0 }; size_t decomposition_size { 0 }; }; // PropList source: https://www.unicode.org/Public/13.0.0/ucd/PropList.txt // Property descriptions: https://www.unicode.org/reports/tr44/tr44-13.html#PropList.txt -using PropList = HashMap>; +using PropList = HashMap>; // Normalization source: https://www.unicode.org/Public/13.0.0/ucd/DerivedNormalizationProps.txt // Normalization descriptions: https://www.unicode.org/reports/tr44/#DerivedNormalizationProps.txt @@ -67,7 +67,7 @@ struct Normalization { QuickCheck quick_check { QuickCheck::Yes }; }; -using NormalizationProps = HashMap>; +using NormalizationProps = HashMap>; struct CodePointName { CodePointRange code_point_range; @@ -79,17 +79,17 @@ struct CodePointName { // https://www.unicode.org/reports/tr44/#General_Category_Values struct CodePointData { u32 code_point { 0 }; - String name; + DeprecatedString name; Optional abbreviation; u8 canonical_combining_class { 0 }; - String bidi_class; + DeprecatedString bidi_class; Optional decomposition_mapping; Optional numeric_value_decimal; Optional numeric_value_digit; Optional numeric_value_numeric; bool bidi_mirrored { false }; - String unicode_1_name; - String iso_comment; + DeprecatedString unicode_1_name; + DeprecatedString iso_comment; Optional simple_uppercase_mapping; Optional simple_lowercase_mapping; Optional simple_titlecase_mapping; @@ -108,7 +108,7 @@ struct UnicodeData { u32 code_points_with_decomposition_mapping { 0 }; Vector decomposition_mappings; - Vector compatibility_tags; + Vector compatibility_tags; u32 simple_uppercase_mapping_size { 0 }; u32 simple_lowercase_mapping_size { 0 }; @@ -117,8 +117,8 @@ struct UnicodeData { u32 code_points_with_special_casing { 0 }; u32 largest_casing_transform_size { 0 }; u32 largest_special_casing_size { 0 }; - Vector conditions; - Vector locales; + Vector conditions; + Vector locales; Vector code_point_data; @@ -159,7 +159,7 @@ struct UnicodeData { PropList sentence_break_props; }; -static String sanitize_entry(String const& entry) +static DeprecatedString sanitize_entry(DeprecatedString const& entry) { auto sanitized = entry.replace("-"sv, "_"sv, ReplaceMode::All); sanitized = sanitized.replace(" "sv, "_"sv, ReplaceMode::All); @@ -243,7 +243,7 @@ static ErrorOr parse_special_casing(Core::Stream::BufferedFile& file, Unic } if (!casing.locale.is_empty()) { - casing.locale = String::formatted("{:c}{}", to_ascii_uppercase(casing.locale[0]), casing.locale.substring_view(1)); + casing.locale = DeprecatedString::formatted("{:c}{}", to_ascii_uppercase(casing.locale[0]), casing.locale.substring_view(1)); if (!unicode_data.locales.contains_slow(casing.locale)) unicode_data.locales.append(casing.locale); @@ -313,7 +313,7 @@ static ErrorOr parse_prop_list(Core::Stream::BufferedFile& file, PropList& static ErrorOr parse_alias_list(Core::Stream::BufferedFile& file, PropList const& prop_list, Vector& prop_aliases) { - String current_property; + DeprecatedString current_property; Array buffer; auto append_alias = [&](auto alias, auto property) { @@ -388,7 +388,7 @@ static ErrorOr parse_name_aliases(Core::Stream::BufferedFile& file, Unicod return {}; } -static ErrorOr parse_value_alias_list(Core::Stream::BufferedFile& file, StringView desired_category, Vector const& value_list, Vector& prop_aliases, bool primary_value_is_first = true, bool sanitize_alias = false) +static ErrorOr parse_value_alias_list(Core::Stream::BufferedFile& file, StringView desired_category, Vector const& value_list, Vector& prop_aliases, bool primary_value_is_first = true, bool sanitize_alias = false) { TRY(file.seek(0, Core::Stream::SeekMode::SetPosition)); Array buffer; @@ -553,7 +553,7 @@ static Optional parse_decomposition_mapping(StringView s if (parts.first().starts_with('<')) { auto const tag = parts.take_first().trim("<>"sv); - mapping.tag = String::formatted("{:c}{}", to_ascii_uppercase(tag[0]), tag.substring_view(1)); + mapping.tag = DeprecatedString::formatted("{:c}{}", to_ascii_uppercase(tag[0]), tag.substring_view(1)); if (!unicode_data.compatibility_tags.contains_slow(mapping.tag)) unicode_data.compatibility_tags.append(mapping.tag); @@ -689,14 +689,14 @@ static ErrorOr generate_unicode_data_header(Core::Stream::BufferedFile& fi { StringBuilder builder; SourceGenerator generator { builder }; - generator.set("casing_transform_size", String::number(unicode_data.largest_casing_transform_size)); + generator.set("casing_transform_size", DeprecatedString::number(unicode_data.largest_casing_transform_size)); - auto generate_enum = [&](StringView name, StringView default_, Vector values, Vector aliases = {}) { + auto generate_enum = [&](StringView name, StringView default_, Vector values, Vector aliases = {}) { quick_sort(values); quick_sort(aliases, [](auto& alias1, auto& alias2) { return alias1.alias < alias2.alias; }); generator.set("name", name); - generator.set("underlying", String::formatted("{}UnderlyingType", name)); + generator.set("underlying", DeprecatedString::formatted("{}UnderlyingType", name)); generator.set("type", ((values.size() + !default_.is_empty()) < 256) ? "u8"sv : "u16"sv); generator.append(R"~~~( @@ -793,8 +793,8 @@ static ErrorOr generate_unicode_data_implementation(Core::Stream::Buffered SourceGenerator generator { builder }; generator.set("string_index_type"sv, unicode_data.unique_strings.type_that_fits()); - generator.set("largest_special_casing_size", String::number(unicode_data.largest_special_casing_size)); - generator.set("special_casing_size", String::number(unicode_data.special_casing.size())); + generator.set("largest_special_casing_size", DeprecatedString::number(unicode_data.largest_special_casing_size)); + generator.set("special_casing_size", DeprecatedString::number(unicode_data.special_casing.size())); generator.append(R"~~~( #include @@ -802,7 +802,7 @@ static ErrorOr generate_unicode_data_implementation(Core::Stream::Buffered #include #include #include -#include +#include #include #include #include @@ -823,17 +823,17 @@ namespace Unicode { generator.append(", {"); for (auto const& item : list) { generator.append(first ? " "sv : ", "sv); - generator.append(String::formatted(format, item)); + generator.append(DeprecatedString::formatted(format, item)); first = false; } - generator.append(String::formatted(" }}, {}", list.size())); + generator.append(DeprecatedString::formatted(" }}, {}", list.size())); }; generator.append(R"~~~( static constexpr Array s_special_casing { {)~~~"); for (auto const& casing : unicode_data.special_casing) { - generator.set("code_point", String::formatted("{:#x}", casing.code_point)); + generator.set("code_point", DeprecatedString::formatted("{:#x}", casing.code_point)); generator.append(R"~~~( { @code_point@)~~~"); @@ -910,15 +910,15 @@ struct CodePointNameComparator : public CodePointRangeComparator { }; )~~~"); - generator.set("decomposition_mappings_size", String::number(unicode_data.decomposition_mappings.size())); + generator.set("decomposition_mappings_size", DeprecatedString::number(unicode_data.decomposition_mappings.size())); generator.append("\nstatic constexpr Array s_decomposition_mappings_data { "); - generator.append(String::join(", "sv, unicode_data.decomposition_mappings, "{:#x}"sv)); + generator.append(DeprecatedString::join(", "sv, unicode_data.decomposition_mappings, "{:#x}"sv)); generator.append(" };\n"); auto append_code_point_mappings = [&](StringView name, StringView mapping_type, u32 size, auto mapping_getter) { generator.set("name", name); generator.set("mapping_type", mapping_type); - generator.set("size", String::number(size)); + generator.set("size", DeprecatedString::number(size)); generator.append(R"~~~( static constexpr Array<@mapping_type@, @size@> s_@name@_mappings { { @@ -941,16 +941,16 @@ static constexpr Array<@mapping_type@, @size@> s_@name@_mappings { { if (mappings_in_current_row++ > 0) generator.append(" "); - generator.set("code_point", String::formatted("{:#x}", data.code_point)); + generator.set("code_point", DeprecatedString::formatted("{:#x}", data.code_point)); generator.append("{ @code_point@"); if constexpr (IsSame> || IsSame>) { - generator.set("mapping", String::formatted("{:#x}", *mapping)); + generator.set("mapping", DeprecatedString::formatted("{:#x}", *mapping)); generator.append(", @mapping@ },"); } else if constexpr (IsSame>) { generator.set("tag", mapping->tag); - generator.set("start", String::number(mapping->decomposition_index)); - generator.set("size", String::number(mapping->decomposition_size)); + generator.set("start", DeprecatedString::number(mapping->decomposition_index)); + generator.set("size", DeprecatedString::number(mapping->decomposition_size)); generator.append(", CompatibilityFormattingTag::@tag@, @start@, @size@ },"); } else { append_list_and_size(data.special_casing_indices, "&s_special_casing[{}]"sv); @@ -983,9 +983,9 @@ static constexpr Array<@mapping_type@, @size@> s_@name@_mappings { { return data.decomposition_mapping; }); - auto append_code_point_range_list = [&](String name, Vector const& ranges) { + auto append_code_point_range_list = [&](DeprecatedString name, Vector const& ranges) { generator.set("name", name); - generator.set("size", String::number(ranges.size())); + generator.set("size", DeprecatedString::number(ranges.size())); generator.append(R"~~~( static constexpr Array @name@ { { )~~~"); @@ -997,8 +997,8 @@ static constexpr Array @name@ { { if (ranges_in_current_row++ > 0) generator.append(" "); - generator.set("first", String::formatted("{:#x}", range.first)); - generator.set("last", String::formatted("{:#x}", range.last)); + generator.set("first", DeprecatedString::formatted("{:#x}", range.first)); + generator.set("last", DeprecatedString::formatted("{:#x}", range.last)); generator.append("{ @first@, @last@ },"); if (ranges_in_current_row == max_ranges_per_row) { @@ -1014,7 +1014,7 @@ static constexpr Array @name@ { { auto append_prop_list = [&](StringView collection_name, StringView property_format, PropList const& property_list) { for (auto const& property : property_list) { - auto name = String::formatted(property_format, property.key); + auto name = DeprecatedString::formatted(property_format, property.key); append_code_point_range_list(move(name), property.value); } @@ -1022,12 +1022,12 @@ static constexpr Array @name@ { { quick_sort(property_names); generator.set("name", collection_name); - generator.set("size", String::number(property_names.size())); + generator.set("size", DeprecatedString::number(property_names.size())); generator.append(R"~~~( static constexpr Array, @size@> @name@ { {)~~~"); for (auto const& property_name : property_names) { - generator.set("name", String::formatted(property_format, property_name)); + generator.set("name", DeprecatedString::formatted(property_format, property_name)); generator.append(R"~~~( @name@.span(),)~~~"); } @@ -1052,7 +1052,7 @@ static constexpr Array, @size@> @name@ { {)~~~"); generator.set("type", type); generator.set("name", name); - generator.set("size", String::number(display_names.size())); + generator.set("size", DeprecatedString::number(display_names.size())); generator.append(R"~~~( static constexpr Array<@type@, @size@> @name@ { { @@ -1061,9 +1061,9 @@ static constexpr Array<@type@, @size@> @name@ { { if (values_in_current_row++ > 0) generator.append(", "); - generator.set("first", String::formatted("{:#x}", display_name.code_point_range.first)); - generator.set("last", String::formatted("{:#x}", display_name.code_point_range.last)); - generator.set("name", String::number(display_name.name)); + generator.set("first", DeprecatedString::formatted("{:#x}", display_name.code_point_range.first)); + generator.set("last", DeprecatedString::formatted("{:#x}", display_name.code_point_range.last)); + generator.set("name", DeprecatedString::number(display_name.name)); generator.append("{ { @first@, @last@ }, @name@ }"); if (values_in_current_row == max_values_per_row) { @@ -1104,13 +1104,13 @@ Span block_display_names() return display_names.span(); } -Optional code_point_display_name(u32 code_point) +Optional code_point_display_name(u32 code_point) { if (auto const* entry = binary_search(s_code_point_display_names, code_point, nullptr, CodePointNameComparator {})) { auto display_name = decode_string(entry->display_name); if (display_name.ends_with("{:X}"sv)) - return String::formatted(display_name, code_point); + return DeprecatedString::formatted(display_name, code_point); return display_name; } @@ -1197,7 +1197,7 @@ bool code_point_has_@enum_snake@(u32 code_point, @enum_title@ @enum_snake@) ValueFromStringOptions options {}; for (auto const& prop : prop_list) { - if constexpr (IsSame, String>) { + if constexpr (IsSame, DeprecatedString>) { hashes.set(CaseInsensitiveStringViewTraits::hash(prop), prop); options.sensitivity = CaseSensitivity::CaseInsensitive; } else { diff --git a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h index 1c28e08bca7..9a8753e9806 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h +++ b/Meta/Lagom/Tools/CodeGenerators/LibUnicode/GeneratorUtil.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -15,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -102,7 +102,7 @@ public: { generator.set("type"sv, type); generator.set("name"sv, name); - generator.set("size"sv, String::number(m_storage.size())); + generator.set("size"sv, DeprecatedString::number(m_storage.size())); generator.append(R"~~~( static constexpr Array<@type@, @size@ + 1> @name@ { { @@ -114,10 +114,10 @@ static constexpr Array<@type@, @size@ + 1> @name@ { { if (values_in_current_row++ > 0) generator.append(", "); - if constexpr (IsSame) - generator.append(String::formatted("\"{}\"sv", value)); + if constexpr (IsSame) + generator.append(DeprecatedString::formatted("\"{}\"sv", value)); else - generator.append(String::formatted("{}", value)); + generator.append(DeprecatedString::formatted("{}", value)); if (values_in_current_row == max_values_per_row) { values_in_current_row = 0; @@ -139,8 +139,8 @@ static constexpr Array<@type@, @size@ + 1> @name@ { { for (size_t i = 0; i < m_storage.size(); ++i) { auto const& list = m_storage[i]; - generator.set("index"sv, String::number(i)); - generator.set("size"sv, String::number(list.size())); + generator.set("index"sv, DeprecatedString::number(i)); + generator.set("size"sv, DeprecatedString::number(list.size())); generator.append(R"~~~( static constexpr Array<@type@, @size@> @name@@index@ { {)~~~"); @@ -148,14 +148,14 @@ static constexpr Array<@type@, @size@> @name@@index@ { {)~~~"); bool first = true; for (auto const& value : list) { generator.append(first ? " "sv : ", "sv); - generator.append(String::formatted("{}", value)); + generator.append(DeprecatedString::formatted("{}", value)); first = false; } generator.append(" } };"); } - generator.set("size"sv, String::number(m_storage.size())); + generator.set("size"sv, DeprecatedString::number(m_storage.size())); generator.append(R"~~~( @@ -169,7 +169,7 @@ static constexpr Array, @size@ + 1> @name@ { { if (values_in_current_row++ > 0) generator.append(", "); - generator.set("index"sv, String::number(i)); + generator.set("index"sv, DeprecatedString::number(i)); generator.append("@name@@index@.span()"); if (values_in_current_row == max_values_per_row) { @@ -188,8 +188,8 @@ protected: HashMap m_storage_indices; }; -class UniqueStringStorage : public UniqueStorage { - using Base = UniqueStorage; +class UniqueStringStorage : public UniqueStorage { + using Base = UniqueStorage; public: // The goal of the string table generator is to ensure the table is located within the read-only @@ -205,7 +205,7 @@ public: if (values_in_current_row++ > 0) generator.append(", "); - generator.append(String::formatted("{:#x}", value)); + generator.append(DeprecatedString::formatted("{:#x}", value)); if (values_in_current_row == max_values_per_row) { values_in_current_row = 0; @@ -225,7 +225,7 @@ public: next_index += string.length() + 2; } - generator.set("size", String::number(next_index)); + generator.set("size", DeprecatedString::number(next_index)); generator.append(R"~~~( static constexpr Array s_encoded_strings { { )~~~"); @@ -243,7 +243,7 @@ static constexpr Array s_encoded_strings { { } }; )~~~"); - generator.set("size", String::number(string_indices.size())); + generator.set("size", DeprecatedString::number(string_indices.size())); generator.append(R"~~~( static constexpr Array s_encoded_string_indices { { )~~~"); @@ -277,8 +277,8 @@ static constexpr StringView decode_string(size_t index) }; struct Alias { - String name; - String alias; + DeprecatedString name; + DeprecatedString alias; }; struct CanonicalLanguageID { @@ -342,7 +342,7 @@ inline ErrorOr read_json_file(StringView path) return JsonValue::from_string(buffer); } -inline ErrorOr path_to_dir_iterator(String path, StringView subpath = "main"sv) +inline ErrorOr path_to_dir_iterator(DeprecatedString path, StringView subpath = "main"sv) { LexicalPath lexical_path(move(path)); if (!subpath.is_empty()) @@ -359,7 +359,7 @@ inline ErrorOr path_to_dir_iterator(String path, StringView s return iterator; } -inline ErrorOr next_path_from_dir_iterator(Core::DirIterator& iterator) +inline ErrorOr next_path_from_dir_iterator(Core::DirIterator& iterator) { auto next_path = iterator.next_full_path(); if (iterator.has_error()) { @@ -416,11 +416,11 @@ void generate_value_from_string(SourceGenerator& generator, StringView method_na { ensure_from_string_types_are_generated(generator); - generator.set("method_name", String::formatted(method_name_format, value_name)); + generator.set("method_name", DeprecatedString::formatted(method_name_format, value_name)); generator.set("value_type", value_type); generator.set("value_name", value_name); generator.set("return_type", options.return_type.has_value() ? *options.return_type : value_type); - generator.set("size", String::number(hashes.size())); + generator.set("size", DeprecatedString::number(hashes.size())); generator.append(R"~~~( Optional<@return_type@> @method_name@(StringView key) @@ -439,11 +439,11 @@ Optional<@return_type@> @method_name@(StringView key) generator.append(" "); if constexpr (IsIntegral) - generator.set("value"sv, String::number(hashes.get(hash_key).value())); + generator.set("value"sv, DeprecatedString::number(hashes.get(hash_key).value())); else - generator.set("value"sv, String::formatted("{}::{}", value_type, hashes.get(hash_key).value())); + generator.set("value"sv, DeprecatedString::formatted("{}::{}", value_type, hashes.get(hash_key).value())); - generator.set("hash"sv, String::number(hash_key)); + generator.set("hash"sv, DeprecatedString::number(hash_key)); generator.append("{ @hash@U, @value@ },"sv); if (values_in_current_row == max_values_per_row) { @@ -452,7 +452,7 @@ Optional<@return_type@> @method_name@(StringView key) } } - generator.set("return_statement", String::formatted(options.return_format, "value->value"sv)); + generator.set("return_statement", DeprecatedString::formatted(options.return_format, "value->value"sv)); generator.append(R"~~~( } }; )~~~"); @@ -476,9 +476,9 @@ Optional<@return_type@> @method_name@(StringView key) } template -void generate_value_to_string(SourceGenerator& generator, StringView method_name_format, StringView value_type, StringView value_name, IdentifierFormatter&& format_identifier, Span values) +void generate_value_to_string(SourceGenerator& generator, StringView method_name_format, StringView value_type, StringView value_name, IdentifierFormatter&& format_identifier, Span values) { - generator.set("method_name", String::formatted(method_name_format, value_name)); + generator.set("method_name", DeprecatedString::formatted(method_name_format, value_name)); generator.set("value_type", value_type); generator.set("value_name", value_name); @@ -506,7 +506,7 @@ StringView @method_name@(@value_type@ @value_name@) } template -void generate_enum(SourceGenerator& generator, IdentifierFormatter&& format_identifier, StringView name, StringView default_, Vector& values, Vector aliases = {}) +void generate_enum(SourceGenerator& generator, IdentifierFormatter&& format_identifier, StringView name, StringView default_, Vector& values, Vector aliases = {}) { quick_sort(values, [](auto const& value1, auto const& value2) { return value1.to_lowercase() < value2.to_lowercase(); }); quick_sort(aliases, [](auto const& alias1, auto const& alias2) { return alias1.alias.to_lowercase() < alias2.alias.to_lowercase(); }); @@ -545,20 +545,20 @@ template) mapping_name = name.replace("-"sv, "_"sv, ReplaceMode::All); else mapping_name = format_identifier(type, name); - return String::formatted(format, mapping_name.to_lowercase()); + return DeprecatedString::formatted(format, mapping_name.to_lowercase()); }; - Vector mapping_names; + Vector mapping_names; for (auto const& locale : locales) { - String mapping_name; + DeprecatedString mapping_name; if constexpr (requires { locale.key; }) { mapping_name = format_mapping_name(format, locale.key); @@ -575,7 +575,7 @@ void generate_mapping(SourceGenerator& generator, LocalesType const& locales, St generator.set("type", type); generator.set("name", name); - generator.set("size", String::number(locales.size())); + generator.set("size", DeprecatedString::number(locales.size())); generator.append(R"~~~( static constexpr Array, @size@> @name@ { { )~~~"); @@ -620,9 +620,9 @@ Span @name@() first = false; if (auto it = aliases.find_if([&](auto const& alias) { return alias.alias == value; }); it != aliases.end()) - generator.append(String::formatted("\"{}\"sv", it->name)); + generator.append(DeprecatedString::formatted("\"{}\"sv", it->name)); else - generator.append(String::formatted("\"{}\"sv", value)); + generator.append(DeprecatedString::formatted("\"{}\"sv", value)); } generator.append(R"~~~( }; diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index a316d696a94..5ceab3934df 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -69,7 +69,7 @@ static StringView sequence_storage_type_to_cpp_storage_type_name(SequenceStorage CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface); -static String union_type_to_variant(UnionType const& union_type, Interface const& interface) +static DeprecatedString union_type_to_variant(UnionType const& union_type, Interface const& interface) { StringBuilder builder; builder.append("Variant<"sv); @@ -95,10 +95,10 @@ static String union_type_to_variant(UnionType const& union_type, Interface const CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface) { if (is_platform_object(type)) - return { .name = String::formatted("JS::Handle<{}>", type.name()), .sequence_storage_type = SequenceStorageType::MarkedVector }; + return { .name = DeprecatedString::formatted("JS::Handle<{}>", type.name()), .sequence_storage_type = SequenceStorageType::MarkedVector }; if (type.is_string()) - return { .name = "String", .sequence_storage_type = SequenceStorageType::Vector }; + return { .name = "DeprecatedString", .sequence_storage_type = SequenceStorageType::Vector }; if (type.name() == "double" && !type.is_nullable()) return { .name = "double", .sequence_storage_type = SequenceStorageType::Vector }; @@ -139,7 +139,7 @@ CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface) if (sequence_cpp_type.sequence_storage_type == SequenceStorageType::MarkedVector) return { .name = storage_type_name, .sequence_storage_type = SequenceStorageType::Vector }; - return { .name = String::formatted("{}<{}>", storage_type_name, sequence_cpp_type.name), .sequence_storage_type = SequenceStorageType::Vector }; + return { .name = DeprecatedString::formatted("{}<{}>", storage_type_name, sequence_cpp_type.name), .sequence_storage_type = SequenceStorageType::Vector }; } if (type.name() == "record") { @@ -149,7 +149,7 @@ CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface) auto record_key_cpp_type = idl_type_name_to_cpp_type(record_key_type, interface); auto record_value_cpp_type = idl_type_name_to_cpp_type(record_value_type, interface); - return { .name = String::formatted("OrderedHashMap<{}, {}>", record_key_cpp_type.name, record_value_cpp_type.name), .sequence_storage_type = SequenceStorageType::Vector }; + return { .name = DeprecatedString::formatted("OrderedHashMap<{}, {}>", record_key_cpp_type.name, record_value_cpp_type.name), .sequence_storage_type = SequenceStorageType::Vector }; } if (is(type)) { @@ -168,7 +168,7 @@ CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface) TODO(); } -static String make_input_acceptable_cpp(String const& input) +static DeprecatedString make_input_acceptable_cpp(DeprecatedString const& input) { if (input.is_one_of("class", "template", "for", "default", "char", "namespace", "delete", "inline")) { StringBuilder builder; @@ -206,7 +206,7 @@ static void generate_include_for(auto& generator, auto& path) } LexicalPath include_path { path_string }; - forked_generator.set("include.path", String::formatted("{}/{}.h", include_path.dirname(), include_path.title())); + forked_generator.set("include.path", DeprecatedString::formatted("{}/{}.h", include_path.dirname(), include_path.title())); forked_generator.append(R"~~~( #include <@include.path@> )~~~"); @@ -215,7 +215,7 @@ static void generate_include_for(auto& generator, auto& path) static void emit_includes_for_all_imports(auto& interface, auto& generator, bool is_iterator = false) { Queue const*> interfaces; - HashTable paths_imported; + HashTable paths_imported; interfaces.enqueue(&interface); @@ -236,15 +236,15 @@ static void emit_includes_for_all_imports(auto& interface, auto& generator, bool generate_include_for(generator, interface->module_own_path); if (is_iterator) { - auto iterator_name = String::formatted("{}Iterator", interface->name); - auto iterator_path = String::formatted("{}Iterator", interface->fully_qualified_name.replace("::"sv, "/"sv, ReplaceMode::All)); + auto iterator_name = DeprecatedString::formatted("{}Iterator", interface->name); + auto iterator_path = DeprecatedString::formatted("{}Iterator", interface->fully_qualified_name.replace("::"sv, "/"sv, ReplaceMode::All)); generate_include_for_iterator(generator, iterator_path, iterator_name); } } } template -static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter, String const& js_name, String const& js_suffix, String const& cpp_name, IDL::Interface const& interface, bool legacy_null_to_empty_string = false, bool optional = false, Optional optional_default_value = {}, bool variadic = false, size_t recursion_depth = 0) +static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter, DeprecatedString const& js_name, DeprecatedString const& js_suffix, DeprecatedString const& cpp_name, IDL::Interface const& interface, bool legacy_null_to_empty_string = false, bool optional = false, Optional optional_default_value = {}, bool variadic = false, size_t recursion_depth = 0) { auto scoped_generator = generator.fork(); auto acceptable_cpp_name = make_input_acceptable_cpp(cpp_name); @@ -261,7 +261,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter if (parameter.type->is_string()) { if (variadic) { scoped_generator.append(R"~~~( - Vector @cpp_name@; + Vector @cpp_name@; @cpp_name@.ensure_capacity(vm.argument_count() - @js_suffix@); for (size_t i = @js_suffix@; i < vm.argument_count(); ++i) { @@ -272,26 +272,26 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter } else if (!optional) { if (!parameter.type->is_nullable()) { scoped_generator.append(R"~~~( - String @cpp_name@; + DeprecatedString @cpp_name@; if (@js_name@@js_suffix@.is_null() && @legacy_null_to_empty_string@) { - @cpp_name@ = String::empty(); + @cpp_name@ = DeprecatedString::empty(); } else { @cpp_name@ = TRY(@js_name@@js_suffix@.to_string(vm)); } )~~~"); } else { scoped_generator.append(R"~~~( - String @cpp_name@; + DeprecatedString @cpp_name@; if (!@js_name@@js_suffix@.is_nullish()) @cpp_name@ = TRY(@js_name@@js_suffix@.to_string(vm)); )~~~"); } } else { scoped_generator.append(R"~~~( - String @cpp_name@; + DeprecatedString @cpp_name@; if (!@js_name@@js_suffix@.is_undefined()) { if (@js_name@@js_suffix@.is_null() && @legacy_null_to_empty_string@) - @cpp_name@ = String::empty(); + @cpp_name@ = DeprecatedString::empty(); else @cpp_name@ = TRY(@js_name@@js_suffix@.to_string(vm)); })~~~"); @@ -573,7 +573,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter auto default_value_cpp_name = enumeration.translated_cpp_names.get(enum_member_name); VERIFY(default_value_cpp_name.has_value()); enum_generator.set("enum.default.cpp_value", *default_value_cpp_name); - enum_generator.set("js_name.as_string", String::formatted("{}{}_string", enum_generator.get("js_name"sv), enum_generator.get("js_suffix"sv))); + enum_generator.set("js_name.as_string", DeprecatedString::formatted("{}{}_string", enum_generator.get("js_name"sv), enum_generator.get("js_suffix"sv))); enum_generator.append(R"~~~( @parameter.type.name@ @cpp_name@ { @parameter.type.name@::@enum.default.cpp_value@ }; )~~~"); @@ -634,8 +634,8 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter for (auto& member : current_dictionary->members) { dictionary_generator.set("member_key", member.name); auto member_js_name = make_input_acceptable_cpp(member.name.to_snakecase()); - auto member_value_name = String::formatted("{}_value", member_js_name); - auto member_property_value_name = String::formatted("{}_property_value", member_js_name); + auto member_value_name = DeprecatedString::formatted("{}_value", member_js_name); + auto member_property_value_name = DeprecatedString::formatted("{}_property_value", member_js_name); dictionary_generator.set("member_name", member_js_name); dictionary_generator.set("member_value_name", member_value_name); dictionary_generator.set("member_property_value_name", member_property_value_name); @@ -705,7 +705,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter auto sequence_generator = scoped_generator.fork(); auto& parameterized_type = verify_cast(*parameter.type); - sequence_generator.set("recursion_depth", String::number(recursion_depth)); + sequence_generator.set("recursion_depth", DeprecatedString::number(recursion_depth)); // An ECMAScript value V is converted to an IDL sequence value as follows: // 1. If Type(V) is not Object, throw a TypeError. @@ -757,7 +757,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter return vm.throw_completion(JS::ErrorType::NotIterable, @js_name@@js_suffix@.to_string_without_side_effects()); )~~~"); - parameterized_type.generate_sequence_from_iterable(sequence_generator, String::formatted("{}{}", acceptable_cpp_name, optional ? "_non_optional" : ""), String::formatted("{}{}", js_name, js_suffix), String::formatted("iterator_method{}", recursion_depth), interface, recursion_depth + 1); + parameterized_type.generate_sequence_from_iterable(sequence_generator, DeprecatedString::formatted("{}{}", acceptable_cpp_name, optional ? "_non_optional" : ""), DeprecatedString::formatted("{}{}", js_name, js_suffix), DeprecatedString::formatted("iterator_method{}", recursion_depth), interface, recursion_depth + 1); if (optional) { sequence_generator.append(R"~~~( @@ -770,7 +770,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter auto record_generator = scoped_generator.fork(); auto& parameterized_type = verify_cast(*parameter.type); - record_generator.set("recursion_depth", String::number(recursion_depth)); + record_generator.set("recursion_depth", DeprecatedString::number(recursion_depth)); // A record can only have two types: key type and value type. VERIFY(parameterized_type.parameters().size() == 2); @@ -820,7 +820,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter )~~~"); IDL::Parameter key_parameter { .type = parameterized_type.parameters()[0], .name = acceptable_cpp_name, .optional_default_value = {}, .extended_attributes = {} }; - generate_to_cpp(record_generator, key_parameter, "key", String::number(recursion_depth), String::formatted("typed_key{}", recursion_depth), interface, false, false, {}, false, recursion_depth + 1); + generate_to_cpp(record_generator, key_parameter, "key", DeprecatedString::number(recursion_depth), DeprecatedString::formatted("typed_key{}", recursion_depth), interface, false, false, {}, false, recursion_depth + 1); record_generator.append(R"~~~( auto value@recursion_depth@ = TRY(@js_name@@js_suffix@_object.get(property_key@recursion_depth@)); @@ -828,7 +828,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter // FIXME: Record value types should be TypeWithExtendedAttributes, which would allow us to get [LegacyNullToEmptyString] here. IDL::Parameter value_parameter { .type = parameterized_type.parameters()[1], .name = acceptable_cpp_name, .optional_default_value = {}, .extended_attributes = {} }; - generate_to_cpp(record_generator, value_parameter, "value", String::number(recursion_depth), String::formatted("typed_value{}", recursion_depth), interface, false, false, {}, false, recursion_depth + 1); + generate_to_cpp(record_generator, value_parameter, "value", DeprecatedString::number(recursion_depth), DeprecatedString::formatted("typed_value{}", recursion_depth), interface, false, false, {}, false, recursion_depth + 1); record_generator.append(R"~~~( @cpp_name@.set(typed_key@recursion_depth@, typed_value@recursion_depth@); @@ -841,7 +841,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter auto& union_type = verify_cast(*parameter.type); union_generator.set("union_type", union_type_to_variant(union_type, interface)); - union_generator.set("recursion_depth", String::number(recursion_depth)); + union_generator.set("recursion_depth", DeprecatedString::number(recursion_depth)); // NOTE: This is handled out here as we need the dictionary conversion code for the {} optional default value. // 3. Let types be the flattened member types of the union type. @@ -891,7 +891,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter to_variant_captures.append("&vm, &realm"sv); if (dictionary_type) - to_variant_captures.append(String::formatted(", &{}{}_to_dictionary", js_name, js_suffix)); + to_variant_captures.append(DeprecatedString::formatted(", &{}{}_to_dictionary", js_name, js_suffix)); union_generator.set("to_variant_captures", to_variant_captures.to_string()); @@ -1028,7 +1028,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter if (method) { )~~~"); - sequence_type->generate_sequence_from_iterable(union_generator, acceptable_cpp_name, String::formatted("{}{}", js_name, js_suffix), "method", interface, recursion_depth + 1); + sequence_type->generate_sequence_from_iterable(union_generator, acceptable_cpp_name, DeprecatedString::formatted("{}{}", js_name, js_suffix), "method", interface, recursion_depth + 1); union_generator.append(R"~~~( @@ -1113,8 +1113,8 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter )~~~"); // NOTE: generate_to_cpp doesn't use the parameter name. // NOTE: generate_to_cpp will use to_{u32,etc.} which uses to_number internally and will thus use TRY, but it cannot throw as we know we are dealing with a number. - IDL::Parameter parameter { .type = *numeric_type, .name = String::empty(), .optional_default_value = {}, .extended_attributes = {} }; - generate_to_cpp(union_generator, parameter, js_name, js_suffix, String::formatted("{}{}_number", js_name, js_suffix), interface, false, false, {}, false, recursion_depth + 1); + IDL::Parameter parameter { .type = *numeric_type, .name = DeprecatedString::empty(), .optional_default_value = {}, .extended_attributes = {} }; + generate_to_cpp(union_generator, parameter, js_name, js_suffix, DeprecatedString::formatted("{}{}_number", js_name, js_suffix), interface, false, false, {}, false, recursion_depth + 1); union_generator.append(R"~~~( return @js_name@@js_suffix@_number; @@ -1178,8 +1178,8 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter // NOTE: generate_to_cpp doesn't use the parameter name. // NOTE: generate_to_cpp will use to_{u32,etc.} which uses to_number internally and will thus use TRY, but it cannot throw as we know we are dealing with a number. - IDL::Parameter parameter { .type = *numeric_type, .name = String::empty(), .optional_default_value = {}, .extended_attributes = {} }; - generate_to_cpp(union_numeric_type_generator, parameter, "x", String::empty(), "x_number", interface, false, false, {}, false, recursion_depth + 1); + IDL::Parameter parameter { .type = *numeric_type, .name = DeprecatedString::empty(), .optional_default_value = {}, .extended_attributes = {} }; + generate_to_cpp(union_numeric_type_generator, parameter, "x", DeprecatedString::empty(), "x_number", interface, false, false, {}, false, recursion_depth + 1); union_numeric_type_generator.append(R"~~~( return x_number; @@ -1189,8 +1189,8 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter // NOTE: generate_to_cpp doesn't use the parameter name. // NOTE: generate_to_cpp will use to_{u32,etc.} which uses to_number internally and will thus use TRY, but it cannot throw as we know we are dealing with a number. - IDL::Parameter parameter { .type = *numeric_type, .name = String::empty(), .optional_default_value = {}, .extended_attributes = {} }; - generate_to_cpp(union_generator, parameter, js_name, js_suffix, String::formatted("{}{}_number", js_name, js_suffix), interface, false, false, {}, false, recursion_depth + 1); + IDL::Parameter parameter { .type = *numeric_type, .name = DeprecatedString::empty(), .optional_default_value = {}, .extended_attributes = {} }; + generate_to_cpp(union_generator, parameter, js_name, js_suffix, DeprecatedString::formatted("{}{}_number", js_name, js_suffix), interface, false, false, {}, false, recursion_depth + 1); union_generator.append(R"~~~( return @js_name@@js_suffix@_number; @@ -1233,7 +1233,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter } else { if (optional_default_value == "\"\"") { union_generator.append(R"~~~( - @union_type@ @cpp_name@ = @js_name@@js_suffix@.is_undefined() ? String::empty() : TRY(@js_name@@js_suffix@_to_variant(@js_name@@js_suffix@)); + @union_type@ @cpp_name@ = @js_name@@js_suffix@.is_undefined() ? DeprecatedString::empty() : TRY(@js_name@@js_suffix@_to_variant(@js_name@@js_suffix@)); )~~~"); } else if (optional_default_value == "{}") { VERIFY(dictionary_type); @@ -1266,21 +1266,21 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter } } -static void generate_argument_count_check(SourceGenerator& generator, String const& function_name, size_t argument_count) +static void generate_argument_count_check(SourceGenerator& generator, DeprecatedString const& function_name, size_t argument_count) { if (argument_count == 0) return; auto argument_count_check_generator = generator.fork(); argument_count_check_generator.set("function.name", function_name); - argument_count_check_generator.set("function.nargs", String::number(argument_count)); + argument_count_check_generator.set("function.nargs", DeprecatedString::number(argument_count)); if (argument_count == 1) { argument_count_check_generator.set(".bad_arg_count", "JS::ErrorType::BadArgCountOne"); argument_count_check_generator.set(".arg_count_suffix", ""); } else { argument_count_check_generator.set(".bad_arg_count", "JS::ErrorType::BadArgCountMany"); - argument_count_check_generator.set(".arg_count_suffix", String::formatted(", \"{}\"", argument_count)); + argument_count_check_generator.set(".arg_count_suffix", DeprecatedString::formatted(", \"{}\"", argument_count)); } argument_count_check_generator.append(R"~~~( @@ -1293,20 +1293,20 @@ static void generate_arguments(SourceGenerator& generator, Vector parameter_names; + Vector parameter_names; size_t argument_index = 0; for (auto& parameter : parameters) { parameter_names.append(make_input_acceptable_cpp(parameter.name.to_snakecase())); if (!parameter.variadic) { - arguments_generator.set("argument.index", String::number(argument_index)); + arguments_generator.set("argument.index", DeprecatedString::number(argument_index)); arguments_generator.append(R"~~~( auto arg@argument.index@ = vm.argument(@argument.index@); )~~~"); } bool legacy_null_to_empty_string = parameter.extended_attributes.contains("LegacyNullToEmptyString"); - generate_to_cpp(generator, parameter, "arg", String::number(argument_index), parameter.name.to_snakecase(), interface, legacy_null_to_empty_string, parameter.optional, parameter.optional_default_value, parameter.variadic, 0); + generate_to_cpp(generator, parameter, "arg", DeprecatedString::number(argument_index), parameter.name.to_snakecase(), interface, legacy_null_to_empty_string, parameter.optional, parameter.optional_default_value, parameter.variadic, 0); ++argument_index; } @@ -1314,13 +1314,13 @@ static void generate_arguments(SourceGenerator& generator, Vectormembers) { dictionary_generator.set("member_key", member.name); - auto member_key_js_name = String::formatted("{}{}", make_input_acceptable_cpp(member.name.to_snakecase()), recursion_depth); + auto member_key_js_name = DeprecatedString::formatted("{}{}", make_input_acceptable_cpp(member.name.to_snakecase()), recursion_depth); dictionary_generator.set("member_name", member_key_js_name); - auto member_value_js_name = String::formatted("{}_value", member_key_js_name); + auto member_value_js_name = DeprecatedString::formatted("{}_value", member_key_js_name); dictionary_generator.set("member_value", member_value_js_name); - auto wrapped_value_name = String::formatted("auto wrapped_{}", member_value_js_name); + auto wrapped_value_name = DeprecatedString::formatted("auto wrapped_{}", member_value_js_name); dictionary_generator.set("wrapped_value_name", wrapped_value_name); - generate_wrap_statement(dictionary_generator, String::formatted("{}.{}", value, member.name), member.type, interface, wrapped_value_name, WrappingReference::No, recursion_depth + 1); + generate_wrap_statement(dictionary_generator, DeprecatedString::formatted("{}.{}", value, member.name), member.type, interface, wrapped_value_name, WrappingReference::No, recursion_depth + 1); dictionary_generator.append(R"~~~( MUST(dictionary_object@recursion_depth@->create_data_property("@member_key@", @wrapped_value_name@)); @@ -1617,24 +1617,24 @@ static void generate_return_statement(SourceGenerator& generator, IDL::Type cons return generate_wrap_statement(generator, "retval", return_type, interface, "return"sv); } -static void generate_variable_statement(SourceGenerator& generator, String const& variable_name, IDL::Type const& value_type, String const& value_name, IDL::Interface const& interface) +static void generate_variable_statement(SourceGenerator& generator, DeprecatedString const& variable_name, IDL::Type const& value_type, DeprecatedString const& value_name, IDL::Interface const& interface) { auto variable_generator = generator.fork(); variable_generator.set("variable_name", variable_name); variable_generator.append(R"~~~( JS::Value @variable_name@; )~~~"); - return generate_wrap_statement(generator, value_name, value_type, interface, String::formatted("{} = ", variable_name)); + return generate_wrap_statement(generator, value_name, value_type, interface, DeprecatedString::formatted("{} = ", variable_name)); } -static void generate_function(SourceGenerator& generator, IDL::Function const& function, StaticFunction is_static_function, String const& class_name, String const& interface_fully_qualified_name, IDL::Interface const& interface) +static void generate_function(SourceGenerator& generator, IDL::Function const& function, StaticFunction is_static_function, DeprecatedString const& class_name, DeprecatedString const& interface_fully_qualified_name, IDL::Interface const& interface) { auto function_generator = generator.fork(); function_generator.set("class_name", class_name); function_generator.set("interface_fully_qualified_name", interface_fully_qualified_name); function_generator.set("function.name", function.name); function_generator.set("function.name:snakecase", make_input_acceptable_cpp(function.name.to_snakecase())); - function_generator.set("overload_suffix", function.is_overloaded ? String::number(function.overload_index) : String::empty()); + function_generator.set("overload_suffix", function.is_overloaded ? DeprecatedString::number(function.overload_index) : DeprecatedString::empty()); if (function.extended_attributes.contains("ImplementedAs")) { auto implemented_as = function.extended_attributes.get("ImplementedAs").value(); @@ -1672,7 +1672,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@@overload_suffi if (arguments_builder.is_empty()) function_generator.set(".arguments", "vm"); else - function_generator.set(".arguments", String::formatted("vm, {}", arguments_builder.string_view())); + function_generator.set(".arguments", DeprecatedString::formatted("vm, {}", arguments_builder.string_view())); function_generator.append(R"~~~( [[maybe_unused]] auto retval = TRY(throw_dom_exception_if_needed(vm, [&] { return @interface_fully_qualified_name@::@function.cpp_name@(@.arguments@); })); @@ -1813,7 +1813,7 @@ static EffectiveOverloadSet compute_the_effective_overload_set(auto const& overl return EffectiveOverloadSet { move(overloads) }; } -static String generate_constructor_for_idl_type(Type const& type) +static DeprecatedString generate_constructor_for_idl_type(Type const& type) { auto append_type_list = [](auto& builder, auto const& type_list) { bool first = true; @@ -1830,7 +1830,7 @@ static String generate_constructor_for_idl_type(Type const& type) switch (type.kind()) { case Type::Kind::Plain: - return String::formatted("make_ref_counted(\"{}\", {})", type.name(), type.is_nullable()); + return DeprecatedString::formatted("make_ref_counted(\"{}\", {})", type.name(), type.is_nullable()); case Type::Kind::Parameterized: { auto const& parameterized_type = type.as_parameterized(); StringBuilder builder; @@ -1852,7 +1852,7 @@ static String generate_constructor_for_idl_type(Type const& type) VERIFY_NOT_REACHED(); } -static void generate_overload_arbiter(SourceGenerator& generator, auto const& overload_set, String const& class_name) +static void generate_overload_arbiter(SourceGenerator& generator, auto const& overload_set, DeprecatedString const& class_name) { auto function_generator = generator.fork(); function_generator.set("class_name", class_name); @@ -1869,7 +1869,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@) auto maximum_argument_count = 0u; for (auto const& overload : overloads_set) maximum_argument_count = max(maximum_argument_count, overload.types.size()); - function_generator.set("max_argument_count", String::number(maximum_argument_count)); + function_generator.set("max_argument_count", DeprecatedString::number(maximum_argument_count)); function_generator.appendln(" switch (min(@max_argument_count@, vm.argument_count())) {"); // Generate the effective overload set for each argument count. @@ -1888,8 +1888,8 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@) if (effective_overload_count == 0) continue; - function_generator.set("current_argument_count", String::number(argument_count)); - function_generator.set("overload_count", String::number(effective_overload_count)); + function_generator.set("current_argument_count", DeprecatedString::number(argument_count)); + function_generator.set("overload_count", DeprecatedString::number(effective_overload_count)); function_generator.appendln(R"~~~( case @current_argument_count@: { Vector overloads; @@ -1930,7 +1930,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@) types_builder.append("}"sv); optionality_builder.append("}"sv); - function_generator.set("overload.callable_id", String::number(overload.callable_id)); + function_generator.set("overload.callable_id", DeprecatedString::number(overload.callable_id)); function_generator.set("overload.types", types_builder.to_string()); function_generator.set("overload.optionality_values", optionality_builder.to_string()); @@ -1955,7 +1955,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@function.name:snakecase@) )~~~"); for (auto i = 0u; i < overload_set.value.size(); ++i) { - function_generator.set("overload_id", String::number(i)); + function_generator.set("overload_id", DeprecatedString::number(i)); function_generator.append(R"~~~( case @overload_id@: return @function.name:snakecase@@overload_id@(vm); @@ -2009,7 +2009,7 @@ private: )~~~"); if (overload_set.value.size() > 1) { for (auto i = 0u; i < overload_set.value.size(); ++i) { - function_generator.set("overload_suffix", String::number(i)); + function_generator.set("overload_suffix", DeprecatedString::number(i)); function_generator.append(R"~~~( JS_DECLARE_NATIVE_FUNCTION(@function.name:snakecase@@overload_suffix@); )~~~"); @@ -2143,7 +2143,7 @@ JS::ThrowCompletionOr @constructor_class@::construct(FunctionObject // Single constructor auto& constructor = interface.constructors[0]; - generator.set("constructor.length", String::number(constructor.shortest_length())); + generator.set("constructor.length", DeprecatedString::number(constructor.shortest_length())); generator.append(R"~~~( auto& vm = this->vm(); @@ -2191,7 +2191,7 @@ void @constructor_class@::initialize(JS::Realm& realm) auto constant_generator = generator.fork(); constant_generator.set("constant.name", constant.name); - generate_wrap_statement(constant_generator, constant.value, constant.type, interface, String::formatted("auto constant_{}_value =", constant.name)); + generate_wrap_statement(constant_generator, constant.value, constant.type, interface, DeprecatedString::formatted("auto constant_{}_value =", constant.name)); constant_generator.append(R"~~~( define_direct_property("@constant.name@", constant_@constant.name@_value, JS::Attribute::Enumerable); @@ -2203,7 +2203,7 @@ void @constructor_class@::initialize(JS::Realm& realm) auto function_generator = generator.fork(); function_generator.set("function.name", overload_set.key); function_generator.set("function.name:snakecase", make_input_acceptable_cpp(overload_set.key.to_snakecase())); - function_generator.set("function.length", String::number(get_shortest_function_length(overload_set.value))); + function_generator.set("function.length", DeprecatedString::number(get_shortest_function_length(overload_set.value))); function_generator.append(R"~~~( define_native_function(realm, "@function.name@", @function.name:snakecase@, @function.length@, default_attributes); @@ -2264,7 +2264,7 @@ private: )~~~"); if (overload_set.value.size() > 1) { for (auto i = 0u; i < overload_set.value.size(); ++i) { - function_generator.set("overload_suffix", String::number(i)); + function_generator.set("overload_suffix", DeprecatedString::number(i)); function_generator.append(R"~~~( JS_DECLARE_NATIVE_FUNCTION(@function.name:snakecase@@overload_suffix@); )~~~"); @@ -2326,7 +2326,7 @@ enum class @enum.type.name@ { enum_generator.append(R"~~~( }; -inline String idl_enum_to_string(@enum.type.name@ value) { +inline DeprecatedString idl_enum_to_string(@enum.type.name@ value) { switch(value) { )~~~"); for (auto& entry : it.value.translated_cpp_names) { @@ -2364,7 +2364,7 @@ void generate_prototype_implementation(IDL::Interface const& interface) generator.set("fully_qualified_name", interface.fully_qualified_name); if (interface.pair_iterator_types.has_value()) { - generator.set("iterator_name", String::formatted("{}Iterator", interface.name)); + generator.set("iterator_name", DeprecatedString::formatted("{}Iterator", interface.name)); } generator.append(R"~~~( @@ -2500,7 +2500,7 @@ void @prototype_class@::initialize(JS::Realm& realm) auto constant_generator = generator.fork(); constant_generator.set("constant.name", constant.name); - generate_wrap_statement(constant_generator, constant.value, constant.type, interface, String::formatted("auto constant_{}_value =", constant.name)); + generate_wrap_statement(constant_generator, constant.value, constant.type, interface, DeprecatedString::formatted("auto constant_{}_value =", constant.name)); constant_generator.append(R"~~~( define_direct_property("@constant.name@", constant_@constant.name@_value, JS::Attribute::Enumerable); @@ -2512,7 +2512,7 @@ void @prototype_class@::initialize(JS::Realm& realm) auto function_generator = generator.fork(); function_generator.set("function.name", overload_set.key); function_generator.set("function.name:snakecase", make_input_acceptable_cpp(overload_set.key.to_snakecase())); - function_generator.set("function.length", String::number(get_shortest_function_length(overload_set.value))); + function_generator.set("function.length", DeprecatedString::number(get_shortest_function_length(overload_set.value))); // FIXME: What if only some of the overloads are Unscopable? if (any_of(overload_set.value, [](auto const& function) { return function.extended_attributes.contains("Unscopable"); })) { @@ -2686,7 +2686,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.setter_callback@) if (!cpp_value) impl->remove_attribute(HTML::AttributeNames::@attribute.reflect_name@); else - MUST(impl->set_attribute(HTML::AttributeNames::@attribute.reflect_name@, String::empty())); + MUST(impl->set_attribute(HTML::AttributeNames::@attribute.reflect_name@, DeprecatedString::empty())); )~~~"); } } else { @@ -2801,7 +2801,7 @@ void generate_iterator_prototype_header(IDL::Interface const& interface) StringBuilder builder; SourceGenerator generator { builder }; - generator.set("prototype_class", String::formatted("{}IteratorPrototype", interface.name)); + generator.set("prototype_class", DeprecatedString::formatted("{}IteratorPrototype", interface.name)); generator.append(R"~~~( #pragma once @@ -2833,10 +2833,10 @@ void generate_iterator_prototype_implementation(IDL::Interface const& interface) StringBuilder builder; SourceGenerator generator { builder }; - generator.set("name", String::formatted("{}Iterator", interface.name)); - generator.set("prototype_class", String::formatted("{}IteratorPrototype", interface.name)); - generator.set("fully_qualified_name", String::formatted("{}Iterator", interface.fully_qualified_name)); - generator.set("possible_include_path", String::formatted("{}Iterator", interface.name.replace("::"sv, "/"sv, ReplaceMode::All))); + generator.set("name", DeprecatedString::formatted("{}Iterator", interface.name)); + generator.set("prototype_class", DeprecatedString::formatted("{}IteratorPrototype", interface.name)); + generator.set("fully_qualified_name", DeprecatedString::formatted("{}Iterator", interface.fully_qualified_name)); + generator.set("possible_include_path", DeprecatedString::formatted("{}Iterator", interface.name.replace("::"sv, "/"sv, ReplaceMode::All))); generator.append(R"~~~( #include diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp index cc25e51e3f5..acfbfe9c4b4 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp @@ -58,8 +58,8 @@ enum class PropertyID { Custom, )~~~"); - Vector shorthand_property_ids; - Vector longhand_property_ids; + Vector shorthand_property_ids; + Vector longhand_property_ids; properties.for_each_member([&](auto& name, auto& value) { VERIFY(value.is_object()); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSTransformFunctions.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSTransformFunctions.cpp index 5285b7ba8f7..8976edacf36 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSTransformFunctions.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSTransformFunctions.cpp @@ -39,7 +39,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return 0; } -static String title_casify_transform_function(StringView input) +static DeprecatedString title_casify_transform_function(StringView input) { // Transform function names look like `fooBar`, so we just have to make the first character uppercase. StringBuilder builder; @@ -189,7 +189,7 @@ TransformFunctionMetadata transform_function_metadata(TransformFunction transfor member_generator.append(first ? " "sv : ", "sv); first = false; - member_generator.append(String::formatted("{{ TransformFunctionParameterType::{}, {}}}", parameter_type, value.as_object().get("required"sv).to_string())); + member_generator.append(DeprecatedString::formatted("{{ TransformFunctionParameterType::{}, {}}}", parameter_type, value.as_object().get("required"sv).to_string())); }); member_generator.append(R"~~~( } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWindowOrWorkerInterfaces.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWindowOrWorkerInterfaces.cpp index b831b2a4584..7d23b67f1b4 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWindowOrWorkerInterfaces.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateWindowOrWorkerInterfaces.cpp @@ -5,9 +5,9 @@ */ #include +#include #include #include -#include #include #include #include @@ -16,14 +16,14 @@ #include static ErrorOr add_to_interface_sets(IDL::Interface&, Vector& window_exposed, Vector& dedicated_worker_exposed, Vector& shared_worker_exposed); -static String s_error_string; +static DeprecatedString s_error_string; static ErrorOr generate_exposed_interface_header(StringView class_name, StringView output_path) { StringBuilder builder; SourceGenerator generator(builder); - generator.set("global_object_snake_name", String(class_name).to_snakecase()); + generator.set("global_object_snake_name", DeprecatedString(class_name).to_snakecase()); generator.append(R"~~~( #pragma once @@ -37,7 +37,7 @@ void add_@global_object_snake_name@_exposed_interfaces(JS::Object&, JS::Realm&); )~~~"); - auto generated_header_path = LexicalPath(output_path).append(String::formatted("{}ExposedInterfaces.h", class_name)).string(); + auto generated_header_path = LexicalPath(output_path).append(DeprecatedString::formatted("{}ExposedInterfaces.h", class_name)).string(); auto generated_header_file = TRY(Core::Stream::File::open(generated_header_path, Core::Stream::OpenMode::Write)); TRY(generated_header_file->write(generator.as_string_view().bytes())); @@ -50,7 +50,7 @@ static ErrorOr generate_exposed_interface_implementation(StringView class_ SourceGenerator generator(builder); generator.set("global_object_name", class_name); - generator.set("global_object_snake_name", String(class_name).to_snakecase()); + generator.set("global_object_snake_name", DeprecatedString(class_name).to_snakecase()); generator.append(R"~~~( #include @@ -123,7 +123,7 @@ void add_@global_object_snake_name@_exposed_interfaces(JS::Object& global, JS::R } } )~~~"); - auto generated_implementation_path = LexicalPath(output_path).append(String::formatted("{}ExposedInterfaces.cpp", class_name)).string(); + auto generated_implementation_path = LexicalPath(output_path).append(DeprecatedString::formatted("{}ExposedInterfaces.cpp", class_name)).string(); auto generated_implementation_file = TRY(Core::Stream::File::open(generated_implementation_path, Core::Stream::OpenMode::Write)); TRY(generated_implementation_file->write(generator.as_string_view().bytes())); @@ -136,7 +136,7 @@ ErrorOr serenity_main(Main::Arguments arguments) StringView output_path; StringView base_path; - Vector paths; + Vector paths; args_parser.add_option(output_path, "Path to output generated files into", "output-path", 'o', "output-path"); args_parser.add_option(base_path, "Path to root of IDL file tree", "base-path", 'b', "base-path"); @@ -149,16 +149,16 @@ ErrorOr serenity_main(Main::Arguments arguments) const LexicalPath lexical_base(base_path); // Read in all IDL files, we must own the storage for all of these for the lifetime of the program - Vector file_contents; - for (String const& path : paths) { + Vector file_contents; + for (DeprecatedString const& path : paths) { auto file_or_error = Core::Stream::File::open(path, Core::Stream::OpenMode::Read); if (file_or_error.is_error()) { - s_error_string = String::formatted("Unable to open file {}", path); + s_error_string = DeprecatedString::formatted("Unable to open file {}", path); return Error::from_string_view(s_error_string); } auto file = file_or_error.release_value(); auto string = MUST(file->read_all()); - file_contents.append(String(ReadonlyBytes(string))); + file_contents.append(DeprecatedString(ReadonlyBytes(string))); } VERIFY(paths.size() == file_contents.size()); @@ -220,7 +220,7 @@ static ErrorOr parse_exposure_set(IDL::Interface& interface) auto maybe_exposed = interface.extended_attributes.get("Exposed"); if (!maybe_exposed.has_value()) { - s_error_string = String::formatted("Interface {} is missing extended attribute Exposed", interface.name); + s_error_string = DeprecatedString::formatted("Interface {} is missing extended attribute Exposed", interface.name); return Error::from_string_view(s_error_string); } auto exposed = maybe_exposed.value().trim_whitespace(); @@ -250,18 +250,18 @@ static ErrorOr parse_exposure_set(IDL::Interface& interface) } else if (candidate == "AudioWorklet"sv) { whom |= ExposedTo::AudioWorklet; } else { - s_error_string = String::formatted("Unknown Exposed attribute candidate {} in {} in {}", candidate, exposed, interface.name); + s_error_string = DeprecatedString::formatted("Unknown Exposed attribute candidate {} in {} in {}", candidate, exposed, interface.name); return Error::from_string_view(s_error_string); } } if (whom == ExposedTo::Nobody) { - s_error_string = String::formatted("Unknown Exposed attribute {} in {}", exposed, interface.name); + s_error_string = DeprecatedString::formatted("Unknown Exposed attribute {} in {}", exposed, interface.name); return Error::from_string_view(s_error_string); } return whom; } - s_error_string = String::formatted("Unknown Exposed attribute {} in {}", exposed, interface.name); + s_error_string = DeprecatedString::formatted("Unknown Exposed attribute {} in {}", exposed, interface.name); return Error::from_string_view(s_error_string); } @@ -275,7 +275,7 @@ static IDL::Interface& add_synthetic_interface(IDL::Interface& reference_interfa auto new_interface = make(); new_interface->name = name; - new_interface->constructor_class = String::formatted("{}Constructor", new_interface->name); + new_interface->constructor_class = DeprecatedString::formatted("{}Constructor", new_interface->name); new_interface->prototype_class = reference_interface.prototype_class; new_interface->parent_name = "[Synthetic Interface]"; diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h index c1e6489f7b3..e86d7c9451e 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GeneratorUtil.h @@ -7,13 +7,13 @@ #pragma once +#include #include -#include #include #include #include -String title_casify(String const& dashy_name) +DeprecatedString title_casify(DeprecatedString const& dashy_name) { auto parts = dashy_name.split('-'); StringBuilder builder; @@ -28,7 +28,7 @@ String title_casify(String const& dashy_name) return builder.to_string(); } -String camel_casify(StringView dashy_name) +DeprecatedString camel_casify(StringView dashy_name) { auto parts = dashy_name.split_view('-'); StringBuilder builder; @@ -49,7 +49,7 @@ String camel_casify(StringView dashy_name) return builder.to_string(); } -String snake_casify(String const& dashy_name) +DeprecatedString snake_casify(DeprecatedString const& dashy_name) { return dashy_name.replace("-"sv, "_"sv, ReplaceMode::All); } diff --git a/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp b/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp index e1c00c8e429..aff038ba598 100644 --- a/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/StateMachineGenerator/main.cpp @@ -4,11 +4,11 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include #include -#include #include #include #include @@ -22,8 +22,8 @@ struct Range { }; struct StateTransition { - Optional new_state; - Optional action; + Optional new_state; + Optional action; }; struct MatchedAction { @@ -32,18 +32,18 @@ struct MatchedAction { }; struct State { - String name; + DeprecatedString name; Vector actions; - Optional entry_action; - Optional exit_action; + Optional entry_action; + Optional exit_action; }; struct StateMachine { - String name; - String initial_state; + DeprecatedString name; + DeprecatedString initial_state; Vector states; Optional anywhere; - Optional namespaces; + Optional namespaces; }; static OwnPtr @@ -232,9 +232,9 @@ ErrorOr serenity_main(Main::Arguments arguments) return 0; } -HashTable actions(StateMachine const& machine) +HashTable actions(StateMachine const& machine) { - HashTable table; + HashTable table; auto do_state = [&](State const& state) { if (state.entry_action.has_value()) @@ -296,7 +296,7 @@ void output_header(StateMachine const& machine, SourceGenerator& generator) { generator.set("class_name", machine.name); generator.set("initial_state", machine.initial_state); - generator.set("state_count", String::number(machine.states.size() + 1)); + generator.set("state_count", DeprecatedString::number(machine.states.size() + 1)); generator.append(R"~~~( #pragma once diff --git a/Meta/Lagom/Tools/ConfigureComponents/main.cpp b/Meta/Lagom/Tools/ConfigureComponents/main.cpp index 052d2d1ec17..c499ceff2f3 100644 --- a/Meta/Lagom/Tools/ConfigureComponents/main.cpp +++ b/Meta/Lagom/Tools/ConfigureComponents/main.cpp @@ -4,11 +4,11 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include #include -#include #include #include #include @@ -25,18 +25,18 @@ enum class ComponentCategory { }; struct ComponentData { - String name; - String description; + DeprecatedString name; + DeprecatedString description; ComponentCategory category { ComponentCategory::Optional }; bool was_selected { false }; - Vector dependencies; + Vector dependencies; bool is_selected { false }; }; struct WhiptailOption { - String tag; - String name; - String description; + DeprecatedString tag; + DeprecatedString name; + DeprecatedString description; bool checked { false }; }; @@ -77,7 +77,7 @@ static Vector read_component_data(Core::ConfigFile const& config_ return components; } -static Result, int> run_whiptail(WhiptailMode mode, Vector const& options, StringView title, StringView description) +static Result, int> run_whiptail(WhiptailMode mode, Vector const& options, StringView title, StringView description) { struct winsize w; if (ioctl(0, TIOCGWINSZ, &w) < 0) { @@ -97,7 +97,7 @@ static Result, int> run_whiptail(WhiptailMode mode, Vector arguments = { "whiptail", "--notags", "--separate-output", "--output-fd", String::number(write_fd) }; + Vector arguments = { "whiptail", "--notags", "--separate-output", "--output-fd", DeprecatedString::number(write_fd) }; if (!title.is_empty()) { arguments.append("--title"); @@ -116,13 +116,13 @@ static Result, int> run_whiptail(WhiptailMode mode, Vector, int> run_whiptail(WhiptailMode mode, Vector, int> run_whiptail(WhiptailMode mode, Vector, int> run_whiptail(WhiptailMode mode, Vectoropen(read_fd, Core::OpenMode::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes); - auto data = String::copy(file->read_all()); + auto data = DeprecatedString::copy(file->read_all()); return data.split('\n'); } -static bool run_system_command(String const& command, StringView command_name) +static bool run_system_command(DeprecatedString const& command, StringView command_name) { if (command.starts_with("cmake"sv)) warnln("\e[34mRunning CMake...\e[0m"); @@ -274,7 +274,7 @@ int main() StringView build_type = customize ? type.substring_view(7) : type.view(); // Step 4: Customize the configuration if the user requested to. In any case, set the components component.is_selected value correctly. - Vector activated_components; + Vector activated_components; if (customize) { Vector options; @@ -336,12 +336,12 @@ int main() } // Step 5: Generate the cmake command. - Vector cmake_arguments = { "cmake", "../..", "-G", "Ninja", "-DBUILD_EVERYTHING=OFF" }; + Vector cmake_arguments = { "cmake", "../..", "-G", "Ninja", "-DBUILD_EVERYTHING=OFF" }; for (auto& component : components) - cmake_arguments.append(String::formatted("-DBUILD_{}={}", component.name.to_uppercase(), component.is_selected ? "ON" : "OFF")); + cmake_arguments.append(DeprecatedString::formatted("-DBUILD_{}={}", component.name.to_uppercase(), component.is_selected ? "ON" : "OFF")); warnln("\e[34mThe following command will be run:\e[0m"); - outln("{} \\", String::join(' ', cmake_arguments)); + outln("{} \\", DeprecatedString::join(' ', cmake_arguments)); outln(" && ninja clean\n && rm -rf Root"); warn("\e[34mDo you want to run the command?\e[0m [Y/n] "); auto character = getchar(); @@ -351,7 +351,7 @@ int main() } // Step 6: Run CMake, 'ninja clean' and 'rm -rf Root' - auto command = String::join(' ', cmake_arguments); + auto command = DeprecatedString::join(' ', cmake_arguments); if (!run_system_command(command, "CMake"sv)) return 1; if (!run_system_command("ninja clean"sv, "Ninja"sv)) diff --git a/Meta/Lagom/Tools/IPCMagicLinter/main.cpp b/Meta/Lagom/Tools/IPCMagicLinter/main.cpp index ee7697eb73c..5c482fc1fd6 100644 --- a/Meta/Lagom/Tools/IPCMagicLinter/main.cpp +++ b/Meta/Lagom/Tools/IPCMagicLinter/main.cpp @@ -21,10 +21,10 @@ int main(int argc, char** argv) } // Read files, compute their hashes, ignore collisions for now. - HashMap> inverse_hashes; + HashMap> inverse_hashes; bool had_errors = false; for (int file_index = 1; file_index < argc; ++file_index) { - String filename(argv[file_index]); + DeprecatedString filename(argv[file_index]); auto file_or_error = Core::File::open(filename, Core::OpenMode::ReadOnly); if (file_or_error.is_error()) { warnln("Error: Cannot open '{}': {}", filename, file_or_error.error()); @@ -32,9 +32,9 @@ int main(int argc, char** argv) continue; // next file } auto file = file_or_error.value(); - String endpoint_name; + DeprecatedString endpoint_name; while (true) { - String line = file->read_line(); + DeprecatedString line = file->read_line(); if (file->error() != 0 || line.is_null()) break; if (!line.starts_with("endpoint "sv)) diff --git a/Meta/Lagom/Wasm/js_repl.cpp b/Meta/Lagom/Wasm/js_repl.cpp index cb798241bfd..316279f1868 100644 --- a/Meta/Lagom/Wasm/js_repl.cpp +++ b/Meta/Lagom/Wasm/js_repl.cpp @@ -50,7 +50,7 @@ EM_JS(void, user_display, (char const* string, u32 length), { globalDisplayToUse template void display(CheckedFormatString format_string, Args const&... args) { - auto string = String::formatted(format_string.view(), args...); + auto string = DeprecatedString::formatted(format_string.view(), args...); user_display(string.characters(), string.length()); } @@ -269,7 +269,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReplObject::print) { auto result = ::print(vm.argument(0)); if (result.is_error()) - return g_vm->throw_completion(String::formatted("Failed to print value: {}", result.error())); + return g_vm->throw_completion(DeprecatedString::formatted("Failed to print value: {}", result.error())); displayln(); @@ -298,7 +298,7 @@ public: // 2.3. Printer(logLevel, args[, options]), https://console.spec.whatwg.org/#printer virtual JS::ThrowCompletionOr printer(JS::Console::LogLevel log_level, PrinterArguments arguments) override { - String indent = String::repeated(" "sv, m_group_stack_depth); + DeprecatedString indent = DeprecatedString::repeated(" "sv, m_group_stack_depth); if (log_level == JS::Console::LogLevel::Trace) { auto trace = arguments.get(); @@ -320,7 +320,7 @@ public: return JS::js_undefined(); } - auto output = String::join(' ', arguments.get>()); + auto output = DeprecatedString::join(' ', arguments.get>()); switch (log_level) { case JS::Console::LogLevel::Debug: displayln("{}{}", indent, output); diff --git a/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch b/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch index 852e9032069..bb31b85bb81 100644 --- a/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch +++ b/Ports/OpenJDK/patches/0008-java.base-Enable-java.lang.Process-on-serenity.patch @@ -188,7 +188,7 @@ index 0000000000000000000000000000000000000000..cc0c08cb85a682d66a00f6b48ad2871f + unix_getUserInfo(env, jinfo, proc.pid); + JNU_CHECK_EXCEPTION(env); + -+ auto cmdline_file = JAVA_TRY(Core::Stream::File::open(String::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read), "Unable to open /proc/pid/cmdline"sv); ++ auto cmdline_file = JAVA_TRY(Core::Stream::File::open(DeprecatedString::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read), "Unable to open /proc/pid/cmdline"sv); + auto contents = JAVA_TRY(cmdline_file->read_all(), "Unable to read /proc/pid/cmdline"sv); + auto cmdline = JAVA_TRY(JsonValue::from_string(contents), "Invalid JSON in /proc/pid/cmdline"sv); + diff --git a/Tests/AK/CMakeLists.txt b/Tests/AK/CMakeLists.txt index c52cf9925f8..be5538afa00 100644 --- a/Tests/AK/CMakeLists.txt +++ b/Tests/AK/CMakeLists.txt @@ -19,6 +19,7 @@ set(AK_TEST_SOURCES TestCircularDuplexStream.cpp TestCircularQueue.cpp TestComplex.cpp + TestDeprecatedString.cpp TestDisjointChunks.cpp TestDistinctNumeric.cpp TestDoublyLinkedList.cpp @@ -61,7 +62,6 @@ set(AK_TEST_SOURCES TestSpan.cpp TestStack.cpp TestStdLibExtras.cpp - TestString.cpp TestStringFloatingPointConversions.cpp TestStringUtils.cpp TestStringView.cpp diff --git a/Tests/AK/TestBase64.cpp b/Tests/AK/TestBase64.cpp index 2290132bce7..32048b7e61e 100644 --- a/Tests/AK/TestBase64.cpp +++ b/Tests/AK/TestBase64.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include TEST_CASE(test_decode) @@ -16,7 +16,7 @@ TEST_CASE(test_decode) auto decoded_option = decode_base64(input); EXPECT(!decoded_option.is_error()); auto decoded = decoded_option.release_value(); - EXPECT(String::copy(decoded) == expected); + EXPECT(DeprecatedString::copy(decoded) == expected); EXPECT(expected.length() <= calculate_base64_decoded_length(input.bytes())); }; @@ -43,7 +43,7 @@ TEST_CASE(test_encode) { auto encode_equal = [&](StringView input, StringView expected) { auto encoded = encode_base64(input.bytes()); - EXPECT(encoded == String(expected)); + EXPECT(encoded == DeprecatedString(expected)); EXPECT_EQ(expected.length(), calculate_base64_encoded_length(input.bytes())); }; diff --git a/Tests/AK/TestBinaryHeap.cpp b/Tests/AK/TestBinaryHeap.cpp index dbd4a9a4afb..5ac1cc953c3 100644 --- a/Tests/AK/TestBinaryHeap.cpp +++ b/Tests/AK/TestBinaryHeap.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include TEST_CASE(construct) { @@ -44,7 +44,7 @@ TEST_CASE(populate_int) TEST_CASE(populate_string) { - BinaryHeap strings; + BinaryHeap strings; strings.insert(1, "ABC"); strings.insert(2, "DEF"); EXPECT_EQ(strings.size(), 2u); diff --git a/Tests/AK/TestBinarySearch.cpp b/Tests/AK/TestBinarySearch.cpp index f5a63eac339..558ff1213c1 100644 --- a/Tests/AK/TestBinarySearch.cpp +++ b/Tests/AK/TestBinarySearch.cpp @@ -49,20 +49,20 @@ TEST_CASE(array_doubles) TEST_CASE(vector_strings) { - Vector strings; + Vector strings; strings.append("bat"); strings.append("cat"); strings.append("dog"); - auto string_compare = [](String const& a, String const& b) -> int { + auto string_compare = [](DeprecatedString const& a, DeprecatedString const& b) -> int { return strcmp(a.characters(), b.characters()); }; - auto test1 = *binary_search(strings, String("bat"), nullptr, string_compare); - auto test2 = *binary_search(strings, String("cat"), nullptr, string_compare); - auto test3 = *binary_search(strings, String("dog"), nullptr, string_compare); - EXPECT_EQ(test1, String("bat")); - EXPECT_EQ(test2, String("cat")); - EXPECT_EQ(test3, String("dog")); + auto test1 = *binary_search(strings, DeprecatedString("bat"), nullptr, string_compare); + auto test2 = *binary_search(strings, DeprecatedString("cat"), nullptr, string_compare); + auto test3 = *binary_search(strings, DeprecatedString("dog"), nullptr, string_compare); + EXPECT_EQ(test1, DeprecatedString("bat")); + EXPECT_EQ(test2, DeprecatedString("cat")); + EXPECT_EQ(test3, DeprecatedString("dog")); } TEST_CASE(single_element) diff --git a/Tests/AK/TestCircularDeque.cpp b/Tests/AK/TestCircularDeque.cpp index 3fa5189bb84..8346eca2daa 100644 --- a/Tests/AK/TestCircularDeque.cpp +++ b/Tests/AK/TestCircularDeque.cpp @@ -7,8 +7,8 @@ #include #include +#include #include -#include TEST_CASE(enqueue_begin) { @@ -37,9 +37,9 @@ TEST_CASE(enqueue_begin) TEST_CASE(enqueue_begin_being_moved_from) { - CircularDeque strings; + CircularDeque strings; - String str { "test" }; + DeprecatedString str { "test" }; strings.enqueue_begin(move(str)); EXPECT(str.is_null()); } diff --git a/Tests/AK/TestCircularQueue.cpp b/Tests/AK/TestCircularQueue.cpp index edc3cb5184e..337164725d0 100644 --- a/Tests/AK/TestCircularQueue.cpp +++ b/Tests/AK/TestCircularQueue.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include TEST_CASE(basic) { @@ -28,7 +28,7 @@ TEST_CASE(basic) TEST_CASE(complex_type) { - CircularQueue strings; + CircularQueue strings; strings.enqueue("ABC"); strings.enqueue("DEF"); @@ -44,7 +44,7 @@ TEST_CASE(complex_type) TEST_CASE(complex_type_clear) { - CircularQueue strings; + CircularQueue strings; strings.enqueue("xxx"); strings.enqueue("xxx"); strings.enqueue("xxx"); diff --git a/Tests/AK/TestString.cpp b/Tests/AK/TestDeprecatedString.cpp similarity index 64% rename from Tests/AK/TestString.cpp rename to Tests/AK/TestDeprecatedString.cpp index bf608e62a33..6da18196c18 100644 --- a/Tests/AK/TestString.cpp +++ b/Tests/AK/TestDeprecatedString.cpp @@ -6,28 +6,28 @@ #include +#include #include -#include #include #include #include TEST_CASE(construct_empty) { - EXPECT(String().is_null()); - EXPECT(String().is_empty()); - EXPECT(!String().characters()); + EXPECT(DeprecatedString().is_null()); + EXPECT(DeprecatedString().is_empty()); + EXPECT(!DeprecatedString().characters()); - EXPECT(!String("").is_null()); - EXPECT(String("").is_empty()); - EXPECT(String("").characters() != nullptr); + EXPECT(!DeprecatedString("").is_null()); + EXPECT(DeprecatedString("").is_empty()); + EXPECT(DeprecatedString("").characters() != nullptr); - EXPECT(String("").impl() == String::empty().impl()); + EXPECT(DeprecatedString("").impl() == DeprecatedString::empty().impl()); } TEST_CASE(construct_contents) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; EXPECT(!test_string.is_empty()); EXPECT(!test_string.is_null()); EXPECT_EQ(test_string.length(), 6u); @@ -42,45 +42,45 @@ TEST_CASE(construct_contents) TEST_CASE(equal) { - EXPECT_NE(String::empty(), String {}); + EXPECT_NE(DeprecatedString::empty(), DeprecatedString {}); } TEST_CASE(compare) { - EXPECT("a"sv < String("b")); - EXPECT(!("a"sv > String("b"))); - EXPECT("b"sv > String("a")); - EXPECT(!("b"sv < String("b"))); - EXPECT("a"sv >= String("a")); - EXPECT(!("a"sv >= String("b"))); - EXPECT("a"sv <= String("a")); - EXPECT(!("b"sv <= String("a"))); + EXPECT("a"sv < DeprecatedString("b")); + EXPECT(!("a"sv > DeprecatedString("b"))); + EXPECT("b"sv > DeprecatedString("a")); + EXPECT(!("b"sv < DeprecatedString("b"))); + EXPECT("a"sv >= DeprecatedString("a")); + EXPECT(!("a"sv >= DeprecatedString("b"))); + EXPECT("a"sv <= DeprecatedString("a")); + EXPECT(!("b"sv <= DeprecatedString("a"))); - EXPECT(String("a") > String()); - EXPECT(!(String() > String("a"))); - EXPECT(String() < String("a")); - EXPECT(!(String("a") < String())); - EXPECT(String("a") >= String()); - EXPECT(!(String() >= String("a"))); - EXPECT(String() <= String("a")); - EXPECT(!(String("a") <= String())); + EXPECT(DeprecatedString("a") > DeprecatedString()); + EXPECT(!(DeprecatedString() > DeprecatedString("a"))); + EXPECT(DeprecatedString() < DeprecatedString("a")); + EXPECT(!(DeprecatedString("a") < DeprecatedString())); + EXPECT(DeprecatedString("a") >= DeprecatedString()); + EXPECT(!(DeprecatedString() >= DeprecatedString("a"))); + EXPECT(DeprecatedString() <= DeprecatedString("a")); + EXPECT(!(DeprecatedString("a") <= DeprecatedString())); - EXPECT(!(String() > String())); - EXPECT(!(String() < String())); - EXPECT(String() >= String()); - EXPECT(String() <= String()); + EXPECT(!(DeprecatedString() > DeprecatedString())); + EXPECT(!(DeprecatedString() < DeprecatedString())); + EXPECT(DeprecatedString() >= DeprecatedString()); + EXPECT(DeprecatedString() <= DeprecatedString()); } TEST_CASE(index_access) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; EXPECT_EQ(test_string[0], 'A'); EXPECT_EQ(test_string[1], 'B'); } TEST_CASE(starts_with) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; EXPECT(test_string.starts_with("AB"sv)); EXPECT(test_string.starts_with('A')); EXPECT(!test_string.starts_with('B')); @@ -92,7 +92,7 @@ TEST_CASE(starts_with) TEST_CASE(ends_with) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; EXPECT(test_string.ends_with("EF"sv)); EXPECT(test_string.ends_with('F')); EXPECT(!test_string.ends_with('E')); @@ -104,7 +104,7 @@ TEST_CASE(ends_with) TEST_CASE(copy_string) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; auto test_string_copy = test_string; EXPECT_EQ(test_string, test_string_copy); EXPECT_EQ(test_string.characters(), test_string_copy.characters()); @@ -112,7 +112,7 @@ TEST_CASE(copy_string) TEST_CASE(move_string) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; auto test_string_copy = test_string; auto test_string_move = move(test_string_copy); EXPECT_EQ(test_string, test_string_move); @@ -121,25 +121,25 @@ TEST_CASE(move_string) TEST_CASE(repeated) { - EXPECT_EQ(String::repeated('x', 0), ""); - EXPECT_EQ(String::repeated('x', 1), "x"); - EXPECT_EQ(String::repeated('x', 2), "xx"); + EXPECT_EQ(DeprecatedString::repeated('x', 0), ""); + EXPECT_EQ(DeprecatedString::repeated('x', 1), "x"); + EXPECT_EQ(DeprecatedString::repeated('x', 2), "xx"); } TEST_CASE(to_int) { - EXPECT_EQ(String("123").to_int().value(), 123); - EXPECT_EQ(String("-123").to_int().value(), -123); + EXPECT_EQ(DeprecatedString("123").to_int().value(), 123); + EXPECT_EQ(DeprecatedString("-123").to_int().value(), -123); } TEST_CASE(to_lowercase) { - EXPECT(String("ABC").to_lowercase() == "abc"); + EXPECT(DeprecatedString("ABC").to_lowercase() == "abc"); } TEST_CASE(to_uppercase) { - EXPECT(String("AbC").to_uppercase() == "ABC"); + EXPECT(DeprecatedString("AbC").to_uppercase() == "ABC"); } TEST_CASE(flystring) @@ -151,7 +151,7 @@ TEST_CASE(flystring) } { - String a = "foo"; + DeprecatedString a = "foo"; FlyString b = a; StringBuilder builder; builder.append('f'); @@ -164,7 +164,7 @@ TEST_CASE(flystring) TEST_CASE(replace) { - String test_string = "Well, hello Friends!"; + DeprecatedString test_string = "Well, hello Friends!"; test_string = test_string.replace("Friends"sv, "Testers"sv, ReplaceMode::FirstOnly); EXPECT(test_string == "Well, hello Testers!"); @@ -175,7 +175,7 @@ TEST_CASE(replace) test_string = test_string.replace("!"sv, " :^)"sv, ReplaceMode::FirstOnly); EXPECT(test_string == "We're, he'reo Testers :^)"); - test_string = String("111._.111._.111"); + test_string = DeprecatedString("111._.111._.111"); test_string = test_string.replace("111"sv, "|||"sv, ReplaceMode::All); EXPECT(test_string == "|||._.|||._.|||"); @@ -185,7 +185,7 @@ TEST_CASE(replace) TEST_CASE(count) { - String test_string = "Well, hello Friends!"; + DeprecatedString test_string = "Well, hello Friends!"; u32 count = test_string.count("Friends"sv); EXPECT(count == 1); @@ -195,7 +195,7 @@ TEST_CASE(count) count = test_string.count("!"sv); EXPECT(count == 1); - test_string = String("111._.111._.111"); + test_string = DeprecatedString("111._.111._.111"); count = test_string.count("111"sv); EXPECT(count == 3); @@ -205,7 +205,7 @@ TEST_CASE(count) TEST_CASE(substring) { - String test = "abcdef"; + DeprecatedString test = "abcdef"; EXPECT_EQ(test.substring(0, 6), test); EXPECT_EQ(test.substring(0, 3), "abc"); EXPECT_EQ(test.substring(3, 3), "def"); @@ -215,7 +215,7 @@ TEST_CASE(substring) TEST_CASE(split) { - String test = "foo bar baz"; + DeprecatedString test = "foo bar baz"; auto parts = test.split(' '); EXPECT_EQ(parts.size(), 3u); EXPECT_EQ(parts[0], "foo"); @@ -259,7 +259,7 @@ TEST_CASE(builder_zero_initial_capacity) TEST_CASE(find) { - String a = "foobarbar"; + DeprecatedString a = "foobarbar"; EXPECT_EQ(a.find("bar"sv), Optional { 3 }); EXPECT_EQ(a.find("baz"sv), Optional {}); EXPECT_EQ(a.find("bar"sv, 4), Optional { 6 }); @@ -275,7 +275,7 @@ TEST_CASE(find) TEST_CASE(find_with_empty_needle) { - String string = ""; + DeprecatedString string = ""; EXPECT_EQ(string.find(""sv), 0u); EXPECT_EQ(string.find_all(""sv), (Vector { 0u })); @@ -286,30 +286,30 @@ TEST_CASE(find_with_empty_needle) TEST_CASE(bijective_base) { - EXPECT_EQ(String::bijective_base_from(0), "A"); - EXPECT_EQ(String::bijective_base_from(25), "Z"); - EXPECT_EQ(String::bijective_base_from(26), "AA"); - EXPECT_EQ(String::bijective_base_from(52), "BA"); - EXPECT_EQ(String::bijective_base_from(704), "ABC"); + EXPECT_EQ(DeprecatedString::bijective_base_from(0), "A"); + EXPECT_EQ(DeprecatedString::bijective_base_from(25), "Z"); + EXPECT_EQ(DeprecatedString::bijective_base_from(26), "AA"); + EXPECT_EQ(DeprecatedString::bijective_base_from(52), "BA"); + EXPECT_EQ(DeprecatedString::bijective_base_from(704), "ABC"); } TEST_CASE(roman_numerals) { - auto zero = String::roman_number_from(0); + auto zero = DeprecatedString::roman_number_from(0); EXPECT_EQ(zero, ""); - auto one = String::roman_number_from(1); + auto one = DeprecatedString::roman_number_from(1); EXPECT_EQ(one, "I"); - auto nine = String::roman_number_from(9); + auto nine = DeprecatedString::roman_number_from(9); EXPECT_EQ(nine, "IX"); - auto fourty_eight = String::roman_number_from(48); + auto fourty_eight = DeprecatedString::roman_number_from(48); EXPECT_EQ(fourty_eight, "XLVIII"); - auto one_thousand_nine_hundred_ninety_eight = String::roman_number_from(1998); + auto one_thousand_nine_hundred_ninety_eight = DeprecatedString::roman_number_from(1998); EXPECT_EQ(one_thousand_nine_hundred_ninety_eight, "MCMXCVIII"); - auto four_thousand = String::roman_number_from(4000); + auto four_thousand = DeprecatedString::roman_number_from(4000); EXPECT_EQ(four_thousand, "4000"); } diff --git a/Tests/AK/TestDisjointChunks.cpp b/Tests/AK/TestDisjointChunks.cpp index 8c0e854a69b..c23806fd4e9 100644 --- a/Tests/AK/TestDisjointChunks.cpp +++ b/Tests/AK/TestDisjointChunks.cpp @@ -6,9 +6,9 @@ #include +#include #include #include -#include #include TEST_CASE(basic) diff --git a/Tests/AK/TestFixedPoint.cpp b/Tests/AK/TestFixedPoint.cpp index 7050fca6005..9536926412f 100644 --- a/Tests/AK/TestFixedPoint.cpp +++ b/Tests/AK/TestFixedPoint.cpp @@ -145,9 +145,9 @@ TEST_CASE(cast) TEST_CASE(formatter) { - EXPECT_EQ(String::formatted("{}", FixedPoint<16>(123.456)), "123.455993"sv); - EXPECT_EQ(String::formatted("{}", FixedPoint<16>(-123.456)), "-123.455994"sv); - EXPECT_EQ(String::formatted("{}", FixedPoint<4>(123.456)), "123.4375"sv); - EXPECT_EQ(String::formatted("{}", FixedPoint<4>(-123.456)), "-123.4375"sv); - EXPECT_EQ(String::formatted("{}", FixedPoint<16> {}), "0"sv); + EXPECT_EQ(DeprecatedString::formatted("{}", FixedPoint<16>(123.456)), "123.455993"sv); + EXPECT_EQ(DeprecatedString::formatted("{}", FixedPoint<16>(-123.456)), "-123.455994"sv); + EXPECT_EQ(DeprecatedString::formatted("{}", FixedPoint<4>(123.456)), "123.4375"sv); + EXPECT_EQ(DeprecatedString::formatted("{}", FixedPoint<4>(-123.456)), "-123.4375"sv); + EXPECT_EQ(DeprecatedString::formatted("{}", FixedPoint<16> {}), "0"sv); } diff --git a/Tests/AK/TestFormat.cpp b/Tests/AK/TestFormat.cpp index 6ba944312b6..46dd4800dda 100644 --- a/Tests/AK/TestFormat.cpp +++ b/Tests/AK/TestFormat.cpp @@ -6,7 +6,7 @@ #include -#include +#include #include #include #include @@ -20,42 +20,42 @@ TEST_CASE(is_integral_works_properly) TEST_CASE(format_string_literals) { - EXPECT_EQ(String::formatted("prefix-{}-suffix", "abc"), "prefix-abc-suffix"); - EXPECT_EQ(String::formatted("{}{}{}", "a", "b", "c"), "abc"); + EXPECT_EQ(DeprecatedString::formatted("prefix-{}-suffix", "abc"), "prefix-abc-suffix"); + EXPECT_EQ(DeprecatedString::formatted("{}{}{}", "a", "b", "c"), "abc"); } TEST_CASE(format_integers) { - EXPECT_EQ(String::formatted("{}", 42u), "42"); - EXPECT_EQ(String::formatted("{:4}", 42u), " 42"); - EXPECT_EQ(String::formatted("{:08}", 42u), "00000042"); - EXPECT_EQ(String::formatted("{:7}", -17), " -17"); - EXPECT_EQ(String::formatted("{}", -17), "-17"); - EXPECT_EQ(String::formatted("{:04}", 13), "0013"); - EXPECT_EQ(String::formatted("{:08x}", 4096), "00001000"); - EXPECT_EQ(String::formatted("{:x}", 0x1111222233334444ull), "1111222233334444"); - EXPECT_EQ(String::formatted("{:4}", 12345678), "12345678"); + EXPECT_EQ(DeprecatedString::formatted("{}", 42u), "42"); + EXPECT_EQ(DeprecatedString::formatted("{:4}", 42u), " 42"); + EXPECT_EQ(DeprecatedString::formatted("{:08}", 42u), "00000042"); + EXPECT_EQ(DeprecatedString::formatted("{:7}", -17), " -17"); + EXPECT_EQ(DeprecatedString::formatted("{}", -17), "-17"); + EXPECT_EQ(DeprecatedString::formatted("{:04}", 13), "0013"); + EXPECT_EQ(DeprecatedString::formatted("{:08x}", 4096), "00001000"); + EXPECT_EQ(DeprecatedString::formatted("{:x}", 0x1111222233334444ull), "1111222233334444"); + EXPECT_EQ(DeprecatedString::formatted("{:4}", 12345678), "12345678"); } TEST_CASE(reorder_format_arguments) { - EXPECT_EQ(String::formatted("{1}{0}", "a", "b"), "ba"); - EXPECT_EQ(String::formatted("{0}{1}", "a", "b"), "ab"); + EXPECT_EQ(DeprecatedString::formatted("{1}{0}", "a", "b"), "ba"); + EXPECT_EQ(DeprecatedString::formatted("{0}{1}", "a", "b"), "ab"); // Compiletime check bypass: ignoring a passed argument. - EXPECT_EQ(String::formatted("{0}{0}{0}"sv, "a", "b"), "aaa"); + EXPECT_EQ(DeprecatedString::formatted("{0}{0}{0}"sv, "a", "b"), "aaa"); // Compiletime check bypass: ignoring a passed argument. - EXPECT_EQ(String::formatted("{1}{}{0}"sv, "a", "b", "c"), "baa"); + EXPECT_EQ(DeprecatedString::formatted("{1}{}{0}"sv, "a", "b", "c"), "baa"); } TEST_CASE(escape_braces) { - EXPECT_EQ(String::formatted("{{{}", "foo"), "{foo"); - EXPECT_EQ(String::formatted("{}}}", "bar"), "bar}"); + EXPECT_EQ(DeprecatedString::formatted("{{{}", "foo"), "{foo"); + EXPECT_EQ(DeprecatedString::formatted("{}}}", "bar"), "bar}"); } TEST_CASE(everything) { - EXPECT_EQ(String::formatted("{{{:04}/{}/{0:8}/{1}", 42u, "foo"), "{0042/foo/ 42/foo"); + EXPECT_EQ(DeprecatedString::formatted("{{{:04}/{}/{0:8}/{1}", 42u, "foo"), "{0042/foo/ 42/foo"); } TEST_CASE(string_builder) @@ -69,85 +69,85 @@ TEST_CASE(string_builder) TEST_CASE(format_without_arguments) { - EXPECT_EQ(String::formatted("foo"), "foo"); + EXPECT_EQ(DeprecatedString::formatted("foo"), "foo"); } TEST_CASE(format_upper_case_integer) { - EXPECT_EQ(String::formatted("{:4X}", 0xff), " FF"); - EXPECT_EQ(String::formatted("{:#4X}", 0xff), "0XFF"); + EXPECT_EQ(DeprecatedString::formatted("{:4X}", 0xff), " FF"); + EXPECT_EQ(DeprecatedString::formatted("{:#4X}", 0xff), "0XFF"); - EXPECT_EQ(String::formatted("{:b}", 0xff), "11111111"); - EXPECT_EQ(String::formatted("{:B}", 0xff), "11111111"); - EXPECT_EQ(String::formatted("{:#b}", 0xff), "0b11111111"); + EXPECT_EQ(DeprecatedString::formatted("{:b}", 0xff), "11111111"); + EXPECT_EQ(DeprecatedString::formatted("{:B}", 0xff), "11111111"); + EXPECT_EQ(DeprecatedString::formatted("{:#b}", 0xff), "0b11111111"); } TEST_CASE(format_aligned) { - EXPECT_EQ(String::formatted("{:*<8}", 13), "13******"); - EXPECT_EQ(String::formatted("{:*^8}", 13), "***13***"); - EXPECT_EQ(String::formatted("{:*>8}", 13), "******13"); - EXPECT_EQ(String::formatted("{:*>+8}", 13), "*****+13"); - EXPECT_EQ(String::formatted("{:*^ 8}", 13), "** 13***"); + EXPECT_EQ(DeprecatedString::formatted("{:*<8}", 13), "13******"); + EXPECT_EQ(DeprecatedString::formatted("{:*^8}", 13), "***13***"); + EXPECT_EQ(DeprecatedString::formatted("{:*>8}", 13), "******13"); + EXPECT_EQ(DeprecatedString::formatted("{:*>+8}", 13), "*****+13"); + EXPECT_EQ(DeprecatedString::formatted("{:*^ 8}", 13), "** 13***"); } TEST_CASE(format_octal) { - EXPECT_EQ(String::formatted("{:o}", 0744), "744"); - EXPECT_EQ(String::formatted("{:#o}", 0744), "0744"); + EXPECT_EQ(DeprecatedString::formatted("{:o}", 0744), "744"); + EXPECT_EQ(DeprecatedString::formatted("{:#o}", 0744), "0744"); } TEST_CASE(zero_pad) { - EXPECT_EQ(String::formatted("{: <010}", 42), "42 "); - EXPECT_EQ(String::formatted("{:010}", 42), "0000000042"); - EXPECT_EQ(String::formatted("{:/^010}", 42), "////42////"); - EXPECT_EQ(String::formatted("{:04x}", -32), "-0020"); - EXPECT_EQ(String::formatted("{:#06x}", -64), "-0x000040"); + EXPECT_EQ(DeprecatedString::formatted("{: <010}", 42), "42 "); + EXPECT_EQ(DeprecatedString::formatted("{:010}", 42), "0000000042"); + EXPECT_EQ(DeprecatedString::formatted("{:/^010}", 42), "////42////"); + EXPECT_EQ(DeprecatedString::formatted("{:04x}", -32), "-0020"); + EXPECT_EQ(DeprecatedString::formatted("{:#06x}", -64), "-0x000040"); } TEST_CASE(replacement_field) { - EXPECT_EQ(String::formatted("{:*>{1}}", 13, static_cast(10)), "********13"); - EXPECT_EQ(String::formatted("{:*<{1}}", 7, 4), "7***"); + EXPECT_EQ(DeprecatedString::formatted("{:*>{1}}", 13, static_cast(10)), "********13"); + EXPECT_EQ(DeprecatedString::formatted("{:*<{1}}", 7, 4), "7***"); // Compiletime check bypass: intentionally ignoring extra arguments - EXPECT_EQ(String::formatted("{:{2}}"sv, -5, 8, 16), " -5"); - EXPECT_EQ(String::formatted("{{{:*^{1}}}}", 1, 3), "{*1*}"); - EXPECT_EQ(String::formatted("{:0{}}", 1, 3), "001"); + EXPECT_EQ(DeprecatedString::formatted("{:{2}}"sv, -5, 8, 16), " -5"); + EXPECT_EQ(DeprecatedString::formatted("{{{:*^{1}}}}", 1, 3), "{*1*}"); + EXPECT_EQ(DeprecatedString::formatted("{:0{}}", 1, 3), "001"); } TEST_CASE(replacement_field_regression) { // FIXME: Compiletime check bypass: cannot parse '}}' correctly. - EXPECT_EQ(String::formatted("{:{}}"sv, "", static_cast(6)), " "); + EXPECT_EQ(DeprecatedString::formatted("{:{}}"sv, "", static_cast(6)), " "); } TEST_CASE(complex_string_specifiers) { - EXPECT_EQ(String::formatted("{:.8}", "123456789"), "12345678"); - EXPECT_EQ(String::formatted("{:9}", "abcd"), "abcd "); - EXPECT_EQ(String::formatted("{:>9}", "abcd"), " abcd"); - EXPECT_EQ(String::formatted("{:^9}", "abcd"), " abcd "); - EXPECT_EQ(String::formatted("{:4.6}", "a"), "a "); - EXPECT_EQ(String::formatted("{:4.6}", "abcdef"), "abcdef"); - EXPECT_EQ(String::formatted("{:4.6}", "abcdefghi"), "abcdef"); + EXPECT_EQ(DeprecatedString::formatted("{:.8}", "123456789"), "12345678"); + EXPECT_EQ(DeprecatedString::formatted("{:9}", "abcd"), "abcd "); + EXPECT_EQ(DeprecatedString::formatted("{:>9}", "abcd"), " abcd"); + EXPECT_EQ(DeprecatedString::formatted("{:^9}", "abcd"), " abcd "); + EXPECT_EQ(DeprecatedString::formatted("{:4.6}", "a"), "a "); + EXPECT_EQ(DeprecatedString::formatted("{:4.6}", "abcdef"), "abcdef"); + EXPECT_EQ(DeprecatedString::formatted("{:4.6}", "abcdefghi"), "abcdef"); } TEST_CASE(cast_integer_to_character) { - EXPECT_EQ(String::formatted("{:c}", static_cast('a')), "a"); - EXPECT_EQ(String::formatted("{:c}", static_cast('f')), "f"); + EXPECT_EQ(DeprecatedString::formatted("{:c}", static_cast('a')), "a"); + EXPECT_EQ(DeprecatedString::formatted("{:c}", static_cast('f')), "f"); } TEST_CASE(boolean_values) { - EXPECT_EQ(String::formatted("{}", true), "true"); - EXPECT_EQ(String::formatted("{}", false), "false"); - EXPECT_EQ(String::formatted("{:6}", true), "true "); - EXPECT_EQ(String::formatted("{:>4}", false), "false"); - EXPECT_EQ(String::formatted("{:d}", false), "0"); - EXPECT_EQ(String::formatted("{:d}", true), "1"); - EXPECT_EQ(String::formatted("{:#08x}", true), "0x00000001"); + EXPECT_EQ(DeprecatedString::formatted("{}", true), "true"); + EXPECT_EQ(DeprecatedString::formatted("{}", false), "false"); + EXPECT_EQ(DeprecatedString::formatted("{:6}", true), "true "); + EXPECT_EQ(DeprecatedString::formatted("{:>4}", false), "false"); + EXPECT_EQ(DeprecatedString::formatted("{:d}", false), "0"); + EXPECT_EQ(DeprecatedString::formatted("{:d}", true), "1"); + EXPECT_EQ(DeprecatedString::formatted("{:#08x}", true), "0x00000001"); } TEST_CASE(pointers) @@ -155,13 +155,13 @@ TEST_CASE(pointers) void* ptr = reinterpret_cast(0x4000); if (sizeof(void*) == 4) { - EXPECT_EQ(String::formatted("{:p}", 32), "0x00000020"); - EXPECT_EQ(String::formatted("{:p}", ptr), "0x00004000"); - EXPECT_EQ(String::formatted("{}", ptr), "0x00004000"); + EXPECT_EQ(DeprecatedString::formatted("{:p}", 32), "0x00000020"); + EXPECT_EQ(DeprecatedString::formatted("{:p}", ptr), "0x00004000"); + EXPECT_EQ(DeprecatedString::formatted("{}", ptr), "0x00004000"); } else if (sizeof(void*) == 8) { - EXPECT_EQ(String::formatted("{:p}", 32), "0x0000000000000020"); - EXPECT_EQ(String::formatted("{:p}", ptr), "0x0000000000004000"); - EXPECT_EQ(String::formatted("{}", ptr), "0x0000000000004000"); + EXPECT_EQ(DeprecatedString::formatted("{:p}", 32), "0x0000000000000020"); + EXPECT_EQ(DeprecatedString::formatted("{:p}", ptr), "0x0000000000004000"); + EXPECT_EQ(DeprecatedString::formatted("{}", ptr), "0x0000000000004000"); } else { VERIFY_NOT_REACHED(); } @@ -173,12 +173,12 @@ TEST_CASE(pointers) // This is a bit scary, thus this test. At least this test should fail in this case. TEST_CASE(ensure_that_format_works) { - if (String::formatted("FAIL") != "FAIL") { + if (DeprecatedString::formatted("FAIL") != "FAIL") { fprintf(stderr, "FAIL\n"); exit(1); } - if (String::formatted("{} FAIL {}", 1, 2) != "1 FAIL 2") { + if (DeprecatedString::formatted("{} FAIL {}", 1, 2) != "1 FAIL 2") { fprintf(stderr, "FAIL\n"); exit(1); } @@ -187,13 +187,13 @@ TEST_CASE(ensure_that_format_works) TEST_CASE(format_string_literal_as_pointer) { char const* literal = "abc"; - EXPECT_EQ(String::formatted("{:p}", literal), String::formatted("{:p}", reinterpret_cast(literal))); + EXPECT_EQ(DeprecatedString::formatted("{:p}", literal), DeprecatedString::formatted("{:p}", reinterpret_cast(literal))); } TEST_CASE(format_character) { char a = 'a'; - EXPECT_EQ(String::formatted("{}", true ? a : 'b'), "a"); + EXPECT_EQ(DeprecatedString::formatted("{}", true ? a : 'b'), "a"); } struct A { @@ -210,8 +210,8 @@ struct AK::Formatter : Formatter { TEST_CASE(format_if_supported) { - EXPECT_EQ(String::formatted("{}", FormatIfSupported { A {} }), "?"); - EXPECT_EQ(String::formatted("{}", FormatIfSupported { B {} }), "B"); + EXPECT_EQ(DeprecatedString::formatted("{}", FormatIfSupported { A {} }), "?"); + EXPECT_EQ(DeprecatedString::formatted("{}", FormatIfSupported { B {} }), "B"); } TEST_CASE(file_descriptor) @@ -239,46 +239,46 @@ TEST_CASE(file_descriptor) TEST_CASE(floating_point_numbers) { - EXPECT_EQ(String::formatted("{}", 1.12), "1.12"); - EXPECT_EQ(String::formatted("{}", 1.), "1"); - EXPECT_EQ(String::formatted("{:.3}", 1.12), "1.12"); - EXPECT_EQ(String::formatted("{:.1}", 1.12), "1.1"); - EXPECT_EQ(String::formatted("{}", -1.12), "-1.12"); + EXPECT_EQ(DeprecatedString::formatted("{}", 1.12), "1.12"); + EXPECT_EQ(DeprecatedString::formatted("{}", 1.), "1"); + EXPECT_EQ(DeprecatedString::formatted("{:.3}", 1.12), "1.12"); + EXPECT_EQ(DeprecatedString::formatted("{:.1}", 1.12), "1.1"); + EXPECT_EQ(DeprecatedString::formatted("{}", -1.12), "-1.12"); - EXPECT_EQ(String::formatted("{}", NAN), "nan"); - EXPECT_EQ(String::formatted("{}", INFINITY), "inf"); - EXPECT_EQ(String::formatted("{}", -INFINITY), "-inf"); + EXPECT_EQ(DeprecatedString::formatted("{}", NAN), "nan"); + EXPECT_EQ(DeprecatedString::formatted("{}", INFINITY), "inf"); + EXPECT_EQ(DeprecatedString::formatted("{}", -INFINITY), "-inf"); // FIXME: There is always the question what we mean with the width field. Do we mean significant digits? // Do we mean the whole width? This is what was the simplest to implement: - EXPECT_EQ(String::formatted("{:x>5.1}", 1.12), "xx1.1"); + EXPECT_EQ(DeprecatedString::formatted("{:x>5.1}", 1.12), "xx1.1"); } TEST_CASE(no_precision_no_trailing_number) { - EXPECT_EQ(String::formatted("{:.0}", 0.1), "0"); + EXPECT_EQ(DeprecatedString::formatted("{:.0}", 0.1), "0"); } TEST_CASE(yay_this_implementation_sucks) { - EXPECT_EQ(String::formatted("{:.0}", .99999999999), "0"); + EXPECT_EQ(DeprecatedString::formatted("{:.0}", .99999999999), "0"); } TEST_CASE(precision_with_trailing_zeros) { - EXPECT_EQ(String::formatted("{:0.3}", 1.12), "1.120"); - EXPECT_EQ(String::formatted("{:0.1}", 1.12), "1.1"); + EXPECT_EQ(DeprecatedString::formatted("{:0.3}", 1.12), "1.120"); + EXPECT_EQ(DeprecatedString::formatted("{:0.1}", 1.12), "1.1"); } TEST_CASE(magnitude_less_than_zero) { - EXPECT_EQ(String::formatted("{}", -0.654), "-0.654"); - EXPECT_EQ(String::formatted("{}", 0.654), "0.654"); + EXPECT_EQ(DeprecatedString::formatted("{}", -0.654), "-0.654"); + EXPECT_EQ(DeprecatedString::formatted("{}", 0.654), "0.654"); } TEST_CASE(format_nullptr) { - EXPECT_EQ(String::formatted("{}", nullptr), String::formatted("{:p}", static_cast(0))); + EXPECT_EQ(DeprecatedString::formatted("{}", nullptr), DeprecatedString::formatted("{:p}", static_cast(0))); } struct C { @@ -294,12 +294,12 @@ struct AK::Formatter : AK::Formatter { TEST_CASE(use_format_string_formatter) { - EXPECT_EQ(String::formatted("{:*<10}", C { 42 }), "C(i=42)***"); + EXPECT_EQ(DeprecatedString::formatted("{:*<10}", C { 42 }), "C(i=42)***"); } TEST_CASE(long_long_regression) { - EXPECT_EQ(String::formatted("{}", 0x0123456789abcdefLL), "81985529216486895"); + EXPECT_EQ(DeprecatedString::formatted("{}", 0x0123456789abcdefLL), "81985529216486895"); StringBuilder builder; AK::FormatBuilder fmtbuilder { builder }; @@ -310,38 +310,38 @@ TEST_CASE(long_long_regression) TEST_CASE(hex_dump) { - EXPECT_EQ(String::formatted("{:hex-dump}", "0000"), "30303030"); - EXPECT_EQ(String::formatted("{:>4hex-dump}", "0000"), "30303030 0000"); - EXPECT_EQ(String::formatted("{:>2hex-dump}", "0000"), "3030 00\n3030 00"); - EXPECT_EQ(String::formatted("{:*>4hex-dump}", "0000"), "30303030****0000"); + EXPECT_EQ(DeprecatedString::formatted("{:hex-dump}", "0000"), "30303030"); + EXPECT_EQ(DeprecatedString::formatted("{:>4hex-dump}", "0000"), "30303030 0000"); + EXPECT_EQ(DeprecatedString::formatted("{:>2hex-dump}", "0000"), "3030 00\n3030 00"); + EXPECT_EQ(DeprecatedString::formatted("{:*>4hex-dump}", "0000"), "30303030****0000"); } TEST_CASE(vector_format) { { Vector v { 1, 2, 3, 4 }; - EXPECT_EQ(String::formatted("{}", v), "[ 1, 2, 3, 4 ]"); + EXPECT_EQ(DeprecatedString::formatted("{}", v), "[ 1, 2, 3, 4 ]"); } { Vector v { "1"sv, "2"sv, "3"sv, "4"sv }; - EXPECT_EQ(String::formatted("{}", v), "[ 1, 2, 3, 4 ]"); + EXPECT_EQ(DeprecatedString::formatted("{}", v), "[ 1, 2, 3, 4 ]"); } { - Vector> v { { "1"sv, "2"sv }, { "3"sv, "4"sv } }; - EXPECT_EQ(String::formatted("{}", v), "[ [ 1, 2 ], [ 3, 4 ] ]"); + Vector> v { { "1"sv, "2"sv }, { "3"sv, "4"sv } }; + EXPECT_EQ(DeprecatedString::formatted("{}", v), "[ [ 1, 2 ], [ 3, 4 ] ]"); } } TEST_CASE(format_wchar) { - EXPECT_EQ(String::formatted("{}", L'a'), "a"); - EXPECT_EQ(String::formatted("{}", L'\U0001F41E'), "\xF0\x9F\x90\x9E"); - EXPECT_EQ(String::formatted("{:x}", L'a'), "61"); - EXPECT_EQ(String::formatted("{:x}", L'\U0001F41E'), "1f41e"); - EXPECT_EQ(String::formatted("{:d}", L'a'), "97"); - EXPECT_EQ(String::formatted("{:d}", L'\U0001F41E'), "128030"); + EXPECT_EQ(DeprecatedString::formatted("{}", L'a'), "a"); + EXPECT_EQ(DeprecatedString::formatted("{}", L'\U0001F41E'), "\xF0\x9F\x90\x9E"); + EXPECT_EQ(DeprecatedString::formatted("{:x}", L'a'), "61"); + EXPECT_EQ(DeprecatedString::formatted("{:x}", L'\U0001F41E'), "1f41e"); + EXPECT_EQ(DeprecatedString::formatted("{:d}", L'a'), "97"); + EXPECT_EQ(DeprecatedString::formatted("{:d}", L'\U0001F41E'), "128030"); - EXPECT_EQ(String::formatted("{:6}", L'a'), "a "); - EXPECT_EQ(String::formatted("{:6d}", L'a'), " 97"); - EXPECT_EQ(String::formatted("{:#x}", L'\U0001F41E'), "0x1f41e"); + EXPECT_EQ(DeprecatedString::formatted("{:6}", L'a'), "a "); + EXPECT_EQ(DeprecatedString::formatted("{:6d}", L'a'), " 97"); + EXPECT_EQ(DeprecatedString::formatted("{:#x}", L'\U0001F41E'), "0x1f41e"); } diff --git a/Tests/AK/TestHashMap.cpp b/Tests/AK/TestHashMap.cpp index 8d46a3d6123..a6b5d2dea24 100644 --- a/Tests/AK/TestHashMap.cpp +++ b/Tests/AK/TestHashMap.cpp @@ -6,9 +6,9 @@ #include +#include #include #include -#include TEST_CASE(construct) { @@ -19,7 +19,7 @@ TEST_CASE(construct) TEST_CASE(construct_from_initializer_list) { - HashMap number_to_string { + HashMap number_to_string { { 1, "One" }, { 2, "Two" }, { 3, "Three" }, @@ -30,7 +30,7 @@ TEST_CASE(construct_from_initializer_list) TEST_CASE(populate) { - HashMap number_to_string; + HashMap number_to_string; number_to_string.set(1, "One"); number_to_string.set(2, "Two"); number_to_string.set(3, "Three"); @@ -41,7 +41,7 @@ TEST_CASE(populate) TEST_CASE(range_loop) { - HashMap number_to_string; + HashMap number_to_string; EXPECT_EQ(number_to_string.set(1, "One"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(number_to_string.set(2, "Two"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(number_to_string.set(3, "Three"), AK::HashSetResult::InsertedNewEntry); @@ -56,7 +56,7 @@ TEST_CASE(range_loop) TEST_CASE(map_remove) { - HashMap number_to_string; + HashMap number_to_string; EXPECT_EQ(number_to_string.set(1, "One"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(number_to_string.set(2, "Two"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(number_to_string.set(3, "Three"), AK::HashSetResult::InsertedNewEntry); @@ -73,7 +73,7 @@ TEST_CASE(map_remove) TEST_CASE(remove_all_matching) { - HashMap map; + HashMap map; map.set(1, "One"); map.set(2, "Two"); @@ -82,27 +82,27 @@ TEST_CASE(remove_all_matching) EXPECT_EQ(map.size(), 4u); - EXPECT_EQ(map.remove_all_matching([&](int key, String const& value) { return key == 1 || value == "Two"; }), true); + EXPECT_EQ(map.remove_all_matching([&](int key, DeprecatedString const& value) { return key == 1 || value == "Two"; }), true); EXPECT_EQ(map.size(), 2u); - EXPECT_EQ(map.remove_all_matching([&](int, String const&) { return false; }), false); + EXPECT_EQ(map.remove_all_matching([&](int, DeprecatedString const&) { return false; }), false); EXPECT_EQ(map.size(), 2u); EXPECT(map.contains(3)); EXPECT(map.contains(4)); - EXPECT_EQ(map.remove_all_matching([&](int, String const&) { return true; }), true); - EXPECT_EQ(map.remove_all_matching([&](int, String const&) { return false; }), false); + EXPECT_EQ(map.remove_all_matching([&](int, DeprecatedString const&) { return true; }), true); + EXPECT_EQ(map.remove_all_matching([&](int, DeprecatedString const&) { return false; }), false); EXPECT(map.is_empty()); - EXPECT_EQ(map.remove_all_matching([&](int, String const&) { return true; }), false); + EXPECT_EQ(map.remove_all_matching([&](int, DeprecatedString const&) { return true; }), false); } TEST_CASE(case_insensitive) { - HashMap casemap; - EXPECT_EQ(String("nickserv").to_lowercase(), String("NickServ").to_lowercase()); + HashMap casemap; + EXPECT_EQ(DeprecatedString("nickserv").to_lowercase(), DeprecatedString("NickServ").to_lowercase()); EXPECT_EQ(casemap.set("nickserv", 3), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(casemap.set("NickServ", 3), AK::HashSetResult::ReplacedExistingEntry); EXPECT_EQ(casemap.size(), 1u); @@ -111,11 +111,11 @@ TEST_CASE(case_insensitive) TEST_CASE(hashmap_of_nonnullownptr_get) { struct Object { - Object(String const& s) + Object(DeprecatedString const& s) : string(s) { } - String string; + DeprecatedString string; }; HashMap> objects; @@ -142,16 +142,16 @@ TEST_CASE(hashmap_of_nonnullownptr_get) TEST_CASE(many_strings) { - HashMap strings; + HashMap strings; for (int i = 0; i < 999; ++i) { - EXPECT_EQ(strings.set(String::number(i), i), AK::HashSetResult::InsertedNewEntry); + EXPECT_EQ(strings.set(DeprecatedString::number(i), i), AK::HashSetResult::InsertedNewEntry); } EXPECT_EQ(strings.size(), 999u); for (auto& it : strings) { EXPECT_EQ(it.key.to_int().value(), it.value); } for (int i = 0; i < 999; ++i) { - EXPECT_EQ(strings.remove(String::number(i)), true); + EXPECT_EQ(strings.remove(DeprecatedString::number(i)), true); } EXPECT_EQ(strings.is_empty(), true); } @@ -204,7 +204,7 @@ TEST_CASE(basic_contains) TEST_CASE(in_place_rehashing_ordered_loop_bug) { - OrderedHashMap map; + OrderedHashMap map; map.set("yt.innertube::nextId", ""); map.set("yt.innertube::requests", ""); map.remove("yt.innertube::nextId"); diff --git a/Tests/AK/TestHashTable.cpp b/Tests/AK/TestHashTable.cpp index cccf4c879fd..86a9690b4a0 100644 --- a/Tests/AK/TestHashTable.cpp +++ b/Tests/AK/TestHashTable.cpp @@ -6,9 +6,9 @@ #include +#include #include #include -#include TEST_CASE(construct) { @@ -44,7 +44,7 @@ TEST_CASE(move_is_not_swap) TEST_CASE(populate) { - HashTable strings; + HashTable strings; strings.set("One"); strings.set("Two"); strings.set("Three"); @@ -55,7 +55,7 @@ TEST_CASE(populate) TEST_CASE(range_loop) { - HashTable strings; + HashTable strings; EXPECT_EQ(strings.set("One"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(strings.set("Two"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(strings.set("Three"), AK::HashSetResult::InsertedNewEntry); @@ -70,7 +70,7 @@ TEST_CASE(range_loop) TEST_CASE(table_remove) { - HashTable strings; + HashTable strings; EXPECT_EQ(strings.set("One"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(strings.set("Two"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(strings.set("Three"), AK::HashSetResult::InsertedNewEntry); @@ -113,8 +113,8 @@ TEST_CASE(remove_all_matching) TEST_CASE(case_insensitive) { - HashTable casetable; - EXPECT_EQ(String("nickserv").to_lowercase(), String("NickServ").to_lowercase()); + HashTable casetable; + EXPECT_EQ(DeprecatedString("nickserv").to_lowercase(), DeprecatedString("NickServ").to_lowercase()); EXPECT_EQ(casetable.set("nickserv"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(casetable.set("NickServ"), AK::HashSetResult::ReplacedExistingEntry); EXPECT_EQ(casetable.size(), 1u); @@ -122,33 +122,33 @@ TEST_CASE(case_insensitive) TEST_CASE(many_strings) { - HashTable strings; + HashTable strings; for (int i = 0; i < 999; ++i) { - EXPECT_EQ(strings.set(String::number(i)), AK::HashSetResult::InsertedNewEntry); + EXPECT_EQ(strings.set(DeprecatedString::number(i)), AK::HashSetResult::InsertedNewEntry); } EXPECT_EQ(strings.size(), 999u); for (int i = 0; i < 999; ++i) { - EXPECT_EQ(strings.remove(String::number(i)), true); + EXPECT_EQ(strings.remove(DeprecatedString::number(i)), true); } EXPECT_EQ(strings.is_empty(), true); } TEST_CASE(many_collisions) { - struct StringCollisionTraits : public GenericTraits { - static unsigned hash(String const&) { return 0; } + struct StringCollisionTraits : public GenericTraits { + static unsigned hash(DeprecatedString const&) { return 0; } }; - HashTable strings; + HashTable strings; for (int i = 0; i < 999; ++i) { - EXPECT_EQ(strings.set(String::number(i)), AK::HashSetResult::InsertedNewEntry); + EXPECT_EQ(strings.set(DeprecatedString::number(i)), AK::HashSetResult::InsertedNewEntry); } EXPECT_EQ(strings.set("foo"), AK::HashSetResult::InsertedNewEntry); EXPECT_EQ(strings.size(), 1000u); for (int i = 0; i < 999; ++i) { - EXPECT_EQ(strings.remove(String::number(i)), true); + EXPECT_EQ(strings.remove(DeprecatedString::number(i)), true); } // FIXME: Doing this with an "EXPECT_NOT_EQ" would be cleaner. @@ -157,24 +157,24 @@ TEST_CASE(many_collisions) TEST_CASE(space_reuse) { - struct StringCollisionTraits : public GenericTraits { - static unsigned hash(String const&) { return 0; } + struct StringCollisionTraits : public GenericTraits { + static unsigned hash(DeprecatedString const&) { return 0; } }; - HashTable strings; + HashTable strings; // Add a few items to allow it to do initial resizing. EXPECT_EQ(strings.set("0"), AK::HashSetResult::InsertedNewEntry); for (int i = 1; i < 5; ++i) { - EXPECT_EQ(strings.set(String::number(i)), AK::HashSetResult::InsertedNewEntry); - EXPECT_EQ(strings.remove(String::number(i - 1)), true); + EXPECT_EQ(strings.set(DeprecatedString::number(i)), AK::HashSetResult::InsertedNewEntry); + EXPECT_EQ(strings.remove(DeprecatedString::number(i - 1)), true); } auto capacity = strings.capacity(); for (int i = 5; i < 999; ++i) { - EXPECT_EQ(strings.set(String::number(i)), AK::HashSetResult::InsertedNewEntry); - EXPECT_EQ(strings.remove(String::number(i - 1)), true); + EXPECT_EQ(strings.set(DeprecatedString::number(i)), AK::HashSetResult::InsertedNewEntry); + EXPECT_EQ(strings.remove(DeprecatedString::number(i - 1)), true); } EXPECT_EQ(strings.capacity(), capacity); @@ -300,7 +300,7 @@ BENCHMARK_CASE(benchmark_thrashing) TEST_CASE(reinsertion) { - OrderedHashTable map; + OrderedHashTable map; map.set("ytidb::LAST_RESULT_ENTRY_KEY"); map.set("__sak"); map.remove("__sak"); diff --git a/Tests/AK/TestJSON.cpp b/Tests/AK/TestJSON.cpp index f748dc530b3..efae3144465 100644 --- a/Tests/AK/TestJSON.cpp +++ b/Tests/AK/TestJSON.cpp @@ -6,15 +6,15 @@ #include +#include #include #include #include -#include #include TEST_CASE(load_form) { - String raw_form_json = R"( + DeprecatedString raw_form_json = R"( { "name": "Form1", "widgets": [ @@ -294,7 +294,7 @@ private: TEST_CASE(fallible_json_object_for_each) { - String raw_json = R"( + DeprecatedString raw_json = R"( { "name": "anon", "home": "/home/anon", @@ -334,7 +334,7 @@ TEST_CASE(fallible_json_object_for_each) TEST_CASE(fallible_json_array_for_each) { - String raw_json = R"( + DeprecatedString raw_json = R"( [ "anon", "/home/anon", diff --git a/Tests/AK/TestLexicalPath.cpp b/Tests/AK/TestLexicalPath.cpp index e1443b9665b..445689b82c7 100644 --- a/Tests/AK/TestLexicalPath.cpp +++ b/Tests/AK/TestLexicalPath.cpp @@ -7,8 +7,8 @@ #include +#include #include -#include TEST_CASE(relative_path) { diff --git a/Tests/AK/TestMemory.cpp b/Tests/AK/TestMemory.cpp index fbdf3726ae5..b1a17caa6ef 100644 --- a/Tests/AK/TestMemory.cpp +++ b/Tests/AK/TestMemory.cpp @@ -6,9 +6,9 @@ #include +#include #include #include -#include TEST_CASE(bitap) { @@ -78,9 +78,9 @@ TEST_CASE(kmp_two_chunks) TEST_CASE(timing_safe_compare) { - String data_set = "abcdefghijklmnopqrstuvwxyz123456789"; + DeprecatedString data_set = "abcdefghijklmnopqrstuvwxyz123456789"; EXPECT_EQ(true, AK::timing_safe_compare(data_set.characters(), data_set.characters(), data_set.length())); - String reversed = data_set.reverse(); + DeprecatedString reversed = data_set.reverse(); EXPECT_EQ(false, AK::timing_safe_compare(data_set.characters(), reversed.characters(), reversed.length())); } diff --git a/Tests/AK/TestNonnullRefPtr.cpp b/Tests/AK/TestNonnullRefPtr.cpp index 7444b9f7b96..dfa26a9e2f6 100644 --- a/Tests/AK/TestNonnullRefPtr.cpp +++ b/Tests/AK/TestNonnullRefPtr.cpp @@ -6,8 +6,8 @@ #include +#include #include -#include struct Object : public RefCounted { int x; diff --git a/Tests/AK/TestOptional.cpp b/Tests/AK/TestOptional.cpp index 23bf3e7491d..c0ee05859e6 100644 --- a/Tests/AK/TestOptional.cpp +++ b/Tests/AK/TestOptional.cpp @@ -7,8 +7,8 @@ #include +#include #include -#include #include TEST_CASE(basic_optional) @@ -59,7 +59,7 @@ TEST_CASE(optional_rvalue_ref_qualified_getters) TEST_CASE(optional_leak_1) { struct Structure { - Optional str; + Optional str; }; // This used to leak, it does not anymore. @@ -81,7 +81,7 @@ TEST_CASE(comparison_without_values) { Optional opt0; Optional opt1; - Optional opt2; + Optional opt2; EXPECT_EQ(opt0, opt1); EXPECT_EQ(opt0, opt2); } @@ -90,7 +90,7 @@ TEST_CASE(comparison_with_values) { Optional opt0; Optional opt1 = "foo"sv; - Optional opt2 = "foo"sv; + Optional opt2 = "foo"sv; Optional opt3 = "bar"sv; EXPECT_NE(opt0, opt1); EXPECT_EQ(opt1, opt2); @@ -99,14 +99,14 @@ TEST_CASE(comparison_with_values) TEST_CASE(comparison_to_underlying_types) { - Optional opt0; - EXPECT_NE(opt0, String()); + Optional opt0; + EXPECT_NE(opt0, DeprecatedString()); EXPECT_NE(opt0, "foo"); Optional opt1 = "foo"sv; EXPECT_EQ(opt1, "foo"); EXPECT_NE(opt1, "bar"); - EXPECT_EQ(opt1, String("foo")); + EXPECT_EQ(opt1, DeprecatedString("foo")); } TEST_CASE(comparison_with_numeric_types) @@ -262,7 +262,7 @@ TEST_CASE(comparison_reference) StringView test = "foo"sv; Optional opt0; Optional opt1 = test; - Optional opt2 = "foo"sv; + Optional opt2 = "foo"sv; Optional opt3 = "bar"sv; EXPECT_NE(opt0, opt1); diff --git a/Tests/AK/TestQueue.cpp b/Tests/AK/TestQueue.cpp index 6e11e6e685e..2e527925c84 100644 --- a/Tests/AK/TestQueue.cpp +++ b/Tests/AK/TestQueue.cpp @@ -6,8 +6,8 @@ #include +#include #include -#include TEST_CASE(construct) { @@ -32,7 +32,7 @@ TEST_CASE(populate_int) TEST_CASE(populate_string) { - Queue strings; + Queue strings; strings.enqueue("ABC"); strings.enqueue("DEF"); EXPECT_EQ(strings.size(), 2u); @@ -43,11 +43,11 @@ TEST_CASE(populate_string) TEST_CASE(order) { - Queue strings; + Queue strings; EXPECT(strings.is_empty()); for (size_t i = 0; i < 10000; ++i) { - strings.enqueue(String::number(i)); + strings.enqueue(DeprecatedString::number(i)); EXPECT_EQ(strings.size(), i + 1); } diff --git a/Tests/AK/TestRefPtr.cpp b/Tests/AK/TestRefPtr.cpp index ce94833d406..def65be2c3d 100644 --- a/Tests/AK/TestRefPtr.cpp +++ b/Tests/AK/TestRefPtr.cpp @@ -6,8 +6,8 @@ #include +#include #include -#include struct Object : public RefCounted { int x; diff --git a/Tests/AK/TestStack.cpp b/Tests/AK/TestStack.cpp index ddbe2765d70..a48f43d5968 100644 --- a/Tests/AK/TestStack.cpp +++ b/Tests/AK/TestStack.cpp @@ -26,7 +26,7 @@ TEST_CASE(basic) TEST_CASE(complex_type) { - AK::Stack stack; + AK::Stack stack; EXPECT_EQ(stack.is_empty(), true); EXPECT(stack.push("Well")); diff --git a/Tests/AK/TestStringUtils.cpp b/Tests/AK/TestStringUtils.cpp index 98011b59bff..d0155c049e2 100644 --- a/Tests/AK/TestStringUtils.cpp +++ b/Tests/AK/TestStringUtils.cpp @@ -282,7 +282,7 @@ TEST_CASE(convert_to_uint_from_octal) TEST_CASE(ends_with) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; EXPECT(AK::StringUtils::ends_with(test_string, "DEF"sv, CaseSensitivity::CaseSensitive)); EXPECT(AK::StringUtils::ends_with(test_string, "ABCDEF"sv, CaseSensitivity::CaseSensitive)); EXPECT(!AK::StringUtils::ends_with(test_string, "ABCDE"sv, CaseSensitivity::CaseSensitive)); @@ -293,7 +293,7 @@ TEST_CASE(ends_with) TEST_CASE(starts_with) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; EXPECT(AK::StringUtils::starts_with(test_string, "ABC"sv, CaseSensitivity::CaseSensitive)); EXPECT(AK::StringUtils::starts_with(test_string, "ABCDEF"sv, CaseSensitivity::CaseSensitive)); EXPECT(!AK::StringUtils::starts_with(test_string, "BCDEF"sv, CaseSensitivity::CaseSensitive)); @@ -304,7 +304,7 @@ TEST_CASE(starts_with) TEST_CASE(contains) { - String test_string = "ABCDEFABCXYZ"; + DeprecatedString test_string = "ABCDEFABCXYZ"; EXPECT(AK::StringUtils::contains(test_string, "ABC"sv, CaseSensitivity::CaseSensitive)); EXPECT(AK::StringUtils::contains(test_string, "ABC"sv, CaseSensitivity::CaseInsensitive)); EXPECT(AK::StringUtils::contains(test_string, "AbC"sv, CaseSensitivity::CaseInsensitive)); @@ -322,7 +322,7 @@ TEST_CASE(contains) EXPECT(!AK::StringUtils::contains(test_string, "L"sv, CaseSensitivity::CaseSensitive)); EXPECT(!AK::StringUtils::contains(test_string, "L"sv, CaseSensitivity::CaseInsensitive)); - String command_palette_bug_string = "Go Go Back"; + DeprecatedString command_palette_bug_string = "Go Go Back"; EXPECT(AK::StringUtils::contains(command_palette_bug_string, "Go Back"sv, AK::CaseSensitivity::CaseSensitive)); EXPECT(AK::StringUtils::contains(command_palette_bug_string, "gO bAcK"sv, AK::CaseSensitivity::CaseInsensitive)); } @@ -351,7 +351,7 @@ TEST_CASE(trim) TEST_CASE(find) { - String test_string = "1234567"; + DeprecatedString test_string = "1234567"; EXPECT_EQ(AK::StringUtils::find(test_string, "1"sv).value_or(1), 0u); EXPECT_EQ(AK::StringUtils::find(test_string, "2"sv).value_or(2), 1u); EXPECT_EQ(AK::StringUtils::find(test_string, "3"sv).value_or(3), 2u); diff --git a/Tests/AK/TestStringView.cpp b/Tests/AK/TestStringView.cpp index 9d5bc18e0a6..39b19f3a3eb 100644 --- a/Tests/AK/TestStringView.cpp +++ b/Tests/AK/TestStringView.cpp @@ -6,7 +6,7 @@ #include -#include +#include #include TEST_CASE(construct_empty) @@ -29,8 +29,8 @@ TEST_CASE(view_literal) TEST_CASE(compare_views) { - String foo1 = "foo"; - String foo2 = "foo"; + DeprecatedString foo1 = "foo"; + DeprecatedString foo2 = "foo"; auto view1 = foo1.view(); auto view2 = foo2.view(); @@ -43,7 +43,7 @@ TEST_CASE(compare_views) TEST_CASE(string_view_literal_operator) { StringView literal_view = "foo"sv; - String test_string = "foo"; + DeprecatedString test_string = "foo"; EXPECT_EQ(literal_view.length(), test_string.length()); EXPECT_EQ(literal_view, test_string); @@ -51,7 +51,7 @@ TEST_CASE(string_view_literal_operator) TEST_CASE(starts_with) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; StringView test_string_view = test_string.view(); EXPECT(test_string_view.starts_with('A')); EXPECT(!test_string_view.starts_with('B')); @@ -64,7 +64,7 @@ TEST_CASE(starts_with) TEST_CASE(ends_with) { - String test_string = "ABCDEF"; + DeprecatedString test_string = "ABCDEF"; StringView test_string_view = test_string.view(); EXPECT(test_string_view.ends_with("DEF"sv)); EXPECT(test_string_view.ends_with('F')); @@ -78,23 +78,23 @@ TEST_CASE(ends_with) TEST_CASE(lines) { - String test_string = "a\rb\nc\r\nd"; + DeprecatedString test_string = "a\rb\nc\r\nd"; StringView test_string_view = test_string.view(); Vector test_string_vector = test_string_view.lines(); EXPECT_EQ(test_string_vector.size(), 4u); - EXPECT(test_string_vector.at(0) == String("a")); - EXPECT(test_string_vector.at(1) == String("b")); - EXPECT(test_string_vector.at(2) == String("c")); - EXPECT(test_string_vector.at(3) == String("d")); + EXPECT(test_string_vector.at(0) == DeprecatedString("a")); + EXPECT(test_string_vector.at(1) == DeprecatedString("b")); + EXPECT(test_string_vector.at(2) == DeprecatedString("c")); + EXPECT(test_string_vector.at(3) == DeprecatedString("d")); test_string = "```\nHello there\r\nHello there\n```"; test_string_view = test_string.view(); test_string_vector = test_string_view.lines(); EXPECT_EQ(test_string_vector.size(), 4u); - EXPECT(test_string_vector.at(0) == String("```")); - EXPECT(test_string_vector.at(1) == String("Hello there")); - EXPECT(test_string_vector.at(2) == String("Hello there")); - EXPECT(test_string_vector.at(3) == String("```")); + EXPECT(test_string_vector.at(0) == DeprecatedString("```")); + EXPECT(test_string_vector.at(1) == DeprecatedString("Hello there")); + EXPECT(test_string_vector.at(2) == DeprecatedString("Hello there")); + EXPECT(test_string_vector.at(3) == DeprecatedString("```")); test_string = "\n\n\n"; test_string_view = test_string.view(); diff --git a/Tests/AK/TestTrie.cpp b/Tests/AK/TestTrie.cpp index 6091ea8b77e..c698ae35492 100644 --- a/Tests/AK/TestTrie.cpp +++ b/Tests/AK/TestTrie.cpp @@ -11,12 +11,12 @@ TEST_CASE(normal_behavior) { - Trie dictionary('/', ""); + Trie dictionary('/', ""); constexpr StringView data[] { "test"sv, "example"sv, "foo"sv, "foobar"sv }; constexpr size_t total_chars = 18; // root (1), 'test' (4), 'example' (7), 'foo' (3), 'foobar' (3, "foo" already stored). for (auto& view : data) { auto it = view.begin(); - MUST(dictionary.insert(it, view.end(), view, [](auto& parent, auto& it) -> Optional { return String::formatted("{}{}", parent.metadata_value(), *it); })); + MUST(dictionary.insert(it, view.end(), view, [](auto& parent, auto& it) -> Optional { return DeprecatedString::formatted("{}{}", parent.metadata_value(), *it); })); } size_t i = 0; diff --git a/Tests/AK/TestTuple.cpp b/Tests/AK/TestTuple.cpp index 9e7f82b724f..75e445f4be2 100644 --- a/Tests/AK/TestTuple.cpp +++ b/Tests/AK/TestTuple.cpp @@ -10,41 +10,41 @@ TEST_CASE(basic) { - Tuple value { 1, "foo" }; + Tuple value { 1, "foo" }; EXPECT_EQ(value.get(), 1); - EXPECT_EQ(value.get(), "foo"); + EXPECT_EQ(value.get(), "foo"); EXPECT_EQ(value.get<0>(), 1); EXPECT_EQ(value.get<1>(), "foo"); // Move assignment value = { 2, "bar" }; EXPECT_EQ(value.get(), 2); - EXPECT_EQ(value.get(), "bar"); + EXPECT_EQ(value.get(), "bar"); EXPECT_EQ(value.get<0>(), 2); EXPECT_EQ(value.get<1>(), "bar"); // Copy ctor auto other_value { value }; EXPECT_EQ(other_value.get(), 2); - EXPECT_EQ(other_value.get(), "bar"); + EXPECT_EQ(other_value.get(), "bar"); EXPECT_EQ(other_value.get<0>(), 2); EXPECT_EQ(other_value.get<1>(), "bar"); // Move ctor auto moved_to_value { move(value) }; EXPECT_EQ(moved_to_value.get(), 2); - EXPECT_EQ(moved_to_value.get(), "bar"); + EXPECT_EQ(moved_to_value.get(), "bar"); EXPECT_EQ(moved_to_value.get<0>(), 2); EXPECT_EQ(moved_to_value.get<1>(), "bar"); // Copy assignment value = moved_to_value; EXPECT_EQ(moved_to_value.get(), 2); - EXPECT_EQ(moved_to_value.get(), "bar"); + EXPECT_EQ(moved_to_value.get(), "bar"); EXPECT_EQ(moved_to_value.get<0>(), 2); EXPECT_EQ(moved_to_value.get<1>(), "bar"); EXPECT_EQ(value.get(), 2); - EXPECT_EQ(value.get(), "bar"); + EXPECT_EQ(value.get(), "bar"); EXPECT_EQ(value.get<0>(), 2); EXPECT_EQ(value.get<1>(), "bar"); } @@ -68,12 +68,12 @@ TEST_CASE(no_copy) TEST_CASE(apply) { - Tuple args { 1, 2, "foo" }; + Tuple args { 1, 2, "foo" }; // With copy { bool was_called = false; - args.apply_as_args([&](int a, int b, String c) { + args.apply_as_args([&](int a, int b, DeprecatedString c) { was_called = true; EXPECT_EQ(a, 1); EXPECT_EQ(b, 2); @@ -85,7 +85,7 @@ TEST_CASE(apply) // With reference { bool was_called = false; - args.apply_as_args([&](int& a, int& b, String& c) { + args.apply_as_args([&](int& a, int& b, DeprecatedString& c) { was_called = true; EXPECT_EQ(a, 1); EXPECT_EQ(b, 2); @@ -98,7 +98,7 @@ TEST_CASE(apply) { bool was_called = false; auto const& args_ref = args; - args_ref.apply_as_args([&](int const& a, int const& b, String const& c) { + args_ref.apply_as_args([&](int const& a, int const& b, DeprecatedString const& c) { was_called = true; EXPECT_EQ(a, 1); EXPECT_EQ(b, 2); diff --git a/Tests/AK/TestUtf16.cpp b/Tests/AK/TestUtf16.cpp index 36ce196632c..ee21a723194 100644 --- a/Tests/AK/TestUtf16.cpp +++ b/Tests/AK/TestUtf16.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include @@ -53,7 +53,7 @@ TEST_CASE(decode_utf8) TEST_CASE(encode_utf8) { { - String utf8_string("Привет, мир! 😀 γειά σου κόσμος こんにちは世界"); + DeprecatedString utf8_string("Привет, мир! 😀 γειά σου κόσμος こんにちは世界"); auto string = AK::utf8_to_utf16(utf8_string); Utf16View view { string }; EXPECT_EQ(view.to_utf8(Utf16View::AllowInvalidCodeUnits::Yes), utf8_string); diff --git a/Tests/AK/TestUtf8.cpp b/Tests/AK/TestUtf8.cpp index f21a6c83595..8c97246632b 100644 --- a/Tests/AK/TestUtf8.cpp +++ b/Tests/AK/TestUtf8.cpp @@ -34,7 +34,7 @@ TEST_CASE(decode_utf8) EXPECT(valid_bytes == (size_t)utf8.byte_length()); u32 expected[] = { 1055, 1088, 1080, 1074, 1077, 1090, 44, 32, 1084, 1080, 1088, 33, 32, 128512, 32, 947, 949, 953, 940, 32, 963, 959, 965, 32, 954, 972, 963, 956, 959, 962, 32, 12371, 12435, 12395, 12385, 12399, 19990, 30028 }; - String expected_underlying_bytes[] = { "П", "р", "и", "в", "е", "т", ",", " ", "м", "и", "р", "!", " ", "😀", " ", "γ", "ε", "ι", "ά", " ", "σ", "ο", "υ", " ", "κ", "ό", "σ", "μ", "ο", "ς", " ", "こ", "ん", "に", "ち", "は", "世", "界" }; + DeprecatedString expected_underlying_bytes[] = { "П", "р", "и", "в", "е", "т", ",", " ", "м", "и", "р", "!", " ", "😀", " ", "γ", "ε", "ι", "ά", " ", "σ", "ο", "υ", " ", "κ", "ό", "σ", "μ", "ο", "ς", " ", "こ", "ん", "に", "ち", "は", "世", "界" }; size_t expected_size = sizeof(expected) / sizeof(expected[0]); size_t i = 0; @@ -125,7 +125,7 @@ TEST_CASE(decode_invalid_ut8) char raw_data[] = { 'a', 'b', (char)0xA0, 'd' }; Utf8View view { StringView { raw_data, 4 } }; u32 expected_characters[] = { 'a', 'b', 0xFFFD, 'd' }; - String expected_underlying_bytes[] = { "a", "b", "\xA0", "d" }; + DeprecatedString expected_underlying_bytes[] = { "a", "b", "\xA0", "d" }; size_t expected_size = sizeof(expected_characters) / sizeof(expected_characters[0]); size_t i = 0; for (auto it = view.begin(); it != view.end(); ++it) { @@ -143,7 +143,7 @@ TEST_CASE(decode_invalid_ut8) char raw_data[] = { 'a', 'b', (char)0xC0, 'd', 'e' }; Utf8View view { StringView { raw_data, 5 } }; u32 expected_characters[] = { 'a', 'b', 0xFFFD, 'd', 'e' }; - String expected_underlying_bytes[] = { "a", "b", "\xC0", "d", "e" }; + DeprecatedString expected_underlying_bytes[] = { "a", "b", "\xC0", "d", "e" }; size_t expected_size = sizeof(expected_characters) / sizeof(expected_characters[0]); size_t i = 0; for (auto it = view.begin(); it != view.end(); ++it) { @@ -161,7 +161,7 @@ TEST_CASE(decode_invalid_ut8) char raw_data[] = { 'a', 'b', (char)0x90, 'd' }; Utf8View view { StringView { raw_data, 4 } }; u32 expected_characters[] = { 'a', 'b', 0xFFFD, 'd' }; - String expected_underlying_bytes[] = { "a", "b", "\x90", "d" }; + DeprecatedString expected_underlying_bytes[] = { "a", "b", "\x90", "d" }; size_t expected_size = sizeof(expected_characters) / sizeof(expected_characters[0]); size_t i = 0; for (auto it = view.begin(); it != view.end(); ++it) { @@ -179,7 +179,7 @@ TEST_CASE(decode_invalid_ut8) char raw_data[] = { 'a', 'b', 'c', (char)0x90 }; Utf8View view { StringView { raw_data, 4 } }; u32 expected_characters[] = { 'a', 'b', 'c', 0xFFFD }; - String expected_underlying_bytes[] = { "a", "b", "c", "\x90" }; + DeprecatedString expected_underlying_bytes[] = { "a", "b", "c", "\x90" }; size_t expected_size = sizeof(expected_characters) / sizeof(expected_characters[0]); size_t i = 0; for (auto it = view.begin(); it != view.end(); ++it) { @@ -206,7 +206,7 @@ TEST_CASE(decode_invalid_ut8) // https://www.unicode.org/versions/Unicode14.0.0/ch03.pdf , section "U+FFFD Substitution of Maximal Subparts" // However, that would go against how we deal with several other kinds of errors, so we stick to emitting only one U+FFFD. u32 expected_characters[] = { 'a', 0xFFFD, 'b' }; - String expected_underlying_bytes[] = { "a", "\xF4\xA3\x91\x96", "b" }; + DeprecatedString expected_underlying_bytes[] = { "a", "\xF4\xA3\x91\x96", "b" }; size_t expected_size = sizeof(expected_characters) / sizeof(expected_characters[0]); size_t i = 0; for (auto it = view.begin(); it != view.end(); ++it) { diff --git a/Tests/AK/TestVariant.cpp b/Tests/AK/TestVariant.cpp index ea7998a0992..37bbf646cd3 100644 --- a/Tests/AK/TestVariant.cpp +++ b/Tests/AK/TestVariant.cpp @@ -18,21 +18,21 @@ struct Object : public RefCounted { TEST_CASE(basic) { - Variant the_value { 42 }; + Variant the_value { 42 }; EXPECT(the_value.has()); EXPECT_EQ(the_value.get(), 42); - the_value = String("42"); - EXPECT(the_value.has()); - EXPECT_EQ(the_value.get(), "42"); + the_value = DeprecatedString("42"); + EXPECT(the_value.has()); + EXPECT_EQ(the_value.get(), "42"); } TEST_CASE(visit) { bool correct = false; - Variant the_value { 42.0f }; + Variant the_value { 42.0f }; the_value.visit( [&](int const&) { correct = false; }, - [&](String const&) { correct = false; }, + [&](DeprecatedString const&) { correct = false; }, [&](float const&) { correct = true; }); EXPECT(correct); } @@ -40,10 +40,10 @@ TEST_CASE(visit) TEST_CASE(visit_const) { bool correct = false; - Variant const the_value { "42"sv }; + Variant const the_value { "42"sv }; the_value.visit( - [&](String const&) { correct = true; }, + [&](DeprecatedString const&) { correct = true; }, [&](auto&) {}, [&](auto const&) {}); @@ -52,7 +52,7 @@ TEST_CASE(visit_const) correct = false; auto the_value_but_not_const = the_value; the_value_but_not_const.visit( - [&](String const&) { correct = true; }, + [&](DeprecatedString const&) { correct = true; }, [&](auto&) {}); EXPECT(correct); @@ -168,13 +168,13 @@ TEST_CASE(duplicated_types) TEST_CASE(return_values) { - using MyVariant = Variant; + using MyVariant = Variant; { MyVariant the_value { 42.0f }; float value = the_value.visit( [&](int const&) { return 1.0f; }, - [&](String const&) { return 2.0f; }, + [&](DeprecatedString const&) { return 2.0f; }, [&](float const& f) { return f; }); EXPECT_EQ(value, 42.0f); } @@ -183,17 +183,17 @@ TEST_CASE(return_values) int value = the_value.visit( [&](int& i) { return i; }, - [&](String&) { return 2; }, + [&](DeprecatedString&) { return 2; }, [&](float&) { return 3; }); EXPECT_EQ(value, 42); } { const MyVariant the_value { "str" }; - String value = the_value.visit( - [&](int const&) { return String { "wrong" }; }, - [&](String const& s) { return s; }, - [&](float const&) { return String { "wrong" }; }); + DeprecatedString value = the_value.visit( + [&](int const&) { return DeprecatedString { "wrong" }; }, + [&](DeprecatedString const& s) { return s; }, + [&](float const&) { return DeprecatedString { "wrong" }; }); EXPECT_EQ(value, "str"); } } @@ -201,11 +201,11 @@ TEST_CASE(return_values) TEST_CASE(return_values_by_reference) { auto ref = adopt_ref_if_nonnull(new (nothrow) Object()); - Variant the_value { 42.0f }; + Variant the_value { 42.0f }; auto& value = the_value.visit( [&](int const&) -> RefPtr& { return ref; }, - [&](String const&) -> RefPtr& { return ref; }, + [&](DeprecatedString const&) -> RefPtr& { return ref; }, [&](float const&) -> RefPtr& { return ref; }); EXPECT_EQ(ref, value); @@ -223,7 +223,7 @@ struct HoldsFloat { TEST_CASE(copy_assign) { { - Variant the_value { 42.0f }; + Variant the_value { 42.0f }; VERIFY(the_value.has()); EXPECT_EQ(the_value.get(), 42.0f); @@ -233,12 +233,12 @@ TEST_CASE(copy_assign) VERIFY(the_value.has()); EXPECT_EQ(the_value.get(), 12); - the_value = String("Hello, world!"); - VERIFY(the_value.has()); - EXPECT_EQ(the_value.get(), "Hello, world!"); + the_value = DeprecatedString("Hello, world!"); + VERIFY(the_value.has()); + EXPECT_EQ(the_value.get(), "Hello, world!"); } { - Variant the_value { HoldsFloat { 42.0f } }; + Variant the_value { HoldsFloat { 42.0f } }; VERIFY(the_value.has()); EXPECT_EQ(the_value.get().f, 42.0f); @@ -248,9 +248,9 @@ TEST_CASE(copy_assign) VERIFY(the_value.has()); EXPECT_EQ(the_value.get().i, 12); - the_value = String("Hello, world!"); - VERIFY(the_value.has()); - EXPECT_EQ(the_value.get(), "Hello, world!"); + the_value = DeprecatedString("Hello, world!"); + VERIFY(the_value.has()); + EXPECT_EQ(the_value.get(), "Hello, world!"); } } diff --git a/Tests/AK/TestVector.cpp b/Tests/AK/TestVector.cpp index ed3ac75e2a6..b7c778d746c 100644 --- a/Tests/AK/TestVector.cpp +++ b/Tests/AK/TestVector.cpp @@ -7,9 +7,9 @@ #include "AK/ReverseIterator.h" #include +#include #include #include -#include #include TEST_CASE(construct) @@ -38,19 +38,19 @@ TEST_CASE(ints) TEST_CASE(strings) { - Vector strings; + Vector strings; strings.append("ABC"); strings.append("DEF"); int loop_counter = 0; - for (String const& string : strings) { + for (DeprecatedString const& string : strings) { EXPECT(!string.is_null()); EXPECT(!string.is_empty()); ++loop_counter; } loop_counter = 0; - for (auto& string : (const_cast const&>(strings))) { + for (auto& string : (const_cast const&>(strings))) { EXPECT(!string.is_null()); EXPECT(!string.is_empty()); ++loop_counter; @@ -60,7 +60,7 @@ TEST_CASE(strings) TEST_CASE(strings_insert_ordered) { - Vector strings; + Vector strings; strings.append("abc"); strings.append("def"); strings.append("ghi"); @@ -163,12 +163,12 @@ TEST_CASE(vector_compare) EXPECT_EQ(ints.size(), 1000u); EXPECT_EQ(ints, same_ints); - Vector strings; - Vector same_strings; + Vector strings; + Vector same_strings; for (int i = 0; i < 1000; ++i) { - strings.append(String::number(i)); - same_strings.append(String::number(i)); + strings.append(DeprecatedString::number(i)); + same_strings.append(DeprecatedString::number(i)); } EXPECT_EQ(strings.size(), 1000u); @@ -178,9 +178,9 @@ TEST_CASE(vector_compare) TEST_CASE(grow_past_inline_capacity) { auto make_vector = [] { - Vector strings; + Vector strings; for (int i = 0; i < 32; ++i) { - strings.append(String::number(i)); + strings.append(DeprecatedString::number(i)); } return strings; }; @@ -286,7 +286,7 @@ TEST_CASE(remove_all_matching) TEST_CASE(nonnullownptrvector) { struct Object { - String string; + DeprecatedString string; }; NonnullOwnPtrVector objects; diff --git a/Tests/AK/TestWeakPtr.cpp b/Tests/AK/TestWeakPtr.cpp index 5a8c733443b..b673294585b 100644 --- a/Tests/AK/TestWeakPtr.cpp +++ b/Tests/AK/TestWeakPtr.cpp @@ -6,7 +6,7 @@ #include -#include +#include #include #include diff --git a/Tests/Kernel/TestKernelFilePermissions.cpp b/Tests/Kernel/TestKernelFilePermissions.cpp index 37eb2aa145d..00dbbabc5be 100644 --- a/Tests/Kernel/TestKernelFilePermissions.cpp +++ b/Tests/Kernel/TestKernelFilePermissions.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -81,12 +81,12 @@ TEST_CASE(test_change_file_location) ftruncate(fd, 0); EXPECT(fchmod(fd, 06755) != -1); - auto suid_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto suid_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!suid_path_or_error.is_error()); auto suid_path = suid_path_or_error.release_value(); EXPECT(suid_path.characters()); - auto new_path = String::formatted("{}.renamed", suid_path); + auto new_path = DeprecatedString::formatted("{}.renamed", suid_path); rename(suid_path.characters(), new_path.characters()); diff --git a/Tests/Kernel/TestKernelPledge.cpp b/Tests/Kernel/TestKernelPledge.cpp index 88bd5beac76..89ff01e5a0b 100644 --- a/Tests/Kernel/TestKernelPledge.cpp +++ b/Tests/Kernel/TestKernelPledge.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -18,7 +18,7 @@ TEST_CASE(test_nonexistent_pledge) TEST_CASE(test_pledge_argument_validation) { - auto const long_argument = String::repeated('a', 2048); + auto const long_argument = DeprecatedString::repeated('a', 2048); auto res = pledge(long_argument.characters(), "stdio"); EXPECT_EQ(res, -1); diff --git a/Tests/Kernel/crash.cpp b/Tests/Kernel/crash.cpp index d5be7cd87f2..6f8864626ed 100644 --- a/Tests/Kernel/crash.cpp +++ b/Tests/Kernel/crash.cpp @@ -6,8 +6,8 @@ */ #include +#include #include -#include #if ARCH(I386) || ARCH(X86_64) # include #endif diff --git a/Tests/Kernel/fuzz-syscalls.cpp b/Tests/Kernel/fuzz-syscalls.cpp index 5b066408904..8a1239ebc3d 100644 --- a/Tests/Kernel/fuzz-syscalls.cpp +++ b/Tests/Kernel/fuzz-syscalls.cpp @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include -#include #include #include #include diff --git a/Tests/LibAudio/TestFLACSpec.cpp b/Tests/LibAudio/TestFLACSpec.cpp index 487d3d9aa4f..3782641cc13 100644 --- a/Tests/LibAudio/TestFLACSpec.cpp +++ b/Tests/LibAudio/TestFLACSpec.cpp @@ -14,7 +14,7 @@ struct FlacTest : Test::TestCase { FlacTest(LexicalPath path) : Test::TestCase( - String::formatted("flac_spec_test_{}", path.basename()), [this]() { run(); }, false) + DeprecatedString::formatted("flac_spec_test_{}", path.basename()), [this]() { run(); }, false) , m_path(std::move(path)) { } @@ -23,7 +23,7 @@ struct FlacTest : Test::TestCase { { auto result = Audio::FlacLoaderPlugin::try_create(m_path.string()); if (result.is_error()) { - FAIL(String::formatted("{} (at {})", result.error().description, result.error().index)); + FAIL(DeprecatedString::formatted("{} (at {})", result.error().description, result.error().index)); return; } @@ -32,7 +32,7 @@ struct FlacTest : Test::TestCase { while (true) { auto maybe_samples = loader->get_more_samples(2 * MiB); if (maybe_samples.is_error()) { - FAIL(String::formatted("{} (at {})", maybe_samples.error().description, maybe_samples.error().index)); + FAIL(DeprecatedString::formatted("{} (at {})", maybe_samples.error().description, maybe_samples.error().index)); return; } if (maybe_samples.value().is_empty()) diff --git a/Tests/LibC/TestLibCInodeWatcher.cpp b/Tests/LibC/TestLibCInodeWatcher.cpp index b36c3eb7ff8..3c8b604411e 100644 --- a/Tests/LibC/TestLibCInodeWatcher.cpp +++ b/Tests/LibC/TestLibCInodeWatcher.cpp @@ -24,12 +24,12 @@ static int read_event(int fd) return rc; } -static String get_event_name() +static DeprecatedString get_event_name() { if (event->name_length == 0) - return String(); + return DeprecatedString(); - return String { event->name, event->name_length - 1 }; + return DeprecatedString { event->name, event->name_length - 1 }; } TEST_CASE(inode_watcher_metadata_modified_event) diff --git a/Tests/LibC/TestLibCMkTemp.cpp b/Tests/LibC/TestLibCMkTemp.cpp index 8480da57715..34df15b1451 100644 --- a/Tests/LibC/TestLibCMkTemp.cpp +++ b/Tests/LibC/TestLibCMkTemp.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -23,7 +23,7 @@ TEST_CASE(test_mktemp_unique_filename) if (fork() == 0) { char path[] = "/tmp/test.mktemp.XXXXXX"; - auto temp_path = String::formatted("{}", mktemp(path)); + auto temp_path = DeprecatedString::formatted("{}", mktemp(path)); EXPECT(temp_path.characters()); unlink(path); @@ -33,10 +33,10 @@ TEST_CASE(test_mktemp_unique_filename) } else { wait(NULL); - auto path1 = String::formatted("{}", reinterpret_cast(ptr)); + auto path1 = DeprecatedString::formatted("{}", reinterpret_cast(ptr)); char path[] = "/tmp/test.mktemp.XXXXXX"; - auto path2 = String::formatted("{}", mktemp(path)); + auto path2 = DeprecatedString::formatted("{}", mktemp(path)); EXPECT(path2.characters()); unlink(path); @@ -53,7 +53,7 @@ TEST_CASE(test_mkdtemp_unique_filename) if (fork() == 0) { char path[] = "/tmp/test.mkdtemp.XXXXXX"; - auto temp_path = String::formatted("{}", mkdtemp(path)); + auto temp_path = DeprecatedString::formatted("{}", mkdtemp(path)); EXPECT(temp_path.characters()); rmdir(path); @@ -63,10 +63,10 @@ TEST_CASE(test_mkdtemp_unique_filename) } else { wait(NULL); - auto path1 = String::formatted("{}", reinterpret_cast(ptr)); + auto path1 = DeprecatedString::formatted("{}", reinterpret_cast(ptr)); char path[] = "/tmp/test.mkdtemp.XXXXXX"; - auto path2 = String::formatted("{}", mkdtemp(path)); + auto path2 = DeprecatedString::formatted("{}", mkdtemp(path)); EXPECT(path2.characters()); rmdir(path); @@ -86,7 +86,7 @@ TEST_CASE(test_mkstemp_unique_filename) auto fd = mkstemp(path); EXPECT_NE(fd, -1); - auto temp_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto temp_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!temp_path_or_error.is_error()); auto temp_path = temp_path_or_error.release_value(); @@ -101,13 +101,13 @@ TEST_CASE(test_mkstemp_unique_filename) } else { wait(NULL); - auto path1 = String::formatted("{}", reinterpret_cast(ptr)); + auto path1 = DeprecatedString::formatted("{}", reinterpret_cast(ptr)); char path[] = "/tmp/test.mkstemp.XXXXXX"; auto fd = mkstemp(path); EXPECT(fd != -1); - auto path2_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto path2_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!path2_or_error.is_error()); auto path2 = path2_or_error.release_value(); @@ -132,7 +132,7 @@ TEST_CASE(test_mkstemps_unique_filename) auto fd = mkstemps(path, 6); EXPECT_NE(fd, -1); - auto temp_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto temp_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!temp_path_or_error.is_error()); auto temp_path = temp_path_or_error.release_value(); @@ -151,13 +151,13 @@ TEST_CASE(test_mkstemps_unique_filename) } else { wait(NULL); - auto path1 = String::formatted("{}", reinterpret_cast(ptr)); + auto path1 = DeprecatedString::formatted("{}", reinterpret_cast(ptr)); char path[] = "/tmp/test.mkstemps.prefixXXXXXXsuffix"; auto fd = mkstemps(path, 6); EXPECT(fd != -1); - auto path2_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto path2_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!path2_or_error.is_error()); auto path2 = path2_or_error.release_value(); diff --git a/Tests/LibC/TestMemmem.cpp b/Tests/LibC/TestMemmem.cpp index a6aefe388e1..5e814b16d54 100644 --- a/Tests/LibC/TestMemmem.cpp +++ b/Tests/LibC/TestMemmem.cpp @@ -37,7 +37,7 @@ TEST_CASE(memmem_search) auto expected = test_case.matching_offset >= 0 ? test_case.haystack + test_case.matching_offset : nullptr; auto result = memmem(test_case.haystack, test_case.haystack_length, test_case.needle, test_case.needle_length); if (result != expected) { - FAIL(String::formatted("Test {} FAILED! expected {:p}, got {:p}", i, expected, result)); + FAIL(DeprecatedString::formatted("Test {} FAILED! expected {:p}, got {:p}", i, expected, result)); } ++i; } diff --git a/Tests/LibC/TestMkDir.cpp b/Tests/LibC/TestMkDir.cpp index 2d419d3e4f2..37da5d1f99d 100644 --- a/Tests/LibC/TestMkDir.cpp +++ b/Tests/LibC/TestMkDir.cpp @@ -12,9 +12,9 @@ #include #include -static String random_dirname() +static DeprecatedString random_dirname() { - return String::formatted("/tmp/test_mkdir_{:04x}", (u16)rand()); + return DeprecatedString::formatted("/tmp/test_mkdir_{:04x}", (u16)rand()); } TEST_SETUP @@ -46,7 +46,7 @@ TEST_CASE(insufficient_permissions) TEST_CASE(nonexistent_parent) { auto parent = random_dirname(); - auto child = String::formatted("{}/foo", parent); + auto child = DeprecatedString::formatted("{}/foo", parent); int res = mkdir(child.characters(), 0755); int cached_errno = errno; EXPECT(res < 0); diff --git a/Tests/LibC/TestPwd.cpp b/Tests/LibC/TestPwd.cpp index 0da3c586d46..ed7e35b2046 100644 --- a/Tests/LibC/TestPwd.cpp +++ b/Tests/LibC/TestPwd.cpp @@ -10,7 +10,7 @@ #include struct PasswdEntry { - String name; + DeprecatedString name; uid_t uid {}; }; diff --git a/Tests/LibC/TestQsort.cpp b/Tests/LibC/TestQsort.cpp index 12df7b644fb..c2e7e6434a7 100644 --- a/Tests/LibC/TestQsort.cpp +++ b/Tests/LibC/TestQsort.cpp @@ -6,9 +6,9 @@ #include +#include #include #include -#include #include #include @@ -63,7 +63,7 @@ TEST_CASE(quick_sort) auto const& key1 = test_objects[i].m_key; auto const& key2 = test_objects[i + 1].m_key; if (key1 > key2) { - FAIL(String::formatted("saw key {} before key {}\n", key1, key2)); + FAIL(DeprecatedString::formatted("saw key {} before key {}\n", key1, key2)); } } // Check that the object's payloads have not been corrupted @@ -71,7 +71,7 @@ TEST_CASE(quick_sort) auto const expected = calc_payload_for_pos(i); auto const payload = test_objects[i].m_payload; if (payload != expected) { - FAIL(String::formatted("Expected payload {} for pos {}, got payload {}", expected, i, payload)); + FAIL(DeprecatedString::formatted("Expected payload {} for pos {}, got payload {}", expected, i, payload)); } } } diff --git a/Tests/LibC/TestRealpath.cpp b/Tests/LibC/TestRealpath.cpp index dc6e558d3bf..1bb34eaa0ab 100644 --- a/Tests/LibC/TestRealpath.cpp +++ b/Tests/LibC/TestRealpath.cpp @@ -6,7 +6,7 @@ #include -#include +#include #include #include #include @@ -21,10 +21,10 @@ static constexpr char PATH_LOREM_250[] = "This-is-an-annoyingly-long-name-that-s static constexpr size_t ITERATION_DEPTH = 17; -static void check_result(char const* what, String const& expected, char const* actual) +static void check_result(char const* what, DeprecatedString const& expected, char const* actual) { if (expected != actual) - FAIL(String::formatted("Expected {} to be \"{}\" ({} characters)", what, actual, actual ? strlen(actual) : 0)); + FAIL(DeprecatedString::formatted("Expected {} to be \"{}\" ({} characters)", what, actual, actual ? strlen(actual) : 0)); } TEST_CASE(overlong_realpath) @@ -59,7 +59,7 @@ TEST_CASE(overlong_realpath) ret = mkdir(PATH_LOREM_250, S_IRWXU); if (ret < 0) { perror("mkdir iter"); - FAIL(String::formatted("Unable to mkdir the overlong path fragment in iteration {}", i)); + FAIL(DeprecatedString::formatted("Unable to mkdir the overlong path fragment in iteration {}", i)); return; } expected.append('/'); @@ -67,7 +67,7 @@ TEST_CASE(overlong_realpath) ret = chdir(PATH_LOREM_250); if (ret < 0) { perror("chdir iter"); - FAIL(String::formatted("Unable to chdir to the overlong path fragment in iteration {}", i)); + FAIL(DeprecatedString::formatted("Unable to chdir to the overlong path fragment in iteration {}", i)); return; } } diff --git a/Tests/LibC/TestSearch.cpp b/Tests/LibC/TestSearch.cpp index 1b30076580a..dca74118d35 100644 --- a/Tests/LibC/TestSearch.cpp +++ b/Tests/LibC/TestSearch.cpp @@ -166,7 +166,7 @@ void twalk_action(void const* node, VISIT order, int depth) // Special case: End signaled by tester. if (depth == TWALK_CHECK_END) { if (tests[count].depth != TWALK_END_MARKER) { - FAIL(String::formatted("Expected action (node={:#x}, order={}, depth={}), but twalk ended early.", + FAIL(DeprecatedString::formatted("Expected action (node={:#x}, order={}, depth={}), but twalk ended early.", tests[count].node, U8(tests[count].order), tests[count].depth)); } return; @@ -174,7 +174,7 @@ void twalk_action(void const* node, VISIT order, int depth) // Special case: End marker reached. if (tests[count].depth == TWALK_END_MARKER) { - FAIL(String::formatted("Expected end, but twalk sent another action (node={:#x}, order={}, depth={}).", + FAIL(DeprecatedString::formatted("Expected end, but twalk sent another action (node={:#x}, order={}, depth={}).", node, U8(order), depth)); return; } diff --git a/Tests/LibC/TestSnprintf.cpp b/Tests/LibC/TestSnprintf.cpp index 482d85d2aff..a22d675b2e1 100644 --- a/Tests/LibC/TestSnprintf.cpp +++ b/Tests/LibC/TestSnprintf.cpp @@ -28,7 +28,7 @@ struct Testcase { size_t dest_expected_n; // == dest_n }; -static String show(ByteBuffer const& buf) +static DeprecatedString show(ByteBuffer const& buf) { StringBuilder builder; for (size_t i = 0; i < buf.size(); ++i) { diff --git a/Tests/LibC/TestStrlcpy.cpp b/Tests/LibC/TestStrlcpy.cpp index 58106e51a17..c766429a04f 100644 --- a/Tests/LibC/TestStrlcpy.cpp +++ b/Tests/LibC/TestStrlcpy.cpp @@ -22,7 +22,7 @@ struct Testcase { size_t dest_expected_n; // == dest_n }; -static String show(ByteBuffer const& buf) +static DeprecatedString show(ByteBuffer const& buf) { StringBuilder builder; for (size_t i = 0; i < buf.size(); ++i) { diff --git a/Tests/LibC/TestStrtodAccuracy.cpp b/Tests/LibC/TestStrtodAccuracy.cpp index 103cb5c309f..15005ae40c6 100644 --- a/Tests/LibC/TestStrtodAccuracy.cpp +++ b/Tests/LibC/TestStrtodAccuracy.cpp @@ -7,8 +7,8 @@ #include +#include #include -#include #include #include @@ -330,7 +330,7 @@ static long long hex_to_ll(char const* hex) } else if ('a' <= ch && ch <= 'f') { digit = ch - 'a' + 10; } else { - FAIL(String::formatted("\n!!! Encountered char {:02x} at {}", ch, i)); + FAIL(DeprecatedString::formatted("\n!!! Encountered char {:02x} at {}", ch, i)); return result; } result <<= 4; @@ -366,7 +366,7 @@ TEST_CASE(strtod_accuracy) } outln("Out of {} tests, saw {} successes and {} fails.", NUM_TESTCASES, successes, fails); if (fails != 0) { - FAIL(String::formatted("{} strtod tests failed", fails)); + FAIL(DeprecatedString::formatted("{} strtod tests failed", fails)); } outln("PASS (with leniency up to {} ULP from the exact solution)", LENIENCY); diff --git a/Tests/LibC/TestWchar.cpp b/Tests/LibC/TestWchar.cpp index db445e485e9..804d837f276 100644 --- a/Tests/LibC/TestWchar.cpp +++ b/Tests/LibC/TestWchar.cpp @@ -215,7 +215,7 @@ TEST_CASE(mbsinit) size_t ret = mbrtowc(nullptr, "\xdf", 1, &state); if (ret != -2ul) - FAIL(String::formatted("mbrtowc accepted partial multibyte sequence with return code {} (expected -2)", static_cast(ret))); + FAIL(DeprecatedString::formatted("mbrtowc accepted partial multibyte sequence with return code {} (expected -2)", static_cast(ret))); // Ensure that we are not in an initial state. EXPECT(mbsinit(&state) == 0); @@ -224,7 +224,7 @@ TEST_CASE(mbsinit) ret = mbrtowc(nullptr, "\xbf", 1, &state); if (ret != 1ul) - FAIL(String::formatted("mbrtowc did not consume the expected number of bytes (1), returned {} instead", static_cast(ret))); + FAIL(DeprecatedString::formatted("mbrtowc did not consume the expected number of bytes (1), returned {} instead", static_cast(ret))); // Ensure that we are in an initial state again. EXPECT(mbsinit(&state) != 0); diff --git a/Tests/LibCompress/TestBrotli.cpp b/Tests/LibCompress/TestBrotli.cpp index 2617863759f..6d34b838014 100644 --- a/Tests/LibCompress/TestBrotli.cpp +++ b/Tests/LibCompress/TestBrotli.cpp @@ -13,15 +13,15 @@ static void run_test(StringView const file_name) { // This makes sure that the tests will run both on target and in Lagom. #ifdef AK_OS_SERENITY - String path = String::formatted("/usr/Tests/LibCompress/brotli-test-files/{}", file_name); + DeprecatedString path = DeprecatedString::formatted("/usr/Tests/LibCompress/brotli-test-files/{}", file_name); #else - String path = String::formatted("brotli-test-files/{}", file_name); + DeprecatedString path = DeprecatedString::formatted("brotli-test-files/{}", file_name); #endif auto cmp_file = MUST(Core::Stream::File::open(path, Core::Stream::OpenMode::Read)); auto cmp_data = MUST(cmp_file->read_all()); - String path_compressed = String::formatted("{}.br", path); + DeprecatedString path_compressed = DeprecatedString::formatted("{}.br", path); auto file = MUST(Core::Stream::File::open(path_compressed, Core::Stream::OpenMode::Read)); auto brotli_stream = Compress::BrotliDecompressionStream { *file }; @@ -89,12 +89,12 @@ TEST_CASE(brotli_decompress_zero_one_bin) { // This makes sure that the tests will run both on target and in Lagom. #ifdef AK_OS_SERENITY - String path = "/usr/Tests/LibCompress/brotli-test-files/zero-one.bin"; + DeprecatedString path = "/usr/Tests/LibCompress/brotli-test-files/zero-one.bin"; #else - String path = "brotli-test-files/zero-one.bin"; + DeprecatedString path = "brotli-test-files/zero-one.bin"; #endif - String path_compressed = String::formatted("{}.br", path); + DeprecatedString path_compressed = DeprecatedString::formatted("{}.br", path); auto file = MUST(Core::Stream::File::open(path_compressed, Core::Stream::OpenMode::Read)); auto brotli_stream = Compress::BrotliDecompressionStream { *file }; diff --git a/Tests/LibCore/TestLibCoreArgsParser.cpp b/Tests/LibCore/TestLibCoreArgsParser.cpp index 9883e3bd821..92390b43238 100644 --- a/Tests/LibCore/TestLibCoreArgsParser.cpp +++ b/Tests/LibCore/TestLibCoreArgsParser.cpp @@ -12,7 +12,7 @@ class ParserResult { public: - ParserResult(Vector const& arguments) + ParserResult(Vector const& arguments) { argv = new char*[arguments.size() + 1]; argc = 0; @@ -60,7 +60,7 @@ public: size_t argc { 0 }; }; -static ParserResult run_parser(Vector arguments, Function parser_initialization = {}) +static ParserResult run_parser(Vector arguments, Function parser_initialization = {}) { Core::ArgsParser parser; if (parser_initialization) @@ -139,7 +139,7 @@ TEST_CASE(bool_option) TEST_CASE(positional_string_argument) { // Single required string argument - String name = ""; + DeprecatedString name = ""; auto parser_result = run_parser({ "app", "buggie" }, [&](auto& parser) { parser.add_positional_argument(name, "name", "name", Core::ArgsParser::Required::Yes); }); diff --git a/Tests/LibCore/TestLibCoreIODevice.cpp b/Tests/LibCore/TestLibCoreIODevice.cpp index 808339fe7a5..ae37acabb15 100644 --- a/Tests/LibCore/TestLibCoreIODevice.cpp +++ b/Tests/LibCore/TestLibCoreIODevice.cpp @@ -8,7 +8,7 @@ #include #include -static bool files_have_same_contents(String filename1, String filename2) +static bool files_have_same_contents(DeprecatedString filename1, DeprecatedString filename2) { auto file1 = Core::File::open(filename1, Core::OpenMode::ReadOnly).value(); auto file2 = Core::File::open(filename2, Core::OpenMode::ReadOnly).value(); @@ -40,7 +40,7 @@ TEST_CASE(file_readline) TEST_CASE(file_get_read_position) { - const String path = "10kb.txt"; + const DeprecatedString path = "10kb.txt"; auto file = Core::File::open(path, Core::OpenMode::ReadOnly).release_value(); const size_t step_size = 98; diff --git a/Tests/LibCpp/test-cpp-parser.cpp b/Tests/LibCpp/test-cpp-parser.cpp index bf18d500f23..52e105b9f0a 100644 --- a/Tests/LibCpp/test-cpp-parser.cpp +++ b/Tests/LibCpp/test-cpp-parser.cpp @@ -13,14 +13,14 @@ constexpr char TESTS_ROOT_DIR[] = "/home/anon/Tests/cpp-tests/parser"; -static String read_all(String const& path) +static DeprecatedString read_all(DeprecatedString const& path) { auto file = MUST(Core::Stream::File::open(path, Core::Stream::OpenMode::Read)); auto file_size = MUST(file->size()); auto content = MUST(ByteBuffer::create_uninitialized(file_size)); if (!file->read_or_error(content.bytes())) VERIFY_NOT_REACHED(); - return String { content.bytes() }; + return DeprecatedString { content.bytes() }; } TEST_CASE(test_regression) @@ -36,7 +36,7 @@ TEST_CASE(test_regression) outln("Checking {}...", path.basename()); - auto ast_file_path = String::formatted("{}.ast", file_path.substring(0, file_path.length() - sizeof(".cpp") + 1)); + auto ast_file_path = DeprecatedString::formatted("{}.ast", file_path.substring(0, file_path.length() - sizeof(".cpp") + 1)); auto source = read_all(file_path); auto target_ast = read_all(ast_file_path); @@ -72,7 +72,7 @@ TEST_CASE(test_regression) fclose(input_stream); - String content { reinterpret_cast(buffer.data()), buffer.size() }; + DeprecatedString content { reinterpret_cast(buffer.data()), buffer.size() }; auto equal = content == target_ast; EXPECT(equal); diff --git a/Tests/LibCpp/test-cpp-preprocessor.cpp b/Tests/LibCpp/test-cpp-preprocessor.cpp index 9cd4a924442..8ee7822636e 100644 --- a/Tests/LibCpp/test-cpp-preprocessor.cpp +++ b/Tests/LibCpp/test-cpp-preprocessor.cpp @@ -12,14 +12,14 @@ constexpr char TESTS_ROOT_DIR[] = "/home/anon/Tests/cpp-tests/preprocessor"; -static String read_all(String const& path) +static DeprecatedString read_all(DeprecatedString const& path) { auto file = MUST(Core::Stream::File::open(path, Core::Stream::OpenMode::Read)); auto file_size = MUST(file->size()); auto content = MUST(ByteBuffer::create_uninitialized(file_size)); if (!file->read_or_error(content.bytes())) VERIFY_NOT_REACHED(); - return String { content.bytes() }; + return DeprecatedString { content.bytes() }; } TEST_CASE(test_regression) @@ -35,7 +35,7 @@ TEST_CASE(test_regression) outln("Checking {}...", path.basename()); - auto ast_file_path = String::formatted("{}.txt", file_path.substring(0, file_path.length() - sizeof(".cpp") + 1)); + auto ast_file_path = DeprecatedString::formatted("{}.txt", file_path.substring(0, file_path.length() - sizeof(".cpp") + 1)); auto source = read_all(file_path); auto target = read_all(ast_file_path); diff --git a/Tests/LibCrypto/TestChecksum.cpp b/Tests/LibCrypto/TestChecksum.cpp index 60293f0f8c6..5faa6281dc0 100644 --- a/Tests/LibCrypto/TestChecksum.cpp +++ b/Tests/LibCrypto/TestChecksum.cpp @@ -15,11 +15,11 @@ TEST_CASE(test_adler32) EXPECT_EQ(digest, expected_result); }; - do_test(String("").bytes(), 0x1); - do_test(String("a").bytes(), 0x00620062); - do_test(String("abc").bytes(), 0x024d0127); - do_test(String("message digest").bytes(), 0x29750586); - do_test(String("abcdefghijklmnopqrstuvwxyz").bytes(), 0x90860b20); + do_test(DeprecatedString("").bytes(), 0x1); + do_test(DeprecatedString("a").bytes(), 0x00620062); + do_test(DeprecatedString("abc").bytes(), 0x024d0127); + do_test(DeprecatedString("message digest").bytes(), 0x29750586); + do_test(DeprecatedString("abcdefghijklmnopqrstuvwxyz").bytes(), 0x90860b20); } TEST_CASE(test_crc32) @@ -29,7 +29,7 @@ TEST_CASE(test_crc32) EXPECT_EQ(digest, expected_result); }; - do_test(String("").bytes(), 0x0); - do_test(String("The quick brown fox jumps over the lazy dog").bytes(), 0x414FA339); - do_test(String("various CRC algorithms input data").bytes(), 0x9BD366AE); + do_test(DeprecatedString("").bytes(), 0x0); + do_test(DeprecatedString("The quick brown fox jumps over the lazy dog").bytes(), 0x414FA339); + do_test(DeprecatedString("various CRC algorithms input data").bytes(), 0x9BD366AE); } diff --git a/Tests/LibELF/test-elf.cpp b/Tests/LibELF/test-elf.cpp index d15e4856c21..97c75c02d00 100644 --- a/Tests/LibELF/test-elf.cpp +++ b/Tests/LibELF/test-elf.cpp @@ -58,7 +58,7 @@ TEST_CASE(test_interp_header_tiny_p_filesz) int nwritten = write(fd, buffer, sizeof(buffer)); EXPECT(nwritten); - auto elf_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!elf_path_or_error.is_error()); auto elf_path = elf_path_or_error.release_value(); @@ -115,7 +115,7 @@ TEST_CASE(test_interp_header_p_filesz_larger_than_p_memsz) int nwritten = write(fd, buffer, sizeof(buffer)); EXPECT(nwritten); - auto elf_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!elf_path_or_error.is_error()); auto elf_path = elf_path_or_error.release_value(); @@ -176,7 +176,7 @@ TEST_CASE(test_interp_header_p_filesz_plus_p_offset_overflow_p_memsz) int nwritten = write(fd, buffer, sizeof(buffer)); EXPECT(nwritten); - auto elf_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!elf_path_or_error.is_error()); auto elf_path = elf_path_or_error.release_value(); @@ -234,7 +234,7 @@ TEST_CASE(test_load_header_p_memsz_zero) int nwritten = write(fd, buffer, sizeof(buffer)); EXPECT(nwritten); - auto elf_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!elf_path_or_error.is_error()); auto elf_path = elf_path_or_error.release_value(); @@ -292,7 +292,7 @@ TEST_CASE(test_load_header_p_memsz_not_equal_to_p_align) int nwritten = write(fd, buffer, sizeof(buffer)); EXPECT(nwritten); - auto elf_path_or_error = Core::File::read_link(String::formatted("/proc/{}/fd/{}", getpid(), fd)); + auto elf_path_or_error = Core::File::read_link(DeprecatedString::formatted("/proc/{}/fd/{}", getpid(), fd)); EXPECT(!elf_path_or_error.is_error()); auto elf_path = elf_path_or_error.release_value(); diff --git a/Tests/LibGL/TestRender.cpp b/Tests/LibGL/TestRender.cpp index 8300eab515e..edd0c162ea6 100644 --- a/Tests/LibGL/TestRender.cpp +++ b/Tests/LibGL/TestRender.cpp @@ -5,8 +5,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include -#include #include #include #include @@ -31,7 +31,7 @@ static NonnullOwnPtr create_testing_context(int width, int height static void expect_bitmap_equals_reference(Gfx::Bitmap const& bitmap, StringView test_name) { - auto reference_filename = String::formatted("{}.qoi", test_name); + auto reference_filename = DeprecatedString::formatted("{}.qoi", test_name); if constexpr (SAVE_OUTPUT) { auto target_path = LexicalPath("/home/anon").append(reference_filename); @@ -42,7 +42,7 @@ static void expect_bitmap_equals_reference(Gfx::Bitmap const& bitmap, StringView EXPECT_EQ(number_of_bytes_written, qoi_buffer.size()); } - auto reference_image_path = String::formatted(REFERENCE_IMAGE_DIR "/{}", reference_filename); + auto reference_image_path = DeprecatedString::formatted(REFERENCE_IMAGE_DIR "/{}", reference_filename); auto reference_bitmap = MUST(Gfx::Bitmap::try_load_from_file(reference_image_path)); EXPECT_EQ(reference_bitmap->visually_equals(bitmap), true); } diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 817f7b88e72..ea19e5cb6ee 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include diff --git a/Tests/LibJS/test-js.cpp b/Tests/LibJS/test-js.cpp index fdbec810053..8ab1cc6bf4e 100644 --- a/Tests/LibJS/test-js.cpp +++ b/Tests/LibJS/test-js.cpp @@ -69,7 +69,7 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage) auto value = TRY(reference.get_value(vm)); if (!can_be_held_weakly(value)) - return vm.throw_completion(JS::ErrorType::CannotBeHeldWeakly, String::formatted("Variable with name {}", variable_name.string())); + return vm.throw_completion(JS::ErrorType::CannotBeHeldWeakly, DeprecatedString::formatted("Variable with name {}", variable_name.string())); vm.heap().uproot_cell(&value.as_cell()); TRY(reference.delete_(vm)); @@ -88,7 +88,7 @@ TESTJS_GLOBAL_FUNCTION(detach_array_buffer, detachArrayBuffer) return JS::js_null(); } -TESTJS_RUN_FILE_FUNCTION(String const& test_file, JS::Interpreter& interpreter, JS::ExecutionContext&) +TESTJS_RUN_FILE_FUNCTION(DeprecatedString const& test_file, JS::Interpreter& interpreter, JS::ExecutionContext&) { if (!test262_parser_tests) return Test::JS::RunFileHookResult::RunAsNormal; @@ -123,8 +123,8 @@ TESTJS_RUN_FILE_FUNCTION(String const& test_file, JS::Interpreter& interpreter, parse_succeeded = !Test::JS::parse_script(test_file, interpreter.realm()).is_error(); bool test_passed = true; - String message; - String expectation_string; + DeprecatedString message; + DeprecatedString expectation_string; switch (expectation) { case Early: diff --git a/Tests/LibJS/test-test262.cpp b/Tests/LibJS/test-test262.cpp index 92b043d2623..89e425368b9 100644 --- a/Tests/LibJS/test-test262.cpp +++ b/Tests/LibJS/test-test262.cpp @@ -4,13 +4,13 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include #include #include #include -#include #include #include #include @@ -147,7 +147,7 @@ public: { } - bool write_lines(Span lines) + bool write_lines(Span lines) { // It's possible the process dies before we can write all the tests // to the stdin. So make sure that we don't crash but just stop writing. @@ -160,8 +160,8 @@ public: return false; } - for (String const& line : lines) { - if (!m_output->write_or_error(String::formatted("{}\n", line).bytes())) + for (DeprecatedString const& line : lines) { + if (!m_output->write_or_error(DeprecatedString::formatted("{}\n", line).bytes())) break; } @@ -175,14 +175,14 @@ public: return true; } - String read_all() + DeprecatedString read_all() { auto all_output_or_error = m_input->read_all(); if (all_output_or_error.is_error()) { warnln("Got error: {} while reading runner output", all_output_or_error.error()); return ""sv; } - return String(all_output_or_error.value().bytes(), Chomp); + return DeprecatedString(all_output_or_error.value().bytes(), Chomp); } enum class ProcessResult { @@ -222,7 +222,7 @@ public: NonnullOwnPtr m_output; }; -static HashMap run_test_files(Span files, size_t offset, StringView command, char const* const arguments[]) +static HashMap run_test_files(Span files, size_t offset, StringView command, char const* const arguments[]) { HashMap results {}; results.ensure_capacity(files.size()); @@ -246,7 +246,7 @@ static HashMap run_test_files(Span files, size_t off return results; } - String output = runner_process->read_all(); + DeprecatedString output = runner_process->read_all(); auto status_or_error = runner_process->status(); bool failed = false; if (!status_or_error.is_error()) { @@ -297,7 +297,7 @@ static HashMap run_test_files(Span files, size_t off return results; } -void write_per_file(HashMap const& result_map, Vector const& paths, StringView per_file_name, double time_taken_in_ms); +void write_per_file(HashMap const& result_map, Vector const& paths, StringView per_file_name, double time_taken_in_ms); ErrorOr serenity_main(Main::Arguments arguments) { @@ -320,12 +320,12 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.parse(arguments); // Normalize the path to ensure filenames are consistent - Vector paths; + Vector paths; if (!Core::File::is_directory(test_directory)) { paths.append(test_directory); } else { - Test::iterate_directory_recursively(LexicalPath::canonicalized_path(test_directory), [&](String const& file_path) { + Test::iterate_directory_recursively(LexicalPath::canonicalized_path(test_directory), [&](DeprecatedString const& file_path) { if (file_path.contains("_FIXTURE"sv)) return; // FIXME: Add ignored file set @@ -337,7 +337,7 @@ ErrorOr serenity_main(Main::Arguments arguments) outln("Found {} tests", paths.size()); auto parameters = pass_through_parameters.split_view(' '); - Vector args; + Vector args; args.ensure_capacity(parameters.size() + 2); args.append(runner_command); if (!dont_disable_core_dump) @@ -408,7 +408,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return 0; } -void write_per_file(HashMap const& result_map, Vector const& paths, StringView per_file_name, double time_taken_in_ms) +void write_per_file(HashMap const& result_map, Vector const& paths, StringView per_file_name, double time_taken_in_ms) { auto file_or_error = Core::Stream::File::open(per_file_name, Core::Stream::OpenMode::Write); diff --git a/Tests/LibJS/test262-runner.cpp b/Tests/LibJS/test262-runner.cpp index 1faa4f29eae..e0a065cbd67 100644 --- a/Tests/LibJS/test262-runner.cpp +++ b/Tests/LibJS/test262-runner.cpp @@ -5,11 +5,11 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include #include -#include #include #include #include @@ -31,11 +31,11 @@ # include #endif -static String s_current_test = ""; +static DeprecatedString s_current_test = ""; static bool s_use_bytecode = false; static bool s_enable_bytecode_optimizations = false; static bool s_parse_only = false; -static String s_harness_file_directory; +static DeprecatedString s_harness_file_directory; static bool s_automatic_harness_detection_mode = false; enum class NegativePhase { @@ -47,9 +47,9 @@ enum class NegativePhase { struct TestError { NegativePhase phase { NegativePhase::ParseOrEarly }; - String type; - String details; - String harness_file; + DeprecatedString type; + DeprecatedString details; + DeprecatedString harness_file; }; using ScriptOrModuleProgram = Variant, JS::NonnullGCPtr>; @@ -93,7 +93,7 @@ static Result run_program(InterpreterT& interpreter, ScriptOrMo auto unit_result = JS::Bytecode::Generator::generate(program_node); if (unit_result.is_error()) { - result = JS::throw_completion(JS::InternalError::create(interpreter.realm(), String::formatted("TODO({})", unit_result.error().to_string()))); + result = JS::throw_completion(JS::InternalError::create(interpreter.realm(), DeprecatedString::formatted("TODO({})", unit_result.error().to_string()))); } else { auto unit = unit_result.release_value(); auto optimization_level = s_enable_bytecode_optimizations ? JS::Bytecode::Interpreter::OptimizationLevel::Optimize : JS::Bytecode::Interpreter::OptimizationLevel::Default; @@ -133,18 +133,18 @@ static Result run_program(InterpreterT& interpreter, ScriptOrMo return {}; } -static HashMap s_cached_harness_files; +static HashMap s_cached_harness_files; static Result read_harness_file(StringView harness_file) { auto cache = s_cached_harness_files.find(harness_file); if (cache == s_cached_harness_files.end()) { - auto file_or_error = Core::Stream::File::open(String::formatted("{}{}", s_harness_file_directory, harness_file), Core::Stream::OpenMode::Read); + auto file_or_error = Core::Stream::File::open(DeprecatedString::formatted("{}{}", s_harness_file_directory, harness_file), Core::Stream::OpenMode::Read); if (file_or_error.is_error()) { return TestError { NegativePhase::Harness, "filesystem", - String::formatted("Could not open file: {}", harness_file), + DeprecatedString::formatted("Could not open file: {}", harness_file), harness_file }; } @@ -154,7 +154,7 @@ static Result read_harness_file(StringView harness_file) return TestError { NegativePhase::Harness, "filesystem", - String::formatted("Could not read file: {}", harness_file), + DeprecatedString::formatted("Could not read file: {}", harness_file), harness_file }; } @@ -264,14 +264,14 @@ static Result run_test(StringView source, StringView filepath, return run_with_interpreter(program_or_error.value()); } -static Result extract_metadata(StringView source) +static Result extract_metadata(StringView source) { auto lines = source.lines(); TestMetadata metadata; bool parsing_negative = false; - String failed_message; + DeprecatedString failed_message; auto parse_list = [&](StringView line) { auto start = line.find('['); @@ -282,7 +282,7 @@ static Result extract_metadata(StringView source) auto end = line.find_last(']'); if (!end.has_value() || end.value() <= start.value()) { - failed_message = String::formatted("Can't parse list in '{}'", line); + failed_message = DeprecatedString::formatted("Can't parse list in '{}'", line); return items; } @@ -295,7 +295,7 @@ static Result extract_metadata(StringView source) auto second_word = [&](StringView line) { auto separator = line.find(' '); if (!separator.has_value() || separator.value() >= (line.length() - 1u)) { - failed_message = String::formatted("Can't parse value after space in '{}'", line); + failed_message = DeprecatedString::formatted("Can't parse value after space in '{}'", line); return ""sv; } return line.substring_view(separator.value() + 1); @@ -349,7 +349,7 @@ static Result extract_metadata(StringView source) metadata.phase = NegativePhase::Runtime; } else { has_phase = false; - failed_message = String::formatted("Unknown negative phase: {}", phase); + failed_message = DeprecatedString::formatted("Unknown negative phase: {}", phase); break; } } else if (line.starts_with("type:"sv)) { @@ -372,7 +372,7 @@ static Result extract_metadata(StringView source) auto flags = parse_list(line); if (flags.is_empty()) { - failed_message = String::formatted("Failed to find flags in '{}'", line); + failed_message = DeprecatedString::formatted("Failed to find flags in '{}'", line); break; } @@ -408,7 +408,7 @@ static Result extract_metadata(StringView source) } if (failed_message.is_empty()) - failed_message = String::formatted("Never reached end of comment '---*/'"); + failed_message = DeprecatedString::formatted("Never reached end of comment '---*/'"); return failed_message; } @@ -522,7 +522,7 @@ static bool verify_test(Result& result, TestMetadata const& met return error.phase == metadata.phase && error.type == metadata.type; } -static bool extract_harness_directory(String const& test_file_path) +static bool extract_harness_directory(DeprecatedString const& test_file_path) { auto test_directory_index = test_file_path.find("test/"sv); if (!test_directory_index.has_value()) { @@ -530,7 +530,7 @@ static bool extract_harness_directory(String const& test_file_path) return false; } - s_harness_file_directory = String::formatted("{}harness/", test_file_path.substring_view(0, test_directory_index.value())); + s_harness_file_directory = DeprecatedString::formatted("{}harness/", test_file_path.substring_view(0, test_directory_index.value())); return true; } @@ -568,7 +568,7 @@ extern "C" __attribute__((__noreturn__)) void __assert_fail(char const* assertio extern "C" __attribute__((__noreturn__)) void __assert_fail(char const* assertion, char const* file, unsigned int line, char const* function) # endif { - auto full_message = String::formatted("{}:{}: {}: Assertion `{}' failed.", file, line, function, assertion); + auto full_message = DeprecatedString::formatted("{}:{}: {}: Assertion `{}' failed.", file, line, function, assertion); handle_failed_assert(full_message.characters()); } #endif @@ -605,7 +605,7 @@ int main(int argc, char** argv) if (s_harness_file_directory.is_empty()) { s_automatic_harness_detection_mode = true; } else if (!s_harness_file_directory.ends_with('/')) { - s_harness_file_directory = String::formatted("{}/", s_harness_file_directory); + s_harness_file_directory = DeprecatedString::formatted("{}/", s_harness_file_directory); } if (timeout <= 0) { @@ -658,10 +658,10 @@ int main(int argc, char** argv) auto collect_output = [&] { fflush(stdout); auto nread = read(stdout_pipe[0], buffer, BUFFER_SIZE); - String value; + DeprecatedString value; if (nread > 0) { - value = String { buffer, static_cast(nread) }; + value = DeprecatedString { buffer, static_cast(nread) }; while (nread > 0) { nread = read(stdout_pipe[0], buffer, BUFFER_SIZE); } @@ -714,7 +714,7 @@ int main(int argc, char** argv) count++; - String source_with_strict; + DeprecatedString source_with_strict; static StringView use_strict = "'use strict';\n"sv; static size_t strict_length = use_strict.length(); @@ -761,7 +761,7 @@ int main(int argc, char** argv) auto result = run_test(original_contents, path, metadata); DISARM_TIMER(); - String first_output = collect_output(); + DeprecatedString first_output = collect_output(); if (!first_output.is_null()) result_object.set("output", first_output); @@ -784,7 +784,7 @@ int main(int argc, char** argv) auto result = run_test(with_strict, path, metadata); DISARM_TIMER(); - String first_output = collect_output(); + DeprecatedString first_output = collect_output(); if (!first_output.is_null()) result_object.set("strict_output", first_output); diff --git a/Tests/LibLocale/TestLocale.cpp b/Tests/LibLocale/TestLocale.cpp index 0e807075e62..7df720eb7c5 100644 --- a/Tests/LibLocale/TestLocale.cpp +++ b/Tests/LibLocale/TestLocale.cpp @@ -93,7 +93,7 @@ TEST_CASE(parse_unicode_locale_id) auto locale_id = Locale::parse_unicode_locale_id(locale); EXPECT(!locale_id.has_value()); }; - auto pass = [](StringView locale, Optional expected_language, Optional expected_script, Optional expected_region, Vector expected_variants) { + auto pass = [](StringView locale, Optional expected_language, Optional expected_script, Optional expected_region, Vector expected_variants) { auto locale_id = Locale::parse_unicode_locale_id(locale); VERIFY(locale_id.has_value()); @@ -270,7 +270,7 @@ TEST_CASE(parse_unicode_locale_id_with_private_use_extension) auto locale_id = Locale::parse_unicode_locale_id(locale); EXPECT(!locale_id.has_value()); }; - auto pass = [](StringView locale, Vector const& expected_extension) { + auto pass = [](StringView locale, Vector const& expected_extension) { auto locale_id = Locale::parse_unicode_locale_id(locale); VERIFY(locale_id.has_value()); EXPECT_EQ(locale_id->private_use_extensions, expected_extension); diff --git a/Tests/LibMarkdown/TestCommonmark.cpp b/Tests/LibMarkdown/TestCommonmark.cpp index 2d2ec547355..16571b832e0 100644 --- a/Tests/LibMarkdown/TestCommonmark.cpp +++ b/Tests/LibMarkdown/TestCommonmark.cpp @@ -4,10 +4,10 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include -#include #include #include #include @@ -24,20 +24,20 @@ TEST_SETUP auto content = MUST(ByteBuffer::create_uninitialized(file_size)); if (!file->read_or_error(content.bytes())) VERIFY_NOT_REACHED(); - String test_data { content.bytes() }; + DeprecatedString test_data { content.bytes() }; auto tests = JsonParser(test_data).parse().value().as_array(); for (size_t i = 0; i < tests.size(); ++i) { auto testcase = tests[i].as_object(); - auto name = String::formatted("{}_ex{}_{}..{}", + auto name = DeprecatedString::formatted("{}_ex{}_{}..{}", testcase.get("section"sv), testcase.get("example"sv), testcase.get("start_line"sv), testcase.get("end_line"sv)); - String markdown = testcase.get("markdown"sv).as_string(); - String html = testcase.get("html"sv).as_string(); + DeprecatedString markdown = testcase.get("markdown"sv).as_string(); + DeprecatedString html = testcase.get("html"sv).as_string(); Test::TestSuite::the().add_case(adopt_ref(*new Test::TestCase( name, [markdown, html]() { diff --git a/Tests/LibPDF/TestPDF.cpp b/Tests/LibPDF/TestPDF.cpp index ecdd7b3f908..01ff0dac602 100644 --- a/Tests/LibPDF/TestPDF.cpp +++ b/Tests/LibPDF/TestPDF.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include -#include #include #include #include @@ -47,7 +47,7 @@ TEST_CASE(empty_file_issue_10702) TEST_CASE(truncated_pdf_header_issue_10717) { - AK::String string { "%PDF-2.11%" }; + AK::DeprecatedString string { "%PDF-2.11%" }; auto document = PDF::Document::create(string.bytes()); EXPECT(document.is_error()); } diff --git a/Tests/LibRegex/Regex.cpp b/Tests/LibRegex/Regex.cpp index e93e1d43b4e..8abf62dd7ff 100644 --- a/Tests/LibRegex/Regex.cpp +++ b/Tests/LibRegex/Regex.cpp @@ -121,7 +121,7 @@ TEST_CASE(regex_lexer) TEST_CASE(parser_error_parens) { - String pattern = "test()test"; + DeprecatedString pattern = "test()test"; Lexer l(pattern); PosixExtendedParser p(l); p.parse(); @@ -131,7 +131,7 @@ TEST_CASE(parser_error_parens) TEST_CASE(parser_error_special_characters_used_at_wrong_place) { - String pattern; + DeprecatedString pattern; Vector chars = { '*', '+', '?', '{' }; StringBuilder b; @@ -266,7 +266,7 @@ TEST_CASE(catch_all_newline) Regex re("^.*$", PosixFlags::Multiline | PosixFlags::StringCopyMatches); RegexResult result; auto lambda = [&result, &re]() { - String aaa = "Hello World\nTest\n1234\n"; + DeprecatedString aaa = "Hello World\nTest\n1234\n"; result = match(aaa, re); EXPECT_EQ(result.success, true); }; @@ -282,11 +282,11 @@ TEST_CASE(catch_all_newline_view) Regex re("^.*$", PosixFlags::Multiline); RegexResult result; - String aaa = "Hello World\nTest\n1234\n"; + DeprecatedString aaa = "Hello World\nTest\n1234\n"; result = match(aaa, re); EXPECT_EQ(result.success, true); EXPECT_EQ(result.count, 3u); - String str = "Hello World"; + DeprecatedString str = "Hello World"; EXPECT_EQ(result.matches.at(0).view, str.view()); EXPECT_EQ(result.matches.at(1).view, "Test"); EXPECT_EQ(result.matches.at(2).view, "1234"); @@ -312,7 +312,7 @@ TEST_CASE(catch_all_newline_2) TEST_CASE(match_all_character_class) { Regex re("[[:alpha:]]"); - String str = "[Window]\nOpacity=255\nAudibleBeep=0\n"; + DeprecatedString str = "[Window]\nOpacity=255\nAudibleBeep=0\n"; RegexResult result = match(str, re, PosixFlags::Global | PosixFlags::StringCopyMatches); EXPECT_EQ(result.success, true); @@ -325,7 +325,7 @@ TEST_CASE(match_all_character_class) TEST_CASE(match_character_class_with_assertion) { Regex re("[[:alpha:]]+$"); - String str = "abcdef"; + DeprecatedString str = "abcdef"; RegexResult result = match(str, re); EXPECT_EQ(result.success, true); @@ -371,7 +371,7 @@ TEST_CASE(ini_file_entries) regex_dbg.print_bytecode(re); } - String haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; + DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; EXPECT_EQ(re.search(haystack.view(), result, PosixFlags::Multiline), true); EXPECT_EQ(result.count, 3u); @@ -399,7 +399,7 @@ TEST_CASE(ini_file_entries2) Regex re("[[:alpha:]]*=([[:digit:]]*)"); RegexResult result; - String haystack = "ViewMode=Icon"; + DeprecatedString haystack = "ViewMode=Icon"; EXPECT_EQ(re.match(haystack.view(), result), false); EXPECT_EQ(result.count, 0u); @@ -420,7 +420,7 @@ TEST_CASE(named_capture_group) regex_dbg.print_bytecode(re); } - String haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; + DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; EXPECT_EQ(re.search(haystack, result, PosixFlags::Multiline), true); EXPECT_EQ(result.count, 2u); EXPECT_EQ(result.matches.at(0).view, "Opacity=255"); @@ -443,7 +443,7 @@ TEST_CASE(ecma262_named_capture_group_with_dollar_sign) regex_dbg.print_bytecode(re); } - String haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; + DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; EXPECT_EQ(re.search(haystack, result, ECMAScriptFlags::Multiline), true); EXPECT_EQ(result.count, 2u); EXPECT_EQ(result.matches.at(0).view, "Opacity=255"); @@ -466,7 +466,7 @@ TEST_CASE(a_star) regex_dbg.print_bytecode(re); } - String haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; + DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; EXPECT_EQ(re.search(haystack.view(), result, PosixFlags::Multiline), true); EXPECT_EQ(result.count, 32u); if (result.count == 32u) { @@ -499,7 +499,7 @@ TEST_CASE(posix_extended_nested_capture_group) EXPECT_EQ(result.capture_group_matches[0][2].view, "llo"sv); } -auto parse_test_case_long_disjunction_chain = String::repeated("a|"sv, 100000); +auto parse_test_case_long_disjunction_chain = DeprecatedString::repeated("a|"sv, 100000); TEST_CASE(ECMA262_parse) { @@ -931,7 +931,7 @@ TEST_CASE(case_insensitive_match) TEST_CASE(extremely_long_fork_chain) { Regex re("(?:aa)*"); - auto result = re.match(String::repeated('a', 1000)); + auto result = re.match(DeprecatedString::repeated('a', 1000)); EXPECT_EQ(result.success, true); } @@ -950,7 +950,7 @@ TEST_CASE(theoretically_infinite_loop) } } -static auto g_lots_of_a_s = String::repeated('a', 10'000'000); +static auto g_lots_of_a_s = DeprecatedString::repeated('a', 10'000'000); BENCHMARK_CASE(fork_performance) { diff --git a/Tests/LibRegex/RegexLibC.cpp b/Tests/LibRegex/RegexLibC.cpp index b4048fc7b06..3e68b96e7a7 100644 --- a/Tests/LibRegex/RegexLibC.cpp +++ b/Tests/LibRegex/RegexLibC.cpp @@ -13,7 +13,7 @@ TEST_CASE(catch_all) { - String pattern = "^.*$"; + DeprecatedString pattern = "^.*$"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -24,7 +24,7 @@ TEST_CASE(catch_all) TEST_CASE(simple_start) { - String pattern = "^hello friends"; + DeprecatedString pattern = "^hello friends"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -37,7 +37,7 @@ TEST_CASE(simple_start) TEST_CASE(simple_end) { - String pattern = ".*hello\\.\\.\\. there$"; + DeprecatedString pattern = ".*hello\\.\\.\\. there$"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -51,7 +51,7 @@ TEST_CASE(simple_end) TEST_CASE(simple_period) { - String pattern = "hello."; + DeprecatedString pattern = "hello."; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -65,7 +65,7 @@ TEST_CASE(simple_period) TEST_CASE(simple_period_end) { - String pattern = "hello.$"; + DeprecatedString pattern = "hello.$"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED | REG_NOSUB), REG_NOERR); @@ -79,7 +79,7 @@ TEST_CASE(simple_period_end) TEST_CASE(simple_escaped) { - String pattern = "hello\\."; + DeprecatedString pattern = "hello\\."; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -91,7 +91,7 @@ TEST_CASE(simple_escaped) TEST_CASE(simple_period2_end) { - String pattern = ".*hi... there$"; + DeprecatedString pattern = ".*hi... there$"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -106,7 +106,7 @@ TEST_CASE(simple_period2_end) TEST_CASE(simple_plus) { - String pattern = "a+"; + DeprecatedString pattern = "a+"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED | REG_NOSUB), REG_NOERR); @@ -120,7 +120,7 @@ TEST_CASE(simple_plus) TEST_CASE(simple_questionmark) { - String pattern = "da?d"; + DeprecatedString pattern = "da?d"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -137,7 +137,7 @@ TEST_CASE(simple_questionmark) TEST_CASE(simple_questionmark_matchall) { - String pattern = "da?d"; + DeprecatedString pattern = "da?d"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -170,12 +170,12 @@ TEST_CASE(simple_questionmark_matchall) TEST_CASE(character_class) { - String pattern = "[[:alpha:]]"; + DeprecatedString pattern = "[[:alpha:]]"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; - String haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; + DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); EXPECT_EQ(regexec(®ex, haystack.characters(), num_matches, matches, 0), REG_NOMATCH); EXPECT_EQ(matches[0].rm_cnt, 0); @@ -189,12 +189,12 @@ TEST_CASE(character_class) TEST_CASE(character_class2) { - String pattern = "[[:alpha:]]*=([[:digit:]]*)|\\[(.*)\\]"; + DeprecatedString pattern = "[[:alpha:]]*=([[:digit:]]*)|\\[(.*)\\]"; regex_t regex; static constexpr int num_matches { 9 }; regmatch_t matches[num_matches]; - String haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; + DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n"; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED | REG_NEWLINE), REG_NOERR); EXPECT_EQ(regexec(®ex, haystack.characters(), num_matches, matches, 0), REG_NOERR); @@ -235,7 +235,7 @@ TEST_CASE(character_class2) TEST_CASE(escaped_char_questionmark) { - String pattern = "This\\.?And\\.?That"; + DeprecatedString pattern = "This\\.?And\\.?That"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -249,7 +249,7 @@ TEST_CASE(escaped_char_questionmark) TEST_CASE(char_qualifier_asterisk) { - String pattern = "regex*"; + DeprecatedString pattern = "regex*"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -263,7 +263,7 @@ TEST_CASE(char_qualifier_asterisk) TEST_CASE(char_utf8) { - String pattern = "😀"; + DeprecatedString pattern = "😀"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -277,7 +277,7 @@ TEST_CASE(char_utf8) TEST_CASE(parens) { - String pattern = "test(hello)test"; + DeprecatedString pattern = "test(hello)test"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -297,7 +297,7 @@ TEST_CASE(parens) TEST_CASE(parser_error_parens) { - String pattern = "test()test"; + DeprecatedString pattern = "test()test"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -310,7 +310,7 @@ TEST_CASE(parser_error_parens) TEST_CASE(parser_error_special_characters_used_at_wrong_place) { - String pattern; + DeprecatedString pattern; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -371,7 +371,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place) TEST_CASE(parser_error_vertical_line_used_at_wrong_place) { - String pattern; + DeprecatedString pattern; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -403,7 +403,7 @@ TEST_CASE(parser_error_vertical_line_used_at_wrong_place) TEST_CASE(parens_qualifier_questionmark) { - String pattern = "test(hello)?test"; + DeprecatedString pattern = "test(hello)?test"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -433,7 +433,7 @@ TEST_CASE(parens_qualifier_questionmark) TEST_CASE(parens_qualifier_asterisk) { - String pattern = "test(hello)*test"; + DeprecatedString pattern = "test(hello)*test"; regex_t regex; static constexpr int num_matches { 6 }; regmatch_t matches[num_matches]; @@ -479,7 +479,7 @@ TEST_CASE(parens_qualifier_asterisk) TEST_CASE(parens_qualifier_asterisk_2) { - String pattern = "test(.*)test"; + DeprecatedString pattern = "test(.*)test"; regex_t regex; static constexpr int num_matches { 6 }; regmatch_t matches[num_matches]; @@ -523,7 +523,7 @@ TEST_CASE(parens_qualifier_asterisk_2) TEST_CASE(mulit_parens_qualifier_too_less_result_values) { - String pattern = "test(a)?(b)?(c)?test"; + DeprecatedString pattern = "test(a)?(b)?(c)?test"; regex_t regex; static constexpr int num_matches { 4 }; regmatch_t matches[num_matches]; @@ -587,7 +587,7 @@ TEST_CASE(mulit_parens_qualifier_too_less_result_values) TEST_CASE(multi_parens_qualifier_questionmark) { - String pattern = "test(a)?(b)?(c)?test"; + DeprecatedString pattern = "test(a)?(b)?(c)?test"; regex_t regex; static constexpr int num_matches { 8 }; regmatch_t matches[num_matches]; @@ -651,7 +651,7 @@ TEST_CASE(multi_parens_qualifier_questionmark) TEST_CASE(simple_alternative) { - String pattern = "test|hello|friends"; + DeprecatedString pattern = "test|hello|friends"; regex_t regex; static constexpr int num_matches { 1 }; regmatch_t matches[num_matches]; @@ -678,7 +678,7 @@ TEST_CASE(simple_alternative) TEST_CASE(alternative_match_groups) { - String pattern = "test(a)?(b)?|hello ?(dear|my)? friends"; + DeprecatedString pattern = "test(a)?(b)?|hello ?(dear|my)? friends"; regex_t regex; static constexpr int num_matches { 8 }; regmatch_t matches[num_matches]; @@ -784,7 +784,7 @@ TEST_CASE(alternative_match_groups) TEST_CASE(parens_qualifier_exact) { - String pattern = "(hello){3}"; + DeprecatedString pattern = "(hello){3}"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -831,7 +831,7 @@ TEST_CASE(parens_qualifier_exact) TEST_CASE(parens_qualifier_minimum) { - String pattern = "(hello){3,}"; + DeprecatedString pattern = "(hello){3,}"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -889,7 +889,7 @@ TEST_CASE(parens_qualifier_minimum) TEST_CASE(parens_qualifier_maximum) { - String pattern = "(hello){2,3}"; + DeprecatedString pattern = "(hello){2,3}"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -946,7 +946,7 @@ TEST_CASE(parens_qualifier_maximum) TEST_CASE(char_qualifier_min_max) { - String pattern = "c{3,30}"; + DeprecatedString pattern = "c{3,30}"; regex_t regex; static constexpr int num_matches { 5 }; regmatch_t matches[num_matches]; @@ -966,7 +966,7 @@ TEST_CASE(char_qualifier_min_max) TEST_CASE(simple_bracket_chars) { - String pattern = "[abc]"; + DeprecatedString pattern = "[abc]"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -980,7 +980,7 @@ TEST_CASE(simple_bracket_chars) TEST_CASE(simple_bracket_chars_inverse) { - String pattern = "[^abc]"; + DeprecatedString pattern = "[^abc]"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -994,7 +994,7 @@ TEST_CASE(simple_bracket_chars_inverse) TEST_CASE(simple_bracket_chars_range) { - String pattern = "[a-d]"; + DeprecatedString pattern = "[a-d]"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -1008,7 +1008,7 @@ TEST_CASE(simple_bracket_chars_range) TEST_CASE(simple_bracket_chars_range_inverse) { - String pattern = "[^a-df-z]"; + DeprecatedString pattern = "[^a-df-z]"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -1024,7 +1024,7 @@ TEST_CASE(simple_bracket_chars_range_inverse) TEST_CASE(bracket_character_class_uuid) { - String pattern = "^([[:xdigit:]]{8})-([[:xdigit:]]{4})-([[:xdigit:]]{4})-([[:xdigit:]]{4})-([[:xdigit:]]{12})$"; + DeprecatedString pattern = "^([[:xdigit:]]{8})-([[:xdigit:]]{4})-([[:xdigit:]]{4})-([[:xdigit:]]{4})-([[:xdigit:]]{12})$"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -1036,7 +1036,7 @@ TEST_CASE(bracket_character_class_uuid) TEST_CASE(simple_bracket_character_class_inverse) { - String pattern = "[^[:digit:]]"; + DeprecatedString pattern = "[^[:digit:]]"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -1050,7 +1050,7 @@ TEST_CASE(simple_bracket_character_class_inverse) TEST_CASE(email_address) { - String pattern = "^[A-Z0-9a-z._%+-]{1,64}@(?:[A-Za-z0-9-]{1,63}\\.){1,125}[A-Za-z]{2,63}$"; + DeprecatedString pattern = "^[A-Z0-9a-z._%+-]{1,64}@(?:[A-Za-z0-9-]{1,63}\\.){1,125}[A-Za-z]{2,63}$"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_NOERR); @@ -1062,7 +1062,7 @@ TEST_CASE(email_address) TEST_CASE(error_message) { - String pattern = "^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$"; + DeprecatedString pattern = "^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED), REG_EBRACK); @@ -1070,7 +1070,7 @@ TEST_CASE(error_message) char buf[1024]; size_t buflen = 1024; auto len = regerror(0, ®ex, buf, buflen); - String expected = "Error during parsing of regular expression:\n ^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$\n ^---- [ ] imbalance."; + DeprecatedString expected = "Error during parsing of regular expression:\n ^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$\n ^---- [ ] imbalance."; for (size_t i = 0; i < len; ++i) { EXPECT_EQ(buf[i], expected[i]); } @@ -1080,7 +1080,7 @@ TEST_CASE(error_message) TEST_CASE(simple_ignorecase) { - String pattern = "^hello friends"; + DeprecatedString pattern = "^hello friends"; regex_t regex; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED | REG_NOSUB | REG_ICASE), REG_NOERR); @@ -1098,8 +1098,8 @@ TEST_CASE(simple_ignorecase) TEST_CASE(simple_notbol_noteol) { - String pattern = "^hello friends$"; - String pattern2 = "hello friends"; + DeprecatedString pattern = "^hello friends$"; + DeprecatedString pattern2 = "hello friends"; regex_t regex, regex2; EXPECT_EQ(regcomp(®ex, pattern.characters(), REG_EXTENDED | REG_NOSUB | REG_ICASE), REG_NOERR); diff --git a/Tests/LibSQL/TestSqlExpressionParser.cpp b/Tests/LibSQL/TestSqlExpressionParser.cpp index 00a8cc71c68..e2468700691 100644 --- a/Tests/LibSQL/TestSqlExpressionParser.cpp +++ b/Tests/LibSQL/TestSqlExpressionParser.cpp @@ -7,9 +7,9 @@ #include +#include #include #include -#include #include #include #include @@ -31,7 +31,7 @@ public: } }; -using ParseResult = AK::Result, String>; +using ParseResult = AK::Result, DeprecatedString>; ParseResult parse(StringView sql) { @@ -633,7 +633,7 @@ TEST_CASE(in_selection_expression) TEST_CASE(expression_tree_depth_limit) { - auto too_deep_expression = String::formatted("{:+^{}}1", "", SQL::AST::Limits::maximum_expression_tree_depth); + auto too_deep_expression = DeprecatedString::formatted("{:+^{}}1", "", SQL::AST::Limits::maximum_expression_tree_depth); EXPECT(!parse(too_deep_expression.substring_view(1)).is_error()); EXPECT(parse(too_deep_expression).is_error()); } diff --git a/Tests/LibSQL/TestSqlHashIndex.cpp b/Tests/LibSQL/TestSqlHashIndex.cpp index 6425dbb4a92..2219b16034d 100644 --- a/Tests/LibSQL/TestSqlHashIndex.cpp +++ b/Tests/LibSQL/TestSqlHashIndex.cpp @@ -148,7 +148,7 @@ void insert_and_get_to_and_from_hash_index(int num_keys) for (auto ix = 0; ix < num_keys; ix++) { SQL::Key k(hash_index->descriptor()); k[0] = keys[ix]; - k[1] = String::formatted("The key value is {} and the pointer is {}", keys[ix], pointers[ix]); + k[1] = DeprecatedString::formatted("The key value is {} and the pointer is {}", keys[ix], pointers[ix]); k.set_pointer(pointers[ix]); hash_index->insert(k); } @@ -166,7 +166,7 @@ void insert_and_get_to_and_from_hash_index(int num_keys) for (auto ix = 0; ix < num_keys; ix++) { SQL::Key k(hash_index->descriptor()); k[0] = keys[ix]; - k[1] = String::formatted("The key value is {} and the pointer is {}", keys[ix], pointers[ix]); + k[1] = DeprecatedString::formatted("The key value is {} and the pointer is {}", keys[ix], pointers[ix]); auto pointer_opt = hash_index->get(k); VERIFY(pointer_opt.has_value()); EXPECT_EQ(pointer_opt.value(), pointers[ix]); @@ -246,7 +246,7 @@ void insert_into_and_scan_hash_index(int num_keys) for (auto ix = 0; ix < num_keys; ix++) { SQL::Key k(hash_index->descriptor()); k[0] = keys[ix]; - k[1] = String::formatted("The key value is {} and the pointer is {}", keys[ix], pointers[ix]); + k[1] = DeprecatedString::formatted("The key value is {} and the pointer is {}", keys[ix], pointers[ix]); k.set_pointer(pointers[ix]); hash_index->insert(k); } @@ -275,7 +275,7 @@ void insert_into_and_scan_hash_index(int num_keys) if (keys[ix] == key_value) { EXPECT_EQ(key.pointer(), pointers[ix]); if (found[ix]) - FAIL(String::formatted("Key {}, index {} already found previously", *key_value, ix)); + FAIL(DeprecatedString::formatted("Key {}, index {} already found previously", *key_value, ix)); found[ix] = true; break; } @@ -288,7 +288,7 @@ void insert_into_and_scan_hash_index(int num_keys) EXPECT_EQ(count, num_keys); for (auto ix = 0; ix < num_keys; ix++) { if (!found[ix]) - FAIL(String::formatted("Key {}, index {} not found", keys[ix], ix)); + FAIL(DeprecatedString::formatted("Key {}, index {} not found", keys[ix], ix)); } } } diff --git a/Tests/LibSQL/TestSqlStatementExecution.cpp b/Tests/LibSQL/TestSqlStatementExecution.cpp index c632aa408ff..e87567c79c2 100644 --- a/Tests/LibSQL/TestSqlStatementExecution.cpp +++ b/Tests/LibSQL/TestSqlStatementExecution.cpp @@ -21,7 +21,7 @@ namespace { constexpr char const* db_name = "/tmp/test.db"; -SQL::ResultOr try_execute(NonnullRefPtr database, String const& sql) +SQL::ResultOr try_execute(NonnullRefPtr database, DeprecatedString const& sql) { auto parser = SQL::AST::Parser(SQL::AST::Lexer(sql)); auto statement = parser.next_statement(); @@ -31,7 +31,7 @@ SQL::ResultOr try_execute(NonnullRefPtr database, return statement->execute(move(database)); } -SQL::ResultSet execute(NonnullRefPtr database, String const& sql) +SQL::ResultSet execute(NonnullRefPtr database, DeprecatedString const& sql) { auto result = try_execute(move(database), sql); if (result.is_error()) { @@ -531,7 +531,7 @@ TEST_CASE(select_with_limit) create_table(database); for (auto count = 0; count < 100; count++) { auto result = execute(database, - String::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); + DeprecatedString::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); EXPECT(result.size() == 1); } auto result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable LIMIT 10;"); @@ -547,7 +547,7 @@ TEST_CASE(select_with_limit_and_offset) create_table(database); for (auto count = 0; count < 100; count++) { auto result = execute(database, - String::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); + DeprecatedString::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); EXPECT(result.size() == 1); } auto result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable LIMIT 10 OFFSET 10;"); @@ -562,7 +562,7 @@ TEST_CASE(select_with_order_limit_and_offset) create_table(database); for (auto count = 0; count < 100; count++) { auto result = execute(database, - String::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); + DeprecatedString::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); EXPECT(result.size() == 1); } auto result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable ORDER BY IntColumn LIMIT 10 OFFSET 10;"); @@ -587,7 +587,7 @@ TEST_CASE(select_with_limit_out_of_bounds) create_table(database); for (auto count = 0; count < 100; count++) { auto result = execute(database, - String::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); + DeprecatedString::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); EXPECT(result.size() == 1); } auto result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable LIMIT 500;"); @@ -602,7 +602,7 @@ TEST_CASE(select_with_offset_out_of_bounds) create_table(database); for (auto count = 0; count < 100; count++) { auto result = execute(database, - String::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); + DeprecatedString::formatted("INSERT INTO TestSchema.TestTable ( TextColumn, IntColumn ) VALUES ( 'Test_{}', {} );", count, count)); EXPECT(result.size() == 1); } auto result = execute(database, "SELECT TextColumn, IntColumn FROM TestSchema.TestTable LIMIT 10 OFFSET 200;"); @@ -633,7 +633,7 @@ TEST_CASE(binary_operator_execution) create_table(database); for (auto count = 0; count < 10; ++count) { - auto result = execute(database, String::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); + auto result = execute(database, DeprecatedString::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); EXPECT_EQ(result.size(), 1u); } @@ -707,7 +707,7 @@ TEST_CASE(binary_operator_failure) create_table(database); for (auto count = 0; count < 10; ++count) { - auto result = execute(database, String::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); + auto result = execute(database, DeprecatedString::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); EXPECT_EQ(result.size(), 1u); } @@ -717,7 +717,7 @@ TEST_CASE(binary_operator_failure) auto error = result.release_error(); EXPECT_EQ(error.error(), SQL::SQLErrorCode::NumericOperatorTypeMismatch); - auto message = String::formatted("NumericOperatorTypeMismatch: Cannot apply '{}' operator to non-numeric operands", op); + auto message = DeprecatedString::formatted("NumericOperatorTypeMismatch: Cannot apply '{}' operator to non-numeric operands", op); EXPECT_EQ(error.error_string(), message); }; @@ -777,7 +777,7 @@ TEST_CASE(delete_single_row) create_table(database); for (auto count = 0; count < 10; ++count) { - auto result = execute(database, String::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); + auto result = execute(database, DeprecatedString::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); EXPECT_EQ(result.size(), 1u); } @@ -821,7 +821,7 @@ TEST_CASE(delete_multiple_rows) create_table(database); for (auto count = 0; count < 10; ++count) { - auto result = execute(database, String::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); + auto result = execute(database, DeprecatedString::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); EXPECT_EQ(result.size(), 1u); } @@ -861,7 +861,7 @@ TEST_CASE(delete_all_rows) create_table(database); for (auto count = 0; count < 10; ++count) { - auto result = execute(database, String::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); + auto result = execute(database, DeprecatedString::formatted("INSERT INTO TestSchema.TestTable VALUES ( 'T{}', {} );", count, count)); EXPECT_EQ(result.size(), 1u); } diff --git a/Tests/LibSQL/TestSqlStatementParser.cpp b/Tests/LibSQL/TestSqlStatementParser.cpp index 6659ac1ea2c..1f59cabc3a2 100644 --- a/Tests/LibSQL/TestSqlStatementParser.cpp +++ b/Tests/LibSQL/TestSqlStatementParser.cpp @@ -8,9 +8,9 @@ #include +#include #include #include -#include #include #include #include @@ -19,7 +19,7 @@ namespace { -using ParseResult = AK::Result, String>; +using ParseResult = AK::Result, DeprecatedString>; ParseResult parse(StringView sql) { @@ -392,7 +392,7 @@ TEST_CASE(update) EXPECT(parse("UPDATE OR table_name SET column_name=4;"sv).is_error()); EXPECT(parse("UPDATE OR foo table_name SET column_name=4;"sv).is_error()); - auto validate = [](StringView sql, SQL::AST::ConflictResolution expected_conflict_resolution, StringView expected_schema, StringView expected_table, StringView expected_alias, Vector> expected_update_columns, bool expect_where_clause, bool expect_returning_clause, Vector expected_returned_column_aliases) { + auto validate = [](StringView sql, SQL::AST::ConflictResolution expected_conflict_resolution, StringView expected_schema, StringView expected_table, StringView expected_alias, Vector> expected_update_columns, bool expect_where_clause, bool expect_returning_clause, Vector expected_returned_column_aliases) { auto result = parse(sql); EXPECT(!result.is_error()); @@ -439,7 +439,7 @@ TEST_CASE(update) } }; - Vector> update_columns { { "COLUMN_NAME" } }; + Vector> update_columns { { "COLUMN_NAME" } }; validate("UPDATE OR ABORT table_name SET column_name=1;"sv, SQL::AST::ConflictResolution::Abort, {}, "TABLE_NAME"sv, {}, update_columns, false, false, {}); validate("UPDATE OR FAIL table_name SET column_name=1;"sv, SQL::AST::ConflictResolution::Fail, {}, "TABLE_NAME"sv, {}, update_columns, false, false, {}); validate("UPDATE OR IGNORE table_name SET column_name=1;"sv, SQL::AST::ConflictResolution::Ignore, {}, "TABLE_NAME"sv, {}, update_columns, false, false, {}); @@ -567,7 +567,7 @@ TEST_CASE(select) }; struct Ordering { - String collation_name; + DeprecatedString collation_name; SQL::Order order; SQL::Nulls nulls; }; @@ -747,9 +747,9 @@ TEST_CASE(common_table_expression) TEST_CASE(nested_subquery_limit) { - auto subquery = String::formatted("{:(^{}}table_name{:)^{}}", "", SQL::AST::Limits::maximum_subquery_depth - 1, "", SQL::AST::Limits::maximum_subquery_depth - 1); - EXPECT(!parse(String::formatted("SELECT * FROM {};"sv, subquery)).is_error()); - EXPECT(parse(String::formatted("SELECT * FROM ({});"sv, subquery)).is_error()); + auto subquery = DeprecatedString::formatted("{:(^{}}table_name{:)^{}}", "", SQL::AST::Limits::maximum_subquery_depth - 1, "", SQL::AST::Limits::maximum_subquery_depth - 1); + EXPECT(!parse(DeprecatedString::formatted("SELECT * FROM {};"sv, subquery)).is_error()); + EXPECT(parse(DeprecatedString::formatted("SELECT * FROM ({});"sv, subquery)).is_error()); } TEST_CASE(describe_table) diff --git a/Tests/LibSQL/TestSqlValueAndTuple.cpp b/Tests/LibSQL/TestSqlValueAndTuple.cpp index 3ff7d14f871..69de82a4376 100644 --- a/Tests/LibSQL/TestSqlValueAndTuple.cpp +++ b/Tests/LibSQL/TestSqlValueAndTuple.cpp @@ -47,11 +47,11 @@ TEST_CASE(text_value) EXPECT_EQ(v.to_string(), "Test"sv); } { - SQL::Value v(String("String Test"sv)); + SQL::Value v(DeprecatedString("String Test"sv)); EXPECT_EQ(v.type(), SQL::SQLType::Text); EXPECT_EQ(v.to_string(), "String Test"sv); - v = String("String Test 2"sv); + v = DeprecatedString("String Test 2"sv); EXPECT_EQ(v.type(), SQL::SQLType::Text); EXPECT_EQ(v.to_string(), "String Test 2"sv); } diff --git a/Tests/LibTLS/TestTLSHandshake.cpp b/Tests/LibTLS/TestTLSHandshake.cpp index 06aec37fe4a..b9675e6f9b8 100644 --- a/Tests/LibTLS/TestTLSHandshake.cpp +++ b/Tests/LibTLS/TestTLSHandshake.cpp @@ -23,14 +23,14 @@ static ByteBuffer operator""_b(char const* string, size_t length) } Vector load_certificates(); -String locate_ca_certs_file(); +DeprecatedString locate_ca_certs_file(); -String locate_ca_certs_file() +DeprecatedString locate_ca_certs_file() { if (Core::File::exists(ca_certs_file)) { return ca_certs_file; } - auto on_target_path = String("/etc/ca_certs.ini"); + auto on_target_path = DeprecatedString("/etc/ca_certs.ini"); if (Core::File::exists(on_target_path)) { return on_target_path; } diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp index 5bb87724d80..c6419c6748c 100644 --- a/Tests/LibWasm/test-wasm.cpp +++ b/Tests/LibWasm/test-wasm.cpp @@ -181,10 +181,10 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export) [&](const auto& ref) -> JS::Value { return JS::Value(static_cast(ref.address.value())); }); }); } - return vm.throw_completion(String::formatted("'{}' does not refer to a function or a global", name)); + return vm.throw_completion(DeprecatedString::formatted("'{}' does not refer to a function or a global", name)); } } - return vm.throw_completion(String::formatted("'{}' could not be found", name)); + return vm.throw_completion(DeprecatedString::formatted("'{}' could not be found", name)); } JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke) @@ -202,7 +202,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke) Vector arguments; if (type->parameters().size() + 1 > vm.argument_count()) - return vm.throw_completion(String::formatted("Expected {} arguments for call, but found {}", type->parameters().size() + 1, vm.argument_count())); + return vm.throw_completion(DeprecatedString::formatted("Expected {} arguments for call, but found {}", type->parameters().size() + 1, vm.argument_count())); size_t index = 1; for (auto& param : type->parameters()) { auto argument = vm.argument(index++); @@ -244,7 +244,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::wasm_invoke) auto result = WebAssemblyModule::machine().invoke(function_address, arguments); if (result.is_trap()) - return vm.throw_completion(String::formatted("Execution trapped: {}", result.trap().reason)); + return vm.throw_completion(DeprecatedString::formatted("Execution trapped: {}", result.trap().reason)); if (result.values().is_empty()) return JS::js_null(); diff --git a/Tests/LibWeb/TestHTMLTokenizer.cpp b/Tests/LibWeb/TestHTMLTokenizer.cpp index e9ec810ca3e..ab36adb14ad 100644 --- a/Tests/LibWeb/TestHTMLTokenizer.cpp +++ b/Tests/LibWeb/TestHTMLTokenizer.cpp @@ -205,7 +205,7 @@ TEST_CASE(regression) auto file_size = MUST(file->size()); auto content = MUST(ByteBuffer::create_uninitialized(file_size)); MUST(file->read(content.bytes())); - String file_contents { content.bytes() }; + DeprecatedString file_contents { content.bytes() }; auto tokens = run_tokenizer(file_contents); u32 hash = hash_tokens(tokens); EXPECT_EQ(hash, 710375345u); diff --git a/Tests/Spreadsheet/test-spreadsheet.cpp b/Tests/Spreadsheet/test-spreadsheet.cpp index 0d87a1d628c..f179ffa68ae 100644 --- a/Tests/Spreadsheet/test-spreadsheet.cpp +++ b/Tests/Spreadsheet/test-spreadsheet.cpp @@ -15,7 +15,7 @@ static constexpr auto s_spreadsheet_runtime_path = "/res/js/Spreadsheet/runtime. static constexpr auto s_spreadsheet_runtime_path = "../../../../Base/res/js/Spreadsheet/runtime.js"sv; #endif -TESTJS_RUN_FILE_FUNCTION(String const&, JS::Interpreter& interpreter, JS::ExecutionContext& global_execution_context) +TESTJS_RUN_FILE_FUNCTION(DeprecatedString const&, JS::Interpreter& interpreter, JS::ExecutionContext& global_execution_context) { auto run_file = [&](StringView name) { auto result = Test::JS::parse_script(name, interpreter.realm()); diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index aadf41d60b6..c45bb1a4dca 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -169,7 +169,7 @@ private: painter.blit({}, audio_bitmap, audio_bitmap.rect()); if (m_show_percent) { - auto volume_text = m_audio_muted ? "mute" : String::formatted("{}%", m_audio_volume); + auto volume_text = m_audio_muted ? "mute" : DeprecatedString::formatted("{}%", m_audio_volume); painter.draw_text({ 16, 3, 24, 16 }, volume_text, Gfx::FontDatabase::default_fixed_width_font(), Gfx::TextAlignment::TopLeft, palette().window_text()); } } diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp index 2c7dbc6502d..9ef14357e16 100644 --- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp +++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.cpp @@ -21,7 +21,7 @@ ClipboardHistoryModel::ClipboardHistoryModel() { } -String ClipboardHistoryModel::column_name(int column) const +DeprecatedString ClipboardHistoryModel::column_name(int column) const { switch (column) { case Column::Data: @@ -37,7 +37,7 @@ String ClipboardHistoryModel::column_name(int column) const } } -static StringView bpp_for_format_resilient(String format) +static StringView bpp_for_format_resilient(DeprecatedString format) { unsigned format_uint = format.to_uint().value_or(static_cast(Gfx::BitmapFormat::Invalid)); // Cannot use Gfx::Bitmap::bpp_for_format here, as we have to accept invalid enum values. @@ -70,7 +70,7 @@ GUI::Variant ClipboardHistoryModel::data(const GUI::ModelIndex& index, GUI::Mode switch (index.column()) { case Column::Data: if (data_and_type.mime_type.starts_with("text/"sv)) - return String::copy(data_and_type.data); + return DeprecatedString::copy(data_and_type.data); if (data_and_type.mime_type == "image/x-serenityos") { StringBuilder builder; builder.append('['); @@ -128,7 +128,7 @@ void ClipboardHistoryModel::remove_item(int index) m_history_items.remove(index); } -void ClipboardHistoryModel::config_string_did_change(String const& domain, String const& group, String const& key, String const& value_string) +void ClipboardHistoryModel::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value_string) { if (domain != "ClipboardHistory" || group != "ClipboardHistory") return; diff --git a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h index 64bed85ad29..5711662affe 100644 --- a/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h +++ b/Userland/Applets/ClipboardHistory/ClipboardHistoryModel.h @@ -42,7 +42,7 @@ public: virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; // ^Config::Listener - virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override; + virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override; private: ClipboardHistoryModel(); @@ -50,11 +50,11 @@ private: // ^GUI::Model virtual int row_count(const GUI::ModelIndex&) const override { return m_history_items.size(); } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } // ^GUI::Clipboard::ClipboardClient - virtual void clipboard_content_did_change(String const&) override { add_item(GUI::Clipboard::the().fetch_data_and_type()); } + virtual void clipboard_content_did_change(DeprecatedString const&) override { add_item(GUI::Clipboard::the().fetch_data_and_type()); } Vector m_history_items; size_t m_history_limit; diff --git a/Userland/Applets/Keymap/KeymapStatusWidget.cpp b/Userland/Applets/Keymap/KeymapStatusWidget.cpp index ecc4269bdef..bc3b1802d94 100644 --- a/Userland/Applets/Keymap/KeymapStatusWidget.cpp +++ b/Userland/Applets/Keymap/KeymapStatusWidget.cpp @@ -59,7 +59,7 @@ ErrorOr KeymapStatusWidget::refresh_menu() return {}; } -void KeymapStatusWidget::set_current_keymap(String const& keymap, ClearBackground clear_background) +void KeymapStatusWidget::set_current_keymap(DeprecatedString const& keymap, ClearBackground clear_background) { if (clear_background == ClearBackground::Yes) { GUI::Painter painter(*this); diff --git a/Userland/Applets/Keymap/KeymapStatusWidget.h b/Userland/Applets/Keymap/KeymapStatusWidget.h index 3e3e0fa54e3..880a6510d25 100644 --- a/Userland/Applets/Keymap/KeymapStatusWidget.h +++ b/Userland/Applets/Keymap/KeymapStatusWidget.h @@ -22,11 +22,11 @@ class KeymapStatusWidget : public GUI::Label { virtual void mousedown_event(GUI::MouseEvent& event) override; - void set_current_keymap(String const& keymap, ClearBackground clear_background = ClearBackground::Yes); + void set_current_keymap(DeprecatedString const& keymap, ClearBackground clear_background = ClearBackground::Yes); private: RefPtr m_context_menu; - String m_current_keymap; + DeprecatedString m_current_keymap; ErrorOr refresh_menu(); diff --git a/Userland/Applets/Keymap/KeymapStatusWindow.cpp b/Userland/Applets/Keymap/KeymapStatusWindow.cpp index 69248141a15..7a0fc2b29f0 100644 --- a/Userland/Applets/Keymap/KeymapStatusWindow.cpp +++ b/Userland/Applets/Keymap/KeymapStatusWindow.cpp @@ -30,7 +30,7 @@ void KeymapStatusWindow::wm_event(GUI::WMEvent& event) } } -void KeymapStatusWindow::set_keymap_text(String const& keymap) +void KeymapStatusWindow::set_keymap_text(DeprecatedString const& keymap) { m_status_widget->set_current_keymap(keymap); } diff --git a/Userland/Applets/Keymap/KeymapStatusWindow.h b/Userland/Applets/Keymap/KeymapStatusWindow.h index a4f4d3a1627..0ba3c106dc8 100644 --- a/Userland/Applets/Keymap/KeymapStatusWindow.h +++ b/Userland/Applets/Keymap/KeymapStatusWindow.h @@ -23,5 +23,5 @@ private: RefPtr m_status_widget; - void set_keymap_text(String const& keymap); + void set_keymap_text(DeprecatedString const& keymap); }; diff --git a/Userland/Applets/Network/main.cpp b/Userland/Applets/Network/main.cpp index 3d0a73adcc5..1f62eb7d4ed 100644 --- a/Userland/Applets/Network/main.cpp +++ b/Userland/Applets/Network/main.cpp @@ -103,7 +103,7 @@ private: m_connected = connected; } - String get_adapter_info() + DeprecatedString get_adapter_info() { StringBuilder adapter_info; @@ -154,7 +154,7 @@ private: return adapter_info.to_string(); } - String m_adapter_info; + DeprecatedString m_adapter_info; bool m_connected = false; bool m_notifications = true; NonnullRefPtr m_connected_icon; diff --git a/Userland/Applets/ResourceGraph/main.cpp b/Userland/Applets/ResourceGraph/main.cpp index 59cf25a25ed..392e2140a55 100644 --- a/Userland/Applets/ResourceGraph/main.cpp +++ b/Userland/Applets/ResourceGraph/main.cpp @@ -54,7 +54,7 @@ private: m_last_idle = idle; float cpu = total_diff > 0 ? (float)(total_diff - idle_diff) / (float)total_diff : 0; m_history.enqueue(cpu); - m_tooltip = String::formatted("CPU usage: {:.1}%", 100 * cpu); + m_tooltip = DeprecatedString::formatted("CPU usage: {:.1}%", 100 * cpu); } else { m_history.enqueue(-1); m_tooltip = "Unable to determine CPU usage"sv; @@ -67,7 +67,7 @@ private: double total_memory = allocated + available; double memory = (double)allocated / total_memory; m_history.enqueue(memory); - m_tooltip = String::formatted("Memory: {} MiB of {:.1} MiB in use", allocated / MiB, total_memory / MiB); + m_tooltip = DeprecatedString::formatted("Memory: {} MiB of {:.1} MiB in use", allocated / MiB, total_memory / MiB); } else { m_history.enqueue(-1); m_tooltip = "Unable to determine memory usage"sv; @@ -98,7 +98,7 @@ private: } } m_history.enqueue(static_cast(recent_tx) / static_cast(m_current_scale)); - m_tooltip = String::formatted("Network: TX {} / RX {} ({:.1} kbit/s)", tx, rx, static_cast(recent_tx) * 8.0 / 1000.0); + m_tooltip = DeprecatedString::formatted("Network: TX {} / RX {} ({:.1} kbit/s)", tx, rx, static_cast(recent_tx) * 8.0 / 1000.0); } else { m_history.enqueue(-1); m_tooltip = "Unable to determine network usage"sv; @@ -230,7 +230,7 @@ private: u64 m_last_total { 0 }; static constexpr u64 const scale_unit = 8000; u64 m_current_scale { scale_unit }; - String m_tooltip; + DeprecatedString m_tooltip; OwnPtr m_proc_stat; OwnPtr m_proc_mem; OwnPtr m_proc_net; diff --git a/Userland/Applications/3DFileViewer/MeshLoader.h b/Userland/Applications/3DFileViewer/MeshLoader.h index 04b8c10146d..2ad0bcba1db 100644 --- a/Userland/Applications/3DFileViewer/MeshLoader.h +++ b/Userland/Applications/3DFileViewer/MeshLoader.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include "Common.h" diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp index e4709c227c4..baed60913a4 100644 --- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp +++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp @@ -38,8 +38,8 @@ RefPtr WavefrontOBJLoader::load(Core::File& file) return nullptr; } - tex_coords.append({ static_cast(atof(String(tex_coord_line.at(1)).characters())), - static_cast(atof(String(tex_coord_line.at(2)).characters())) }); + tex_coords.append({ static_cast(atof(DeprecatedString(tex_coord_line.at(1)).characters())), + static_cast(atof(DeprecatedString(tex_coord_line.at(2)).characters())) }); continue; } @@ -51,9 +51,9 @@ RefPtr WavefrontOBJLoader::load(Core::File& file) return nullptr; } - normals.append({ static_cast(atof(String(normal_line.at(1)).characters())), - static_cast(atof(String(normal_line.at(2)).characters())), - static_cast(atof(String(normal_line.at(3)).characters())) }); + normals.append({ static_cast(atof(DeprecatedString(normal_line.at(1)).characters())), + static_cast(atof(DeprecatedString(normal_line.at(2)).characters())), + static_cast(atof(DeprecatedString(normal_line.at(3)).characters())) }); continue; } @@ -66,9 +66,9 @@ RefPtr WavefrontOBJLoader::load(Core::File& file) return nullptr; } - vertices.append({ static_cast(atof(String(vertex_line.at(1)).characters())), - static_cast(atof(String(vertex_line.at(2)).characters())), - static_cast(atof(String(vertex_line.at(3)).characters())) }); + vertices.append({ static_cast(atof(DeprecatedString(vertex_line.at(1)).characters())), + static_cast(atof(DeprecatedString(vertex_line.at(2)).characters())), + static_cast(atof(DeprecatedString(vertex_line.at(3)).characters())) }); continue; } diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index 6baa1cf7eff..c5de4c63738 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -33,7 +33,7 @@ class GLContextWidget final : public GUI::Frame { C_OBJECT(GLContextWidget); public: - bool load_path(String const& fname); + bool load_path(DeprecatedString const& fname); bool load_file(Core::File& file); void toggle_rotate_x() { m_rotate_x = !m_rotate_x; } void toggle_rotate_y() { m_rotate_y = !m_rotate_y; } @@ -267,7 +267,7 @@ void GLContextWidget::timer_event(Core::TimerEvent&) if ((m_cycles % 30) == 0) { auto render_time = m_accumulated_time / 30.0; auto frame_rate = render_time > 0 ? 1000 / render_time : 0; - m_stats->set_text(String::formatted("{:.0f} fps, {:.1f} ms", frame_rate, render_time)); + m_stats->set_text(DeprecatedString::formatted("{:.0f} fps, {:.1f} ms", frame_rate, render_time)); m_accumulated_time = 0; glEnable(GL_LIGHT0); @@ -289,12 +289,12 @@ void GLContextWidget::timer_event(Core::TimerEvent&) m_cycles++; } -bool GLContextWidget::load_path(String const& filename) +bool GLContextWidget::load_path(DeprecatedString const& filename) { auto file = Core::File::construct(filename); if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) { - GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); return false; } @@ -305,23 +305,23 @@ bool GLContextWidget::load_file(Core::File& file) { auto const& filename = file.filename(); if (!filename.ends_with(".obj"sv)) { - GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: invalid file type", filename), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: invalid file type", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } if (file.is_device()) { - GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open device files", filename), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: Can't open device files", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } if (file.is_directory()) { - GUI::MessageBox::show(window(), String::formatted("Opening \"{}\" failed: Can't open directories", filename), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: Can't open directories", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } auto new_mesh = m_mesh_loader->load(file); if (new_mesh.is_null()) { - GUI::MessageBox::show(window(), String::formatted("Reading \"{}\" failed.", filename), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Reading \"{}\" failed.", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } @@ -330,7 +330,7 @@ bool GLContextWidget::load_file(Core::File& file) builder.append(filename.split('.').at(0)); builder.append(".bmp"sv); - String texture_path = Core::File::absolute_path(builder.string_view()); + DeprecatedString texture_path = Core::File::absolute_path(builder.string_view()); // Attempt to open the texture file from disk RefPtr texture_image; @@ -405,7 +405,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto file = response.value(); if (widget->load_file(*file)) { auto canonical_path = Core::File::absolute_path(file->filename()); - window->set_title(String::formatted("{} - 3D File Viewer", canonical_path)); + window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path)); } })); file_menu.add_separator(); @@ -594,7 +594,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto filename = arguments.argc > 1 ? arguments.argv[1] : "/home/anon/Documents/3D Models/teapot.obj"; if (widget->load_path(filename)) { auto canonical_path = Core::File::absolute_path(filename); - window->set_title(String::formatted("{} - 3D File Viewer", canonical_path)); + window->set_title(DeprecatedString::formatted("{} - 3D File Viewer", canonical_path)); } return app->exec(); diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp index 4365d21b402..9d82f6e8fdb 100644 --- a/Userland/Applications/Assistant/Providers.cpp +++ b/Userland/Applications/Assistant/Providers.cpp @@ -60,7 +60,7 @@ void URLResult::activate() const Desktop::Launcher::open(URL::create_with_url_or_path(title())); } -void AppProvider::query(String const& query, Function)> on_complete) +void AppProvider::query(DeprecatedString const& query, Function)> on_complete) { if (query.starts_with('=') || query.starts_with('$')) return; @@ -79,7 +79,7 @@ void AppProvider::query(String const& query, Function)> on_complete) +void CalculatorProvider::query(DeprecatedString const& query, Function)> on_complete) { if (!query.starts_with('=')) return; @@ -97,7 +97,7 @@ void CalculatorProvider::query(String const& query, Function)> on_complete) +void FileProvider::query(DeprecatedString const& query, Function)> on_complete) { build_filesystem_cache(); @@ -159,7 +159,7 @@ void FileProvider::build_filesystem_cache() (void)Threading::BackgroundAction::construct( [this, strong_ref = NonnullRefPtr(*this)](auto&) { - String slash = "/"; + DeprecatedString slash = "/"; auto timer = Core::ElapsedTimer::start_new(); while (!m_work_queue.is_empty()) { auto base_directory = m_work_queue.dequeue(); @@ -197,7 +197,7 @@ void FileProvider::build_filesystem_cache() }); } -void TerminalProvider::query(String const& query, Function)> on_complete) +void TerminalProvider::query(DeprecatedString const& query, Function)> on_complete) { if (!query.starts_with('$')) return; @@ -209,7 +209,7 @@ void TerminalProvider::query(String const& query, Function)> on_complete) +void URLProvider::query(DeprecatedString const& query, Function)> on_complete) { if (query.is_empty() || query.starts_with('=') || query.starts_with('$')) return; diff --git a/Userland/Applications/Assistant/Providers.h b/Userland/Applications/Assistant/Providers.h index 8acaa756ed8..ba8759ea701 100644 --- a/Userland/Applications/Assistant/Providers.h +++ b/Userland/Applications/Assistant/Providers.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include #include #include #include @@ -26,8 +26,8 @@ public: virtual Gfx::Bitmap const* bitmap() const = 0; - String const& title() const { return m_title; } - String const& tooltip() const { return m_tooltip; } + DeprecatedString const& title() const { return m_title; } + DeprecatedString const& tooltip() const { return m_tooltip; } int score() const { return m_score; } bool equals(Result const& other) const { @@ -37,7 +37,7 @@ public: } protected: - Result(String title, String tooltip, int score = 0) + Result(DeprecatedString title, DeprecatedString tooltip, int score = 0) : m_title(move(title)) , m_tooltip(move(tooltip)) , m_score(score) @@ -45,14 +45,14 @@ protected: } private: - String m_title; - String m_tooltip; + DeprecatedString m_title; + DeprecatedString m_tooltip; int m_score { 0 }; }; class AppResult final : public Result { public: - AppResult(RefPtr bitmap, String title, String tooltip, NonnullRefPtr af, int score) + AppResult(RefPtr bitmap, DeprecatedString title, DeprecatedString tooltip, NonnullRefPtr af, int score) : Result(move(title), move(tooltip), score) , m_app_file(move(af)) , m_bitmap(move(bitmap)) @@ -70,7 +70,7 @@ private: class CalculatorResult final : public Result { public: - explicit CalculatorResult(String title) + explicit CalculatorResult(DeprecatedString title) : Result(move(title), "Copy to Clipboard"sv, 100) , m_bitmap(GUI::Icon::default_icon("app-calculator"sv).bitmap_for_size(16)) { @@ -86,7 +86,7 @@ private: class FileResult final : public Result { public: - explicit FileResult(String title, int score) + explicit FileResult(DeprecatedString title, int score) : Result(move(title), "", score) { } @@ -98,7 +98,7 @@ public: class TerminalResult final : public Result { public: - explicit TerminalResult(String command) + explicit TerminalResult(DeprecatedString command) : Result(move(command), "Run command in Terminal"sv, 100) , m_bitmap(GUI::Icon::default_icon("app-terminal"sv).bitmap_for_size(16)) { @@ -132,41 +132,41 @@ class Provider : public RefCounted { public: virtual ~Provider() = default; - virtual void query(String const&, Function)> on_complete) = 0; + virtual void query(DeprecatedString const&, Function)> on_complete) = 0; }; class AppProvider final : public Provider { public: - void query(String const& query, Function)> on_complete) override; + void query(DeprecatedString const& query, Function)> on_complete) override; }; class CalculatorProvider final : public Provider { public: - void query(String const& query, Function)> on_complete) override; + void query(DeprecatedString const& query, Function)> on_complete) override; }; class FileProvider final : public Provider { public: FileProvider(); - void query(String const& query, Function)> on_complete) override; + void query(DeprecatedString const& query, Function)> on_complete) override; void build_filesystem_cache(); private: RefPtr>> m_fuzzy_match_work; bool m_building_cache { false }; - Vector m_full_path_cache; - Queue m_work_queue; + Vector m_full_path_cache; + Queue m_work_queue; }; class TerminalProvider final : public Provider { public: - void query(String const& query, Function)> on_complete) override; + void query(DeprecatedString const& query, Function)> on_complete) override; }; class URLProvider final : public Provider { public: - void query(String const& query, Function)> on_complete) override; + void query(DeprecatedString const& query, Function)> on_complete) override; }; } diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index f51de15a8ce..54ed65abd84 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -6,10 +6,10 @@ */ #include "Providers.h" +#include #include #include #include -#include #include #include #include @@ -38,7 +38,7 @@ struct AppState { size_t visible_result_count { 0 }; Threading::Mutex lock; - String last_query; + DeprecatedString last_query; }; class ResultRow final : public GUI::Button { @@ -87,7 +87,7 @@ public: Function)> on_new_results; - void search(String const& query) + void search(DeprecatedString const& query) { for (auto& provider : m_providers) { provider.query(query, [=, this](auto results) { @@ -97,7 +97,7 @@ public: } private: - void did_receive_results(String const& query, NonnullRefPtrVector const& results) + void did_receive_results(DeprecatedString const& query, NonnullRefPtrVector const& results) { { Threading::MutexLocker db_locker(m_mutex); @@ -135,7 +135,7 @@ private: NonnullRefPtrVector m_providers; Threading::Mutex m_mutex; - HashMap> m_result_cache; + HashMap> m_result_cache; }; } diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp index b4661756a55..1357fda2470 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.cpp +++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp @@ -74,12 +74,12 @@ private: }; } - String title() const + DeprecatedString title() const { return m_title_textbox->text(); } - String url() const + DeprecatedString url() const { return m_url_textbox->text(); } @@ -97,7 +97,7 @@ BookmarksBarWidget& BookmarksBarWidget::the() return *s_the; } -BookmarksBarWidget::BookmarksBarWidget(String const& bookmarks_file, bool enabled) +BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, bool enabled) { s_the = this; set_layout(); @@ -259,7 +259,7 @@ void BookmarksBarWidget::update_content_size() } } -bool BookmarksBarWidget::contains_bookmark(String const& url) +bool BookmarksBarWidget::contains_bookmark(DeprecatedString const& url) { for (int item_index = 0; item_index < model()->row_count(); ++item_index) { @@ -272,7 +272,7 @@ bool BookmarksBarWidget::contains_bookmark(String const& url) return false; } -bool BookmarksBarWidget::remove_bookmark(String const& url) +bool BookmarksBarWidget::remove_bookmark(DeprecatedString const& url) { for (int item_index = 0; item_index < model()->row_count(); ++item_index) { @@ -292,7 +292,7 @@ bool BookmarksBarWidget::remove_bookmark(String const& url) return false; } -bool BookmarksBarWidget::add_bookmark(String const& url, String const& title) +bool BookmarksBarWidget::add_bookmark(DeprecatedString const& url, DeprecatedString const& title) { Vector values; values.append(title); @@ -306,7 +306,7 @@ bool BookmarksBarWidget::add_bookmark(String const& url, String const& title) return false; } -bool BookmarksBarWidget::edit_bookmark(String const& url) +bool BookmarksBarWidget::edit_bookmark(DeprecatedString const& url) { for (int item_index = 0; item_index < model()->row_count(); ++item_index) { auto item_title = model()->index(item_index, 0).data().to_string(); diff --git a/Userland/Applications/Browser/BookmarksBarWidget.h b/Userland/Applications/Browser/BookmarksBarWidget.h index 9a19b92c313..7cbcd62bc03 100644 --- a/Userland/Applications/Browser/BookmarksBarWidget.h +++ b/Userland/Applications/Browser/BookmarksBarWidget.h @@ -31,13 +31,13 @@ public: No }; - Function on_bookmark_click; - Function on_bookmark_hover; + Function on_bookmark_click; + Function on_bookmark_hover; - bool contains_bookmark(String const& url); - bool remove_bookmark(String const& url); - bool add_bookmark(String const& url, String const& title); - bool edit_bookmark(String const& url); + bool contains_bookmark(DeprecatedString const& url); + bool remove_bookmark(DeprecatedString const& url); + bool add_bookmark(DeprecatedString const& url, DeprecatedString const& title); + bool edit_bookmark(DeprecatedString const& url); virtual Optional calculated_min_size() const override { @@ -46,7 +46,7 @@ public: } private: - BookmarksBarWidget(String const&, bool enabled); + BookmarksBarWidget(DeprecatedString const&, bool enabled); // ^GUI::ModelClient virtual void model_did_update(unsigned) override; @@ -63,7 +63,7 @@ private: RefPtr m_context_menu; RefPtr m_context_menu_default_action; - String m_context_menu_url; + DeprecatedString m_context_menu_url; NonnullRefPtrVector m_bookmarks; diff --git a/Userland/Applications/Browser/Browser.h b/Userland/Applications/Browser/Browser.h index 10d199c71fd..417dcbfeaa9 100644 --- a/Userland/Applications/Browser/Browser.h +++ b/Userland/Applications/Browser/Browser.h @@ -6,19 +6,19 @@ #pragma once -#include +#include #include namespace Browser { -extern String g_home_url; -extern String g_new_tab_url; -extern String g_search_engine; -extern Vector g_content_filters; -extern Vector g_proxies; -extern HashMap g_proxy_mappings; +extern DeprecatedString g_home_url; +extern DeprecatedString g_new_tab_url; +extern DeprecatedString g_search_engine; +extern Vector g_content_filters; +extern Vector g_proxies; +extern HashMap g_proxy_mappings; extern bool g_content_filters_enabled; extern IconBag g_icon_bag; -extern String g_webdriver_content_ipc_path; +extern DeprecatedString g_webdriver_content_ipc_path; } diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 69d596be804..bc5b2c6d5f1 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -46,7 +46,7 @@ namespace Browser { -static String bookmarks_file_path() +static DeprecatedString bookmarks_file_path() { StringBuilder builder; builder.append(Core::StandardPaths::config_directory()); @@ -54,7 +54,7 @@ static String bookmarks_file_path() return builder.to_string(); } -static String search_engines_file_path() +static DeprecatedString search_engines_file_path() { StringBuilder builder; builder.append(Core::StandardPaths::config_directory()); @@ -247,7 +247,7 @@ void BrowserWindow::build_menus() m_take_visible_screenshot_action = GUI::Action::create( "Take &Visible Screenshot"sv, g_icon_bag.filetype_image, [this](auto&) { if (auto result = take_screenshot(ScreenshotType::Visible); result.is_error()) - GUI::MessageBox::show_error(this, String::formatted("{}", result.error())); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("{}", result.error())); }, this); m_take_visible_screenshot_action->set_status_tip("Save a screenshot of the visible portion of the current tab to the Downloads directory"sv); @@ -255,7 +255,7 @@ void BrowserWindow::build_menus() m_take_full_screenshot_action = GUI::Action::create( "Take &Full Screenshot"sv, g_icon_bag.filetype_image, [this](auto&) { if (auto result = take_screenshot(ScreenshotType::Full); result.is_error()) - GUI::MessageBox::show_error(this, String::formatted("{}", result.error())); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("{}", result.error())); }, this); m_take_full_screenshot_action->set_status_tip("Save a screenshot of the entirety of the current tab to the Downloads directory"sv); @@ -410,7 +410,7 @@ void BrowserWindow::build_menus() add_user_agent("Safari iOS Mobile", "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1"); auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) { - String user_agent; + DeprecatedString user_agent; if (GUI::InputBox::show(this, user_agent, "Enter User Agent:"sv, "Custom User Agent"sv) != GUI::InputBox::ExecResult::OK || user_agent.is_empty() || user_agent.is_null()) { m_disable_user_agent_spoofing->activate(); return; @@ -501,7 +501,7 @@ ErrorOr BrowserWindow::load_search_engines(GUI::Menu& settings_menu) } auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) { - String search_engine; + DeprecatedString search_engine; if (GUI::InputBox::show(this, search_engine, "Enter URL template:"sv, "Custom Search Engine"sv, "https://host/search?q={}"sv) != GUI::InputBox::ExecResult::OK || search_engine.is_empty()) { m_disable_search_engine_action->activate(); return; @@ -543,7 +543,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab) { auto& title = tab.title(); auto url = tab.url(); - set_title(String::formatted("{} - Browser", title.is_empty() ? url.to_string() : title)); + set_title(DeprecatedString::formatted("{} - Browser", title.is_empty() ? url.to_string() : title)); } void BrowserWindow::create_new_tab(URL url, bool activate) @@ -591,7 +591,7 @@ void BrowserWindow::create_new_tab(URL url, bool activate) return m_cookie_jar.get_named_cookie(url, name); }; - new_tab.on_get_cookie = [this](auto& url, auto source) -> String { + new_tab.on_get_cookie = [this](auto& url, auto source) -> DeprecatedString { return m_cookie_jar.get_cookie(url, source); }; @@ -647,7 +647,7 @@ void BrowserWindow::proxy_mappings_changed() }); } -void BrowserWindow::config_string_did_change(String const& domain, String const& group, String const& key, String const& value) +void BrowserWindow::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) { if (domain != "Browser") return; @@ -673,7 +673,7 @@ void BrowserWindow::config_string_did_change(String const& domain, String const& // TODO: ColorScheme } -void BrowserWindow::config_bool_did_change(String const& domain, String const& group, String const& key, bool value) +void BrowserWindow::config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) { dbgln("{} {} {} {}", domain, group, key, value); if (domain != "Browser" || group != "Preferences") diff --git a/Userland/Applications/Browser/BrowserWindow.h b/Userland/Applications/Browser/BrowserWindow.h index ee039d6e612..6728c0dabec 100644 --- a/Userland/Applications/Browser/BrowserWindow.h +++ b/Userland/Applications/Browser/BrowserWindow.h @@ -55,8 +55,8 @@ private: ErrorOr load_search_engines(GUI::Menu& settings_menu); void set_window_title_for_tab(Tab const&); - virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override; - virtual void config_bool_did_change(String const& domain, String const& group, String const& key, bool value) override; + virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override; + virtual void config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) override; virtual void event(Core::Event&) override; diff --git a/Userland/Applications/Browser/ConsoleWidget.cpp b/Userland/Applications/Browser/ConsoleWidget.cpp index 7e02db847e8..b089779d93b 100644 --- a/Userland/Applications/Browser/ConsoleWidget.cpp +++ b/Userland/Applications/Browser/ConsoleWidget.cpp @@ -92,7 +92,7 @@ void ConsoleWidget::notify_about_new_console_message(i32 message_index) request_console_messages(); } -void ConsoleWidget::handle_console_messages(i32 start_index, Vector const& message_types, Vector const& messages) +void ConsoleWidget::handle_console_messages(i32 start_index, Vector const& message_types, Vector const& messages) { i32 end_index = start_index + message_types.size() - 1; if (end_index <= m_highest_received_message_index) { diff --git a/Userland/Applications/Browser/ConsoleWidget.h b/Userland/Applications/Browser/ConsoleWidget.h index 06930ccb50b..1b9f15aa830 100644 --- a/Userland/Applications/Browser/ConsoleWidget.h +++ b/Userland/Applications/Browser/ConsoleWidget.h @@ -21,12 +21,12 @@ public: virtual ~ConsoleWidget() = default; void notify_about_new_console_message(i32 message_index); - void handle_console_messages(i32 start_index, Vector const& message_types, Vector const& messages); + void handle_console_messages(i32 start_index, Vector const& message_types, Vector const& messages); void print_source_line(StringView); void print_html(StringView); void reset(); - Function on_js_input; + Function on_js_input; Function on_request_messages; private: @@ -46,7 +46,7 @@ private: struct Group { int id { 0 }; - String label; + DeprecatedString label; }; Vector m_group_stack; int m_next_group_id { 1 }; diff --git a/Userland/Applications/Browser/CookieJar.cpp b/Userland/Applications/Browser/CookieJar.cpp index 5d44870c91e..2acd18d50b3 100644 --- a/Userland/Applications/Browser/CookieJar.cpp +++ b/Userland/Applications/Browser/CookieJar.cpp @@ -16,7 +16,7 @@ namespace Browser { -String CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) +DeprecatedString CookieJar::get_cookie(const URL& url, Web::Cookie::Source source) { purge_expired_cookies(); @@ -134,7 +134,7 @@ Vector CookieJar::get_all_cookies(URL const& url) return cookies; } -Optional CookieJar::get_named_cookie(URL const& url, String const& name) +Optional CookieJar::get_named_cookie(URL const& url, DeprecatedString const& name) { auto domain = canonicalize_domain(url); if (!domain.has_value()) @@ -150,7 +150,7 @@ Optional CookieJar::get_named_cookie(URL const& url, String return {}; } -Optional CookieJar::canonicalize_domain(const URL& url) +Optional CookieJar::canonicalize_domain(const URL& url) { // https://tools.ietf.org/html/rfc6265#section-5.1.2 if (!url.is_valid()) @@ -160,7 +160,7 @@ Optional CookieJar::canonicalize_domain(const URL& url) return url.host().to_lowercase(); } -bool CookieJar::domain_matches(String const& string, String const& domain_string) +bool CookieJar::domain_matches(DeprecatedString const& string, DeprecatedString const& domain_string) { // https://tools.ietf.org/html/rfc6265#section-5.1.3 @@ -184,7 +184,7 @@ bool CookieJar::domain_matches(String const& string, String const& domain_string return true; } -bool CookieJar::path_matches(String const& request_path, String const& cookie_path) +bool CookieJar::path_matches(DeprecatedString const& request_path, DeprecatedString const& cookie_path) { // https://tools.ietf.org/html/rfc6265#section-5.1.4 @@ -207,12 +207,12 @@ bool CookieJar::path_matches(String const& request_path, String const& cookie_pa return false; } -String CookieJar::default_path(const URL& url) +DeprecatedString CookieJar::default_path(const URL& url) { // https://tools.ietf.org/html/rfc6265#section-5.1.4 // 1. Let uri-path be the path portion of the request-uri if such a portion exists (and empty otherwise). - String uri_path = url.path(); + DeprecatedString uri_path = url.path(); // 2. If the uri-path is empty or if the first character of the uri-path is not a %x2F ("/") character, output %x2F ("/") and skip the remaining steps. if (uri_path.is_empty() || (uri_path[0] != '/')) @@ -229,7 +229,7 @@ String CookieJar::default_path(const URL& url) return uri_path.substring(0, last_separator); } -void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source) +void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, DeprecatedString canonicalized_domain, Web::Cookie::Source source) { // https://tools.ietf.org/html/rfc6265#section-5.3 @@ -315,7 +315,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con m_cookies.set(key, move(cookie)); } -Vector CookieJar::get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode) +Vector CookieJar::get_matching_cookies(const URL& url, DeprecatedString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode) { // https://tools.ietf.org/html/rfc6265#section-5.4 diff --git a/Userland/Applications/Browser/CookieJar.h b/Userland/Applications/Browser/CookieJar.h index 89ce521ee5f..eada4c9fc17 100644 --- a/Userland/Applications/Browser/CookieJar.h +++ b/Userland/Applications/Browser/CookieJar.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include #include #include @@ -19,34 +19,34 @@ namespace Browser { struct CookieStorageKey { bool operator==(CookieStorageKey const&) const = default; - String name; - String domain; - String path; + DeprecatedString name; + DeprecatedString domain; + DeprecatedString path; }; class CookieJar { public: - String get_cookie(const URL& url, Web::Cookie::Source source); + DeprecatedString get_cookie(const URL& url, Web::Cookie::Source source); void set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source); void update_cookie(URL const&, Web::Cookie::Cookie); void dump_cookies() const; Vector get_all_cookies() const; Vector get_all_cookies(URL const& url); - Optional get_named_cookie(URL const& url, String const& name); + Optional get_named_cookie(URL const& url, DeprecatedString const& name); private: - static Optional canonicalize_domain(const URL& url); - static bool domain_matches(String const& string, String const& domain_string); - static bool path_matches(String const& request_path, String const& cookie_path); - static String default_path(const URL& url); + static Optional canonicalize_domain(const URL& url); + static bool domain_matches(DeprecatedString const& string, DeprecatedString const& domain_string); + static bool path_matches(DeprecatedString const& request_path, DeprecatedString const& cookie_path); + static DeprecatedString default_path(const URL& url); enum class MatchingCookiesSpecMode { RFC6265, WebDriver, }; - void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, String canonicalized_domain, Web::Cookie::Source source); - Vector get_matching_cookies(const URL& url, String const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode = MatchingCookiesSpecMode::RFC6265); + void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, DeprecatedString canonicalized_domain, Web::Cookie::Source source); + Vector get_matching_cookies(const URL& url, DeprecatedString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode = MatchingCookiesSpecMode::RFC6265); void purge_expired_cookies(); HashMap m_cookies; diff --git a/Userland/Applications/Browser/CookiesModel.cpp b/Userland/Applications/Browser/CookiesModel.cpp index 2f7ca996470..717736c730e 100644 --- a/Userland/Applications/Browser/CookiesModel.cpp +++ b/Userland/Applications/Browser/CookiesModel.cpp @@ -34,7 +34,7 @@ int CookiesModel::row_count(GUI::ModelIndex const& index) const return 0; } -String CookiesModel::column_name(int column) const +DeprecatedString CookiesModel::column_name(int column) const { switch (column) { case Column::Domain: @@ -95,7 +95,7 @@ TriState CookiesModel::data_matches(GUI::ModelIndex const& index, GUI::Variant c return TriState::True; auto const& cookie = m_cookies[index.row()]; - auto haystack = String::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value); + auto haystack = DeprecatedString::formatted("{} {} {} {}", cookie.domain, cookie.path, cookie.name, cookie.value); if (fuzzy_match(needle, haystack).score > 0) return TriState::True; return TriState::False; diff --git a/Userland/Applications/Browser/CookiesModel.h b/Userland/Applications/Browser/CookiesModel.h index 22f6a9964ad..8b66b78856e 100644 --- a/Userland/Applications/Browser/CookiesModel.h +++ b/Userland/Applications/Browser/CookiesModel.h @@ -30,7 +30,7 @@ public: void clear_items(); virtual int row_count(GUI::ModelIndex const&) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override; + virtual DeprecatedString column_name(int column) const override; virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override; virtual TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override; diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp index c6ec1ca2b60..605169d471f 100644 --- a/Userland/Applications/Browser/DownloadWidget.cpp +++ b/Userland/Applications/Browser/DownloadWidget.cpp @@ -49,7 +49,7 @@ DownloadWidget::DownloadWidget(const URL& url) { auto file_or_error = Core::Stream::File::open(m_destination_path, Core::Stream::OpenMode::Write); if (file_or_error.is_error()) { - GUI::MessageBox::show(window(), String::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Cannot open {} for writing", m_destination_path), "Download failed"sv, GUI::MessageBox::Type::Error); window()->close(); return; } @@ -71,7 +71,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_browser_image->load_from_file("/res/graphics/download-animation.gif"sv); animation_layout.add_spacer(); - auto& source_label = add(String::formatted("From: {}", url)); + auto& source_label = add(DeprecatedString::formatted("From: {}", url)); source_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); source_label.set_fixed_height(16); @@ -82,7 +82,7 @@ DownloadWidget::DownloadWidget(const URL& url) m_progress_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_progress_label->set_fixed_height(16); - auto& destination_label = add(String::formatted("To: {}", m_destination_path)); + auto& destination_label = add(DeprecatedString::formatted("To: {}", m_destination_path)); destination_label.set_text_alignment(Gfx::TextAlignment::CenterLeft); destination_label.set_fixed_height(16); @@ -161,7 +161,7 @@ void DownloadWidget::did_finish(bool success) m_cancel_button->update(); if (!success) { - GUI::MessageBox::show(window(), String::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Download failed for some reason"), "Download failed"sv, GUI::MessageBox::Type::Error); window()->close(); return; } diff --git a/Userland/Applications/Browser/DownloadWidget.h b/Userland/Applications/Browser/DownloadWidget.h index 21fc7641ab9..176d818d878 100644 --- a/Userland/Applications/Browser/DownloadWidget.h +++ b/Userland/Applications/Browser/DownloadWidget.h @@ -30,7 +30,7 @@ private: void did_finish(bool success); URL m_url; - String m_destination_path; + DeprecatedString m_destination_path; RefPtr m_download; RefPtr m_progressbar; RefPtr m_progress_label; diff --git a/Userland/Applications/Browser/ElementSizePreviewWidget.cpp b/Userland/Applications/Browser/ElementSizePreviewWidget.cpp index 0ee3e8aef65..f8c928d56c8 100644 --- a/Userland/Applications/Browser/ElementSizePreviewWidget.cpp +++ b/Userland/Applications/Browser/ElementSizePreviewWidget.cpp @@ -21,13 +21,13 @@ void ElementSizePreviewWidget::paint_event(GUI::PaintEvent& event) int content_width_padding = 8; int content_height_padding = 8; - auto content_size_text = String::formatted("{}x{}", m_node_content_width, m_node_content_height); + auto content_size_text = DeprecatedString::formatted("{}x{}", m_node_content_width, m_node_content_height); int inner_content_width = max(100, font().width(content_size_text) + 2 * content_width_padding); int inner_content_height = max(15, font().glyph_height() + 2 * content_height_padding); auto format_size_text = [&](float size) { - return String::formatted("{:.4f}", size); + return DeprecatedString::formatted("{:.4f}", size); }; auto compute_text_string_width = [&](float size) { diff --git a/Userland/Applications/Browser/History.cpp b/Userland/Applications/Browser/History.cpp index f93d07fcc6b..fce443159e3 100644 --- a/Userland/Applications/Browser/History.cpp +++ b/Userland/Applications/Browser/History.cpp @@ -18,7 +18,7 @@ void History::dump() const } } -void History::push(const URL& url, String const& title) +void History::push(const URL& url, DeprecatedString const& title) { if (!m_items.is_empty() && m_items[m_current].url == url) return; @@ -30,7 +30,7 @@ void History::push(const URL& url, String const& title) m_current++; } -void History::replace_current(const URL& url, String const& title) +void History::replace_current(const URL& url, DeprecatedString const& title) { if (m_current == -1) return; @@ -65,7 +65,7 @@ void History::clear() m_current = -1; } -void History::update_title(String const& title) +void History::update_title(DeprecatedString const& title) { if (m_current == -1) return; diff --git a/Userland/Applications/Browser/History.h b/Userland/Applications/Browser/History.h index 655c5619894..cdc0d33fd5e 100644 --- a/Userland/Applications/Browser/History.h +++ b/Userland/Applications/Browser/History.h @@ -15,13 +15,13 @@ class History { public: struct URLTitlePair { URL url; - String title; + DeprecatedString title; }; void dump() const; - void push(const URL& url, String const& title); - void replace_current(const URL& url, String const& title); - void update_title(String const& title); + void push(const URL& url, DeprecatedString const& title); + void replace_current(const URL& url, DeprecatedString const& title); + void update_title(DeprecatedString const& title); URLTitlePair current() const; Vector const get_back_title_history(); diff --git a/Userland/Applications/Browser/IconBag.cpp b/Userland/Applications/Browser/IconBag.cpp index ab741c40ddd..037d26fef11 100644 --- a/Userland/Applications/Browser/IconBag.cpp +++ b/Userland/Applications/Browser/IconBag.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include namespace Browser { diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp index 56f9fde607e..2a74f90c088 100644 --- a/Userland/Applications/Browser/InspectorWidget.cpp +++ b/Userland/Applications/Browser/InspectorWidget.cpp @@ -126,7 +126,7 @@ void InspectorWidget::select_default_node() m_dom_tree_view->set_cursor({}, GUI::AbstractView::SelectionUpdate::ClearIfNotSelected); } -void InspectorWidget::set_dom_json(String json) +void InspectorWidget::set_dom_json(DeprecatedString json) { if (m_dom_json.has_value() && m_dom_json.value() == json) return; @@ -148,7 +148,7 @@ void InspectorWidget::clear_dom_json() clear_style_json(); } -void InspectorWidget::set_dom_node_properties_json(Selection selection, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json) +void InspectorWidget::set_dom_node_properties_json(Selection selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json) { if (selection != m_selection) { dbgln("Got data for the wrong node id! Wanted ({}), got ({})", m_selection.to_string(), selection.to_string()); @@ -159,7 +159,7 @@ void InspectorWidget::set_dom_node_properties_json(Selection selection, String s update_node_box_model(node_box_sizing_json); } -void InspectorWidget::load_style_json(String specified_values_json, String computed_values_json, String custom_properties_json) +void InspectorWidget::load_style_json(DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json) { m_selection_specified_values_json = specified_values_json; m_computed_style_table_view->set_model(WebView::StylePropertiesModel::create(m_selection_specified_values_json.value().view())); @@ -174,7 +174,7 @@ void InspectorWidget::load_style_json(String specified_values_json, String compu m_custom_properties_table_view->set_searchable(true); } -void InspectorWidget::update_node_box_model(Optional node_box_sizing_json) +void InspectorWidget::update_node_box_model(Optional node_box_sizing_json) { if (!node_box_sizing_json.has_value()) { return; diff --git a/Userland/Applications/Browser/InspectorWidget.h b/Userland/Applications/Browser/InspectorWidget.h index bff3d1ed30c..f28059d6fac 100644 --- a/Userland/Applications/Browser/InspectorWidget.h +++ b/Userland/Applications/Browser/InspectorWidget.h @@ -29,20 +29,20 @@ public: return dom_node_id == other.dom_node_id && pseudo_element == other.pseudo_element; } - String to_string() const + DeprecatedString to_string() const { if (pseudo_element.has_value()) - return String::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value())); - return String::formatted("id: {}", dom_node_id); + return DeprecatedString::formatted("id: {}, pseudo: {}", dom_node_id, Web::CSS::pseudo_element_name(pseudo_element.value())); + return DeprecatedString::formatted("id: {}", dom_node_id); } }; virtual ~InspectorWidget() = default; void set_web_view(NonnullRefPtr web_view) { m_web_view = web_view; } - void set_dom_json(String); + void set_dom_json(DeprecatedString); void clear_dom_json(); - void set_dom_node_properties_json(Selection, String specified_values_json, String computed_values_json, String custom_properties_json, String node_box_sizing_json); + void set_dom_node_properties_json(Selection, DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json, DeprecatedString node_box_sizing_json); void set_selection(Selection); void select_default_node(); @@ -51,8 +51,8 @@ private: InspectorWidget(); void set_selection(GUI::ModelIndex); - void load_style_json(String specified_values_json, String computed_values_json, String custom_properties_json); - void update_node_box_model(Optional node_box_sizing_json); + void load_style_json(DeprecatedString specified_values_json, DeprecatedString computed_values_json, DeprecatedString custom_properties_json); + void update_node_box_model(Optional node_box_sizing_json); void clear_style_json(); void clear_node_box_model(); @@ -66,12 +66,12 @@ private: Web::Layout::BoxModelMetrics m_node_box_sizing; - Optional m_dom_json; + Optional m_dom_json; Optional m_pending_selection; Selection m_selection; - Optional m_selection_specified_values_json; - Optional m_selection_computed_values_json; - Optional m_selection_custom_properties_json; + Optional m_selection_specified_values_json; + Optional m_selection_computed_values_json; + Optional m_selection_custom_properties_json; }; } diff --git a/Userland/Applications/Browser/StorageModel.cpp b/Userland/Applications/Browser/StorageModel.cpp index 490960118f2..4d68b3ee328 100644 --- a/Userland/Applications/Browser/StorageModel.cpp +++ b/Userland/Applications/Browser/StorageModel.cpp @@ -10,7 +10,7 @@ namespace Browser { -void StorageModel::set_items(OrderedHashMap map) +void StorageModel::set_items(OrderedHashMap map) { begin_insert_rows({}, m_local_storage_entries.size(), m_local_storage_entries.size()); m_local_storage_entries = map; @@ -35,7 +35,7 @@ int StorageModel::row_count(GUI::ModelIndex const& index) const return 0; } -String StorageModel::column_name(int column) const +DeprecatedString StorageModel::column_name(int column) const { switch (column) { case Column::Key: @@ -85,7 +85,7 @@ TriState StorageModel::data_matches(GUI::ModelIndex const& index, GUI::Variant c auto const& local_storage_key = keys[index.row()]; auto const& local_storage_value = m_local_storage_entries.get(local_storage_key).value_or({}); - auto haystack = String::formatted("{} {}", local_storage_key, local_storage_value); + auto haystack = DeprecatedString::formatted("{} {}", local_storage_key, local_storage_value); if (fuzzy_match(needle, haystack).score > 0) return TriState::True; return TriState::False; diff --git a/Userland/Applications/Browser/StorageModel.h b/Userland/Applications/Browser/StorageModel.h index f4d9ee592d5..6b8735e00fd 100644 --- a/Userland/Applications/Browser/StorageModel.h +++ b/Userland/Applications/Browser/StorageModel.h @@ -18,17 +18,17 @@ public: __Count, }; - void set_items(OrderedHashMap map); + void set_items(OrderedHashMap map); void clear_items(); virtual int row_count(GUI::ModelIndex const&) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override; + virtual DeprecatedString column_name(int column) const override; virtual GUI::ModelIndex index(int row, int column = 0, GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role = GUI::ModelRole::Display) const override; virtual TriState data_matches(GUI::ModelIndex const& index, GUI::Variant const& term) const override; private: - OrderedHashMap m_local_storage_entries; + OrderedHashMap m_local_storage_entries; }; } diff --git a/Userland/Applications/Browser/StorageWidget.cpp b/Userland/Applications/Browser/StorageWidget.cpp index c548033961d..2b0418fb413 100644 --- a/Userland/Applications/Browser/StorageWidget.cpp +++ b/Userland/Applications/Browser/StorageWidget.cpp @@ -107,7 +107,7 @@ void StorageWidget::clear_cookies() m_cookies_model->clear_items(); } -void StorageWidget::set_local_storage_entries(OrderedHashMap entries) +void StorageWidget::set_local_storage_entries(OrderedHashMap entries) { m_local_storage_model->set_items(entries); } @@ -117,7 +117,7 @@ void StorageWidget::clear_local_storage_entries() m_local_storage_model->clear_items(); } -void StorageWidget::set_session_storage_entries(OrderedHashMap entries) +void StorageWidget::set_session_storage_entries(OrderedHashMap entries) { m_session_storage_model->set_items(entries); } diff --git a/Userland/Applications/Browser/StorageWidget.h b/Userland/Applications/Browser/StorageWidget.h index 11160fb822f..f04001e4c2e 100644 --- a/Userland/Applications/Browser/StorageWidget.h +++ b/Userland/Applications/Browser/StorageWidget.h @@ -26,10 +26,10 @@ public: Function on_update_cookie; - void set_local_storage_entries(OrderedHashMap entries); + void set_local_storage_entries(OrderedHashMap entries); void clear_local_storage_entries(); - void set_session_storage_entries(OrderedHashMap entries); + void set_session_storage_entries(OrderedHashMap entries); void clear_session_storage_entries(); private: diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 8f725f100ca..fe1d05a8c21 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -42,12 +42,12 @@ namespace Browser { -URL url_from_user_input(String const& input) +URL url_from_user_input(DeprecatedString const& input) { if (input.starts_with('?') && !g_search_engine.is_empty()) return URL(g_search_engine.replace("{}"sv, URL::percent_encode(input.substring_view(1)), ReplaceMode::FirstOnly)); - URL url_with_http_schema = URL(String::formatted("http://{}", input)); + URL url_with_http_schema = URL(DeprecatedString::formatted("http://{}", input)); if (url_with_http_schema.is_valid() && url_with_http_schema.port().has_value()) return url_with_http_schema; @@ -62,13 +62,13 @@ void Tab::start_download(const URL& url) { auto window = GUI::Window::construct(&this->window()); window->resize(300, 170); - window->set_title(String::formatted("0% of {}", url.basename())); + window->set_title(DeprecatedString::formatted("0% of {}", url.basename())); window->set_resizable(false); window->set_main_widget(url); window->show(); } -void Tab::view_source(const URL& url, String const& source) +void Tab::view_source(const URL& url, DeprecatedString const& source) { auto window = GUI::Window::construct(&this->window()); auto& editor = window->set_main_widget(); @@ -83,7 +83,7 @@ void Tab::view_source(const URL& url, String const& source) window->show(); } -void Tab::update_status(Optional text_override, i32 count_waiting) +void Tab::update_status(Optional text_override, i32 count_waiting) { if (text_override.has_value()) { m_statusbar->set_text(*text_override); @@ -99,10 +99,10 @@ void Tab::update_status(Optional text_override, i32 count_waiting) if (count_waiting == 0) { // ex: "Loading google.com" - m_statusbar->set_text(String::formatted("Loading {}", m_navigating_url->host())); + m_statusbar->set_text(DeprecatedString::formatted("Loading {}", m_navigating_url->host())); } else { // ex: "google.com is waiting on 5 resources" - m_statusbar->set_text(String::formatted("{} is waiting on {} resource{}", m_navigating_url->host(), count_waiting, count_waiting == 1 ? ""sv : "s"sv)); + m_statusbar->set_text(DeprecatedString::formatted("{} is waiting on {} resource{}", m_navigating_url->host(), count_waiting, count_waiting == 1 ? ""sv : "s"sv)); } } @@ -386,7 +386,7 @@ Tab::Tab(BrowserWindow& window) return {}; }; - view().on_get_cookie = [this](auto& url, auto source) -> String { + view().on_get_cookie = [this](auto& url, auto source) -> DeprecatedString { if (on_get_cookie) return on_get_cookie(url, source); return {}; @@ -485,7 +485,7 @@ Optional Tab::url_from_location_bar(MayAppendTLD may_append_tld) return {}; } - String text = m_location_box->text(); + DeprecatedString text = m_location_box->text(); StringBuilder builder; builder.append(text); @@ -495,7 +495,7 @@ Optional Tab::url_from_location_bar(MayAppendTLD may_append_tld) builder.append(".com"sv); } } - String final_text = builder.to_string(); + DeprecatedString final_text = builder.to_string(); auto url = url_from_user_input(final_text); return url; @@ -552,7 +552,7 @@ void Tab::bookmark_current_url() update_bookmark_button(url); } -void Tab::update_bookmark_button(String const& url) +void Tab::update_bookmark_button(DeprecatedString const& url) { if (BookmarksBarWidget::the().contains_bookmark(url)) { m_bookmark_button->set_icon(g_icon_bag.bookmark_filled); @@ -672,7 +672,7 @@ void Tab::show_console_window() console_window->set_title("JS Console"); console_window->set_icon(g_icon_bag.filetype_javascript); m_console_widget = console_window->set_main_widget(); - m_console_widget->on_js_input = [this](String const& js_source) { + m_console_widget->on_js_input = [this](DeprecatedString const& js_source) { m_web_content_view->js_console_input(js_source); }; m_console_widget->on_request_messages = [this](i32 start_index) { diff --git a/Userland/Applications/Browser/Tab.h b/Userland/Applications/Browser/Tab.h index 23346310944..f65eb6ff83f 100644 --- a/Userland/Applications/Browser/Tab.h +++ b/Userland/Applications/Browser/Tab.h @@ -59,20 +59,20 @@ public: void window_position_changed(Gfx::IntPoint const&); void window_size_changed(Gfx::IntSize const&); - Function on_title_change; + Function on_title_change; Function on_tab_open_request; Function on_tab_close_request; Function on_tab_close_other_request; Function on_favicon_change; Function(AK::URL const& url)> on_get_all_cookies; - Function(AK::URL const& url, String const& name)> on_get_named_cookie; - Function on_get_cookie; + Function(AK::URL const& url, DeprecatedString const& name)> on_get_named_cookie; + Function on_get_cookie; Function on_set_cookie; Function on_dump_cookies; Function on_update_cookie; Function()> on_get_cookies_entries; - Function()> on_get_local_storage_entries; - Function()> on_get_session_storage_entries; + Function()> on_get_local_storage_entries; + Function()> on_get_session_storage_entries; Function on_take_screenshot; void enable_webdriver_mode(); @@ -86,7 +86,7 @@ public: void show_console_window(); void show_storage_inspector(); - String const& title() const { return m_title; } + DeprecatedString const& title() const { return m_title; } Gfx::Bitmap const* icon() const { return m_icon; } WebView::OutOfProcessWebView& view() { return *m_web_content_view; } @@ -102,10 +102,10 @@ private: void update_actions(); void bookmark_current_url(); - void update_bookmark_button(String const& url); + void update_bookmark_button(DeprecatedString const& url); void start_download(const URL& url); - void view_source(const URL& url, String const& source); - void update_status(Optional text_override = {}, i32 count_waiting = 0); + void view_source(const URL& url, DeprecatedString const& source); + void update_status(Optional text_override = {}, i32 count_waiting = 0); enum class MayAppendTLD { No, @@ -138,7 +138,7 @@ private: RefPtr m_page_context_menu; RefPtr m_go_back_context_menu; RefPtr m_go_forward_context_menu; - String m_title; + DeprecatedString m_title; RefPtr m_icon; Optional m_navigating_url; @@ -147,6 +147,6 @@ private: bool m_is_history_navigation { false }; }; -URL url_from_user_input(String const& input); +URL url_from_user_input(DeprecatedString const& input); } diff --git a/Userland/Applications/Browser/WindowActions.cpp b/Userland/Applications/Browser/WindowActions.cpp index 51d7cbcd960..a18e5743071 100644 --- a/Userland/Applications/Browser/WindowActions.cpp +++ b/Userland/Applications/Browser/WindowActions.cpp @@ -60,12 +60,12 @@ WindowActions::WindowActions(GUI::Window& window) for (auto i = 0; i <= 7; ++i) { m_tab_actions.append(GUI::Action::create( - String::formatted("Tab {}", i + 1), { Mod_Ctrl, static_cast(Key_1 + i) }, [this, i](auto&) { + DeprecatedString::formatted("Tab {}", i + 1), { Mod_Ctrl, static_cast(Key_1 + i) }, [this, i](auto&) { if (on_tabs[i]) on_tabs[i](); }, &window)); - m_tab_actions.last().set_status_tip(String::formatted("Switch to tab {}", i + 1)); + m_tab_actions.last().set_status_tip(DeprecatedString::formatted("Switch to tab {}", i + 1)); } m_tab_actions.append(GUI::Action::create( "Last tab", { Mod_Ctrl, Key_9 }, [this](auto&) { diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index 1e3b80389a8..a133d305656 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -31,21 +31,21 @@ namespace Browser { -String g_search_engine; -String g_home_url; -String g_new_tab_url; -Vector g_content_filters; +DeprecatedString g_search_engine; +DeprecatedString g_home_url; +DeprecatedString g_new_tab_url; +Vector g_content_filters; bool g_content_filters_enabled { true }; -Vector g_proxies; -HashMap g_proxy_mappings; +Vector g_proxies; +HashMap g_proxy_mappings; IconBag g_icon_bag; -String g_webdriver_content_ipc_path; +DeprecatedString g_webdriver_content_ipc_path; } static ErrorOr load_content_filters() { - auto file = TRY(Core::Stream::File::open(String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::Stream::OpenMode::Read)); + auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::Stream::OpenMode::Read)); auto ad_filter_list = TRY(Core::Stream::BufferedFile::create(move(file))); auto buffer = TRY(ByteBuffer::create_uninitialized(4096)); while (TRY(ad_filter_list->can_read_line())) { @@ -66,7 +66,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio recvfd sendfd unix fattr cpath rpath wpath proc exec")); - Vector specified_urls; + Vector specified_urls; Core::ArgsParser args_parser; args_parser.add_positional_argument(specified_urls, "URLs to open", "url", Core::ArgsParser::Required::No); @@ -129,7 +129,7 @@ ErrorOr serenity_main(Main::Arguments arguments) } } - auto url_from_argument_string = [](String const& string) -> URL { + auto url_from_argument_string = [](DeprecatedString const& string) -> URL { if (Core::File::exists(string)) { return URL::create_with_file_scheme(Core::File::real_path_for(string)); } @@ -153,7 +153,7 @@ ErrorOr serenity_main(Main::Arguments arguments) } window->content_filters_changed(); }; - TRY(content_filters_watcher->add_watch(String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified)); + TRY(content_filters_watcher->add_watch(DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()), Core::FileWatcherEvent::Type::ContentModified)); app->on_action_enter = [&](GUI::Action& action) { if (auto* browser_window = dynamic_cast(app->active_window())) { diff --git a/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp b/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp index 9a5fb3417fb..8e12b500872 100644 --- a/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp +++ b/Userland/Applications/BrowserSettings/BrowserSettingsWidget.cpp @@ -12,16 +12,16 @@ #include #include -static String default_homepage_url = "file:///res/html/misc/welcome.html"; -static String default_new_tab_url = "file:///res/html/misc/new-tab.html"; -static String default_search_engine = ""; -static String default_color_scheme = "auto"; +static DeprecatedString default_homepage_url = "file:///res/html/misc/welcome.html"; +static DeprecatedString default_new_tab_url = "file:///res/html/misc/new-tab.html"; +static DeprecatedString default_search_engine = ""; +static DeprecatedString default_color_scheme = "auto"; static bool default_show_bookmarks_bar = true; static bool default_auto_close_download_windows = false; struct ColorScheme { - String title; - String setting_value; + DeprecatedString title; + DeprecatedString setting_value; }; class ColorSchemeModel final : public GUI::Model { @@ -96,7 +96,7 @@ BrowserSettingsWidget::BrowserSettingsWidget() Vector search_engine_fields; search_engine_fields.empend("title", "Title", Gfx::TextAlignment::CenterLeft); search_engine_fields.empend("url_format", "Url format", Gfx::TextAlignment::CenterLeft); - auto search_engines_model = GUI::JsonArrayModel::create(String::formatted("{}/SearchEngines.json", Core::StandardPaths::config_directory()), move(search_engine_fields)); + auto search_engines_model = GUI::JsonArrayModel::create(DeprecatedString::formatted("{}/SearchEngines.json", Core::StandardPaths::config_directory()), move(search_engine_fields)); search_engines_model->invalidate(); Vector custom_search_engine; custom_search_engine.append("Custom..."); @@ -105,7 +105,7 @@ BrowserSettingsWidget::BrowserSettingsWidget() m_search_engine_combobox->set_model(move(search_engines_model)); m_search_engine_combobox->set_only_allow_values_from_model(true); - m_search_engine_combobox->on_change = [this](AK::String const&, GUI::ModelIndex const& cursor_index) { + m_search_engine_combobox->on_change = [this](AK::DeprecatedString const&, GUI::ModelIndex const& cursor_index) { auto url_format = m_search_engine_combobox->model()->index(cursor_index.row(), 1).data().to_string(); m_is_custom_search_engine = url_format.is_empty(); m_custom_search_engine_group->set_enabled(m_is_custom_search_engine); diff --git a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp index 6cddf8100b2..50e99dfd732 100644 --- a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp +++ b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp @@ -20,9 +20,9 @@ static constexpr bool s_default_enable_content_filtering = true; -static String filter_list_file_path() +static DeprecatedString filter_list_file_path() { - return String::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()); + return DeprecatedString::formatted("{}/BrowserContentFilters.txt", Core::StandardPaths::config_directory()); } ErrorOr DomainListModel::load() @@ -55,7 +55,7 @@ ErrorOr DomainListModel::save() return {}; } -void DomainListModel::add_domain(String name) +void DomainListModel::add_domain(DeprecatedString name) { begin_insert_rows({}, m_domain_list.size(), m_domain_list.size()); m_domain_list.append(move(name)); @@ -117,7 +117,7 @@ ContentFilterSettingsWidget::ContentFilterSettingsWidget() m_enable_content_filtering_checkbox->on_checked = [&](auto) { set_modified(true); }; m_add_new_domain_button->on_click = [&](unsigned) { - String text; + DeprecatedString text; if (GUI::InputBox::show(window(), text, "Enter domain name"sv, "Add domain to Content Filter"sv) == GUI::Dialog::ExecResult::OK && !text.is_empty()) { diff --git a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.h b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.h index dea26e5cad7..102ada7aac9 100644 --- a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.h +++ b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.h @@ -21,12 +21,12 @@ public: virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return 1; } virtual GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole = GUI::ModelRole::Display) const override { return m_domain_list[index.row()]; } - void add_domain(String name); + void add_domain(DeprecatedString name); void delete_domain(size_t index); private: bool m_was_modified { false }; - Vector m_domain_list; + Vector m_domain_list; }; class ContentFilterSettingsWidget : public GUI::SettingsWindow::Tab { diff --git a/Userland/Applications/Calculator/CalculatorWidget.cpp b/Userland/Applications/Calculator/CalculatorWidget.cpp index 4835797214a..0964eca72a2 100644 --- a/Userland/Applications/Calculator/CalculatorWidget.cpp +++ b/Userland/Applications/Calculator/CalculatorWidget.cpp @@ -31,7 +31,7 @@ CalculatorWidget::CalculatorWidget() m_label->set_frame_thickness(2); for (int i = 0; i < 10; i++) { - m_digit_button[i] = *find_descendant_of_type_named(String::formatted("{}_button", i)); + m_digit_button[i] = *find_descendant_of_type_named(DeprecatedString::formatted("{}_button", i)); add_digit_button(*m_digit_button[i], i); } @@ -128,7 +128,7 @@ void CalculatorWidget::add_digit_button(GUI::Button& button, int digit) }; } -String CalculatorWidget::get_entry() +DeprecatedString CalculatorWidget::get_entry() { return m_entry->text(); } diff --git a/Userland/Applications/Calculator/CalculatorWidget.h b/Userland/Applications/Calculator/CalculatorWidget.h index 556dadc22b1..6f91bf75db2 100644 --- a/Userland/Applications/Calculator/CalculatorWidget.h +++ b/Userland/Applications/Calculator/CalculatorWidget.h @@ -19,7 +19,7 @@ class CalculatorWidget final : public GUI::Widget { C_OBJECT(CalculatorWidget) public: virtual ~CalculatorWidget() override = default; - String get_entry(); + DeprecatedString get_entry(); void set_entry(Crypto::BigFraction); void shrink(unsigned); diff --git a/Userland/Applications/Calculator/Keypad.cpp b/Userland/Applications/Calculator/Keypad.cpp index c261800043a..63b89432c76 100644 --- a/Userland/Applications/Calculator/Keypad.cpp +++ b/Userland/Applications/Calculator/Keypad.cpp @@ -112,15 +112,15 @@ void Keypad::set_to_0() m_state = State::External; } -String Keypad::to_string() const +DeprecatedString Keypad::to_string() const { if (m_state == State::External) return m_internal_value.to_string(m_displayed_fraction_length); StringBuilder builder; - String const integer_value = m_int_value.to_base(10); - String const frac_value = m_frac_value.to_base(10); + DeprecatedString const integer_value = m_int_value.to_base(10); + DeprecatedString const frac_value = m_frac_value.to_base(10); unsigned const number_pre_zeros = m_frac_length.to_u64() - (frac_value.length() - 1) - (frac_value == "0" ? 0 : 1); builder.append(integer_value); diff --git a/Userland/Applications/Calculator/Keypad.h b/Userland/Applications/Calculator/Keypad.h index ce57847284c..7fb97993788 100644 --- a/Userland/Applications/Calculator/Keypad.h +++ b/Userland/Applications/Calculator/Keypad.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -33,7 +33,7 @@ public: void set_rounding_length(unsigned); unsigned rounding_length() const; - String to_string() const; + DeprecatedString to_string() const; private: // Internal representation of the current decimal value. diff --git a/Userland/Applications/Calculator/main.cpp b/Userland/Applications/Calculator/main.cpp index 2ad7653b530..af00b85f9d7 100644 --- a/Userland/Applications/Calculator/main.cpp +++ b/Userland/Applications/Calculator/main.cpp @@ -78,7 +78,7 @@ ErrorOr serenity_main(Main::Arguments arguments) Optional last_rounding_mode = 1; for (unsigned i {}; i < rounding_modes.size(); ++i) { - auto round_action = GUI::Action::create_checkable(String::formatted("To &{} digits", rounding_modes[i]), + auto round_action = GUI::Action::create_checkable(DeprecatedString::formatted("To &{} digits", rounding_modes[i]), [&widget, rounding_mode = rounding_modes[i], &last_rounding_mode, i](auto&) { widget->set_rounding_length(rounding_mode); last_rounding_mode = i; @@ -89,11 +89,11 @@ ErrorOr serenity_main(Main::Arguments arguments) } constexpr auto format { "&Custom - {} ..."sv }; - auto round_custom = GUI::Action::create_checkable(String::formatted(format, 0), [&](auto& action) { + auto round_custom = GUI::Action::create_checkable(DeprecatedString::formatted(format, 0), [&](auto& action) { unsigned custom_rounding_length = widget->rounding_length(); if (RoundingDialog::show(window, "Choose custom rounding"sv, custom_rounding_length) == GUI::Dialog::ExecResult::OK) { - action.set_text(String::formatted(format, custom_rounding_length)); + action.set_text(DeprecatedString::formatted(format, custom_rounding_length)); widget->set_rounding_length(custom_rounding_length); last_rounding_mode.clear(); } else if (last_rounding_mode.has_value()) @@ -107,7 +107,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (RoundingDialog::show(window, "Choose shrinking length"sv, shrink_length) == GUI::Dialog::ExecResult::OK) { round_custom->set_checked(true); - round_custom->set_text(String::formatted(format, shrink_length)); + round_custom->set_text(DeprecatedString::formatted(format, shrink_length)); widget->set_rounding_length(shrink_length); widget->shrink(shrink_length); } diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index 29f35fd44a3..4951885d2cc 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -123,7 +123,7 @@ int AddEventDialog::MeridiemListModel::row_count(const GUI::ModelIndex&) const return 2; } -String AddEventDialog::MonthListModel::column_name(int column) const +DeprecatedString AddEventDialog::MonthListModel::column_name(int column) const { switch (column) { case Column::Month: @@ -133,7 +133,7 @@ String AddEventDialog::MonthListModel::column_name(int column) const } } -String AddEventDialog::MeridiemListModel::column_name(int column) const +DeprecatedString AddEventDialog::MeridiemListModel::column_name(int column) const { switch (column) { case Column::Meridiem: diff --git a/Userland/Applications/Calendar/AddEventDialog.h b/Userland/Applications/Calendar/AddEventDialog.h index 4f0aa162e84..fab9abbef08 100644 --- a/Userland/Applications/Calendar/AddEventDialog.h +++ b/Userland/Applications/Calendar/AddEventDialog.h @@ -38,7 +38,7 @@ private: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: @@ -57,7 +57,7 @@ private: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: diff --git a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp index de5afd1f18f..1d8ba5f0a8f 100644 --- a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp +++ b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp @@ -69,7 +69,7 @@ CharacterMapWidget::CharacterMapWidget() m_next_glyph_action->set_status_tip("Seek the next visible glyph"); m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { - String input; + DeprecatedString input; if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) { auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input); if (!maybe_code_point.has_value()) @@ -139,7 +139,7 @@ CharacterMapWidget::CharacterMapWidget() for (auto& block : unicode_blocks) m_unicode_block_list.append(block.display_name); - m_unicode_block_model = GUI::ItemListModel::create(m_unicode_block_list); + m_unicode_block_model = GUI::ItemListModel::create(m_unicode_block_list); m_unicode_block_listview->set_model(*m_unicode_block_model); m_unicode_block_listview->set_activates_on_selection(true); m_unicode_block_listview->horizontal_scrollbar().set_visible(false); diff --git a/Userland/Applications/CharacterMap/CharacterMapWidget.h b/Userland/Applications/CharacterMap/CharacterMapWidget.h index 3d82a18c1df..214f6108367 100644 --- a/Userland/Applications/CharacterMap/CharacterMapWidget.h +++ b/Userland/Applications/CharacterMap/CharacterMapWidget.h @@ -42,6 +42,6 @@ private: RefPtr m_go_to_glyph_action; RefPtr m_find_glyphs_action; - Vector m_unicode_block_list; + Vector m_unicode_block_list; Unicode::CodePointRange m_range { 0x0000, 0x10FFFF }; }; diff --git a/Userland/Applications/CharacterMap/CharacterSearchWidget.cpp b/Userland/Applications/CharacterMap/CharacterSearchWidget.cpp index 3ffc6539523..382d5b7ad07 100644 --- a/Userland/Applications/CharacterMap/CharacterSearchWidget.cpp +++ b/Userland/Applications/CharacterMap/CharacterSearchWidget.cpp @@ -11,8 +11,8 @@ struct SearchResult { u32 code_point; - String code_point_string; - String display_text; + DeprecatedString code_point_string; + DeprecatedString display_text; }; class CharacterSearchModel final : public GUI::Model { diff --git a/Userland/Applications/CharacterMap/SearchCharacters.h b/Userland/Applications/CharacterMap/SearchCharacters.h index a4350bd0cd1..50d2765879e 100644 --- a/Userland/Applications/CharacterMap/SearchCharacters.h +++ b/Userland/Applications/CharacterMap/SearchCharacters.h @@ -6,13 +6,13 @@ #pragma once -#include +#include #include template void for_each_character_containing(StringView query, Callback callback) { - String uppercase_query = query.to_uppercase_string(); + DeprecatedString uppercase_query = query.to_uppercase_string(); StringView uppercase_query_view = uppercase_query.view(); constexpr u32 maximum_code_point = 0x10FFFF; // FIXME: There's probably a better way to do this than just looping, but it still only takes ~150ms to run for me! diff --git a/Userland/Applications/CharacterMap/main.cpp b/Userland/Applications/CharacterMap/main.cpp index 1a129107f42..87eeec7bdf0 100644 --- a/Userland/Applications/CharacterMap/main.cpp +++ b/Userland/Applications/CharacterMap/main.cpp @@ -17,7 +17,7 @@ #include #include -static void search_and_print_results(String const& query) +static void search_and_print_results(DeprecatedString const& query) { outln("Searching for '{}'", query); u32 result_count = 0; @@ -52,7 +52,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - String query; + DeprecatedString query; Core::ArgsParser args_parser; args_parser.add_option(query, "Search character names using this query, and print them as a list.", "search", 's', "query"); args_parser.parse(arguments); diff --git a/Userland/Applications/ClockSettings/ClockSettingsWidget.h b/Userland/Applications/ClockSettings/ClockSettingsWidget.h index 50db28840aa..99fa5bb1a49 100644 --- a/Userland/Applications/ClockSettings/ClockSettingsWidget.h +++ b/Userland/Applications/ClockSettings/ClockSettingsWidget.h @@ -28,5 +28,5 @@ private: RefPtr m_clock_preview_update_timer; - String m_time_format; + DeprecatedString m_time_format; }; diff --git a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp index 25722449e0b..0750eb042c0 100644 --- a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp +++ b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.cpp @@ -131,7 +131,7 @@ void TimeZoneSettingsWidget::set_time_zone_location() auto name = Locale::format_time_zone(locale, m_time_zone, Locale::CalendarPatternStyle::Long, now); auto offset = Locale::format_time_zone(locale, m_time_zone, Locale::CalendarPatternStyle::LongOffset, now); - m_time_zone_text = String::formatted("{}\n({})", name, offset); + m_time_zone_text = DeprecatedString::formatted("{}\n({})", name, offset); } // https://en.wikipedia.org/wiki/Mercator_projection#Derivation diff --git a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.h b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.h index 202c2c7ed6a..4a8e0e8beb2 100644 --- a/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.h +++ b/Userland/Applications/ClockSettings/TimeZoneSettingsWidget.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include #include #include @@ -28,11 +28,11 @@ private: Optional compute_time_zone_location() const; void set_time_zone(); - String m_time_zone; + DeprecatedString m_time_zone; RefPtr m_time_zone_combo_box; RefPtr m_time_zone_map; RefPtr m_time_zone_marker; Optional m_time_zone_location; - String m_time_zone_text; + DeprecatedString m_time_zone_text; }; diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index 350ec1ce3af..edeed4a9fa6 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -43,8 +43,8 @@ #include struct TitleAndText { - String title; - String text; + DeprecatedString title; + DeprecatedString text; }; struct ThreadBacktracesAndCpuRegisters { @@ -99,7 +99,7 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core: } return { - String::formatted("Thread #{} (TID {})", thread_index, thread_info.tid), + DeprecatedString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid), builder.build() }; } @@ -128,7 +128,7 @@ static TitleAndText build_cpu_registers(const ELF::Core::ThreadInfo& thread_info #endif return { - String::formatted("Thread #{} (TID {})", thread_index, thread_info.tid), + DeprecatedString::formatted("Thread #{} (TID {})", thread_index, thread_info.tid), builder.build() }; } @@ -145,7 +145,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); - String coredump_path {}; + DeprecatedString coredump_path {}; bool unlink_on_exit = false; StringBuilder full_backtrace; @@ -161,9 +161,9 @@ ErrorOr serenity_main(Main::Arguments arguments) return 1; } - Vector memory_regions; + Vector memory_regions; coredump->for_each_memory_region_info([&](auto& memory_region_info) { - memory_regions.append(String::formatted("{:p} - {:p}: {}", memory_region_info.region_start, memory_region_info.region_end, memory_region_info.region_name)); + memory_regions.append(DeprecatedString::formatted("{:p} - {:p}: {}", memory_region_info.region_start, memory_region_info.region_end, memory_region_info.region_name)); return IterationDecision::Continue; }); @@ -197,7 +197,7 @@ ErrorOr serenity_main(Main::Arguments arguments) app_name = af->name(); auto& description_label = *widget->find_descendant_of_type_named("description"); - description_label.set_text(String::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal)); + description_label.set_text(DeprecatedString::formatted("\"{}\" (PID {}) has crashed - {} (signal {})", app_name, pid, strsignal(termination_signal), termination_signal)); auto& executable_link_label = *widget->find_descendant_of_type_named("executable_link"); executable_link_label.set_text(LexicalPath::canonicalized_path(executable_path)); @@ -214,7 +214,7 @@ ErrorOr serenity_main(Main::Arguments arguments) }; auto& arguments_label = *widget->find_descendant_of_type_named("arguments_label"); - arguments_label.set_text(String::join(' ', crashed_process_arguments)); + arguments_label.set_text(DeprecatedString::join(' ', crashed_process_arguments)); auto& progressbar = *widget->find_descendant_of_type_named("progressbar"); auto& tab_widget = *widget->find_descendant_of_type_named("tab_widget"); @@ -246,7 +246,7 @@ ErrorOr serenity_main(Main::Arguments arguments) environment_tab->layout()->set_margins(4); auto environment_text_editor = TRY(environment_tab->try_add()); - environment_text_editor->set_text(String::join('\n', environment)); + environment_text_editor->set_text(DeprecatedString::join('\n', environment)); environment_text_editor->set_mode(GUI::TextEditor::Mode::ReadOnly); environment_text_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap); environment_text_editor->set_should_hide_unnecessary_scrollbars(true); @@ -256,7 +256,7 @@ ErrorOr serenity_main(Main::Arguments arguments) memory_regions_tab->layout()->set_margins(4); auto memory_regions_text_editor = TRY(memory_regions_tab->try_add()); - memory_regions_text_editor->set_text(String::join('\n', memory_regions)); + memory_regions_text_editor->set_text(DeprecatedString::join('\n', memory_regions)); memory_regions_text_editor->set_mode(GUI::TextEditor::Mode::ReadOnly); memory_regions_text_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap); memory_regions_text_editor->set_should_hide_unnecessary_scrollbars(true); @@ -284,14 +284,14 @@ ErrorOr serenity_main(Main::Arguments arguments) return; } - LexicalPath lexical_path(String::formatted("{}_{}_backtrace.txt", pid, app_name)); + LexicalPath lexical_path(DeprecatedString::formatted("{}_{}_backtrace.txt", pid, app_name)); auto file_or_error = FileSystemAccessClient::Client::the().try_save_file(window, lexical_path.title(), lexical_path.extension()); if (file_or_error.is_error()) return; auto file = file_or_error.value(); if (!file->write(full_backtrace.to_string())) - GUI::MessageBox::show(window, String::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, DeprecatedString::formatted("Couldn't save file: {}.", file_or_error.error()), "Saving backtrace failed"sv, GUI::MessageBox::Type::Error); }; (void)Threading::BackgroundAction::construct( diff --git a/Userland/Applications/Debugger/main.cpp b/Userland/Applications/Debugger/main.cpp index 23581936439..47c511f57e2 100644 --- a/Userland/Applications/Debugger/main.cpp +++ b/Userland/Applications/Debugger/main.cpp @@ -57,7 +57,7 @@ static void handle_print_registers(PtraceRegisters const& regs) #endif } -static bool handle_disassemble_command(String const& command, FlatPtr first_instruction) +static bool handle_disassemble_command(DeprecatedString const& command, FlatPtr first_instruction) { auto parts = command.split(' '); size_t number_of_instructions_to_disassemble = 5; @@ -104,7 +104,7 @@ static bool handle_backtrace_command(PtraceRegisters const& regs) while (g_debug_session->peek(eip_val).has_value() && g_debug_session->peek(ebp_val).has_value()) { auto eip_symbol = g_debug_session->symbolicate(eip_val); auto source_position = g_debug_session->get_source_position(eip_val); - String symbol_location = (eip_symbol.has_value() && eip_symbol->symbol != "") ? eip_symbol->symbol : "???"; + DeprecatedString symbol_location = (eip_symbol.has_value() && eip_symbol->symbol != "") ? eip_symbol->symbol : "???"; if (source_position.has_value()) { outln("{:p} in {} ({}:{})", eip_val, symbol_location, source_position->file_path, source_position->line_number); } else { @@ -127,7 +127,7 @@ static bool insert_breakpoint_at_address(FlatPtr address) return g_debug_session->insert_breakpoint(address); } -static bool insert_breakpoint_at_source_position(String const& file, size_t line) +static bool insert_breakpoint_at_source_position(DeprecatedString const& file, size_t line) { auto result = g_debug_session->insert_breakpoint(file, line); if (!result.has_value()) { @@ -138,7 +138,7 @@ static bool insert_breakpoint_at_source_position(String const& file, size_t line return true; } -static bool insert_breakpoint_at_symbol(String const& symbol) +static bool insert_breakpoint_at_symbol(DeprecatedString const& symbol) { auto result = g_debug_session->insert_breakpoint(symbol); if (!result.has_value()) { @@ -149,7 +149,7 @@ static bool insert_breakpoint_at_symbol(String const& symbol) return true; } -static bool handle_breakpoint_command(String const& command) +static bool handle_breakpoint_command(DeprecatedString const& command) { auto parts = command.split(' '); if (parts.size() != 2) @@ -176,7 +176,7 @@ static bool handle_breakpoint_command(String const& command) return insert_breakpoint_at_symbol(argument); } -static bool handle_examine_command(String const& command) +static bool handle_examine_command(DeprecatedString const& command) { auto parts = command.split(' '); if (parts.size() != 2) diff --git a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp index 47247ba1979..339fb73a135 100644 --- a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.cpp @@ -50,7 +50,7 @@ void BackgroundSettingsWidget::create_frame() m_wallpaper_view->set_model(GUI::FileSystemModel::create("/res/wallpapers")); m_wallpaper_view->set_model_column(GUI::FileSystemModel::Column::Name); m_wallpaper_view->on_selection_change = [this] { - String path; + DeprecatedString path; if (m_wallpaper_view->selection().is_empty()) { path = ""; } else { @@ -97,7 +97,7 @@ void BackgroundSettingsWidget::create_frame() m_mode_combo = *find_descendant_of_type_named("mode_combo"); m_mode_combo->set_only_allow_values_from_model(true); - m_mode_combo->set_model(*GUI::ItemListModel::create(m_modes)); + m_mode_combo->set_model(*GUI::ItemListModel::create(m_modes)); bool first_mode_change = true; m_mode_combo->on_change = [this, first_mode_change](auto&, const GUI::ModelIndex& index) mutable { m_monitor_widget->set_wallpaper_mode(m_modes.at(index.row())); @@ -154,7 +154,7 @@ void BackgroundSettingsWidget::load_current_settings() void BackgroundSettingsWidget::apply_settings() { if (!GUI::Desktop::the().set_wallpaper(m_monitor_widget->wallpaper_bitmap(), m_monitor_widget->wallpaper())) - GUI::MessageBox::show_error(window(), String::formatted("Unable to load file {} as wallpaper", m_monitor_widget->wallpaper())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Unable to load file {} as wallpaper", m_monitor_widget->wallpaper())); GUI::Desktop::the().set_background_color(m_color_input->text()); GUI::Desktop::the().set_wallpaper_mode(m_monitor_widget->wallpaper_mode()); diff --git a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.h b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.h index 2a187b0f58c..a3e666d4087 100644 --- a/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.h +++ b/Userland/Applications/DisplaySettings/BackgroundSettingsWidget.h @@ -32,7 +32,7 @@ private: void create_frame(); void load_current_settings(); - Vector m_modes; + Vector m_modes; bool& m_background_settings_changed; diff --git a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp index e72a9f8685d..3fe62e439d5 100644 --- a/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/DesktopSettingsWidget.cpp @@ -52,7 +52,7 @@ void DesktopSettingsWidget::apply_settings() auto& desktop = GUI::Desktop::the(); if (workspace_rows != desktop.workspace_rows() || workspace_columns != desktop.workspace_columns()) { if (!GUI::ConnectionToWindowServer::the().apply_workspace_settings(workspace_rows, workspace_columns, true)) { - GUI::MessageBox::show(window(), String::formatted("Error applying workspace settings"), + GUI::MessageBox::show(window(), DeprecatedString::formatted("Error applying workspace settings"), "Workspace settings"sv, GUI::MessageBox::Type::Error); } } diff --git a/Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp b/Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp index e69e8130651..f62ce4bbbe4 100644 --- a/Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/EffectsSettingsWidget.cpp @@ -120,7 +120,7 @@ ErrorOr EffectsSettingsWidget::load_settings() }; for (size_t i = 0; i < list.size(); ++i) TRY(m_geometry_list.try_append(list[i])); - m_geometry_combobox->set_model(ItemListModel::create(m_geometry_list)); + m_geometry_combobox->set_model(ItemListModel::create(m_geometry_list)); m_geometry_combobox->set_selected_index(m_system_effects.geometry()); return {}; diff --git a/Userland/Applications/DisplaySettings/EffectsSettingsWidget.h b/Userland/Applications/DisplaySettings/EffectsSettingsWidget.h index b3a822c071a..ef941f3b3f7 100644 --- a/Userland/Applications/DisplaySettings/EffectsSettingsWidget.h +++ b/Userland/Applications/DisplaySettings/EffectsSettingsWidget.h @@ -27,7 +27,7 @@ private: ErrorOr load_settings(); SystemEffects m_system_effects; - Vector m_geometry_list; + Vector m_geometry_list; RefPtr m_geometry_combobox; }; diff --git a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp index 613a5d4d4c1..c1639b9bbd2 100644 --- a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.cpp @@ -65,7 +65,7 @@ void MonitorSettingsWidget::create_resolution_list() i32 aspect_width = resolution.width() / gcf; i32 aspect_height = resolution.height() / gcf; - m_resolution_strings.append(String::formatted("{}x{} ({}:{})", resolution.width(), resolution.height(), aspect_width, aspect_height)); + m_resolution_strings.append(DeprecatedString::formatted("{}x{} ({}:{})", resolution.width(), resolution.height(), aspect_width, aspect_height)); } } @@ -77,7 +77,7 @@ void MonitorSettingsWidget::create_frame() m_screen_combo = *find_descendant_of_type_named("screen_combo"); m_screen_combo->set_only_allow_values_from_model(true); - m_screen_combo->set_model(*GUI::ItemListModel::create(m_screens)); + m_screen_combo->set_model(*GUI::ItemListModel::create(m_screens)); m_screen_combo->on_change = [this](auto&, const GUI::ModelIndex& index) { m_selected_screen_index = index.row(); selected_screen_index_or_resolution_changed(); @@ -85,7 +85,7 @@ void MonitorSettingsWidget::create_frame() m_resolution_combo = *find_descendant_of_type_named("resolution_combo"); m_resolution_combo->set_only_allow_values_from_model(true); - m_resolution_combo->set_model(*GUI::ItemListModel::create(m_resolution_strings)); + m_resolution_combo->set_model(*GUI::ItemListModel::create(m_resolution_strings)); m_resolution_combo->on_change = [this](auto&, const GUI::ModelIndex& index) { auto& selected_screen = m_screen_layout.screens[m_selected_screen_index]; selected_screen.resolution = m_resolutions.at(index.row()); @@ -123,7 +123,7 @@ void MonitorSettingsWidget::create_frame() m_dpi_label = *find_descendant_of_type_named("display_dpi"); } -static String display_name_from_edid(EDID::Parser const& edid) +static DeprecatedString display_name_from_edid(EDID::Parser const& edid) { auto manufacturer_name = edid.manufacturer_name(); auto product_name = edid.display_product_name(); @@ -131,12 +131,12 @@ static String display_name_from_edid(EDID::Parser const& edid) auto build_manufacturer_product_name = [&]() { if (product_name.is_null() || product_name.is_empty()) return manufacturer_name; - return String::formatted("{} {}", manufacturer_name, product_name); + return DeprecatedString::formatted("{} {}", manufacturer_name, product_name); }; if (auto screen_size = edid.screen_size(); screen_size.has_value()) { auto diagonal_inch = hypot(screen_size.value().horizontal_cm(), screen_size.value().vertical_cm()) / 2.54; - return String::formatted("{} {}\"", build_manufacturer_product_name(), roundf(diagonal_inch)); + return DeprecatedString::formatted("{} {}\"", build_manufacturer_product_name(), roundf(diagonal_inch)); } return build_manufacturer_product_name(); @@ -151,7 +151,7 @@ void MonitorSettingsWidget::load_current_settings() size_t virtual_screen_count = 0; for (size_t i = 0; i < m_screen_layout.screens.size(); i++) { - String screen_display_name; + DeprecatedString screen_display_name; if (m_screen_layout.screens[i].mode == WindowServer::ScreenLayout::Screen::Mode::Device) { if (auto edid = EDID::Parser::from_display_connector_device(m_screen_layout.screens[i].device.value()); !edid.is_error()) { // TODO: multihead screen_display_name = display_name_from_edid(edid.value()); @@ -163,13 +163,13 @@ void MonitorSettingsWidget::load_current_settings() } } else { dbgln("Frame buffer {} is virtual.", i); - screen_display_name = String::formatted("Virtual screen {}", virtual_screen_count++); + screen_display_name = DeprecatedString::formatted("Virtual screen {}", virtual_screen_count++); m_screen_edids.append({}); } if (i == m_screen_layout.main_screen_index) - m_screens.append(String::formatted("{}: {} (main screen)", i + 1, screen_display_name)); + m_screens.append(DeprecatedString::formatted("{}: {} (main screen)", i + 1, screen_display_name)); else - m_screens.append(String::formatted("{}: {}", i + 1, screen_display_name)); + m_screens.append(DeprecatedString::formatted("{}: {}", i + 1, screen_display_name)); } m_selected_screen_index = m_screen_layout.main_screen_index; m_screen_combo->set_selected_index(m_selected_screen_index); @@ -185,7 +185,7 @@ void MonitorSettingsWidget::selected_screen_index_or_resolution_changed() Gfx::IntSize current_resolution = m_resolutions.at(index); Optional screen_dpi; - String screen_dpi_tooltip; + DeprecatedString screen_dpi_tooltip; if (m_screen_edids[m_selected_screen_index].has_value()) { auto& edid = m_screen_edids[m_selected_screen_index]; if (auto screen_size = edid.value().screen_size(); screen_size.has_value()) { @@ -195,14 +195,14 @@ void MonitorSettingsWidget::selected_screen_index_or_resolution_changed() auto diagonal_pixels = hypot(current_resolution.width(), current_resolution.height()); if (diagonal_pixels != 0.0) { screen_dpi = diagonal_pixels / diagonal_inch; - screen_dpi_tooltip = String::formatted("{} inch display ({}cm x {}cm)", roundf(diagonal_inch), x_cm, y_cm); + screen_dpi_tooltip = DeprecatedString::formatted("{} inch display ({}cm x {}cm)", roundf(diagonal_inch), x_cm, y_cm); } } } if (screen_dpi.has_value()) { m_dpi_label->set_tooltip(screen_dpi_tooltip); - m_dpi_label->set_text(String::formatted("{} dpi", screen_dpi.value())); + m_dpi_label->set_text(DeprecatedString::formatted("{} dpi", screen_dpi.value())); m_dpi_label->set_visible(true); } else { m_dpi_label->set_visible(false); @@ -235,7 +235,7 @@ void MonitorSettingsWidget::apply_settings() auto seconds_until_revert = 10; auto box_text = [&seconds_until_revert] { - return String::formatted("Do you want to keep the new settings? They will be reverted after {} {}.", + return DeprecatedString::formatted("Do you want to keep the new settings? They will be reverted after {} {}.", seconds_until_revert, seconds_until_revert == 1 ? "second" : "seconds"); }; @@ -257,20 +257,20 @@ void MonitorSettingsWidget::apply_settings() if (box->exec() == GUI::MessageBox::ExecResult::Yes) { auto save_result = GUI::ConnectionToWindowServer::the().save_screen_layout(); if (!save_result.success()) { - GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()), + GUI::MessageBox::show(window(), DeprecatedString::formatted("Error saving settings: {}", save_result.error_msg()), "Unable to save setting"sv, GUI::MessageBox::Type::Error); } } else { auto restore_result = GUI::ConnectionToWindowServer::the().set_screen_layout(current_layout, false); if (!restore_result.success()) { - GUI::MessageBox::show(window(), String::formatted("Error restoring settings: {}", restore_result.error_msg()), + GUI::MessageBox::show(window(), DeprecatedString::formatted("Error restoring settings: {}", restore_result.error_msg()), "Unable to restore setting"sv, GUI::MessageBox::Type::Error); } else { load_current_settings(); } } } else { - GUI::MessageBox::show(window(), String::formatted("Error setting screen layout: {}", result.error_msg()), + GUI::MessageBox::show(window(), DeprecatedString::formatted("Error setting screen layout: {}", result.error_msg()), "Unable to apply changes"sv, GUI::MessageBox::Type::Error); } } diff --git a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.h b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.h index 39f8e4fb40f..f0c2ff73b33 100644 --- a/Userland/Applications/DisplaySettings/MonitorSettingsWidget.h +++ b/Userland/Applications/DisplaySettings/MonitorSettingsWidget.h @@ -45,10 +45,10 @@ private: size_t m_selected_screen_index { 0 }; WindowServer::ScreenLayout m_screen_layout; - Vector m_screens; + Vector m_screens; Vector> m_screen_edids; Vector m_resolutions; - Vector m_resolution_strings; + Vector m_resolution_strings; RefPtr m_monitor_widget; RefPtr m_screen_combo; diff --git a/Userland/Applications/DisplaySettings/MonitorWidget.cpp b/Userland/Applications/DisplaySettings/MonitorWidget.cpp index a9fe4a16ead..692a95f430a 100644 --- a/Userland/Applications/DisplaySettings/MonitorWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorWidget.cpp @@ -25,7 +25,7 @@ MonitorWidget::MonitorWidget() set_fixed_size(304, 201); } -bool MonitorWidget::set_wallpaper(String path) +bool MonitorWidget::set_wallpaper(DeprecatedString path) { if (!is_different_to_current_wallpaper_path(path)) return false; @@ -63,7 +63,7 @@ StringView MonitorWidget::wallpaper() const return m_desktop_wallpaper_path; } -void MonitorWidget::set_wallpaper_mode(String mode) +void MonitorWidget::set_wallpaper_mode(DeprecatedString mode) { if (m_desktop_wallpaper_mode == mode) return; diff --git a/Userland/Applications/DisplaySettings/MonitorWidget.h b/Userland/Applications/DisplaySettings/MonitorWidget.h index 16bbd34c3ad..e5a3fa59e33 100644 --- a/Userland/Applications/DisplaySettings/MonitorWidget.h +++ b/Userland/Applications/DisplaySettings/MonitorWidget.h @@ -14,10 +14,10 @@ class MonitorWidget final : public GUI::Widget { C_OBJECT(MonitorWidget); public: - bool set_wallpaper(String path); + bool set_wallpaper(DeprecatedString path); StringView wallpaper() const; - void set_wallpaper_mode(String mode); + void set_wallpaper_mode(DeprecatedString mode); StringView wallpaper_mode() const; RefPtr wallpaper_bitmap() const { return m_wallpaper_bitmap; } @@ -43,14 +43,14 @@ private: RefPtr m_desktop_bitmap; bool m_desktop_dirty { true }; - String m_desktop_wallpaper_path; + DeprecatedString m_desktop_wallpaper_path; RefPtr m_wallpaper_bitmap; - String m_desktop_wallpaper_mode; + DeprecatedString m_desktop_wallpaper_mode; Gfx::IntSize m_desktop_resolution; int m_desktop_scale_factor { 1 }; Gfx::Color m_desktop_color; - bool is_different_to_current_wallpaper_path(String const& path) + bool is_different_to_current_wallpaper_path(DeprecatedString const& path) { return (!path.is_empty() && path != m_desktop_wallpaper_path) || (path.is_empty() && m_desktop_wallpaper_path != nullptr); } diff --git a/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp b/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp index d4593abad84..8635ba5de45 100644 --- a/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp +++ b/Userland/Applications/DisplaySettings/ThemePreviewWidget.cpp @@ -19,7 +19,7 @@ ThemePreviewWidget::ThemePreviewWidget(Gfx::Palette const& palette) set_fixed_size(304, 201); } -void ThemePreviewWidget::set_theme(String path) +void ThemePreviewWidget::set_theme(DeprecatedString path) { set_theme_from_file(*Core::File::open(path, Core::OpenMode::ReadOnly).release_value_but_fixme_should_propagate_errors()); } diff --git a/Userland/Applications/DisplaySettings/ThemePreviewWidget.h b/Userland/Applications/DisplaySettings/ThemePreviewWidget.h index 370db193397..f4abd130bf6 100644 --- a/Userland/Applications/DisplaySettings/ThemePreviewWidget.h +++ b/Userland/Applications/DisplaySettings/ThemePreviewWidget.h @@ -18,7 +18,7 @@ class ThemePreviewWidget final : public GUI::AbstractThemePreview { C_OBJECT(ThemePreviewWidget); public: - void set_theme(String path); + void set_theme(DeprecatedString path); private: explicit ThemePreviewWidget(Gfx::Palette const& palette); diff --git a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp index ee3fd1e2c24..5f53b7d16c4 100644 --- a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp +++ b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.cpp @@ -36,7 +36,7 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed) m_theme_preview = find_descendant_of_type_named("preview_frame")->add(palette()); m_themes_combo = *find_descendant_of_type_named("themes_combo"); m_themes_combo->set_only_allow_values_from_model(true); - m_themes_combo->set_model(*GUI::ItemListModel::create(m_theme_names)); + m_themes_combo->set_model(*GUI::ItemListModel::create(m_theme_names)); m_themes_combo->on_change = [this](auto&, const GUI::ModelIndex& index) { m_selected_theme = &m_themes.at(index.row()); m_theme_preview->set_theme(m_selected_theme->path); diff --git a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.h b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.h index 654e8a9fb91..3ec7a9fb28b 100644 --- a/Userland/Applications/DisplaySettings/ThemesSettingsWidget.h +++ b/Userland/Applications/DisplaySettings/ThemesSettingsWidget.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include @@ -24,7 +24,7 @@ public: private: Vector m_themes; - Vector m_theme_names; + Vector m_theme_names; RefPtr m_themes_combo; RefPtr m_theme_preview; diff --git a/Userland/Applications/Escalator/EscalatorWindow.cpp b/Userland/Applications/Escalator/EscalatorWindow.cpp index 9b2927fe63c..82645a79310 100644 --- a/Userland/Applications/Escalator/EscalatorWindow.cpp +++ b/Userland/Applications/Escalator/EscalatorWindow.cpp @@ -36,9 +36,9 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector argum RefPtr app_label = *main_widget.find_descendant_of_type_named("description"); - String prompt; + DeprecatedString prompt; if (options.description.is_empty()) - prompt = String::formatted("{} requires root access. Please enter password for user \"{}\".", m_arguments[0], m_current_user.username()); + prompt = DeprecatedString::formatted("{} requires root access. Please enter password for user \"{}\".", m_arguments[0], m_current_user.username()); else prompt = options.description; @@ -51,7 +51,7 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector argum m_ok_button->on_click = [this](auto) { auto result = check_password(); if (result.is_error()) { - GUI::MessageBox::show_error(this, String::formatted("Failed to execute command: {}", result.error())); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("Failed to execute command: {}", result.error())); close(); } }; @@ -67,7 +67,7 @@ EscalatorWindow::EscalatorWindow(StringView executable, Vector argum ErrorOr EscalatorWindow::check_password() { - String password = m_password_input->text(); + DeprecatedString password = m_password_input->text(); if (password.is_empty()) { GUI::MessageBox::show_error(this, "Please enter a password."sv); return {}; diff --git a/Userland/Applications/Escalator/EscalatorWindow.h b/Userland/Applications/Escalator/EscalatorWindow.h index 21c51e7cc53..fa3f297528e 100644 --- a/Userland/Applications/Escalator/EscalatorWindow.h +++ b/Userland/Applications/Escalator/EscalatorWindow.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include diff --git a/Userland/Applications/Escalator/main.cpp b/Userland/Applications/Escalator/main.cpp index 0570487e677..c84b1eb9f7e 100644 --- a/Userland/Applications/Escalator/main.cpp +++ b/Userland/Applications/Escalator/main.cpp @@ -6,7 +6,7 @@ */ #include "EscalatorWindow.h" -#include +#include #include #include #include @@ -35,7 +35,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto executable_path = Core::File::resolve_executable_from_environment(command[0]); if (!executable_path.has_value()) { - GUI::MessageBox::show_error(nullptr, String::formatted("Could not execute command {}: Command not found.", command[0])); + GUI::MessageBox::show_error(nullptr, DeprecatedString::formatted("Could not execute command {}: Command not found.", command[0])); return 127; } diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 832b36f7132..a4ed76d6495 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -27,7 +27,7 @@ namespace FileManager { -void spawn_terminal(String const& directory) +void spawn_terminal(DeprecatedString const& directory) { posix_spawn_file_actions_t spawn_actions; posix_spawn_file_actions_init(&spawn_actions); @@ -86,7 +86,7 @@ NonnullRefPtrVector DirectoryView::get_launch_handlers(URL cons return handlers; } -NonnullRefPtrVector DirectoryView::get_launch_handlers(String const& path) +NonnullRefPtrVector DirectoryView::get_launch_handlers(DeprecatedString const& path) { return get_launch_handlers(URL::create_with_file_scheme(path)); } @@ -120,11 +120,11 @@ void DirectoryView::handle_activation(GUI::ModelIndex const& index) if (default_launcher) { auto launch_origin_rect = current_view().to_widget_rect(current_view().content_rect(index)).translated(current_view().screen_relative_rect().location()); - setenv("__libgui_launch_origin_rect", String::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1); + setenv("__libgui_launch_origin_rect", DeprecatedString::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1); launch(url, *default_launcher); unsetenv("__libgui_launch_origin_rect"); } else { - auto error_message = String::formatted("Could not open {}", path); + auto error_message = DeprecatedString::formatted("Could not open {}", path); GUI::MessageBox::show(window(), error_message, "File Manager"sv, GUI::MessageBox::Type::Error); } } @@ -162,7 +162,7 @@ void DirectoryView::setup_model() { m_model->on_directory_change_error = [this](int, char const* error_string) { auto failed_path = m_model->root_path(); - auto error_message = String::formatted("Could not read {}:\n{}", failed_path, error_string); + auto error_message = DeprecatedString::formatted("Could not read {}:\n{}", failed_path, error_string); m_error_label->set_text(error_message); set_active_widget(m_error_label); @@ -176,7 +176,7 @@ void DirectoryView::setup_model() }; m_model->on_rename_error = [this](int, char const* error_string) { - GUI::MessageBox::show_error(window(), String::formatted("Unable to rename file: {}", error_string)); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Unable to rename file: {}", error_string)); }; m_model->on_complete = [this] { @@ -340,7 +340,7 @@ void DirectoryView::model_did_update(unsigned flags) update_statusbar(); } -void DirectoryView::set_view_mode_from_string(String const& mode) +void DirectoryView::set_view_mode_from_string(DeprecatedString const& mode) { if (m_mode == Mode::Desktop) return; @@ -357,7 +357,7 @@ void DirectoryView::set_view_mode_from_string(String const& mode) } } -void DirectoryView::config_string_did_change(String const& domain, String const& group, String const& key, String const& value) +void DirectoryView::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) { if (domain != "FileManager" || group != "DirectoryView") return; @@ -389,7 +389,7 @@ void DirectoryView::set_view_mode(ViewMode mode) VERIFY_NOT_REACHED(); } -void DirectoryView::add_path_to_history(String path) +void DirectoryView::add_path_to_history(DeprecatedString path) { if (m_path_history.size() && m_path_history.at(m_path_history_position) == path) return; @@ -401,7 +401,7 @@ void DirectoryView::add_path_to_history(String path) m_path_history_position = m_path_history.size() - 1; } -bool DirectoryView::open(String const& path) +bool DirectoryView::open(DeprecatedString const& path) { auto real_path = Core::File::real_path_for(path); if (real_path.is_null() || !Core::File::is_directory(path)) @@ -525,9 +525,9 @@ void DirectoryView::launch(URL const&, LauncherHandler const& launcher_handler) } } -Vector DirectoryView::selected_file_paths() const +Vector DirectoryView::selected_file_paths() const { - Vector paths; + Vector paths; auto& view = current_view(); auto& model = *view.model(); view.selection().for_each_index([&](GUI::ModelIndex const& index) { @@ -567,36 +567,36 @@ void DirectoryView::handle_selection_change() void DirectoryView::setup_actions() { m_mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { - String value; + DeprecatedString value; if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New directory"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) { - auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value)); + auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value)); int rc = mkdir(new_dir_path.characters(), 0777); if (rc < 0) { auto saved_errno = errno; - GUI::MessageBox::show(window(), String::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("mkdir(\"{}\") failed: {}", new_dir_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); } } }); m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { - String value; + DeprecatedString value; if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New file"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) { - auto new_file_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", path(), value)); + auto new_file_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value)); struct stat st; int rc = stat(new_file_path.characters(), &st); if ((rc < 0 && errno != ENOENT)) { auto saved_errno = errno; - GUI::MessageBox::show(window(), String::formatted("stat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("stat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); return; } if (rc == 0) { - GUI::MessageBox::show(window(), String::formatted("{}: Already exists", new_file_path), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("{}: Already exists", new_file_path), "Error"sv, GUI::MessageBox::Type::Error); return; } int fd = creat(new_file_path.characters(), 0666); if (fd < 0) { auto saved_errno = errno; - GUI::MessageBox::show(window(), String::formatted("creat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("creat(\"{}\") failed: {}", new_file_path, strerror(saved_errno)), "Error"sv, GUI::MessageBox::Type::Error); return; } rc = close(fd); @@ -663,11 +663,11 @@ void DirectoryView::handle_drop(GUI::ModelIndex const& index, GUI::DropEvent con return; bool had_accepted_drop = false; - Vector paths_to_copy; + Vector paths_to_copy; for (auto& url_to_copy : urls) { if (!url_to_copy.is_valid() || url_to_copy.path() == target_node.full_path()) continue; - auto new_path = String::formatted("{}/{}", target_node.full_path(), LexicalPath::basename(url_to_copy.path())); + auto new_path = DeprecatedString::formatted("{}/{}", target_node.full_path(), LexicalPath::basename(url_to_copy.path())); if (url_to_copy.path() == new_path) continue; diff --git a/Userland/Applications/FileManager/DirectoryView.h b/Userland/Applications/FileManager/DirectoryView.h index 5570ecaee34..8f1a0070ec7 100644 --- a/Userland/Applications/FileManager/DirectoryView.h +++ b/Userland/Applications/FileManager/DirectoryView.h @@ -21,7 +21,7 @@ namespace FileManager { -void spawn_terminal(String const& directory); +void spawn_terminal(DeprecatedString const& directory); class LauncherHandler : public RefCounted { public: @@ -51,8 +51,8 @@ public: virtual ~DirectoryView() override; - bool open(String const& path); - String path() const { return model().root_path(); } + bool open(DeprecatedString const& path); + DeprecatedString path() const { return model().root_path(); } void open_parent_directory(); void open_previous_directory(); void open_next_directory(); @@ -60,7 +60,7 @@ public: int path_history_position() const { return m_path_history_position; } static RefPtr get_default_launch_handler(NonnullRefPtrVector const& handlers); static NonnullRefPtrVector get_launch_handlers(URL const& url); - static NonnullRefPtrVector get_launch_handlers(String const& path); + static NonnullRefPtrVector get_launch_handlers(DeprecatedString const& path); void refresh(); @@ -82,7 +82,7 @@ public: void set_view_mode(ViewMode); ViewMode view_mode() const { return m_view_mode; } - void set_view_mode_from_string(String const&); + void set_view_mode_from_string(DeprecatedString const&); GUI::AbstractView& current_view() { @@ -120,7 +120,7 @@ public: bool is_desktop() const { return m_mode == Mode::Desktop; } - Vector selected_file_paths() const; + Vector selected_file_paths() const; GUI::Action& mkdir_action() { return *m_mkdir_action; } GUI::Action& touch_action() { return *m_touch_action; } @@ -133,7 +133,7 @@ public: GUI::Action& view_as_columns_action() { return *m_view_as_columns_action; } // ^Config::Listener - virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override; + virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override; private: explicit DirectoryView(Mode); @@ -166,8 +166,8 @@ private: NonnullRefPtr m_model; NonnullRefPtr m_sorting_model; size_t m_path_history_position { 0 }; - Vector m_path_history; - void add_path_to_history(String); + Vector m_path_history; + void add_path_to_history(DeprecatedString); RefPtr m_error_label; diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp index 2ecbe804453..997a4191af4 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp @@ -129,11 +129,11 @@ void FileOperationProgressWidget::did_error(StringView message) { // FIXME: Communicate more with the user about errors. close_pipe(); - GUI::MessageBox::show(window(), String::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK); + GUI::MessageBox::show(window(), DeprecatedString::formatted("An error occurred: {}", message), "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK); window()->close(); } -String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count) +DeprecatedString FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_byte_count) { int elapsed = m_elapsed_timer.elapsed() / 1000; @@ -144,7 +144,7 @@ String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_ int seconds_remaining = (bytes_left * elapsed) / bytes_done; if (seconds_remaining < 30) - return String::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5); + return DeprecatedString::formatted("{} seconds", 5 + seconds_remaining - seconds_remaining % 5); if (seconds_remaining < 60) return "About a minute"; if (seconds_remaining < 90) @@ -157,14 +157,14 @@ String FileOperationProgressWidget::estimate_time(off_t bytes_done, off_t total_ if (minutes_remaining < 60) { if (seconds_remaining < 30) - return String::formatted("About {} minutes", minutes_remaining); - return String::formatted("Over {} minutes", minutes_remaining); + return DeprecatedString::formatted("About {} minutes", minutes_remaining); + return DeprecatedString::formatted("Over {} minutes", minutes_remaining); } time_t hours_remaining = minutes_remaining / 60; minutes_remaining %= 60; - return String::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining); + return DeprecatedString::formatted("{} hours and {} minutes", hours_remaining, minutes_remaining); } void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, [[maybe_unused]] off_t current_file_done, [[maybe_unused]] off_t current_file_size, StringView current_filename) @@ -178,13 +178,13 @@ void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byt switch (m_operation) { case FileOperation::Copy: - files_copied_label.set_text(String::formatted("Copying file {} of {}", files_done, total_file_count)); + files_copied_label.set_text(DeprecatedString::formatted("Copying file {} of {}", files_done, total_file_count)); break; case FileOperation::Move: - files_copied_label.set_text(String::formatted("Moving file {} of {}", files_done, total_file_count)); + files_copied_label.set_text(DeprecatedString::formatted("Moving file {} of {}", files_done, total_file_count)); break; case FileOperation::Delete: - files_copied_label.set_text(String::formatted("Deleting file {} of {}", files_done, total_file_count)); + files_copied_label.set_text(DeprecatedString::formatted("Deleting file {} of {}", files_done, total_file_count)); break; default: VERIFY_NOT_REACHED(); diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.h b/Userland/Applications/FileManager/FileOperationProgressWidget.h index 1706a8307bc..1fc7366f5e4 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.h +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.h @@ -29,7 +29,7 @@ private: void close_pipe(); - String estimate_time(off_t bytes_done, off_t total_byte_count); + DeprecatedString estimate_time(off_t bytes_done, off_t total_byte_count); Core::ElapsedTimer m_elapsed_timer; FileOperation m_operation; diff --git a/Userland/Applications/FileManager/FileUtils.cpp b/Userland/Applications/FileManager/FileUtils.cpp index f74fc80a0e4..5a853980e2f 100644 --- a/Userland/Applications/FileManager/FileUtils.cpp +++ b/Userland/Applications/FileManager/FileUtils.cpp @@ -17,13 +17,13 @@ namespace FileManager { HashTable> file_operation_windows; -void delete_paths(Vector const& paths, bool should_confirm, GUI::Window* parent_window) +void delete_paths(Vector const& paths, bool should_confirm, GUI::Window* parent_window) { - String message; + DeprecatedString message; if (paths.size() == 1) { - message = String::formatted("Are you sure you want to delete {}?", LexicalPath::basename(paths[0])); + message = DeprecatedString::formatted("Are you sure you want to delete {}?", LexicalPath::basename(paths[0])); } else { - message = String::formatted("Are you sure you want to delete {} files?", paths.size()); + message = DeprecatedString::formatted("Are you sure you want to delete {} files?", paths.size()); } if (should_confirm) { @@ -40,7 +40,7 @@ void delete_paths(Vector const& paths, bool should_confirm, GUI::Window* _exit(1); } -ErrorOr run_file_operation(FileOperation operation, Vector const& sources, String const& destination, GUI::Window* parent_window) +ErrorOr run_file_operation(FileOperation operation, Vector const& sources, DeprecatedString const& destination, GUI::Window* parent_window) { auto pipe_fds = TRY(Core::System::pipe2(0)); diff --git a/Userland/Applications/FileManager/FileUtils.h b/Userland/Applications/FileManager/FileUtils.h index 1355837c874..5f856525d56 100644 --- a/Userland/Applications/FileManager/FileUtils.h +++ b/Userland/Applications/FileManager/FileUtils.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -19,7 +19,7 @@ enum class FileOperation { Delete, }; -void delete_paths(Vector const&, bool should_confirm, GUI::Window*); +void delete_paths(Vector const&, bool should_confirm, GUI::Window*); -ErrorOr run_file_operation(FileOperation, Vector const& sources, String const& destination, GUI::Window*); +ErrorOr run_file_operation(FileOperation, Vector const& sources, DeprecatedString const& destination, GUI::Window*); } diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp index a8cfe13ff75..93ed82b47c0 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.cpp +++ b/Userland/Applications/FileManager/PropertiesWindow.cpp @@ -26,7 +26,7 @@ #include #include -PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Window* parent_window) +PropertiesWindow::PropertiesWindow(DeprecatedString const& path, bool disable_rename, Window* parent_window) : Window(parent_window) { auto lexical_path = LexicalPath(path); @@ -67,8 +67,8 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind return; } - String owner_name; - String group_name; + DeprecatedString owner_name; + DeprecatedString group_name; if (auto* pw = getpwuid(st.st_uid)) { owner_name = pw->pw_name; @@ -116,10 +116,10 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind size->set_text(human_readable_size_long(st.st_size)); auto owner = general_tab.find_descendant_of_type_named("owner"); - owner->set_text(String::formatted("{} ({})", owner_name, st.st_uid)); + owner->set_text(DeprecatedString::formatted("{} ({})", owner_name, st.st_uid)); auto group = general_tab.find_descendant_of_type_named("group"); - group->set_text(String::formatted("{} ({})", group_name, st.st_gid)); + group->set_text(DeprecatedString::formatted("{} ({})", group_name, st.st_gid)); auto created_at = general_tab.find_descendant_of_type_named("created_at"); created_at->set_text(GUI::FileSystemModel::timestamp_string(st.st_ctime)); @@ -167,7 +167,7 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind void PropertiesWindow::update() { m_icon->set_bitmap(GUI::FileIconProvider::icon_for_path(make_full_path(m_name), m_mode).bitmap_for_size(32)); - set_title(String::formatted("{} - Properties", m_name)); + set_title(DeprecatedString::formatted("{} - Properties", m_name)); } void PropertiesWindow::permission_changed(mode_t mask, bool set) @@ -182,24 +182,24 @@ void PropertiesWindow::permission_changed(mode_t mask, bool set) m_apply_button->set_enabled(m_name_dirty || m_permissions_dirty); } -String PropertiesWindow::make_full_path(String const& name) +DeprecatedString PropertiesWindow::make_full_path(DeprecatedString const& name) { - return String::formatted("{}/{}", m_parent_path, name); + return DeprecatedString::formatted("{}/{}", m_parent_path, name); } bool PropertiesWindow::apply_changes() { if (m_name_dirty) { - String new_name = m_name_box->text(); - String new_file = make_full_path(new_name).characters(); + DeprecatedString new_name = m_name_box->text(); + DeprecatedString new_file = make_full_path(new_name).characters(); if (Core::File::exists(new_file)) { - GUI::MessageBox::show(this, String::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(this, DeprecatedString::formatted("A file \"{}\" already exists!", new_name), "Error"sv, GUI::MessageBox::Type::Error); return false; } if (rename(make_full_path(m_name).characters(), new_file.characters())) { - GUI::MessageBox::show(this, String::formatted("Could not rename file: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(this, DeprecatedString::formatted("Could not rename file: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); return false; } @@ -210,7 +210,7 @@ bool PropertiesWindow::apply_changes() if (m_permissions_dirty) { if (chmod(make_full_path(m_name).characters(), m_mode)) { - GUI::MessageBox::show(this, String::formatted("Could not update permissions: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(this, DeprecatedString::formatted("Could not update permissions: {}!", strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); return false; } @@ -249,7 +249,7 @@ void PropertiesWindow::setup_permission_checkboxes(GUI::CheckBox& box_read, GUI: box_execute.set_enabled(can_edit_checkboxes); } -GUI::Button& PropertiesWindow::make_button(String text, GUI::Widget& parent) +GUI::Button& PropertiesWindow::make_button(DeprecatedString text, GUI::Widget& parent) { auto& button = parent.add(text); button.set_fixed_size(70, 22); diff --git a/Userland/Applications/FileManager/PropertiesWindow.h b/Userland/Applications/FileManager/PropertiesWindow.h index c1150a8debd..82b89811a1c 100644 --- a/Userland/Applications/FileManager/PropertiesWindow.h +++ b/Userland/Applications/FileManager/PropertiesWindow.h @@ -22,11 +22,11 @@ public: virtual ~PropertiesWindow() override = default; private: - PropertiesWindow(String const& path, bool disable_rename, Window* parent = nullptr); + PropertiesWindow(DeprecatedString const& path, bool disable_rename, Window* parent = nullptr); struct PropertyValuePair { - String property; - String value; + DeprecatedString property; + DeprecatedString value; Optional link = {}; }; @@ -36,7 +36,7 @@ private: mode_t execute; }; - static String const get_description(mode_t const mode) + static DeprecatedString const get_description(mode_t const mode) { if (S_ISREG(mode)) return "File"; @@ -58,19 +58,19 @@ private: return "Unknown"; } - GUI::Button& make_button(String, GUI::Widget& parent); + GUI::Button& make_button(DeprecatedString, GUI::Widget& parent); void setup_permission_checkboxes(GUI::CheckBox& box_read, GUI::CheckBox& box_write, GUI::CheckBox& box_execute, PermissionMasks masks, mode_t mode); void permission_changed(mode_t mask, bool set); bool apply_changes(); void update(); - String make_full_path(String const& name); + DeprecatedString make_full_path(DeprecatedString const& name); RefPtr m_apply_button; RefPtr m_name_box; RefPtr m_icon; - String m_name; - String m_parent_path; - String m_path; + DeprecatedString m_name; + DeprecatedString m_parent_path; + DeprecatedString m_path; mode_t m_mode { 0 }; mode_t m_old_mode { 0 }; bool m_permissions_dirty { false }; diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp index 85a9a4928a3..db2b22c36ea 100644 --- a/Userland/Applications/FileManager/main.cpp +++ b/Userland/Applications/FileManager/main.cpp @@ -56,15 +56,15 @@ using namespace FileManager; static ErrorOr run_in_desktop_mode(); -static ErrorOr run_in_windowed_mode(String const& initial_location, String const& entry_focused_on_init); -static void do_copy(Vector const& selected_file_paths, FileOperation file_operation); -static void do_paste(String const& target_directory, GUI::Window* window); -static void do_create_link(Vector const& selected_file_paths, GUI::Window* window); -static void do_create_archive(Vector const& selected_file_paths, GUI::Window* window); -static void do_set_wallpaper(String const& file_path, GUI::Window* window); -static void do_unzip_archive(Vector const& selected_file_paths, GUI::Window* window); -static void show_properties(String const& container_dir_path, String const& path, Vector const& selected, GUI::Window* window); -static bool add_launch_handler_actions_to_menu(RefPtr& menu, DirectoryView const& directory_view, String const& full_path, RefPtr& default_action, NonnullRefPtrVector& current_file_launch_handlers); +static ErrorOr run_in_windowed_mode(DeprecatedString const& initial_location, DeprecatedString const& entry_focused_on_init); +static void do_copy(Vector const& selected_file_paths, FileOperation file_operation); +static void do_paste(DeprecatedString const& target_directory, GUI::Window* window); +static void do_create_link(Vector const& selected_file_paths, GUI::Window* window); +static void do_create_archive(Vector const& selected_file_paths, GUI::Window* window); +static void do_set_wallpaper(DeprecatedString const& file_path, GUI::Window* window); +static void do_unzip_archive(Vector const& selected_file_paths, GUI::Window* window); +static void show_properties(DeprecatedString const& container_dir_path, DeprecatedString const& path, Vector const& selected, GUI::Window* window); +static bool add_launch_handler_actions_to_menu(RefPtr& menu, DirectoryView const& directory_view, DeprecatedString const& full_path, RefPtr& default_action, NonnullRefPtrVector& current_file_launch_handlers); ErrorOr serenity_main(Main::Arguments arguments) { @@ -79,7 +79,7 @@ ErrorOr serenity_main(Main::Arguments arguments) bool is_desktop_mode { false }; bool is_selection_mode { false }; bool ignore_path_resolution { false }; - String initial_location; + DeprecatedString initial_location; args_parser.add_option(is_desktop_mode, "Run in desktop mode", "desktop", 'd'); args_parser.add_option(is_selection_mode, "Show entry in parent folder", "select", 's'); args_parser.add_option(ignore_path_resolution, "Use raw path, do not resolve real path", "raw", 'r'); @@ -120,7 +120,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (initial_location.is_empty()) initial_location = "/"; - String focused_entry; + DeprecatedString focused_entry; if (is_selection_mode) { LexicalPath path(initial_location); initial_location = path.dirname(); @@ -130,7 +130,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return run_in_windowed_mode(initial_location, focused_entry); } -void do_copy(Vector const& selected_file_paths, FileOperation file_operation) +void do_copy(Vector const& selected_file_paths, FileOperation file_operation) { VERIFY(!selected_file_paths.is_empty()); @@ -145,14 +145,14 @@ void do_copy(Vector const& selected_file_paths, FileOperation file_opera GUI::Clipboard::the().set_data(copy_text.build().bytes(), "text/uri-list"); } -void do_paste(String const& target_directory, GUI::Window* window) +void do_paste(DeprecatedString const& target_directory, GUI::Window* window) { auto data_and_type = GUI::Clipboard::the().fetch_data_and_type(); if (data_and_type.mime_type != "text/uri-list") { dbgln("Cannot paste clipboard type {}", data_and_type.mime_type); return; } - auto copied_lines = String::copy(data_and_type.data).split('\n'); + auto copied_lines = DeprecatedString::copy(data_and_type.data).split('\n'); if (copied_lines.is_empty()) { dbgln("No files to paste"); return; @@ -164,7 +164,7 @@ void do_paste(String const& target_directory, GUI::Window* window) copied_lines.remove(0); } - Vector source_paths; + Vector source_paths; for (auto& uri_as_string : copied_lines) { if (uri_as_string.is_empty()) continue; @@ -182,19 +182,19 @@ void do_paste(String const& target_directory, GUI::Window* window) } } -void do_create_link(Vector const& selected_file_paths, GUI::Window* window) +void do_create_link(Vector const& selected_file_paths, GUI::Window* window) { auto path = selected_file_paths.first(); - auto destination = String::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path)); + auto destination = DeprecatedString::formatted("{}/{}", Core::StandardPaths::desktop_directory(), LexicalPath::basename(path)); if (auto result = Core::File::link_file(destination, path); result.is_error()) { - GUI::MessageBox::show(window, String::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv, + GUI::MessageBox::show(window, DeprecatedString::formatted("Could not create desktop shortcut:\n{}", result.error()), "File Manager"sv, GUI::MessageBox::Type::Error); } } -void do_create_archive(Vector const& selected_file_paths, GUI::Window* window) +void do_create_archive(Vector const& selected_file_paths, GUI::Window* window) { - String archive_name; + DeprecatedString archive_name; if (GUI::InputBox::show(window, archive_name, "Enter name:"sv, "Create Archive"sv) != GUI::InputBox::ExecResult::OK) return; @@ -220,7 +220,7 @@ void do_create_archive(Vector const& selected_file_paths, GUI::Window* w } if (!zip_pid) { - Vector relative_paths; + Vector relative_paths; Vector arg_list; arg_list.append("/bin/zip"); arg_list.append("-r"); @@ -244,10 +244,10 @@ void do_create_archive(Vector const& selected_file_paths, GUI::Window* w } } -void do_set_wallpaper(String const& file_path, GUI::Window* window) +void do_set_wallpaper(DeprecatedString const& file_path, GUI::Window* window) { auto show_error = [&] { - GUI::MessageBox::show(window, String::formatted("Failed to set {} as wallpaper.", file_path), "Failed to set wallpaper"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, DeprecatedString::formatted("Failed to set {} as wallpaper.", file_path), "Failed to set wallpaper"sv, GUI::MessageBox::Type::Error); }; auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(file_path); @@ -260,10 +260,10 @@ void do_set_wallpaper(String const& file_path, GUI::Window* window) show_error(); } -void do_unzip_archive(Vector const& selected_file_paths, GUI::Window* window) +void do_unzip_archive(Vector const& selected_file_paths, GUI::Window* window) { - String archive_file_path = selected_file_paths.first(); - String output_directory_path = archive_file_path.substring(0, archive_file_path.length() - 4); + DeprecatedString archive_file_path = selected_file_paths.first(); + DeprecatedString output_directory_path = archive_file_path.substring(0, archive_file_path.length() - 4); pid_t unzip_pid = fork(); if (unzip_pid < 0) { @@ -286,7 +286,7 @@ void do_unzip_archive(Vector const& selected_file_paths, GUI::Window* wi } } -void show_properties(String const& container_dir_path, String const& path, Vector const& selected, GUI::Window* window) +void show_properties(DeprecatedString const& container_dir_path, DeprecatedString const& path, Vector const& selected, GUI::Window* window) { RefPtr properties; if (selected.is_empty()) { @@ -301,7 +301,7 @@ void show_properties(String const& container_dir_path, String const& path, Vecto properties->show(); } -bool add_launch_handler_actions_to_menu(RefPtr& menu, DirectoryView const& directory_view, String const& full_path, RefPtr& default_action, NonnullRefPtrVector& current_file_launch_handlers) +bool add_launch_handler_actions_to_menu(RefPtr& menu, DirectoryView const& directory_view, DeprecatedString const& full_path, RefPtr& default_action, NonnullRefPtrVector& current_file_launch_handlers) { current_file_launch_handlers = directory_view.get_launch_handlers(full_path); @@ -312,9 +312,9 @@ bool add_launch_handler_actions_to_menu(RefPtr& menu, DirectoryView c directory_view.launch(URL::create_with_file_scheme(full_path), launcher_handler); }); if (default_file_handler->details().launcher_type == Desktop::Launcher::LauncherType::Application) - file_open_action->set_text(String::formatted("Run {}", file_open_action->text())); + file_open_action->set_text(DeprecatedString::formatted("Run {}", file_open_action->text())); else - file_open_action->set_text(String::formatted("Open in {}", file_open_action->text())); + file_open_action->set_text(DeprecatedString::formatted("Open in {}", file_open_action->text())); default_action = file_open_action; @@ -421,8 +421,8 @@ ErrorOr run_in_desktop_mode() auto properties_action = GUI::CommonActions::make_properties_action( [&](auto&) { - String path = directory_view->path(); - Vector selected = directory_view->selected_file_paths(); + DeprecatedString path = directory_view->path(); + Vector selected = directory_view->selected_file_paths(); show_properties(path, path, selected, directory_view->window()); }, @@ -435,7 +435,7 @@ ErrorOr run_in_desktop_mode() window); paste_action->set_enabled(GUI::Clipboard::the().fetch_mime_type() == "text/uri-list" && access(directory_view->path().characters(), W_OK) == 0); - GUI::Clipboard::the().on_change = [&](String const& data_type) { + GUI::Clipboard::the().on_change = [&](DeprecatedString const& data_type) { paste_action->set_enabled(data_type == "text/uri-list" && access(directory_view->path().characters(), W_OK) == 0); }; @@ -537,7 +537,7 @@ ErrorOr run_in_desktop_mode() }; struct BackgroundWallpaperListener : Config::Listener { - virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override + virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override { if (domain == "WindowManager" && group == "Background" && key == "Wallpaper") { auto wallpaper_bitmap_or_error = Gfx::Bitmap::try_load_from_file(value); @@ -563,7 +563,7 @@ ErrorOr run_in_desktop_mode() return GUI::Application::the()->exec(); } -ErrorOr run_in_windowed_mode(String const& initial_location, String const& entry_focused_on_init) +ErrorOr run_in_windowed_mode(DeprecatedString const& initial_location, DeprecatedString const& entry_focused_on_init) { auto window = TRY(GUI::Window::try_create()); window->set_title("File Manager"); @@ -753,7 +753,7 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& view_type_action_group->add_action(directory_view->view_as_columns_action()); auto tree_view_selected_file_paths = [&] { - Vector paths; + Vector paths; auto& view = tree_view; view.selection().for_each_index([&](GUI::ModelIndex const& index) { paths.append(directories_model->full_path(index)); @@ -797,7 +797,7 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const& action) { - Vector paths; + Vector paths; if (action.activator() == tree_view_directory_context_menu) paths = tree_view_selected_file_paths(); else @@ -816,7 +816,7 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-terminal.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const& action) { - Vector paths; + Vector paths; if (action.activator() == tree_view_directory_context_menu) paths = tree_view_selected_file_paths(); else @@ -886,9 +886,9 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& auto properties_action = GUI::CommonActions::make_properties_action( [&](auto& action) { - String container_dir_path; - String path; - Vector selected; + DeprecatedString container_dir_path; + DeprecatedString path; + Vector selected; if (action.activator() == directory_context_menu || directory_view->active_widget()->is_focused()) { path = directory_view->path(); container_dir_path = path; @@ -905,7 +905,7 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& auto paste_action = GUI::CommonActions::make_paste_action( [&](GUI::Action const& action) { - String target_directory; + DeprecatedString target_directory; if (action.activator() == directory_context_menu) target_directory = directory_view->selected_file_paths()[0]; else @@ -917,7 +917,7 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& auto folder_specific_paste_action = GUI::CommonActions::make_paste_action( [&](GUI::Action const& action) { - String target_directory; + DeprecatedString target_directory; if (action.activator() == directory_context_menu) target_directory = directory_view->selected_file_paths()[0]; else @@ -945,7 +945,7 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& }, window); - GUI::Clipboard::the().on_change = [&](String const& data_type) { + GUI::Clipboard::the().on_change = [&](DeprecatedString const& data_type) { auto current_location = directory_view->path(); paste_action->set_enabled(data_type == "text/uri-list" && access(current_location.characters(), W_OK) == 0); }; @@ -1090,13 +1090,13 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& } }; - directory_view->on_path_change = [&](String const& new_path, bool can_read_in_path, bool can_write_in_path) { + directory_view->on_path_change = [&](DeprecatedString const& new_path, bool can_read_in_path, bool can_write_in_path) { auto icon = GUI::FileIconProvider::icon_for_path(new_path); auto* bitmap = icon.bitmap_for_size(16); window->set_icon(bitmap); location_textbox.set_icon(bitmap); - window->set_title(String::formatted("{} - File Manager", new_path)); + window->set_title(DeprecatedString::formatted("{} - File Manager", new_path)); location_textbox.set_text(new_path); { @@ -1298,7 +1298,7 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& } }; - auto copy_urls_to_directory = [&](Vector const& urls, String const& directory) { + auto copy_urls_to_directory = [&](Vector const& urls, DeprecatedString const& directory) { if (urls.is_empty()) { dbgln("No files to copy"); return; @@ -1307,12 +1307,12 @@ ErrorOr run_in_windowed_mode(String const& initial_location, String const& for (auto& url_to_copy : urls) { if (!url_to_copy.is_valid() || url_to_copy.path() == directory) continue; - auto new_path = String::formatted("{}/{}", directory, LexicalPath::basename(url_to_copy.path())); + auto new_path = DeprecatedString::formatted("{}/{}", directory, LexicalPath::basename(url_to_copy.path())); if (url_to_copy.path() == new_path) continue; if (auto result = Core::File::copy_file_or_directory(url_to_copy.path(), new_path); result.is_error()) { - auto error_message = String::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_string(), new_path, static_cast(result.error())); + auto error_message = DeprecatedString::formatted("Could not copy {} into {}:\n {}", url_to_copy.to_string(), new_path, static_cast(result.error())); GUI::MessageBox::show(window, error_message, "File Manager"sv, GUI::MessageBox::Type::Error); } else { had_accepted_copy = true; diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp index d2869a79658..00b9153c534 100644 --- a/Userland/Applications/FontEditor/MainWidget.cpp +++ b/Userland/Applications/FontEditor/MainWidget.cpp @@ -73,7 +73,7 @@ ErrorOr> MainWidget::create_preview_window() m_preview_textbox = find_descendant_of_type_named("preview_textbox"); m_preview_textbox->on_change = [&] { - auto preview = String::formatted("{}\n{}", m_preview_textbox->text(), Unicode::to_unicode_uppercase_full(m_preview_textbox->text())); + auto preview = DeprecatedString::formatted("{}\n{}", m_preview_textbox->text(), Unicode::to_unicode_uppercase_full(m_preview_textbox->text())); m_preview_label->set_text(preview); }; m_preview_textbox->set_text(pangrams[0]); @@ -110,7 +110,7 @@ ErrorOr MainWidget::create_actions() m_open_action = GUI::CommonActions::make_open_action([&](auto&) { if (!request_close()) return; - Optional open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/"sv); + Optional open_path = GUI::FilePicker::get_open_filepath(window(), {}, "/res/fonts/"sv); if (!open_path.has_value()) return; if (auto result = open_file(open_path.value()); result.is_error()) @@ -126,7 +126,7 @@ ErrorOr MainWidget::create_actions() m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) { LexicalPath lexical_path(m_path.is_empty() ? "Untitled.font" : m_path); - Optional save_path = GUI::FilePicker::get_save_filepath(window(), lexical_path.title(), lexical_path.extension()); + Optional save_path = GUI::FilePicker::get_save_filepath(window(), lexical_path.title(), lexical_path.extension()); if (!save_path.has_value()) return; if (auto result = save_file(save_path.value()); result.is_error()) @@ -148,7 +148,7 @@ ErrorOr MainWidget::create_actions() }); m_paste_action->set_enabled(GUI::Clipboard::the().fetch_mime_type() == "glyph/x-fonteditor"); - GUI::Clipboard::the().on_change = [&](String const& data_type) { + GUI::Clipboard::the().on_change = [&](DeprecatedString const& data_type) { m_paste_action->set_enabled(data_type == "glyph/x-fonteditor"); }; @@ -241,7 +241,7 @@ ErrorOr MainWidget::create_actions() m_show_system_emoji_action->set_status_tip("Show or hide system emoji"); m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) { - String input; + DeprecatedString input; if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv) == GUI::InputBox::ExecResult::OK && !input.is_empty()) { auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input); if (!maybe_code_point.has_value()) @@ -370,18 +370,18 @@ ErrorOr MainWidget::create_models() { for (auto& it : Gfx::font_slope_names) TRY(m_font_slope_list.try_append(it.name)); - m_slope_combobox->set_model(GUI::ItemListModel::create(m_font_slope_list)); + m_slope_combobox->set_model(GUI::ItemListModel::create(m_font_slope_list)); for (auto& it : Gfx::font_weight_names) TRY(m_font_weight_list.try_append(it.name)); - m_weight_combobox->set_model(GUI::ItemListModel::create(m_font_weight_list)); + m_weight_combobox->set_model(GUI::ItemListModel::create(m_font_weight_list)); auto unicode_blocks = Unicode::block_display_names(); TRY(m_unicode_block_list.try_append("Show All")); for (auto& block : unicode_blocks) TRY(m_unicode_block_list.try_append(block.display_name)); - m_unicode_block_model = GUI::ItemListModel::create(m_unicode_block_list); + m_unicode_block_model = GUI::ItemListModel::create(m_unicode_block_list); m_filter_model = TRY(GUI::FilteringProxyModel::create(*m_unicode_block_model)); m_filter_model->set_filter_term(""sv); @@ -578,7 +578,7 @@ MainWidget::MainWidget() }; } -ErrorOr MainWidget::initialize(String const& path, RefPtr&& edited_font) +ErrorOr MainWidget::initialize(DeprecatedString const& path, RefPtr&& edited_font) { if (m_edited_font == edited_font) return {}; @@ -711,7 +711,7 @@ ErrorOr MainWidget::initialize_menubar(GUI::Window& window) return {}; } -ErrorOr MainWidget::save_file(String const& path) +ErrorOr MainWidget::save_file(DeprecatedString const& path) { auto masked_font = TRY(m_edited_font->masked_character_set()); TRY(masked_font->write_to_file(path)); @@ -764,7 +764,7 @@ void MainWidget::set_show_system_emoji(bool show) m_glyph_map_widget->set_show_system_emoji(show); } -ErrorOr MainWidget::open_file(String const& path) +ErrorOr MainWidget::open_file(DeprecatedString const& path) { auto unmasked_font = TRY(TRY(Gfx::BitmapFont::try_load_from_file(path))->unmasked_character_set()); TRY(initialize(path, move(unmasked_font))); @@ -972,11 +972,11 @@ ErrorOr MainWidget::copy_selected_glyphs() TRY(buffer.try_append(rows, bytes_per_glyph * selection.size())); TRY(buffer.try_append(widths, selection.size())); - HashMap metadata; - metadata.set("start", String::number(selection.start())); - metadata.set("count", String::number(selection.size())); - metadata.set("width", String::number(edited_font().max_glyph_width())); - metadata.set("height", String::number(edited_font().glyph_height())); + HashMap metadata; + metadata.set("start", DeprecatedString::number(selection.start())); + metadata.set("count", DeprecatedString::number(selection.size())); + metadata.set("width", DeprecatedString::number(edited_font().max_glyph_width())); + metadata.set("height", DeprecatedString::number(edited_font().glyph_height())); GUI::Clipboard::the().set_data(buffer.bytes(), "glyph/x-fonteditor", metadata); return {}; @@ -1058,11 +1058,11 @@ void MainWidget::delete_selected_glyphs() void MainWidget::show_error(Error error, StringView preface, StringView basename) { - String formatted_error; + DeprecatedString formatted_error; if (basename.is_empty()) - formatted_error = String::formatted("{}: {}", preface, error); + formatted_error = DeprecatedString::formatted("{}: {}", preface, error); else - formatted_error = String::formatted("{} \"{}\" failed: {}", preface, basename, error); + formatted_error = DeprecatedString::formatted("{} \"{}\" failed: {}", preface, basename, error); GUI::MessageBox::show_error(window(), formatted_error); warnln(formatted_error); } diff --git a/Userland/Applications/FontEditor/MainWidget.h b/Userland/Applications/FontEditor/MainWidget.h index 54f98d5c20b..59c322cd291 100644 --- a/Userland/Applications/FontEditor/MainWidget.h +++ b/Userland/Applications/FontEditor/MainWidget.h @@ -34,15 +34,15 @@ public: virtual ~MainWidget() override = default; - ErrorOr initialize(String const& path, RefPtr&&); + ErrorOr initialize(DeprecatedString const& path, RefPtr&&); ErrorOr initialize_menubar(GUI::Window&); - ErrorOr open_file(String const&); - ErrorOr save_file(String const&); + ErrorOr open_file(DeprecatedString const&); + ErrorOr save_file(DeprecatedString const&); bool request_close(); void update_title(); - String const& path() { return m_path; } + DeprecatedString const& path() { return m_path; } Gfx::BitmapFont const& edited_font() { return *m_edited_font; } bool is_showing_font_metadata() { return m_font_metadata; } @@ -160,10 +160,10 @@ private: RefPtr m_preview_textbox; RefPtr m_font_preview_window; - String m_path; - Vector m_font_weight_list; - Vector m_font_slope_list; - Vector m_unicode_block_list; + DeprecatedString m_path; + Vector m_font_weight_list; + Vector m_font_slope_list; + Vector m_unicode_block_list; bool m_font_metadata { true }; bool m_unicode_blocks { true }; Unicode::CodePointRange m_range { 0x0000, 0x10FFFF }; diff --git a/Userland/Applications/FontEditor/NewFontDialog.cpp b/Userland/Applications/FontEditor/NewFontDialog.cpp index 9adff877645..36c92e3df49 100644 --- a/Userland/Applications/FontEditor/NewFontDialog.cpp +++ b/Userland/Applications/FontEditor/NewFontDialog.cpp @@ -138,12 +138,12 @@ NewFontDialog::NewFontDialog(GUI::Window* parent_window) for (auto& it : Gfx::font_weight_names) m_font_weight_list.append(it.name); - m_weight_combobox->set_model(*GUI::ItemListModel::create(m_font_weight_list)); + m_weight_combobox->set_model(*GUI::ItemListModel::create(m_font_weight_list)); m_weight_combobox->set_selected_index(3); for (auto& it : Gfx::font_slope_names) m_font_slope_list.append(it.name); - m_slope_combobox->set_model(*GUI::ItemListModel::create(m_font_slope_list)); + m_slope_combobox->set_model(*GUI::ItemListModel::create(m_font_slope_list)); m_slope_combobox->set_selected_index(0); m_presentation_spinbox->set_value(12); diff --git a/Userland/Applications/FontEditor/NewFontDialog.h b/Userland/Applications/FontEditor/NewFontDialog.h index eb7f2f07330..91796df434b 100644 --- a/Userland/Applications/FontEditor/NewFontDialog.h +++ b/Userland/Applications/FontEditor/NewFontDialog.h @@ -31,8 +31,8 @@ private: u8 presentation_size; u16 weight; u8 slope; - String name; - String family; + DeprecatedString name; + DeprecatedString family; bool is_fixed_width; } m_new_font_metadata; @@ -51,6 +51,6 @@ private: RefPtr m_spacing_spinbox; RefPtr m_fixed_width_checkbox; - Vector m_font_weight_list; - Vector m_font_slope_list; + Vector m_font_weight_list; + Vector m_font_slope_list; }; diff --git a/Userland/Applications/GamesSettings/CardSettingsWidget.cpp b/Userland/Applications/GamesSettings/CardSettingsWidget.cpp index 2f37876c72f..5a2788f7872 100644 --- a/Userland/Applications/GamesSettings/CardSettingsWidget.cpp +++ b/Userland/Applications/GamesSettings/CardSettingsWidget.cpp @@ -74,7 +74,7 @@ void CardSettingsWidget::set_cards_background_color(Gfx::Color color) m_preview_frame->set_palette(new_palette); } -bool CardSettingsWidget::set_card_back_image_path(String const& path) +bool CardSettingsWidget::set_card_back_image_path(DeprecatedString const& path) { auto index = static_cast(m_card_back_image_view->model())->index(path, m_card_back_image_view->model_column()); if (index.is_valid()) { @@ -86,7 +86,7 @@ bool CardSettingsWidget::set_card_back_image_path(String const& path) return false; } -String CardSettingsWidget::card_back_image_path() const +DeprecatedString CardSettingsWidget::card_back_image_path() const { auto& card_back_selection = m_card_back_image_view->selection(); GUI::ModelIndex card_back_image_index = m_last_selected_card_back; diff --git a/Userland/Applications/GamesSettings/CardSettingsWidget.h b/Userland/Applications/GamesSettings/CardSettingsWidget.h index 61dbb03c6a0..9e8e6e70c3c 100644 --- a/Userland/Applications/GamesSettings/CardSettingsWidget.h +++ b/Userland/Applications/GamesSettings/CardSettingsWidget.h @@ -25,8 +25,8 @@ private: CardSettingsWidget(); void set_cards_background_color(Gfx::Color); - bool set_card_back_image_path(String const&); - String card_back_image_path() const; + bool set_card_back_image_path(DeprecatedString const&); + DeprecatedString card_back_image_path() const; RefPtr m_preview_frame; RefPtr m_preview_card_back; diff --git a/Userland/Applications/Help/History.cpp b/Userland/Applications/Help/History.cpp index fea165421c0..2bbab72c9d3 100644 --- a/Userland/Applications/Help/History.cpp +++ b/Userland/Applications/Help/History.cpp @@ -16,7 +16,7 @@ void History::push(StringView history_item) m_current_history_item++; } -String History::current() +DeprecatedString History::current() { if (m_current_history_item == -1) return {}; diff --git a/Userland/Applications/Help/History.h b/Userland/Applications/Help/History.h index 3ec3d7da1b2..c5f56c96268 100644 --- a/Userland/Applications/Help/History.h +++ b/Userland/Applications/Help/History.h @@ -6,13 +6,13 @@ #pragma once -#include +#include #include class History final { public: void push(StringView history_item); - String current(); + DeprecatedString current(); void go_back(); void go_forward(); @@ -23,6 +23,6 @@ public: void clear(); private: - Vector m_items; + Vector m_items; int m_current_history_item { -1 }; }; diff --git a/Userland/Applications/Help/MainWidget.cpp b/Userland/Applications/Help/MainWidget.cpp index ad98f9afc86..2d1d6faa68f 100644 --- a/Userland/Applications/Help/MainWidget.cpp +++ b/Userland/Applications/Help/MainWidget.cpp @@ -8,7 +8,7 @@ */ #include "MainWidget.h" -#include +#include #include #include #include @@ -66,7 +66,7 @@ MainWidget::MainWidget() } auto& search_model = *static_cast(view_model); auto const& mapped_index = search_model.map(index); - String path = m_manual_model->page_path(mapped_index); + DeprecatedString path = m_manual_model->page_path(mapped_index); if (path.is_null()) { m_web_view->load_empty_document(); return; @@ -79,7 +79,7 @@ MainWidget::MainWidget() m_browse_view = find_descendant_of_type_named("browse_view"); m_browse_view->on_selection_change = [this] { - String path = m_manual_model->page_path(m_browse_view->selection().first()); + DeprecatedString path = m_manual_model->page_path(m_browse_view->selection().first()); if (path.is_null()) return; @@ -114,7 +114,7 @@ MainWidget::MainWidget() } auto const section = url.paths()[0]; auto const page = url.paths()[1]; - auto const path = String::formatted("/usr/share/man/man{}/{}.md", section, page); + auto const path = DeprecatedString::formatted("/usr/share/man/man{}/{}.md", section, page); m_history.push(path); open_url(URL::create_with_file_scheme(path, url.fragment())); @@ -150,7 +150,7 @@ MainWidget::MainWidget() m_go_forward_action->set_enabled(false); m_go_home_action = GUI::CommonActions::make_go_home_action([this](auto&) { - String path = "/usr/share/man/man7/Help-index.md"; + DeprecatedString path = "/usr/share/man/man7/Help-index.md"; m_history.push(path); open_page(path); }); @@ -180,7 +180,7 @@ void MainWidget::set_start_page(StringView start_page, u32 section) if (!start_page.is_null()) { if (section != 0) { // > Help [section] [name] - String path = String::formatted("/usr/share/man/man{}/{}.md", section, start_page); + DeprecatedString path = DeprecatedString::formatted("/usr/share/man/man{}/{}.md", section, start_page); m_history.push(path); open_page(path); set_start_page = true; @@ -204,7 +204,7 @@ void MainWidget::set_start_page(StringView start_page, u32 section) "8" }; for (auto s : sections) { - String path = String::formatted("/usr/share/man/man{}/{}.md", s, start_page); + DeprecatedString path = DeprecatedString::formatted("/usr/share/man/man{}/{}.md", s, start_page); if (Core::File::exists(path)) { m_history.push(path); open_page(path); @@ -246,7 +246,7 @@ ErrorOr MainWidget::initialize_fallibles(GUI::Window& window) auto help_menu = TRY(window.try_add_menu("&Help")); TRY(help_menu->try_add_action(GUI::CommonActions::make_command_palette_action(&window))); TRY(help_menu->try_add_action(GUI::Action::create("&Contents", { Key_F1 }, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/filetype-unknown.png"sv)), [&](auto&) { - String path = "/usr/share/man/man1/Help.md"; + DeprecatedString path = "/usr/share/man/man1/Help.md"; open_page(path); }))); TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Help", TRY(GUI::Icon::try_create_default_icon("app-help"sv)), &window))); @@ -282,8 +282,8 @@ void MainWidget::open_url(URL const& url) if (browse_view_index.has_value()) { m_browse_view->expand_tree(browse_view_index.value().parent()); - String page_and_section = m_manual_model->page_and_section(browse_view_index.value()); - window()->set_title(String::formatted("{} - Help", page_and_section)); + DeprecatedString page_and_section = m_manual_model->page_and_section(browse_view_index.value()); + window()->set_title(DeprecatedString::formatted("{} - Help", page_and_section)); } else { window()->set_title("Help"); } @@ -294,10 +294,10 @@ void MainWidget::open_url(URL const& url) void MainWidget::open_external(URL const& url) { if (!Desktop::Launcher::open(url)) - GUI::MessageBox::show(window(), String::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error); } -void MainWidget::open_page(String const& path) +void MainWidget::open_page(DeprecatedString const& path) { m_go_back_action->set_enabled(m_history.can_go_back()); m_go_forward_action->set_enabled(m_history.can_go_forward()); diff --git a/Userland/Applications/Help/MainWidget.h b/Userland/Applications/Help/MainWidget.h index 8dcc756bde0..18f3aa91beb 100644 --- a/Userland/Applications/Help/MainWidget.h +++ b/Userland/Applications/Help/MainWidget.h @@ -26,7 +26,7 @@ private: MainWidget(); void open_url(URL const&); - void open_page(String const& path); + void open_page(DeprecatedString const& path); void open_external(URL const&); History m_history; diff --git a/Userland/Applications/Help/ManualModel.cpp b/Userland/Applications/Help/ManualModel.cpp index 619086bc047..cf07fedc1b9 100644 --- a/Userland/Applications/Help/ManualModel.cpp +++ b/Userland/Applications/Help/ManualModel.cpp @@ -46,7 +46,7 @@ Optional ManualModel::index_from_path(StringView path) const return {}; } -String ManualModel::page_name(const GUI::ModelIndex& index) const +DeprecatedString ManualModel::page_name(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; @@ -57,7 +57,7 @@ String ManualModel::page_name(const GUI::ModelIndex& index) const return page->name(); } -String ManualModel::page_path(const GUI::ModelIndex& index) const +DeprecatedString ManualModel::page_path(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; @@ -68,7 +68,7 @@ String ManualModel::page_path(const GUI::ModelIndex& index) const return page->path(); } -ErrorOr ManualModel::page_view(String const& path) const +ErrorOr ManualModel::page_view(DeprecatedString const& path) const { if (path.is_empty()) return StringView {}; @@ -87,7 +87,7 @@ ErrorOr ManualModel::page_view(String const& path) const return view; } -String ManualModel::page_and_section(const GUI::ModelIndex& index) const +DeprecatedString ManualModel::page_and_section(const GUI::ModelIndex& index) const { if (!index.is_valid()) return {}; @@ -96,7 +96,7 @@ String ManualModel::page_and_section(const GUI::ModelIndex& index) const return {}; auto* page = static_cast(node); auto* section = static_cast(page->parent()); - return String::formatted("{}({})", page->name(), section->section_name()); + return DeprecatedString::formatted("{}({})", page->name(), section->section_name()); } GUI::ModelIndex ManualModel::index(int row, int column, const GUI::ModelIndex& parent_index) const @@ -151,7 +151,7 @@ GUI::Variant ManualModel::data(const GUI::ModelIndex& index, GUI::ModelRole role case GUI::ModelRole::Search: if (!node->is_page()) return {}; - return String(page_view(page_path(index)).value()); + return DeprecatedString(page_view(page_path(index)).value()); case GUI::ModelRole::Display: return node->name(); case GUI::ModelRole::Icon: diff --git a/Userland/Applications/Help/ManualModel.h b/Userland/Applications/Help/ManualModel.h index 9995836636a..8655fe1009d 100644 --- a/Userland/Applications/Help/ManualModel.h +++ b/Userland/Applications/Help/ManualModel.h @@ -6,10 +6,10 @@ #pragma once +#include #include #include #include -#include #include class ManualModel final : public GUI::Model { @@ -23,10 +23,10 @@ public: Optional index_from_path(StringView) const; - String page_name(const GUI::ModelIndex&) const; - String page_path(const GUI::ModelIndex&) const; - String page_and_section(const GUI::ModelIndex&) const; - ErrorOr page_view(String const& path) const; + DeprecatedString page_name(const GUI::ModelIndex&) const; + DeprecatedString page_path(const GUI::ModelIndex&) const; + DeprecatedString page_and_section(const GUI::ModelIndex&) const; + ErrorOr page_view(DeprecatedString const& path) const; void update_section_node_on_toggle(const GUI::ModelIndex&, bool const); virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; @@ -42,5 +42,5 @@ private: GUI::Icon m_section_open_icon; GUI::Icon m_section_icon; GUI::Icon m_page_icon; - mutable HashMap> m_mapped_files; + mutable HashMap> m_mapped_files; }; diff --git a/Userland/Applications/Help/ManualNode.h b/Userland/Applications/Help/ManualNode.h index 6fb5957edaa..d9157b06fcd 100644 --- a/Userland/Applications/Help/ManualNode.h +++ b/Userland/Applications/Help/ManualNode.h @@ -7,8 +7,8 @@ #pragma once +#include #include -#include class ManualNode { public: @@ -16,7 +16,7 @@ public: virtual NonnullOwnPtrVector& children() const = 0; virtual ManualNode const* parent() const = 0; - virtual String name() const = 0; + virtual DeprecatedString name() const = 0; virtual bool is_page() const { return false; } virtual bool is_open() const { return false; } }; diff --git a/Userland/Applications/Help/ManualPageNode.cpp b/Userland/Applications/Help/ManualPageNode.cpp index e906e34c37b..52223c5d463 100644 --- a/Userland/Applications/Help/ManualPageNode.cpp +++ b/Userland/Applications/Help/ManualPageNode.cpp @@ -19,7 +19,7 @@ NonnullOwnPtrVector& ManualPageNode::children() const return empty_vector; } -String ManualPageNode::path() const +DeprecatedString ManualPageNode::path() const { - return String::formatted("{}/{}.md", m_section.path(), m_page); + return DeprecatedString::formatted("{}/{}.md", m_section.path(), m_page); } diff --git a/Userland/Applications/Help/ManualPageNode.h b/Userland/Applications/Help/ManualPageNode.h index c01349f2de1..e0a9ade594a 100644 --- a/Userland/Applications/Help/ManualPageNode.h +++ b/Userland/Applications/Help/ManualPageNode.h @@ -22,12 +22,12 @@ public: virtual NonnullOwnPtrVector& children() const override; virtual ManualNode const* parent() const override; - virtual String name() const override { return m_page; }; + virtual DeprecatedString name() const override { return m_page; }; virtual bool is_page() const override { return true; } - String path() const; + DeprecatedString path() const; private: ManualSectionNode const& m_section; - String m_page; + DeprecatedString m_page; }; diff --git a/Userland/Applications/Help/ManualSectionNode.cpp b/Userland/Applications/Help/ManualSectionNode.cpp index c11292638da..2259715693c 100644 --- a/Userland/Applications/Help/ManualSectionNode.cpp +++ b/Userland/Applications/Help/ManualSectionNode.cpp @@ -6,14 +6,14 @@ #include "ManualSectionNode.h" #include "ManualPageNode.h" +#include #include #include -#include #include -String ManualSectionNode::path() const +DeprecatedString ManualSectionNode::path() const { - return String::formatted("/usr/share/man/man{}", m_section); + return DeprecatedString::formatted("/usr/share/man/man{}", m_section); } void ManualSectionNode::reify_if_needed() const @@ -24,7 +24,7 @@ void ManualSectionNode::reify_if_needed() const Core::DirIterator dir_iter { path(), Core::DirIterator::Flags::SkipDots }; - Vector page_names; + Vector page_names; while (dir_iter.has_next()) { LexicalPath lexical_path(dir_iter.next_path()); if (lexical_path.extension() != "md") diff --git a/Userland/Applications/Help/ManualSectionNode.h b/Userland/Applications/Help/ManualSectionNode.h index 173e3475bfd..ee7850f1db3 100644 --- a/Userland/Applications/Help/ManualSectionNode.h +++ b/Userland/Applications/Help/ManualSectionNode.h @@ -13,9 +13,9 @@ class ManualSectionNode : public ManualNode { public: virtual ~ManualSectionNode() override = default; - ManualSectionNode(String section, String name) + ManualSectionNode(DeprecatedString section, DeprecatedString name) : m_section(section) - , m_full_name(String::formatted("{}. {}", section, name)) + , m_full_name(DeprecatedString::formatted("{}. {}", section, name)) { } @@ -26,18 +26,18 @@ public: } virtual ManualNode const* parent() const override { return nullptr; } - virtual String name() const override { return m_full_name; } + virtual DeprecatedString name() const override { return m_full_name; } virtual bool is_open() const override { return m_open; } void set_open(bool open); - String const& section_name() const { return m_section; } - String path() const; + DeprecatedString const& section_name() const { return m_section; } + DeprecatedString path() const; private: void reify_if_needed() const; - String m_section; - String m_full_name; + DeprecatedString m_section; + DeprecatedString m_full_name; mutable NonnullOwnPtrVector m_children; mutable bool m_reified { false }; bool m_open { false }; diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp index 79f73e49802..d6db39b13df 100644 --- a/Userland/Applications/Help/main.cpp +++ b/Userland/Applications/Help/main.cpp @@ -17,7 +17,7 @@ using namespace Help; -static String parse_input(StringView input) +static DeprecatedString parse_input(StringView input) { AK::URL url(input); if (url.is_valid()) @@ -39,7 +39,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/tmp/session/%sid/portal/webcontent", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); - String start_page; + DeprecatedString start_page; u32 section = 0; Core::ArgsParser args_parser; diff --git a/Userland/Applications/HexEditor/FindDialog.cpp b/Userland/Applications/HexEditor/FindDialog.cpp index 9c3c73ed433..9f2c2472d8d 100644 --- a/Userland/Applications/HexEditor/FindDialog.cpp +++ b/Userland/Applications/HexEditor/FindDialog.cpp @@ -6,8 +6,8 @@ #include "FindDialog.h" #include +#include #include -#include #include #include #include @@ -31,7 +31,7 @@ static constexpr Array options = { } }; -GUI::Dialog::ExecResult FindDialog::show(GUI::Window* parent_window, String& out_text, ByteBuffer& out_buffer, bool& find_all) +GUI::Dialog::ExecResult FindDialog::show(GUI::Window* parent_window, DeprecatedString& out_text, ByteBuffer& out_buffer, bool& find_all) { auto dialog = FindDialog::construct(); @@ -67,13 +67,13 @@ GUI::Dialog::ExecResult FindDialog::show(GUI::Window* parent_window, String& out return result; } -Result FindDialog::process_input(String text_value, OptionId opt) +Result FindDialog::process_input(DeprecatedString text_value, OptionId opt) { dbgln("process_input opt={}", (int)opt); switch (opt) { case OPTION_ASCII_STRING: { if (text_value.is_empty()) - return String("Input is empty"); + return DeprecatedString("Input is empty"); return text_value.to_byte_buffer(); } @@ -81,7 +81,7 @@ Result FindDialog::process_input(String text_value, OptionId case OPTION_HEX_VALUE: { auto decoded = decode_hex(text_value.replace(" "sv, ""sv, ReplaceMode::All)); if (decoded.is_error()) - return String::formatted("Input is invalid: {}", decoded.error().string_literal()); + return DeprecatedString::formatted("Input is invalid: {}", decoded.error().string_literal()); return decoded.value(); } diff --git a/Userland/Applications/HexEditor/FindDialog.h b/Userland/Applications/HexEditor/FindDialog.h index 73d41a3b8fa..1aaf2d97515 100644 --- a/Userland/Applications/HexEditor/FindDialog.h +++ b/Userland/Applications/HexEditor/FindDialog.h @@ -19,12 +19,12 @@ class FindDialog : public GUI::Dialog { C_OBJECT(FindDialog); public: - static ExecResult show(GUI::Window* parent_window, String& out_tex, ByteBuffer& out_buffer, bool& find_all); + static ExecResult show(GUI::Window* parent_window, DeprecatedString& out_tex, ByteBuffer& out_buffer, bool& find_all); private: - Result process_input(String text_value, OptionId opt); + Result process_input(DeprecatedString text_value, OptionId opt); - String text_value() const { return m_text_value; } + DeprecatedString text_value() const { return m_text_value; } OptionId selected_option() const { return m_selected_option; } bool find_all() const { return m_find_all; } @@ -37,6 +37,6 @@ private: RefPtr m_cancel_button; bool m_find_all { false }; - String m_text_value; + DeprecatedString m_text_value; OptionId m_selected_option { OPTION_INVALID }; }; diff --git a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp index d22f861b236..0918603f8a9 100644 --- a/Userland/Applications/HexEditor/GoToOffsetDialog.cpp +++ b/Userland/Applications/HexEditor/GoToOffsetDialog.cpp @@ -5,7 +5,7 @@ */ #include "GoToOffsetDialog.h" -#include +#include #include #include #include @@ -27,7 +27,7 @@ GUI::Dialog::ExecResult GoToOffsetDialog::show(GUI::Window* parent_window, int& dialog->set_icon(parent_window->icon()); if (history_offset) - dialog->m_text_editor->set_text(String::formatted("{}", history_offset)); + dialog->m_text_editor->set_text(DeprecatedString::formatted("{}", history_offset)); auto result = dialog->exec(); @@ -50,9 +50,9 @@ int GoToOffsetDialog::process_input() int offset; auto type = m_offset_type_box->text().trim_whitespace(); if (type == "Decimal") { - offset = String::formatted("{}", input_offset).to_int().value_or(0); + offset = DeprecatedString::formatted("{}", input_offset).to_int().value_or(0); } else if (type == "Hexadecimal") { - offset = strtol(String::formatted("{}", input_offset).characters(), nullptr, 16); + offset = strtol(DeprecatedString::formatted("{}", input_offset).characters(), nullptr, 16); } else { VERIFY_NOT_REACHED(); } @@ -84,8 +84,8 @@ int GoToOffsetDialog::calculate_new_offset(int input_offset) void GoToOffsetDialog::update_statusbar() { auto new_offset = calculate_new_offset(process_input()); - m_statusbar->set_text(0, String::formatted("HEX: {:#08X}", new_offset)); - m_statusbar->set_text(1, String::formatted("DEC: {}", new_offset)); + m_statusbar->set_text(0, DeprecatedString::formatted("HEX: {:#08X}", new_offset)); + m_statusbar->set_text(1, DeprecatedString::formatted("DEC: {}", new_offset)); } GoToOffsetDialog::GoToOffsetDialog() @@ -108,14 +108,14 @@ GoToOffsetDialog::GoToOffsetDialog() m_offset_type.append("Decimal"); m_offset_type.append("Hexadecimal"); - m_offset_type_box->set_model(GUI::ItemListModel::create(m_offset_type)); + m_offset_type_box->set_model(GUI::ItemListModel::create(m_offset_type)); m_offset_type_box->set_selected_index(0); m_offset_type_box->set_only_allow_values_from_model(true); m_offset_from.append("Start"); m_offset_from.append("Here"); m_offset_from.append("End"); - m_offset_from_box->set_model(GUI::ItemListModel::create(m_offset_from)); + m_offset_from_box->set_model(GUI::ItemListModel::create(m_offset_from)); m_offset_from_box->set_selected_index(0); m_offset_from_box->set_only_allow_values_from_model(true); diff --git a/Userland/Applications/HexEditor/GoToOffsetDialog.h b/Userland/Applications/HexEditor/GoToOffsetDialog.h index 0312bc58a70..8b8b73ee2cc 100644 --- a/Userland/Applications/HexEditor/GoToOffsetDialog.h +++ b/Userland/Applications/HexEditor/GoToOffsetDialog.h @@ -24,8 +24,8 @@ private: int calculate_new_offset(int offset); int m_selection_offset { 0 }; int m_buffer_size { 0 }; - Vector m_offset_type; - Vector m_offset_from; + Vector m_offset_type; + Vector m_offset_from; RefPtr m_text_editor; RefPtr m_go_button; diff --git a/Userland/Applications/HexEditor/HexDocument.h b/Userland/Applications/HexEditor/HexDocument.h index 5a170b4a654..1cad264d592 100644 --- a/Userland/Applications/HexEditor/HexDocument.h +++ b/Userland/Applications/HexEditor/HexDocument.h @@ -89,7 +89,7 @@ public: virtual void undo() override; virtual void redo() override; - virtual String action_text() const override { return "Update cell"; } + virtual DeprecatedString action_text() const override { return "Update cell"; } virtual bool merge_with(GUI::Command const& other) override; diff --git a/Userland/Applications/HexEditor/HexEditor.cpp b/Userland/Applications/HexEditor/HexEditor.cpp index 0da1a8e9208..55ee1b2c8de 100644 --- a/Userland/Applications/HexEditor/HexEditor.cpp +++ b/Userland/Applications/HexEditor/HexEditor.cpp @@ -590,7 +590,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) }; bool is_current_line = (m_position / bytes_per_row()) == i; - auto line = String::formatted("{:#08X}", i * bytes_per_row()); + auto line = DeprecatedString::formatted("{:#08X}", i * bytes_per_row()); painter.draw_text( side_offset_rect, line, @@ -625,7 +625,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) }; const u8 cell_value = m_document->get(byte_position).value; - auto line = String::formatted("{:02X}", cell_value); + auto line = DeprecatedString::formatted("{:02X}", cell_value); Gfx::Color background_color = palette().color(background_role()); Gfx::Color text_color = [&]() -> Gfx::Color { @@ -690,7 +690,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event) } painter.fill_rect(text_background_rect, background_color); - painter.draw_text(text_display_rect, String::formatted("{:c}", isprint(cell_value) ? cell_value : '.'), Gfx::TextAlignment::TopLeft, text_color); + painter.draw_text(text_display_rect, DeprecatedString::formatted("{:c}", isprint(cell_value) ? cell_value : '.'), Gfx::TextAlignment::TopLeft, text_color); if (m_edit_mode == EditMode::Text) { if (byte_position == m_position && m_cursor_blink_active) { @@ -768,7 +768,7 @@ Vector HexEditor::find_all(ByteBuffer& needle, size_t start) } } if (found) { - matches.append({ i, String::formatted("{}", StringView { needle }.to_string().characters()) }); + matches.append({ i, DeprecatedString::formatted("{}", StringView { needle }.to_string().characters()) }); i += needle.size() - 1; } } diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index 65f0aaf9c82..097d14745a4 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -61,11 +61,11 @@ HexEditorWidget::HexEditorWidget() }; m_editor->on_status_change = [this](int position, HexEditor::EditMode edit_mode, int selection_start, int selection_end) { - m_statusbar->set_text(0, String::formatted("Offset: {:#08X}", position)); - m_statusbar->set_text(1, String::formatted("Edit Mode: {}", edit_mode == HexEditor::EditMode::Hex ? "Hex" : "Text")); - m_statusbar->set_text(2, String::formatted("Selection Start: {}", selection_start)); - m_statusbar->set_text(3, String::formatted("Selection End: {}", selection_end)); - m_statusbar->set_text(4, String::formatted("Selected Bytes: {}", m_editor->selection_size())); + m_statusbar->set_text(0, DeprecatedString::formatted("Offset: {:#08X}", position)); + m_statusbar->set_text(1, DeprecatedString::formatted("Edit Mode: {}", edit_mode == HexEditor::EditMode::Hex ? "Hex" : "Text")); + m_statusbar->set_text(2, DeprecatedString::formatted("Selection Start: {}", selection_start)); + m_statusbar->set_text(3, DeprecatedString::formatted("Selection End: {}", selection_end)); + m_statusbar->set_text(4, DeprecatedString::formatted("Selected Bytes: {}", m_editor->selection_size())); bool has_selection = m_editor->has_selection(); m_copy_hex_action->set_enabled(has_selection); @@ -99,7 +99,7 @@ HexEditorWidget::HexEditorWidget() }; m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { - String value; + DeprecatedString value; if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:"sv, "New file size"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto file_size = value.to_uint(); if (!file_size.has_value()) { @@ -108,7 +108,7 @@ HexEditorWidget::HexEditorWidget() } if (auto error = m_editor->open_new_file(file_size.value()); error.is_error()) { - GUI::MessageBox::show(window(), String::formatted("Unable to open new file: {}"sv, error.error()), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Unable to open new file: {}"sv, error.error()), "Error"sv, GUI::MessageBox::Type::Error); return; } @@ -176,11 +176,11 @@ HexEditorWidget::HexEditorWidget() m_search_results->update(); if (matches.is_empty()) { - GUI::MessageBox::show(window(), String::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); return; } - GUI::MessageBox::show(window(), String::formatted("Found {} matches for \"{}\" in this file", matches.size(), m_search_text), String::formatted("{} matches", matches.size()), GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Found {} matches for \"{}\" in this file", matches.size(), m_search_text), DeprecatedString::formatted("{} matches", matches.size()), GUI::MessageBox::Type::Warning); set_search_results_visible(true); } else { bool same_buffers = false; @@ -192,7 +192,7 @@ HexEditorWidget::HexEditorWidget() auto result = m_editor->find_and_highlight(m_search_buffer, same_buffers ? last_found_index() : 0); if (!result.has_value()) { - GUI::MessageBox::show(window(), String::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Pattern \"{}\" not found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); return; } @@ -242,7 +242,7 @@ HexEditorWidget::HexEditorWidget() m_copy_as_c_code_action->set_enabled(false); m_fill_selection_action = GUI::Action::create("Fill &Selection...", { Mod_Ctrl, Key_B }, [&](const GUI::Action&) { - String value; + DeprecatedString value; if (GUI::InputBox::show(window(), value, "Fill byte (hex):"sv, "Fill Selection"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) { auto fill_byte = strtol(value.characters(), nullptr, 16); m_editor->fill_selection(fill_byte); @@ -305,9 +305,9 @@ void HexEditorWidget::update_inspector_values(size_t position) else unsigned_byte_value = (unsigned_64_bit_int >> (64 - 8)) & 0xFF; - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedByte, String::number(static_cast(unsigned_byte_value))); - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedByte, String::number(unsigned_byte_value)); - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::ASCII, String::formatted("{:c}", static_cast(unsigned_byte_value))); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedByte, DeprecatedString::number(static_cast(unsigned_byte_value))); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedByte, DeprecatedString::number(unsigned_byte_value)); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::ASCII, DeprecatedString::formatted("{:c}", static_cast(unsigned_byte_value))); } else { value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedByte, ""); value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedByte, ""); @@ -321,8 +321,8 @@ void HexEditorWidget::update_inspector_values(size_t position) else unsigned_short_value = (unsigned_64_bit_int >> (64 - 16)) & 0xFFFF; - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedShort, String::number(static_cast(unsigned_short_value))); - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedShort, String::number(unsigned_short_value)); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedShort, DeprecatedString::number(static_cast(unsigned_short_value))); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedShort, DeprecatedString::number(unsigned_short_value)); } else { value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedShort, ""); value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedShort, ""); @@ -335,9 +335,9 @@ void HexEditorWidget::update_inspector_values(size_t position) else unsigned_int_value = (unsigned_64_bit_int >> 32) & 0xFFFFFFFF; - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedInt, String::number(static_cast(unsigned_int_value))); - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedInt, String::number(unsigned_int_value)); - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::Float, String::number(bit_cast(unsigned_int_value))); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedInt, DeprecatedString::number(static_cast(unsigned_int_value))); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedInt, DeprecatedString::number(unsigned_int_value)); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::Float, DeprecatedString::number(bit_cast(unsigned_int_value))); } else { value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedInt, ""); value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedInt, ""); @@ -345,9 +345,9 @@ void HexEditorWidget::update_inspector_values(size_t position) } if (byte_read_count >= 8) { - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedLong, String::number(static_cast(unsigned_64_bit_int))); - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedLong, String::number(unsigned_64_bit_int)); - value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::Double, String::number(bit_cast(unsigned_64_bit_int))); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedLong, DeprecatedString::number(static_cast(unsigned_64_bit_int))); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedLong, DeprecatedString::number(unsigned_64_bit_int)); + value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::Double, DeprecatedString::number(bit_cast(unsigned_64_bit_int))); } else { value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::SignedLong, ""); value_inspector_model->set_parsed_value(ValueInspectorModel::ValueType::UnsignedLong, ""); @@ -418,7 +418,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) auto result = m_editor->find_and_highlight(m_search_buffer, last_found_index()); if (!result.has_value()) { - GUI::MessageBox::show(&window, String::formatted("No more matches for \"{}\" found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); + GUI::MessageBox::show(&window, DeprecatedString::formatted("No more matches for \"{}\" found in this file", m_search_text), "Not found"sv, GUI::MessageBox::Type::Warning); return; } m_editor->update(); @@ -459,7 +459,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window) m_bytes_per_row_actions.set_exclusive(true); auto& bytes_per_row_menu = view_menu.add_submenu("Bytes per &Row"); for (int i = 8; i <= 32; i += 8) { - auto action = GUI::Action::create_checkable(String::number(i), [this, i](auto&) { + auto action = GUI::Action::create_checkable(DeprecatedString::number(i), [this, i](auto&) { m_editor->set_bytes_per_row(i); m_editor->update(); Config::write_i32("HexEditor"sv, "Layout"sv, "BytesPerRow"sv, i); diff --git a/Userland/Applications/HexEditor/HexEditorWidget.h b/Userland/Applications/HexEditor/HexEditorWidget.h index e1782d4832d..7695fb3a58b 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.h +++ b/Userland/Applications/HexEditor/HexEditorWidget.h @@ -41,12 +41,12 @@ private: virtual void drop_event(GUI::DropEvent&) override; RefPtr m_editor; - String m_path; - String m_name; - String m_extension; + DeprecatedString m_path; + DeprecatedString m_name; + DeprecatedString m_extension; int m_goto_history { 0 }; - String m_search_text; + DeprecatedString m_search_text; ByteBuffer m_search_buffer; int last_found_index() const { return m_last_found_index == -1 ? 0 : m_last_found_index; } int m_last_found_index { -1 }; diff --git a/Userland/Applications/HexEditor/SearchResultsModel.h b/Userland/Applications/HexEditor/SearchResultsModel.h index 99ba4329f55..c5adfca7a55 100644 --- a/Userland/Applications/HexEditor/SearchResultsModel.h +++ b/Userland/Applications/HexEditor/SearchResultsModel.h @@ -6,16 +6,16 @@ #pragma once +#include #include #include -#include #include #include #include struct Match { u64 offset; - String value; + DeprecatedString value; }; class SearchResultsModel final : public GUI::Model { @@ -40,7 +40,7 @@ public: return 2; } - String column_name(int column) const override + DeprecatedString column_name(int column) const override { switch (column) { case Column::Offset: @@ -63,7 +63,7 @@ public: auto& match = m_matches.at(index.row()); switch (index.column()) { case Column::Offset: - return String::formatted("{:#08X}", match.offset); + return DeprecatedString::formatted("{:#08X}", match.offset); case Column::Value: { Utf8View utf8_view(match.value); if (!utf8_view.validate()) diff --git a/Userland/Applications/HexEditor/ValueInspectorModel.h b/Userland/Applications/HexEditor/ValueInspectorModel.h index 0cddf740e23..7acf4a66456 100644 --- a/Userland/Applications/HexEditor/ValueInspectorModel.h +++ b/Userland/Applications/HexEditor/ValueInspectorModel.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include #include #include @@ -45,7 +45,7 @@ public: set_parsed_value(static_cast(i), ""); } - void set_parsed_value(ValueType type, String value) + void set_parsed_value(ValueType type, DeprecatedString value) { m_values[type] = value; } @@ -60,7 +60,7 @@ public: return 2; } - String column_name(int column) const override + DeprecatedString column_name(int column) const override { switch (column) { case Column::Type: @@ -71,7 +71,7 @@ public: VERIFY_NOT_REACHED(); } - String inspector_value_type_to_string(ValueType type) const + DeprecatedString inspector_value_type_to_string(ValueType type) const { switch (type) { case SignedByte: @@ -156,5 +156,5 @@ public: private: bool m_is_little_endian = false; - Array m_values = {}; + Array m_values = {}; }; diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp index ba480ed4837..397fe533dbf 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.cpp +++ b/Userland/Applications/ImageViewer/ViewWidget.cpp @@ -75,14 +75,14 @@ bool ViewWidget::is_previous_available() const return false; } -Vector ViewWidget::load_files_from_directory(String const& path) const +Vector ViewWidget::load_files_from_directory(DeprecatedString const& path) const { - Vector files_in_directory; + Vector files_in_directory; auto current_dir = LexicalPath(path).parent().string(); Core::DirIterator iterator(current_dir, Core::DirIterator::Flags::SkipDots); while (iterator.has_next()) { - String file = iterator.next_full_path(); + DeprecatedString file = iterator.next_full_path(); if (!Gfx::Bitmap::is_path_a_supported_image_format(file)) continue; files_in_directory.append(file); @@ -90,7 +90,7 @@ Vector ViewWidget::load_files_from_directory(String const& path) const return files_in_directory; } -void ViewWidget::set_path(String const& path) +void ViewWidget::set_path(DeprecatedString const& path) { m_path = path; m_files_in_same_dir = load_files_from_directory(path); @@ -151,10 +151,10 @@ void ViewWidget::mouseup_event(GUI::MouseEvent& event) GUI::AbstractZoomPanWidget::mouseup_event(event); } -void ViewWidget::load_from_file(String const& path) +void ViewWidget::load_from_file(DeprecatedString const& path) { auto show_error = [&] { - GUI::MessageBox::show(window(), String::formatted("Failed to open {}", path), "Cannot open image"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Failed to open {}", path), "Cannot open image"sv, GUI::MessageBox::Type::Error); }; auto file_or_error = Core::MappedFile::map(path); diff --git a/Userland/Applications/ImageViewer/ViewWidget.h b/Userland/Applications/ImageViewer/ViewWidget.h index fca9c12603e..b3a8d001f9b 100644 --- a/Userland/Applications/ImageViewer/ViewWidget.h +++ b/Userland/Applications/ImageViewer/ViewWidget.h @@ -30,12 +30,12 @@ public: virtual ~ViewWidget() override = default; Gfx::Bitmap const* bitmap() const { return m_bitmap.ptr(); } - String const& path() const { return m_path; } + DeprecatedString const& path() const { return m_path; } void set_toolbar_height(int height) { m_toolbar_height = height; } int toolbar_height() { return m_toolbar_height; } bool scaled_for_first_image() { return m_scaled_for_first_image; } void set_scaled_for_first_image(bool val) { m_scaled_for_first_image = val; } - void set_path(String const& path); + void set_path(DeprecatedString const& path); void resize_window(); void set_scaling_mode(Gfx::Painter::ScalingMode); @@ -46,7 +46,7 @@ public: void flip(Gfx::Orientation); void rotate(Gfx::RotationDirection); void navigate(Directions); - void load_from_file(String const&); + void load_from_file(DeprecatedString const&); Function on_doubleclick; Function on_drop; @@ -63,9 +63,9 @@ private: void set_bitmap(Gfx::Bitmap const* bitmap); void animate(); - Vector load_files_from_directory(String const& path) const; + Vector load_files_from_directory(DeprecatedString const& path) const; - String m_path; + DeprecatedString m_path; RefPtr m_bitmap; Optional m_decoded_image; @@ -75,7 +75,7 @@ private: int m_toolbar_height { 28 }; bool m_scaled_for_first_image { false }; - Vector m_files_in_same_dir; + Vector m_files_in_same_dir; Optional m_current_index; Gfx::Painter::ScalingMode m_scaling_mode { Gfx::Painter::ScalingMode::NearestNeighbor }; }; diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index ceeae2c0d9d..1a37a3ac4f4 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -74,7 +74,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return; } - window->set_title(String::formatted("{} {} {}% - Image Viewer", widget->path(), widget->bitmap()->size().to_string(), (int)(scale * 100))); + window->set_title(DeprecatedString::formatted("{} {} {}% - Image Viewer", widget->path(), widget->bitmap()->size().to_string(), (int)(scale * 100))); if (!widget->scaled_for_first_image()) { widget->set_scaled_for_first_image(true); @@ -123,7 +123,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return; auto msgbox_result = GUI::MessageBox::show(window, - String::formatted("Are you sure you want to delete {}?", path), + DeprecatedString::formatted("Are you sure you want to delete {}?", path), "Confirm deletion"sv, GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); @@ -134,7 +134,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto unlinked_or_error = Core::System::unlink(widget->path()); if (unlinked_or_error.is_error()) { GUI::MessageBox::show(window, - String::formatted("unlink({}) failed: {}", path, unlinked_or_error.error()), + DeprecatedString::formatted("unlink({}) failed: {}", path, unlinked_or_error.error()), "Delete failed"sv, GUI::MessageBox::Type::Error); @@ -171,7 +171,7 @@ ErrorOr serenity_main(Main::Arguments arguments) [&](auto&) { if (!GUI::Desktop::the().set_wallpaper(widget->bitmap(), widget->path())) { GUI::MessageBox::show(window, - String::formatted("set_wallpaper({}) failed", widget->path()), + DeprecatedString::formatted("set_wallpaper({}) failed", widget->path()), "Could not set wallpaper"sv, GUI::MessageBox::Type::Error); } diff --git a/Userland/Applications/KeyboardMapper/KeyPositions.h b/Userland/Applications/KeyboardMapper/KeyPositions.h index a94afd2bc76..9a976be5855 100644 --- a/Userland/Applications/KeyboardMapper/KeyPositions.h +++ b/Userland/Applications/KeyboardMapper/KeyPositions.h @@ -6,7 +6,7 @@ #pragma once -#include +#include struct KeyPosition { u32 scancode; @@ -16,7 +16,7 @@ struct KeyPosition { int height; bool enabled; int map_index; - String name; + DeprecatedString name; }; #define KEY_COUNT 63 diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp index dccc76b064b..c8c32eb5eb3 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp @@ -57,7 +57,7 @@ void KeyboardMapperWidget::create_frame() tmp_button.set_enabled(keys[i].enabled); tmp_button.on_click = [this, &tmp_button]() { - String value; + DeprecatedString value; if (GUI::InputBox::show(window(), value, "New Character:"sv, "Select Character"sv) == GUI::InputBox::ExecResult::OK) { int i = m_keys.find_first_index(&tmp_button).value_or(0); VERIFY(i > 0); @@ -127,7 +127,7 @@ u32* KeyboardMapperWidget::map_from_name(const StringView map_name) return map; } -ErrorOr KeyboardMapperWidget::load_map_from_file(String const& filename) +ErrorOr KeyboardMapperWidget::load_map_from_file(DeprecatedString const& filename) { auto character_map = TRY(Keyboard::CharacterMapFile::load_from_file(filename)); @@ -149,7 +149,7 @@ ErrorOr KeyboardMapperWidget::load_map_from_system() { auto character_map = TRY(Keyboard::CharacterMap::fetch_system_map()); - m_filename = String::formatted("/res/keymaps/{}.json", character_map.character_map_name()); + m_filename = DeprecatedString::formatted("/res/keymaps/{}.json", character_map.character_map_name()); m_character_map = character_map.character_map_data(); set_current_map("map"); @@ -171,7 +171,7 @@ ErrorOr KeyboardMapperWidget::save_to_file(StringView filename) { JsonObject map_json; - auto add_array = [&](String name, u32* values) { + auto add_array = [&](DeprecatedString name, u32* values) { JsonArray items; for (int i = 0; i < 90; i++) { StringBuilder sb; @@ -191,7 +191,7 @@ ErrorOr KeyboardMapperWidget::save_to_file(StringView filename) add_array("shift_altgr_map", m_character_map.shift_altgr_map); // Write to file. - String file_content = map_json.to_string(); + DeprecatedString file_content = map_json.to_string(); auto file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Write)); TRY(file->write(file_content.bytes())); file->close(); @@ -236,7 +236,7 @@ void KeyboardMapperWidget::keyup_event(GUI::KeyEvent& event) } } -void KeyboardMapperWidget::set_current_map(const String current_map) +void KeyboardMapperWidget::set_current_map(const DeprecatedString current_map) { m_current_map_name = current_map; u32* map = map_from_name(m_current_map_name); diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h index ca51cd18b2b..5ada870a38b 100644 --- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h +++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.h @@ -18,7 +18,7 @@ public: virtual ~KeyboardMapperWidget() override = default; void create_frame(); - ErrorOr load_map_from_file(String const&); + ErrorOr load_map_from_file(DeprecatedString const&); ErrorOr load_map_from_system(); ErrorOr save(); ErrorOr save_to_file(StringView); @@ -31,7 +31,7 @@ protected: virtual void keydown_event(GUI::KeyEvent&) override; virtual void keyup_event(GUI::KeyEvent&) override; - void set_current_map(const String); + void set_current_map(const DeprecatedString); void update_window_title(); private: @@ -43,8 +43,8 @@ private: u32* map_from_name(const StringView map_name); void update_modifier_radio_buttons(GUI::KeyEvent&); - String m_filename; + DeprecatedString m_filename; Keyboard::CharacterMapData m_character_map; - String m_current_map_name; + DeprecatedString m_current_map_name; bool m_automatic_modifier { false }; }; diff --git a/Userland/Applications/KeyboardMapper/main.cpp b/Userland/Applications/KeyboardMapper/main.cpp index 7fa5656126a..f2cedca48c6 100644 --- a/Userland/Applications/KeyboardMapper/main.cpp +++ b/Userland/Applications/KeyboardMapper/main.cpp @@ -50,7 +50,7 @@ ErrorOr serenity_main(Main::Arguments arguments) if (!keyboard_mapper_widget->request_close()) return; - Optional path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv); + Optional path = GUI::FilePicker::get_open_filepath(window, "Open"sv, "/res/keymaps/"sv); if (!path.has_value()) return; @@ -67,8 +67,8 @@ ErrorOr serenity_main(Main::Arguments arguments) }); auto save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) { - String name = "Unnamed"; - Optional save_path = GUI::FilePicker::get_save_filepath(window, name, "json"); + DeprecatedString name = "Unnamed"; + Optional save_path = GUI::FilePicker::get_save_filepath(window, name, "json"); if (!save_path.has_value()) return; diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp index 5687a96693e..c8c89699585 100644 --- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp +++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.cpp @@ -33,7 +33,7 @@ class KeymapSelectionDialog final : public GUI::Dialog { public: virtual ~KeymapSelectionDialog() override = default; - static String select_keymap(Window* parent_window, Vector const& selected_keymaps) + static DeprecatedString select_keymap(Window* parent_window, Vector const& selected_keymaps) { auto dialog = KeymapSelectionDialog::construct(parent_window, selected_keymaps); dialog->set_title("Add a keymap"); @@ -42,13 +42,13 @@ public: return dialog->selected_keymap(); } - return String::empty(); + return DeprecatedString::empty(); } - String selected_keymap() { return m_selected_keymap; } + DeprecatedString selected_keymap() { return m_selected_keymap; } private: - KeymapSelectionDialog(Window* parent_window, Vector const& selected_keymaps) + KeymapSelectionDialog(Window* parent_window, Vector const& selected_keymaps) : Dialog(parent_window) { auto& widget = set_main_widget(); @@ -62,7 +62,7 @@ private: Core::DirIterator iterator("/res/keymaps/", Core::DirIterator::Flags::SkipDots); if (iterator.has_error()) { - GUI::MessageBox::show(nullptr, String::formatted("Error on reading mapping file list: {}", iterator.error_string()), "Keyboard settings"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(nullptr, DeprecatedString::formatted("Error on reading mapping file list: {}", iterator.error_string()), "Keyboard settings"sv, GUI::MessageBox::Type::Error); GUI::Application::the()->quit(-1); } @@ -79,7 +79,7 @@ private: m_keymaps_combobox = *widget.find_descendant_of_type_named("keymaps_combobox"); m_keymaps_combobox->set_only_allow_values_from_model(true); - m_keymaps_combobox->set_model(*GUI::ItemListModel::create(m_character_map_files)); + m_keymaps_combobox->set_model(*GUI::ItemListModel::create(m_character_map_files)); m_keymaps_combobox->set_selected_index(0); m_keymaps_combobox->on_change = [&](auto& keymap, auto) { @@ -98,8 +98,8 @@ private: } RefPtr m_keymaps_combobox; - Vector m_character_map_files; - String m_selected_keymap; + Vector m_character_map_files; + DeprecatedString m_selected_keymap; }; class KeymapModel final : public GUI::Model { @@ -111,7 +111,7 @@ public: GUI::Variant data(GUI::ModelIndex const& index, GUI::ModelRole role) const override { - String const& data = m_data.at(index.row()); + DeprecatedString const& data = m_data.at(index.row()); if (role == GUI::ModelRole::Font && data == m_active_keymap) return Gfx::FontDatabase::default_font().bold_variant(); @@ -124,30 +124,30 @@ public: invalidate(); } - void add_keymap(String const& keymap) + void add_keymap(DeprecatedString const& keymap) { m_data.append(keymap); invalidate(); } - void set_active_keymap(String const& keymap) + void set_active_keymap(DeprecatedString const& keymap) { m_active_keymap = keymap; invalidate(); } - String const& active_keymap() { return m_active_keymap; } + DeprecatedString const& active_keymap() { return m_active_keymap; } - String const& keymap_at(size_t index) + DeprecatedString const& keymap_at(size_t index) { return m_data[index]; } - Vector const& keymaps() const { return m_data; } + Vector const& keymaps() const { return m_data; } private: - Vector m_data; - String m_active_keymap; + Vector m_data; + DeprecatedString m_active_keymap; }; KeyboardSettingsWidget::KeyboardSettingsWidget() @@ -280,8 +280,8 @@ void KeyboardSettingsWidget::apply_settings() Config::write_bool("KeyboardSettings"sv, "StartupEnable"sv, "NumLock"sv, m_num_lock_checkbox->is_checked()); } -void KeyboardSettingsWidget::set_keymaps(Vector const& keymaps, String const& active_keymap) +void KeyboardSettingsWidget::set_keymaps(Vector const& keymaps, DeprecatedString const& active_keymap) { - auto keymaps_string = String::join(',', keymaps); + auto keymaps_string = DeprecatedString::join(',', keymaps); GUI::Process::spawn_or_show_error(window(), "/bin/keymap"sv, Array { "-s", keymaps_string.characters(), "-m", active_keymap.characters() }); } diff --git a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.h b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.h index 1c22386c64e..ff2dba31b90 100644 --- a/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.h +++ b/Userland/Applications/KeyboardSettings/KeyboardSettingsWidget.h @@ -26,11 +26,11 @@ public: private: KeyboardSettingsWidget(); - void set_keymaps(Vector const& keymaps, String const& active_keymap); + void set_keymaps(Vector const& keymaps, DeprecatedString const& active_keymap); - Vector m_initial_keymap_list; + Vector m_initial_keymap_list; - String m_initial_active_keymap; + DeprecatedString m_initial_active_keymap; RefPtr m_selected_keymaps_listview; RefPtr m_active_keymap_label; diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp index 16a7942d6fb..87425cc5165 100644 --- a/Userland/Applications/Magnifier/main.cpp +++ b/Userland/Applications/Magnifier/main.cpp @@ -62,7 +62,7 @@ ErrorOr serenity_main(Main::Arguments arguments) }))); TRY(file_menu->try_add_action(GUI::CommonActions::make_save_as_action([&](auto&) { - AK::String filename = "file for saving"; + AK::DeprecatedString filename = "file for saving"; auto do_save = [&]() -> ErrorOr { auto response = FileSystemAccessClient::Client::the().try_save_file(window, "Capture", "png"); if (response.is_error()) diff --git a/Userland/Applications/Mail/AccountHolder.cpp b/Userland/Applications/Mail/AccountHolder.cpp index e9f56a973ba..ed41e8d4fb8 100644 --- a/Userland/Applications/Mail/AccountHolder.cpp +++ b/Userland/Applications/Mail/AccountHolder.cpp @@ -12,7 +12,7 @@ AccountHolder::AccountHolder() m_mailbox_tree_model = MailboxTreeModel::create(*this); } -void AccountHolder::add_account_with_name_and_mailboxes(String name, Vector const& mailboxes) +void AccountHolder::add_account_with_name_and_mailboxes(DeprecatedString name, Vector const& mailboxes) { auto account = AccountNode::create(move(name)); diff --git a/Userland/Applications/Mail/AccountHolder.h b/Userland/Applications/Mail/AccountHolder.h index fa694f271a7..91a4cb6259c 100644 --- a/Userland/Applications/Mail/AccountHolder.h +++ b/Userland/Applications/Mail/AccountHolder.h @@ -8,9 +8,9 @@ #pragma once #include "MailboxTreeModel.h" +#include #include #include -#include #include class BaseNode : public RefCounted { @@ -22,7 +22,7 @@ class MailboxNode; class AccountNode final : public BaseNode { public: - static NonnullRefPtr create(String name) + static NonnullRefPtr create(DeprecatedString name) { return adopt_ref(*new AccountNode(move(name))); } @@ -35,21 +35,21 @@ public: } NonnullRefPtrVector const& mailboxes() const { return m_mailboxes; } - String const& name() const { return m_name; } + DeprecatedString const& name() const { return m_name; } private: - explicit AccountNode(String name) + explicit AccountNode(DeprecatedString name) : m_name(move(name)) { } - String m_name; + DeprecatedString m_name; NonnullRefPtrVector m_mailboxes; }; class MailboxNode final : public BaseNode { public: - static NonnullRefPtr create(AccountNode const& associated_account, IMAP::ListItem const& mailbox, String display_name) + static NonnullRefPtr create(AccountNode const& associated_account, IMAP::ListItem const& mailbox, DeprecatedString display_name) { return adopt_ref(*new MailboxNode(associated_account, mailbox, move(display_name))); } @@ -57,8 +57,8 @@ public: virtual ~MailboxNode() override = default; AccountNode const& associated_account() const { return m_associated_account; } - String const& select_name() const { return m_mailbox.name; } - String const& display_name() const { return m_display_name; } + DeprecatedString const& select_name() const { return m_mailbox.name; } + DeprecatedString const& display_name() const { return m_display_name; } IMAP::ListItem const& mailbox() const { return m_mailbox; } bool has_parent() const { return m_parent; } @@ -70,7 +70,7 @@ public: void add_child(NonnullRefPtr child) { m_children.append(child); } private: - MailboxNode(AccountNode const& associated_account, IMAP::ListItem const& mailbox, String display_name) + MailboxNode(AccountNode const& associated_account, IMAP::ListItem const& mailbox, DeprecatedString display_name) : m_associated_account(associated_account) , m_mailbox(mailbox) , m_display_name(move(display_name)) @@ -79,7 +79,7 @@ private: AccountNode const& m_associated_account; IMAP::ListItem m_mailbox; - String m_display_name; + DeprecatedString m_display_name; NonnullRefPtrVector m_children; RefPtr m_parent; @@ -94,7 +94,7 @@ public: return adopt_own(*new AccountHolder()); } - void add_account_with_name_and_mailboxes(String, Vector const&); + void add_account_with_name_and_mailboxes(DeprecatedString, Vector const&); NonnullRefPtrVector const& accounts() const { return m_accounts; } MailboxTreeModel& mailbox_tree_model() { return *m_mailbox_tree_model; } diff --git a/Userland/Applications/Mail/InboxModel.cpp b/Userland/Applications/Mail/InboxModel.cpp index c5a1a392950..9f62c7a8d47 100644 --- a/Userland/Applications/Mail/InboxModel.cpp +++ b/Userland/Applications/Mail/InboxModel.cpp @@ -17,7 +17,7 @@ int InboxModel::row_count(GUI::ModelIndex const&) const return m_entries.size(); } -String InboxModel::column_name(int column_index) const +DeprecatedString InboxModel::column_name(int column_index) const { switch (column_index) { case Column::From: diff --git a/Userland/Applications/Mail/InboxModel.h b/Userland/Applications/Mail/InboxModel.h index a878d77e30e..113f739c054 100644 --- a/Userland/Applications/Mail/InboxModel.h +++ b/Userland/Applications/Mail/InboxModel.h @@ -11,8 +11,8 @@ #include struct InboxEntry { - String from; - String subject; + DeprecatedString from; + DeprecatedString subject; }; class InboxModel final : public GUI::Model { @@ -32,7 +32,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index d64b360db53..0d80634b175 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -43,7 +43,7 @@ MailWidget::MailWidget() if (!Desktop::Launcher::open(url)) { GUI::MessageBox::show( window(), - String::formatted("The link to '{}' could not be opened.", url), + DeprecatedString::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error); } @@ -125,7 +125,7 @@ bool MailWidget::connect_and_login() auto maybe_imap_client = tls ? IMAP::Client::connect_tls(server, port) : IMAP::Client::connect_plaintext(server, port); if (maybe_imap_client.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("Failed to connect to '{}:{}' over {}: {}", server, port, tls ? "TLS" : "Plaintext", maybe_imap_client.error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to connect to '{}:{}' over {}: {}", server, port, tls ? "TLS" : "Plaintext", maybe_imap_client.error())); return false; } m_imap_client = maybe_imap_client.release_value(); @@ -138,7 +138,7 @@ bool MailWidget::connect_and_login() if (response.status() != IMAP::ResponseStatus::OK) { dbgln("Failed to login. The server says: '{}'", response.response_text()); - GUI::MessageBox::show_error(window(), String::formatted("Failed to login. The server says: '{}'", response.response_text())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to login. The server says: '{}'", response.response_text())); return false; } @@ -146,7 +146,7 @@ bool MailWidget::connect_and_login() if (response.status() != IMAP::ResponseStatus::OK) { dbgln("Failed to retrieve mailboxes. The server says: '{}'", response.response_text()); - GUI::MessageBox::show_error(window(), String::formatted("Failed to retrieve mailboxes. The server says: '{}'", response.response_text())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve mailboxes. The server says: '{}'", response.response_text())); return false; } @@ -257,7 +257,7 @@ void MailWidget::selected_mailbox() if (response.status() != IMAP::ResponseStatus::OK) { dbgln("Failed to select mailbox. The server says: '{}'", response.response_text()); - GUI::MessageBox::show_error(window(), String::formatted("Failed to select mailbox. The server says: '{}'", response.response_text())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to select mailbox. The server says: '{}'", response.response_text())); return; } @@ -284,7 +284,7 @@ void MailWidget::selected_mailbox() if (response.status() != IMAP::ResponseStatus::OK) { dbgln("Failed to retrieve subject/from for e-mails. The server says: '{}'", response.response_text()); - GUI::MessageBox::show_error(window(), String::formatted("Failed to retrieve e-mails. The server says: '{}'", response.response_text())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve e-mails. The server says: '{}'", response.response_text())); return; } @@ -294,7 +294,7 @@ void MailWidget::selected_mailbox() auto& response_data = fetch_data.get(); auto& body_data = response_data.body_data(); - auto data_item_has_header = [](IMAP::FetchCommand::DataItem const& data_item, String const& search_header) { + auto data_item_has_header = [](IMAP::FetchCommand::DataItem const& data_item, DeprecatedString const& search_header) { if (!data_item.section.has_value()) return false; if (data_item.section->type != IMAP::FetchCommand::DataItem::SectionType::HeaderFields) @@ -307,14 +307,14 @@ void MailWidget::selected_mailbox() return header_iterator != data_item.section->headers->end(); }; - auto subject_iterator = body_data.find_if([&data_item_has_header](Tuple>& data) { + auto subject_iterator = body_data.find_if([&data_item_has_header](Tuple>& data) { auto const data_item = data.get<0>(); return data_item_has_header(data_item, "Subject"); }); VERIFY(subject_iterator != body_data.end()); - auto from_iterator = body_data.find_if([&data_item_has_header](Tuple>& data) { + auto from_iterator = body_data.find_if([&data_item_has_header](Tuple>& data) { auto const data_item = data.get<0>(); return data_item_has_header(data_item, "From"); }); @@ -323,7 +323,7 @@ void MailWidget::selected_mailbox() // FIXME: All of the following doesn't really follow RFC 2822: https://datatracker.ietf.org/doc/html/rfc2822 - auto parse_and_unfold = [](String const& value) { + auto parse_and_unfold = [](DeprecatedString const& value) { GenericLexer lexer(value); StringBuilder builder; @@ -352,7 +352,7 @@ void MailWidget::selected_mailbox() auto& subject_iterator_value = subject_iterator->get<1>().value(); auto subject_index = subject_iterator_value.find("Subject:"sv); - String subject; + DeprecatedString subject; if (subject_index.has_value()) { auto potential_subject = subject_iterator_value.substring(subject_index.value()); auto subject_parts = potential_subject.split_limit(':', 2); @@ -400,12 +400,12 @@ void MailWidget::selected_email_to_load() if (fetch_response.status() != IMAP::ResponseStatus::OK) { dbgln("Failed to retrieve the body structure of the selected e-mail. The server says: '{}'", fetch_response.response_text()); - GUI::MessageBox::show_error(window(), String::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text())); return; } Vector selected_alternative_position; - String selected_alternative_encoding; + DeprecatedString selected_alternative_encoding; auto& response_data = fetch_response.data().fetch_data().last().get(); @@ -461,7 +461,7 @@ void MailWidget::selected_email_to_load() if (fetch_response.status() != IMAP::ResponseStatus::OK) { dbgln("Failed to retrieve the body of the selected e-mail. The server says: '{}'", fetch_response.response_text()); - GUI::MessageBox::show_error(window(), String::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to retrieve the selected e-mail. The server says: '{}'", fetch_response.response_text())); return; } @@ -481,7 +481,7 @@ void MailWidget::selected_email_to_load() } auto& body_data = fetch_response_data.body_data(); - auto body_text_part_iterator = body_data.find_if([](Tuple>& data) { + auto body_text_part_iterator = body_data.find_if([](Tuple>& data) { const auto data_item = data.get<0>(); return data_item.section.has_value() && data_item.section->type == IMAP::FetchCommand::DataItem::SectionType::Parts; }); @@ -489,7 +489,7 @@ void MailWidget::selected_email_to_load() auto& encoded_data = body_text_part_iterator->get<1>().value(); - String decoded_data; + DeprecatedString decoded_data; // FIXME: String uses char internally, so 8bit shouldn't be stored in it. // However, it works for now. @@ -503,7 +503,7 @@ void MailWidget::selected_email_to_load() decoded_data = IMAP::decode_quoted_printable(encoded_data); } else { dbgln("Mail: Unimplemented decoder for encoding: {}", selected_alternative_encoding); - GUI::MessageBox::show(window(), String::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported"sv, GUI::MessageBox::Type::Information); + GUI::MessageBox::show(window(), DeprecatedString::formatted("The e-mail encoding '{}' is currently unsupported.", selected_alternative_encoding), "Unsupported"sv, GUI::MessageBox::Type::Information); return; } diff --git a/Userland/Applications/MailSettings/MailSettingsWidget.cpp b/Userland/Applications/MailSettings/MailSettingsWidget.cpp index 040ad3dc7b4..0a3d75dd209 100644 --- a/Userland/Applications/MailSettings/MailSettingsWidget.cpp +++ b/Userland/Applications/MailSettings/MailSettingsWidget.cpp @@ -53,7 +53,7 @@ MailSettingsWidget::MailSettingsWidget() m_port_combobox = *find_descendant_of_type_named("port_input"); m_port_combobox->set_text(Config::read_string("Mail"sv, "Connection"sv, "Port"sv, "993"sv)); m_port_combobox->set_only_allow_values_from_model(false); - m_port_combobox->set_model(*GUI::ItemListModel::create(m_common_ports)); + m_port_combobox->set_model(*GUI::ItemListModel::create(m_common_ports)); m_port_combobox->on_change = [&](auto, auto) { set_modified(true); }; diff --git a/Userland/Applications/MailSettings/MailSettingsWidget.h b/Userland/Applications/MailSettings/MailSettingsWidget.h index 77c45f1038b..aef4752a8b3 100644 --- a/Userland/Applications/MailSettings/MailSettingsWidget.h +++ b/Userland/Applications/MailSettings/MailSettingsWidget.h @@ -21,11 +21,11 @@ public: private: MailSettingsWidget(); - String m_server; - String m_port; + DeprecatedString m_server; + DeprecatedString m_port; bool m_tls { false }; - String m_email; - Vector m_common_ports; + DeprecatedString m_email; + Vector m_common_ports; RefPtr m_server_inputbox; RefPtr m_port_combobox; diff --git a/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp b/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp index d97c1913c23..8501aceba45 100644 --- a/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp +++ b/Userland/Applications/MouseSettings/HighlightPreviewWidget.cpp @@ -5,7 +5,7 @@ */ #include "HighlightPreviewWidget.h" -#include +#include #include #include #include @@ -22,7 +22,7 @@ HighlightPreviewWidget::HighlightPreviewWidget(Gfx::Palette const& palette) ErrorOr HighlightPreviewWidget::reload_cursor() { auto cursor_theme = GUI::ConnectionToWindowServer::the().get_cursor_theme(); - auto theme_path = String::formatted("/res/cursor-themes/{}/{}", cursor_theme, "Config.ini"); + auto theme_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}", cursor_theme, "Config.ini"); auto cursor_theme_config = TRY(Core::ConfigFile::open(theme_path)); auto load_bitmap = [](StringView path, StringView default_path) { auto maybe_bitmap = Gfx::Bitmap::try_load_from_file(path); @@ -31,7 +31,7 @@ ErrorOr HighlightPreviewWidget::reload_cursor() return Gfx::Bitmap::try_load_from_file(default_path); }; constexpr auto default_cursor_path = "/res/cursor-themes/Default/arrow.x2y2.png"sv; - auto cursor_path = String::formatted("/res/cursor-themes/{}/{}", + auto cursor_path = DeprecatedString::formatted("/res/cursor-themes/{}/{}", cursor_theme, cursor_theme_config->read_entry("Cursor", "Arrow")); m_cursor_bitmap = TRY(load_bitmap(cursor_path, default_cursor_path)); m_cursor_params = Gfx::CursorParams::parse_from_filename(cursor_path, m_cursor_bitmap->rect().center()).constrained(*m_cursor_bitmap); diff --git a/Userland/Applications/MouseSettings/MouseWidget.cpp b/Userland/Applications/MouseSettings/MouseWidget.cpp index b6a467523ac..c609714dbbc 100644 --- a/Userland/Applications/MouseSettings/MouseWidget.cpp +++ b/Userland/Applications/MouseSettings/MouseWidget.cpp @@ -89,10 +89,10 @@ void MouseWidget::reset_default_values() void MouseWidget::update_speed_label() { - m_speed_label->set_text(String::formatted("{} %", m_speed_slider->value())); + m_speed_label->set_text(DeprecatedString::formatted("{} %", m_speed_slider->value())); } void MouseWidget::update_double_click_speed_label() { - m_double_click_speed_label->set_text(String::formatted("{} ms", m_double_click_speed_slider->value())); + m_double_click_speed_label->set_text(DeprecatedString::formatted("{} ms", m_double_click_speed_slider->value())); } diff --git a/Userland/Applications/MouseSettings/ThemeWidget.cpp b/Userland/Applications/MouseSettings/ThemeWidget.cpp index 7c6c12661f9..56ab89be704 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.cpp +++ b/Userland/Applications/MouseSettings/ThemeWidget.cpp @@ -15,7 +15,7 @@ #include #include -String MouseCursorModel::column_name(int column_index) const +DeprecatedString MouseCursorModel::column_name(int column_index) const { switch (column_index) { case Column::Bitmap: @@ -50,7 +50,7 @@ void MouseCursorModel::invalidate() return; m_cursors.clear(); - Core::DirIterator iterator(String::formatted("/res/cursor-themes/{}", m_theme_name), Core::DirIterator::Flags::SkipDots); + Core::DirIterator iterator(DeprecatedString::formatted("/res/cursor-themes/{}", m_theme_name), Core::DirIterator::Flags::SkipDots); while (iterator.has_next()) { auto path = iterator.next_full_path(); @@ -90,7 +90,7 @@ void ThemeModel::invalidate() while (iterator.has_next()) { auto path = iterator.next_path(); - if (access(String::formatted("/res/cursor-themes/{}/Config.ini", path).characters(), R_OK) == 0) + if (access(DeprecatedString::formatted("/res/cursor-themes/{}/Config.ini", path).characters(), R_OK) == 0) m_themes.append(path); } Model::invalidate(); @@ -119,7 +119,7 @@ ThemeWidget::ThemeWidget() m_mouse_cursor_model->change_theme(theme_name); m_theme_name_box = find_descendant_of_type_named("theme_name_box"); - m_theme_name_box->on_change = [this](String const& value, GUI::ModelIndex const&) { + m_theme_name_box->on_change = [this](DeprecatedString const& value, GUI::ModelIndex const&) { m_mouse_cursor_model->change_theme(value); set_modified(true); }; diff --git a/Userland/Applications/MouseSettings/ThemeWidget.h b/Userland/Applications/MouseSettings/ThemeWidget.h index 27c6b5ee9a2..4b4deac025d 100644 --- a/Userland/Applications/MouseSettings/ThemeWidget.h +++ b/Userland/Applications/MouseSettings/ThemeWidget.h @@ -25,11 +25,11 @@ public: virtual int row_count(const GUI::ModelIndex&) const override { return m_cursors.size(); } virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } - virtual String column_name(int column_index) const override; + virtual DeprecatedString column_name(int column_index) const override; virtual GUI::Variant data(const GUI::ModelIndex& index, GUI::ModelRole role) const override; virtual void invalidate() override; - void change_theme(String const& name) + void change_theme(DeprecatedString const& name) { m_theme_name = name; invalidate(); @@ -40,13 +40,13 @@ private: struct Cursor { RefPtr bitmap; - String path; - String name; + DeprecatedString path; + DeprecatedString name; Gfx::CursorParams params; }; Vector m_cursors; - String m_theme_name; + DeprecatedString m_theme_name; }; class ThemeModel final : public GUI::Model { @@ -59,7 +59,7 @@ public: virtual void invalidate() override; private: - Vector m_themes; + Vector m_themes; }; class ThemeWidget final : public GUI::SettingsWindow::Tab { diff --git a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp index 33b96b9ccfe..ba6d9884bdd 100644 --- a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp +++ b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.cpp @@ -6,9 +6,9 @@ #include "NetworkSettingsWidget.h" +#include #include #include -#include #include #include #include @@ -100,8 +100,8 @@ NetworkSettingsWidget::NetworkSettingsWidget() index++; }); - m_adapters_combobox->set_model(GUI::ItemListModel::create(m_adapter_names)); - m_adapters_combobox->on_change = [this](String const& text, GUI::ModelIndex const&) { + m_adapters_combobox->set_model(GUI::ItemListModel::create(m_adapter_names)); + m_adapters_combobox->on_change = [this](DeprecatedString const& text, GUI::ModelIndex const&) { on_switch_adapter(text); }; auto const& selected_adapter = selected_adapter_index; @@ -110,7 +110,7 @@ NetworkSettingsWidget::NetworkSettingsWidget() on_switch_adapter(m_adapter_names[selected_adapter_index]); } -void NetworkSettingsWidget::on_switch_adapter(String const& adapter) +void NetworkSettingsWidget::on_switch_adapter(DeprecatedString const& adapter) { auto& adapter_data = m_network_adapters.get(adapter).value(); m_current_adapter_data = &adapter_data; @@ -142,11 +142,11 @@ void NetworkSettingsWidget::apply_settings() config_file->write_bool_entry(adapter_data.key, "DHCP", adapter_data.value.dhcp); if (adapter_data.value.enabled && !adapter_data.value.dhcp) { if (!IPv4Address::from_string(adapter_data.value.ip_address).has_value()) { - GUI::MessageBox::show_error(window(), String::formatted("Invalid IPv4 address for adapter {}", adapter_data.key)); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Invalid IPv4 address for adapter {}", adapter_data.key)); return; } if (!IPv4Address::from_string(adapter_data.value.default_gateway).has_value()) { - GUI::MessageBox::show_error(window(), String::formatted("Invalid IPv4 gateway for adapter {}", adapter_data.key)); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Invalid IPv4 gateway for adapter {}", adapter_data.key)); return; } } @@ -158,7 +158,7 @@ void NetworkSettingsWidget::apply_settings() GUI::Process::spawn_or_show_error(window(), "/bin/NetworkServer"sv); } -void NetworkSettingsWidget::switch_adapter(String const& adapter) +void NetworkSettingsWidget::switch_adapter(DeprecatedString const& adapter) { m_adapters_combobox->set_text(adapter, GUI::AllowCallback::No); on_switch_adapter(adapter); diff --git a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.h b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.h index 6f7f9493132..fb55b06ea52 100644 --- a/Userland/Applications/NetworkSettings/NetworkSettingsWidget.h +++ b/Userland/Applications/NetworkSettings/NetworkSettingsWidget.h @@ -17,7 +17,7 @@ class NetworkSettingsWidget : public GUI::SettingsWindow::Tab { public: virtual void apply_settings() override; - void switch_adapter(String const& adapter); + void switch_adapter(DeprecatedString const& adapter); private: NetworkSettingsWidget(); @@ -25,16 +25,16 @@ private: struct NetworkAdapterData { bool enabled = false; bool dhcp = false; - String ip_address; + DeprecatedString ip_address; int cidr = 0; - String default_gateway; + DeprecatedString default_gateway; }; - void on_switch_adapter(String const& adapter); + void on_switch_adapter(DeprecatedString const& adapter); void on_switch_enabled_or_dhcp(); - HashMap m_network_adapters; - Vector m_adapter_names; + HashMap m_network_adapters; + Vector m_adapter_names; NetworkAdapterData* m_current_adapter_data = nullptr; RefPtr m_enabled_checkbox; diff --git a/Userland/Applications/NetworkSettings/main.cpp b/Userland/Applications/NetworkSettings/main.cpp index d23906cd2dc..a05a0a46350 100644 --- a/Userland/Applications/NetworkSettings/main.cpp +++ b/Userland/Applications/NetworkSettings/main.cpp @@ -29,7 +29,7 @@ ErrorOr serenity_main(Main::Arguments args) TRY(Core::System::unveil("/tmp/portal/window", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); - String adapter; + DeprecatedString adapter; Core::ArgsParser parser; parser.add_positional_argument(adapter, "Adapter to display settings for", "adapter", Core::ArgsParser::Required::No); diff --git a/Userland/Applications/PDFViewer/NumericInput.cpp b/Userland/Applications/PDFViewer/NumericInput.cpp index fcd5769e5ca..b5290e36c3a 100644 --- a/Userland/Applications/PDFViewer/NumericInput.cpp +++ b/Userland/Applications/PDFViewer/NumericInput.cpp @@ -70,7 +70,7 @@ void NumericInput::set_max_number(i32 number) void NumericInput::on_focus_lost() { if (m_needs_text_reset) { - set_text(String::number(m_current_number)); + set_text(DeprecatedString::number(m_current_number)); m_needs_text_reset = false; } if (on_number_changed) @@ -83,7 +83,7 @@ void NumericInput::set_current_number(i32 number, GUI::AllowCallback allow_callb return; m_current_number = clamp(number, m_min_number, m_max_number); - set_text(String::number(m_current_number)); + set_text(DeprecatedString::number(m_current_number)); if (on_number_changed && allow_callback == GUI::AllowCallback::Yes) on_number_changed(m_current_number); } diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index 159e3676357..1af1d1e0447 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -184,7 +184,7 @@ void PDFViewerWidget::initialize_toolbar(GUI::Toolbar& toolbar) void PDFViewerWidget::open_file(Core::File& file) { - window()->set_title(String::formatted("{} - PDF Viewer", file.filename())); + window()->set_title(DeprecatedString::formatted("{} - PDF Viewer", file.filename())); auto handle_error = [&](PDF::PDFErrorOr maybe_error) { if (maybe_error.is_error()) { @@ -214,7 +214,7 @@ void PDFViewerWidget::open_file(Core::File& file) if (handle_error(m_viewer->set_document(document))) return; - m_total_page_label->set_text(String::formatted("of {}", document->get_page_count())); + m_total_page_label->set_text(DeprecatedString::formatted("of {}", document->get_page_count())); m_page_text_box->set_enabled(true); m_page_text_box->set_current_number(1, GUI::AllowCallback::No); diff --git a/Userland/Applications/PartitionEditor/PartitionModel.cpp b/Userland/Applications/PartitionEditor/PartitionModel.cpp index a14bf02e915..f6cf48cf49a 100644 --- a/Userland/Applications/PartitionEditor/PartitionModel.cpp +++ b/Userland/Applications/PartitionEditor/PartitionModel.cpp @@ -12,7 +12,7 @@ namespace PartitionEditor { -String PartitionModel::column_name(int column) const +DeprecatedString PartitionModel::column_name(int column) const { switch (column) { case Column::Partition: @@ -60,7 +60,7 @@ GUI::Variant PartitionModel::data(GUI::ModelIndex const& index, GUI::ModelRole r return {}; } -ErrorOr PartitionModel::set_device_path(String const& path) +ErrorOr PartitionModel::set_device_path(DeprecatedString const& path) { auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly)); diff --git a/Userland/Applications/PartitionEditor/PartitionModel.h b/Userland/Applications/PartitionEditor/PartitionModel.h index 252fd5a5087..a54165062fb 100644 --- a/Userland/Applications/PartitionEditor/PartitionModel.h +++ b/Userland/Applications/PartitionEditor/PartitionModel.h @@ -27,10 +27,10 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_partition_table->partitions_count(); } virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; - ErrorOr set_device_path(String const&); + ErrorOr set_device_path(DeprecatedString const&); private: PartitionModel() = default; diff --git a/Userland/Applications/PartitionEditor/main.cpp b/Userland/Applications/PartitionEditor/main.cpp index c427ee62013..3bc10b069d2 100644 --- a/Userland/Applications/PartitionEditor/main.cpp +++ b/Userland/Applications/PartitionEditor/main.cpp @@ -16,9 +16,9 @@ #include #include -static Vector get_device_paths() +static Vector get_device_paths() { - auto device_paths = Vector(); + auto device_paths = Vector(); Core::DirIterator iterator("/dev", Core::DirIterator::SkipParentAndBaseDir); while (iterator.has_next()) { auto path = iterator.next_full_path(); @@ -61,13 +61,13 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(partition_model->set_device_path(device_paths.first())); auto& device_combobox = *widget->find_descendant_of_type_named("device_combobox"); - device_combobox.set_model(GUI::ItemListModel::create(device_paths)); + device_combobox.set_model(GUI::ItemListModel::create(device_paths)); device_combobox.set_only_allow_values_from_model(true); device_combobox.set_selected_index(0); device_combobox.on_change = [&](auto const& path, auto const&) { auto result = partition_model->set_device_path(path); if (result.is_error()) - GUI::MessageBox::show_error(window, String::formatted("No partition table found for device {}", path)); + GUI::MessageBox::show_error(window, DeprecatedString::formatted("No partition table found for device {}", path)); }; auto& partition_table_view = *widget->find_descendant_of_type_named("partition_table_view"); diff --git a/Userland/Applications/Piano/KnobsWidget.cpp b/Userland/Applications/Piano/KnobsWidget.cpp index 733d82c1f2d..cfa8c0d21fb 100644 --- a/Userland/Applications/Piano/KnobsWidget.cpp +++ b/Userland/Applications/Piano/KnobsWidget.cpp @@ -26,7 +26,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) m_octave_container = add(); m_octave_container->set_layout(); m_octave_container->add("Octave"); - m_octave_value = m_octave_container->add(String::number(m_track_manager.keyboard()->virtual_keyboard_octave())); + m_octave_value = m_octave_container->add(DeprecatedString::number(m_track_manager.keyboard()->virtual_keyboard_octave())); // FIXME: Implement vertical flipping in GUI::Slider, not here. m_octave_knob = m_octave_container->add(); @@ -39,7 +39,7 @@ KnobsWidget::KnobsWidget(TrackManager& track_manager, MainWidget& main_widget) if (m_change_underlying) m_main_widget.set_octave_and_ensure_note_change(new_octave); VERIFY(new_octave == m_track_manager.keyboard()->virtual_keyboard_octave()); - m_octave_value->set_text(String::number(new_octave)); + m_octave_value->set_text(DeprecatedString::number(new_octave)); }; for (auto& parameter : m_track_manager.current_track()->track_mastering()->parameters()) diff --git a/Userland/Applications/Piano/PlayerWidget.cpp b/Userland/Applications/Piano/PlayerWidget.cpp index 9084435ce07..36409a0be84 100644 --- a/Userland/Applications/Piano/PlayerWidget.cpp +++ b/Userland/Applications/Piano/PlayerWidget.cpp @@ -36,7 +36,7 @@ PlayerWidget::PlayerWidget(TrackManager& manager, AudioPlayerLoop& loop) m_track_dropdown = add(); m_track_dropdown->set_max_width(75); - m_track_dropdown->set_model(*GUI::ItemListModel::create(m_track_number_choices)); + m_track_dropdown->set_model(*GUI::ItemListModel::create(m_track_number_choices)); m_track_dropdown->set_only_allow_values_from_model(true); m_track_dropdown->set_model_column(0); m_track_dropdown->set_selected_index(0); @@ -100,7 +100,7 @@ void PlayerWidget::add_track() { m_track_manager.add_track(); auto latest_track_count = m_track_manager.track_count(); - auto latest_track_string = String::number(latest_track_count); + auto latest_track_string = DeprecatedString::number(latest_track_count); m_track_number_choices.append(latest_track_string); m_track_dropdown->set_selected_index(latest_track_count - 1); } diff --git a/Userland/Applications/Piano/PlayerWidget.h b/Userland/Applications/Piano/PlayerWidget.h index af5e2f664e7..0862cd0ba3d 100644 --- a/Userland/Applications/Piano/PlayerWidget.h +++ b/Userland/Applications/Piano/PlayerWidget.h @@ -26,7 +26,7 @@ private: TrackManager& m_track_manager; AudioPlayerLoop& m_audio_loop; - Vector m_track_number_choices; + Vector m_track_number_choices; RefPtr m_play_icon; RefPtr m_pause_icon; diff --git a/Userland/Applications/Piano/ProcessorParameterWidget/Dropdown.h b/Userland/Applications/Piano/ProcessorParameterWidget/Dropdown.h index a600a97805d..c29044adf6f 100644 --- a/Userland/Applications/Piano/ProcessorParameterWidget/Dropdown.h +++ b/Userland/Applications/Piano/ProcessorParameterWidget/Dropdown.h @@ -19,12 +19,12 @@ requires(IsEnum) class ProcessorParameterDropdown : public GUI::ComboBox C_OBJECT(ProcessorParameterDropdown); public: - ProcessorParameterDropdown(DSP::ProcessorEnumParameter& parameter, Vector modes) + ProcessorParameterDropdown(DSP::ProcessorEnumParameter& parameter, Vector modes) : ComboBox() , m_parameter(parameter) , m_modes(move(modes)) { - auto model = GUI::ItemListModel>::create(m_modes); + auto model = GUI::ItemListModel>::create(m_modes); set_model(model); set_only_allow_values_from_model(true); set_model_column(0); @@ -54,5 +54,5 @@ public: private: DSP::ProcessorEnumParameter& m_parameter; - Vector m_modes; + Vector m_modes; }; diff --git a/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.cpp b/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.cpp index 23ba1105d4a..2cbdec53b47 100644 --- a/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.cpp +++ b/Userland/Applications/Piano/ProcessorParameterWidget/ParameterWidget.cpp @@ -19,14 +19,14 @@ ProcessorParameterWidget::ProcessorParameterWidget(DSP::ProcessorParameter& raw_ switch (raw_parameter.type()) { case DSP::ParameterType::Range: { auto& parameter = static_cast(raw_parameter); - m_value_label = add(String::number(static_cast(parameter.value()))); + m_value_label = add(DeprecatedString::number(static_cast(parameter.value()))); m_parameter_modifier = add(Orientation::Vertical, parameter, m_value_label); break; } case DSP::ParameterType::Enum: { // FIXME: We shouldn't do that, but the only user is the synth right now. auto& parameter = static_cast&>(raw_parameter); - auto enum_strings = Vector { "Sine", "Triangle", "Square", "Saw", "Noise" }; + auto enum_strings = Vector { "Sine", "Triangle", "Square", "Saw", "Noise" }; m_parameter_modifier = add>(parameter, move(enum_strings)); break; } diff --git a/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp b/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp index 515838f8d96..0a7d71194dd 100644 --- a/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp +++ b/Userland/Applications/Piano/ProcessorParameterWidget/Slider.cpp @@ -27,7 +27,7 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP: set_step((min_log - max_log) / slider_steps); } set_tooltip(m_parameter.name()); - m_value_label->set_text(String::formatted("{:.2f}", static_cast(m_parameter))); + m_value_label->set_text(DeprecatedString::formatted("{:.2f}", static_cast(m_parameter))); on_change = [this](auto value) { if (m_currently_setting_from_ui) @@ -42,11 +42,11 @@ ProcessorParameterSlider::ProcessorParameterSlider(Orientation orientation, DSP: m_parameter.set_value(real_value); if (m_value_label) { double value = static_cast(m_parameter); - String label_text = String::formatted("{:.2f}", value); + DeprecatedString label_text = DeprecatedString::formatted("{:.2f}", value); // FIXME: This is a magic value; we know that with normal font sizes, the label will disappear starting from approximately this length. // Can we do this dynamically? if (label_text.length() > 7) - m_value_label->set_text(String::formatted("{:.0f}", value)); + m_value_label->set_text(DeprecatedString::formatted("{:.0f}", value)); else m_value_label->set_text(label_text); } diff --git a/Userland/Applications/Piano/RollWidget.cpp b/Userland/Applications/Piano/RollWidget.cpp index f358c15df82..ece088e7adb 100644 --- a/Userland/Applications/Piano/RollWidget.cpp +++ b/Userland/Applications/Piano/RollWidget.cpp @@ -161,7 +161,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event) painter.draw_text(note_name_rect, note_name, Gfx::TextAlignment::CenterLeft); note_name_rect.translate_by(Gfx::FontDatabase::default_font().width(note_name) + 2, 0); if (note % notes_per_octave == 0) - painter.draw_text(note_name_rect, String::formatted("{}", note / notes_per_octave + 1), Gfx::TextAlignment::CenterLeft); + painter.draw_text(note_name_rect, DeprecatedString::formatted("{}", note / notes_per_octave + 1), Gfx::TextAlignment::CenterLeft); } int x = m_roll_width * (static_cast(m_track_manager.transport()->time()) / roll_length); diff --git a/Userland/Applications/Piano/SamplerWidget.cpp b/Userland/Applications/Piano/SamplerWidget.cpp index 2fcd6cfc240..f4d3c426ff3 100644 --- a/Userland/Applications/Piano/SamplerWidget.cpp +++ b/Userland/Applications/Piano/SamplerWidget.cpp @@ -55,7 +55,7 @@ SamplerWidget::SamplerWidget(TrackManager& track_manager) m_open_button->set_focus_policy(GUI::FocusPolicy::TabFocus); m_open_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors()); m_open_button->on_click = [this](auto) { - Optional open_path = GUI::FilePicker::get_open_filepath(window()); + Optional open_path = GUI::FilePicker::get_open_filepath(window()); if (!open_path.has_value()) return; // TODO: We don't actually load the sample. diff --git a/Userland/Applications/Piano/main.cpp b/Userland/Applications/Piano/main.cpp index 1b4e3d544a6..9b416f4a567 100644 --- a/Userland/Applications/Piano/main.cpp +++ b/Userland/Applications/Piano/main.cpp @@ -33,7 +33,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TrackManager track_manager; Audio::WavWriter wav_writer; - Optional save_path; + Optional save_path; bool need_to_write_wav = false; auto audio_loop = AudioPlayerLoop::construct(track_manager, need_to_write_wav, wav_writer); @@ -57,7 +57,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return; wav_writer.set_file(save_path.value()); if (wav_writer.has_error()) { - GUI::MessageBox::show(window, String::formatted("Failed to export WAV file: {}", wav_writer.error_string()), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, DeprecatedString::formatted("Failed to export WAV file: {}", wav_writer.error_string()), "Error"sv, GUI::MessageBox::Type::Error); wav_writer.clear_error(); return; } diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.h b/Userland/Applications/PixelPaint/CreateNewImageDialog.h index 8025950a829..b4280d0ff0f 100644 --- a/Userland/Applications/PixelPaint/CreateNewImageDialog.h +++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.h @@ -15,12 +15,12 @@ class CreateNewImageDialog final : public GUI::Dialog { public: Gfx::IntSize const& image_size() const { return m_image_size; } - String const& image_name() const { return m_image_name; } + DeprecatedString const& image_name() const { return m_image_name; } private: CreateNewImageDialog(GUI::Window* parent_window); - String m_image_name; + DeprecatedString m_image_name; Gfx::IntSize m_image_size; RefPtr m_name_textbox; diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.h b/Userland/Applications/PixelPaint/CreateNewLayerDialog.h index f3f7853610b..fb446b561b8 100644 --- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.h +++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.h @@ -15,13 +15,13 @@ class CreateNewLayerDialog final : public GUI::Dialog { public: Gfx::IntSize const& layer_size() const { return m_layer_size; } - String const& layer_name() const { return m_layer_name; } + DeprecatedString const& layer_name() const { return m_layer_name; } private: CreateNewLayerDialog(Gfx::IntSize const& suggested_size, GUI::Window* parent_window); Gfx::IntSize m_layer_size; - String m_layer_name; + DeprecatedString m_layer_name; RefPtr m_name_textbox; }; diff --git a/Userland/Applications/PixelPaint/EditGuideDialog.cpp b/Userland/Applications/PixelPaint/EditGuideDialog.cpp index a4472e85e88..f33bf27c2dc 100644 --- a/Userland/Applications/PixelPaint/EditGuideDialog.cpp +++ b/Userland/Applications/PixelPaint/EditGuideDialog.cpp @@ -13,7 +13,7 @@ namespace PixelPaint { -EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, String const& offset, Guide::Orientation orientation) +EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, DeprecatedString const& offset, Guide::Orientation orientation) : Dialog(parent_window) , m_offset(offset) , m_orientation(orientation) diff --git a/Userland/Applications/PixelPaint/EditGuideDialog.h b/Userland/Applications/PixelPaint/EditGuideDialog.h index 4b826a1e0b8..bdc31f6124c 100644 --- a/Userland/Applications/PixelPaint/EditGuideDialog.h +++ b/Userland/Applications/PixelPaint/EditGuideDialog.h @@ -16,15 +16,15 @@ class EditGuideDialog final : public GUI::Dialog { C_OBJECT(EditGuideDialog); public: - String const offset() const { return m_offset; } + DeprecatedString const offset() const { return m_offset; } Guide::Orientation orientation() const { return m_orientation; } Optional offset_as_pixel(ImageEditor const&); private: - EditGuideDialog(GUI::Window* parent_window, String const& offset = {}, Guide::Orientation orientation = Guide::Orientation::Unset); + EditGuideDialog(GUI::Window* parent_window, DeprecatedString const& offset = {}, Guide::Orientation orientation = Guide::Orientation::Unset); - String m_offset; + DeprecatedString m_offset; Guide::Orientation m_orientation; RefPtr m_offset_text_box; bool m_is_horizontal_checked { false }; diff --git a/Userland/Applications/PixelPaint/FilterTreeModel.h b/Userland/Applications/PixelPaint/FilterTreeModel.h index fa3c16e175d..4853472b916 100644 --- a/Userland/Applications/PixelPaint/FilterTreeModel.h +++ b/Userland/Applications/PixelPaint/FilterTreeModel.h @@ -16,7 +16,7 @@ namespace PixelPaint { class FilterNode final : public GUI::TreeViewModel::Node { public: - FilterNode(String text, Optional icon, Node* parent_node, NonnullRefPtr filter) + FilterNode(DeprecatedString text, Optional icon, Node* parent_node, NonnullRefPtr filter) : Node(move(text), move(icon), parent_node) , m_filter(move(filter)) { diff --git a/Userland/Applications/PixelPaint/IconBag.cpp b/Userland/Applications/PixelPaint/IconBag.cpp index 12a1f3b65e8..48973cede77 100644 --- a/Userland/Applications/PixelPaint/IconBag.cpp +++ b/Userland/Applications/PixelPaint/IconBag.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include namespace PixelPaint { diff --git a/Userland/Applications/PixelPaint/Image.cpp b/Userland/Applications/PixelPaint/Image.cpp index 3062b9165b1..213217fdd7b 100644 --- a/Userland/Applications/PixelPaint/Image.cpp +++ b/Userland/Applications/PixelPaint/Image.cpp @@ -474,7 +474,7 @@ void Image::did_change_rect(Gfx::IntRect const& a_modified_rect) client->image_did_change_rect(modified_rect); } -ImageUndoCommand::ImageUndoCommand(Image& image, String action_text) +ImageUndoCommand::ImageUndoCommand(Image& image, DeprecatedString action_text) : m_snapshot(image.take_snapshot().release_value_but_fixme_should_propagate_errors()) , m_image(image) , m_action_text(move(action_text)) diff --git a/Userland/Applications/PixelPaint/Image.h b/Userland/Applications/PixelPaint/Image.h index 1b0bf5fcbc0..00d252db93a 100644 --- a/Userland/Applications/PixelPaint/Image.h +++ b/Userland/Applications/PixelPaint/Image.h @@ -123,16 +123,16 @@ private: class ImageUndoCommand : public GUI::Command { public: - ImageUndoCommand(Image&, String action_text); + ImageUndoCommand(Image&, DeprecatedString action_text); virtual void undo() override; virtual void redo() override; - virtual String action_text() const override { return m_action_text; } + virtual DeprecatedString action_text() const override { return m_action_text; } private: RefPtr m_snapshot; Image& m_image; - String m_action_text; + DeprecatedString m_action_text; }; } diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index ed4cc8d6277..a98ce207c3e 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -34,7 +34,7 @@ ImageEditor::ImageEditor(NonnullRefPtr image) , m_gui_event_loop(Core::EventLoop::current()) { set_focus_policy(GUI::FocusPolicy::StrongFocus); - m_undo_stack.push(make(*m_image, String())); + m_undo_stack.push(make(*m_image, DeprecatedString())); m_image->add_client(*this); m_image->selection().add_client(*this); set_original_rect(m_image->rect()); @@ -61,7 +61,7 @@ ImageEditor::~ImageEditor() m_image->remove_client(*this); } -void ImageEditor::did_complete_action(String action_text) +void ImageEditor::did_complete_action(DeprecatedString action_text) { if (on_modified_change) on_modified_change(true); @@ -105,14 +105,14 @@ bool ImageEditor::redo() return true; } -void ImageEditor::set_title(String title) +void ImageEditor::set_title(DeprecatedString title) { m_title = move(title); if (on_title_change) on_title_change(m_title); } -void ImageEditor::set_path(String path) +void ImageEditor::set_path(DeprecatedString path) { m_path = move(path); set_title(LexicalPath::title(m_path)); @@ -201,7 +201,7 @@ void ImageEditor::paint_event(GUI::PaintEvent& event) int const editor_x = content_to_frame_position({ x, 0 }).x(); painter.draw_line({ editor_x, 0 }, { editor_x, m_ruler_thickness }, ruler_fg_color); - painter.draw_text({ { editor_x + 2, 0 }, { m_ruler_thickness, m_ruler_thickness - 2 } }, String::formatted("{}", x), painter.font(), Gfx::TextAlignment::CenterLeft, ruler_text_color); + painter.draw_text({ { editor_x + 2, 0 }, { m_ruler_thickness, m_ruler_thickness - 2 } }, DeprecatedString::formatted("{}", x), painter.font(), Gfx::TextAlignment::CenterLeft, ruler_text_color); } // Vertical ruler @@ -218,7 +218,7 @@ void ImageEditor::paint_event(GUI::PaintEvent& event) int const editor_y = content_to_frame_position({ 0, y }).y(); painter.draw_line({ 0, editor_y }, { m_ruler_thickness, editor_y }, ruler_fg_color); - painter.draw_text({ { 0, editor_y - m_ruler_thickness }, { m_ruler_thickness, m_ruler_thickness } }, String::formatted("{}", y), painter.font(), Gfx::TextAlignment::BottomRight, ruler_text_color); + painter.draw_text({ { 0, editor_y - m_ruler_thickness }, { m_ruler_thickness, m_ruler_thickness } }, DeprecatedString::formatted("{}", y), painter.font(), Gfx::TextAlignment::BottomRight, ruler_text_color); } // Mouse position indicator @@ -684,7 +684,7 @@ void ImageEditor::save_project() return; auto result = save_project_to_file(*response.value()); if (result.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("Could not save {}: {}", path(), result.error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Could not save {}: {}", path(), result.error())); return; } undo_stack().set_current_unmodified(); @@ -700,7 +700,7 @@ void ImageEditor::save_project_as() auto file = response.value(); auto result = save_project_to_file(*file); if (result.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("Could not save {}: {}", file->filename(), result.error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Could not save {}: {}", file->filename(), result.error())); return; } set_path(file->filename()); @@ -710,7 +710,7 @@ void ImageEditor::save_project_as() on_modified_change(false); } -Result ImageEditor::save_project_to_file(Core::File& file) const +Result ImageEditor::save_project_to_file(Core::File& file) const { StringBuilder builder; auto json = MUST(JsonObjectSerializer<>::try_create(builder)); @@ -729,7 +729,7 @@ Result ImageEditor::save_project_to_file(Core::File& file) const MUST(json.finish()); if (!file.write(builder.string_view())) - return String { file.error_string() }; + return DeprecatedString { file.error_string() }; return {}; } diff --git a/Userland/Applications/PixelPaint/ImageEditor.h b/Userland/Applications/PixelPaint/ImageEditor.h index fc1997458b7..5fdfedc8fda 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.h +++ b/Userland/Applications/PixelPaint/ImageEditor.h @@ -43,17 +43,17 @@ public: void set_active_tool(Tool*); void update_tool_cursor(); - void did_complete_action(String action_text); + void did_complete_action(DeprecatedString action_text); bool undo(); bool redo(); auto& undo_stack() { return m_undo_stack; } - String const& path() const { return m_path; } - void set_path(String); + DeprecatedString const& path() const { return m_path; } + void set_path(DeprecatedString); - String const& title() const { return m_title; } - void set_title(String); + DeprecatedString const& title() const { return m_title; } + void set_title(DeprecatedString); void add_guide(NonnullRefPtr guide) { m_guides.append(guide); } void remove_guide(Guide const& guide) @@ -82,7 +82,7 @@ public: Function on_active_layer_change; - Function on_title_change; + Function on_title_change; Function on_image_mouse_position_change; @@ -144,7 +144,7 @@ private: GUI::MouseEvent event_adjusted_for_layer(GUI::MouseEvent const&, Layer const&) const; GUI::MouseEvent event_with_pan_and_scale_applied(GUI::MouseEvent const&) const; - Result save_project_to_file(Core::File&) const; + Result save_project_to_file(Core::File&) const; int calculate_ruler_step_size() const; Gfx::IntRect mouse_indicator_rect_x() const; @@ -156,8 +156,8 @@ private: RefPtr m_active_layer; GUI::UndoStack m_undo_stack; - String m_path; - String m_title; + DeprecatedString m_path; + DeprecatedString m_title; NonnullRefPtrVector m_guides; bool m_show_guides { true }; diff --git a/Userland/Applications/PixelPaint/ImageProcessor.cpp b/Userland/Applications/PixelPaint/ImageProcessor.cpp index e826c218533..9aed3d3fa26 100644 --- a/Userland/Applications/PixelPaint/ImageProcessor.cpp +++ b/Userland/Applications/PixelPaint/ImageProcessor.cpp @@ -20,7 +20,7 @@ void FilterApplicationCommand::execute() m_filter->m_editor->gui_event_loop().deferred_invoke([strong_this = NonnullRefPtr(*this)]() { // HACK: we can't tell strong_this to not be const (*const_cast*>(&strong_this->m_target_layer))->did_modify_bitmap(strong_this->m_target_layer->rect()); - strong_this->m_filter->m_editor->did_complete_action(String::formatted("Filter {}", strong_this->m_filter->filter_name())); + strong_this->m_filter->m_editor->did_complete_action(DeprecatedString::formatted("Filter {}", strong_this->m_filter->filter_name())); }); } diff --git a/Userland/Applications/PixelPaint/Layer.cpp b/Userland/Applications/PixelPaint/Layer.cpp index 87d62215499..11df1ba0e15 100644 --- a/Userland/Applications/PixelPaint/Layer.cpp +++ b/Userland/Applications/PixelPaint/Layer.cpp @@ -16,7 +16,7 @@ namespace PixelPaint { -ErrorOr> Layer::try_create_with_size(Image& image, Gfx::IntSize const& size, String name) +ErrorOr> Layer::try_create_with_size(Image& image, Gfx::IntSize const& size, DeprecatedString name) { VERIFY(!size.is_empty()); @@ -27,7 +27,7 @@ ErrorOr> Layer::try_create_with_size(Image& image, Gfx::Int return adopt_nonnull_ref_or_enomem(new (nothrow) Layer(image, move(bitmap), move(name))); } -ErrorOr> Layer::try_create_with_bitmap(Image& image, NonnullRefPtr bitmap, String name) +ErrorOr> Layer::try_create_with_bitmap(Image& image, NonnullRefPtr bitmap, DeprecatedString name) { VERIFY(!bitmap->size().is_empty()); @@ -56,7 +56,7 @@ ErrorOr> Layer::try_create_snapshot(Image& image, Layer con return snapshot; } -Layer::Layer(Image& image, NonnullRefPtr bitmap, String name) +Layer::Layer(Image& image, NonnullRefPtr bitmap, DeprecatedString name) : m_image(image) , m_name(move(name)) , m_content_bitmap(move(bitmap)) @@ -101,7 +101,7 @@ void Layer::set_opacity_percent(int opacity_percent) m_image.layer_did_modify_properties({}, *this); } -void Layer::set_name(String name) +void Layer::set_name(DeprecatedString name) { if (m_name == name) return; diff --git a/Userland/Applications/PixelPaint/Layer.h b/Userland/Applications/PixelPaint/Layer.h index 6e5121eceeb..f635ef17429 100644 --- a/Userland/Applications/PixelPaint/Layer.h +++ b/Userland/Applications/PixelPaint/Layer.h @@ -9,9 +9,9 @@ #pragma once +#include #include #include -#include #include #include #include @@ -29,8 +29,8 @@ class Layer AK_MAKE_NONMOVABLE(Layer); public: - static ErrorOr> try_create_with_size(Image&, Gfx::IntSize const&, String name); - static ErrorOr> try_create_with_bitmap(Image&, NonnullRefPtr, String name); + static ErrorOr> try_create_with_size(Image&, Gfx::IntSize const&, DeprecatedString name); + static ErrorOr> try_create_with_bitmap(Image&, NonnullRefPtr, DeprecatedString name); static ErrorOr> try_create_snapshot(Image&, Layer const&); ~Layer() = default; @@ -53,8 +53,8 @@ public: Gfx::IntRect relative_rect() const { return { location(), size() }; } Gfx::IntRect rect() const { return { {}, size() }; } - String const& name() const { return m_name; } - void set_name(String); + DeprecatedString const& name() const { return m_name; } + void set_name(DeprecatedString); void flip(Gfx::Orientation orientation); void rotate(Gfx::RotationDirection direction); @@ -97,11 +97,11 @@ public: Gfx::Bitmap& currently_edited_bitmap(); private: - Layer(Image&, NonnullRefPtr, String name); + Layer(Image&, NonnullRefPtr, DeprecatedString name); Image& m_image; - String m_name; + DeprecatedString m_name; Gfx::IntPoint m_location; NonnullRefPtr m_content_bitmap; RefPtr m_scratch_edited_bitmap { nullptr }; diff --git a/Userland/Applications/PixelPaint/LevelsDialog.cpp b/Userland/Applications/PixelPaint/LevelsDialog.cpp index 3b0fd8d8e88..d38a989039c 100644 --- a/Userland/Applications/PixelPaint/LevelsDialog.cpp +++ b/Userland/Applications/PixelPaint/LevelsDialog.cpp @@ -42,7 +42,7 @@ LevelsDialog::LevelsDialog(GUI::Window* parent_window, ImageEditor* editor) VERIFY(cancel_button); VERIFY(m_editor->active_layer()); - context_label->set_text(String::formatted("Working on layer: {}", m_editor->active_layer()->name())); + context_label->set_text(DeprecatedString::formatted("Working on layer: {}", m_editor->active_layer()->name())); m_gamma_slider->set_value(100); m_brightness_slider->on_change = [this](auto) { diff --git a/Userland/Applications/PixelPaint/MainWidget.cpp b/Userland/Applications/PixelPaint/MainWidget.cpp index 4c546aa7547..a6961c23349 100644 --- a/Userland/Applications/PixelPaint/MainWidget.cpp +++ b/Userland/Applications/PixelPaint/MainWidget.cpp @@ -142,7 +142,7 @@ void MainWidget::image_editor_did_update_undo_stack() } // Note: Update these together! v -static Vector const s_suggested_zoom_levels { "25%", "50%", "100%", "200%", "300%", "400%", "800%", "1600%", "Fit to width", "Fit to height", "Fit entire image" }; +static Vector const s_suggested_zoom_levels { "25%", "50%", "100%", "200%", "300%", "400%", "800%", "1600%", "Fit to width", "Fit to height", "Fit entire image" }; static constexpr int s_zoom_level_fit_width = 8; static constexpr int s_zoom_level_fit_height = 9; static constexpr int s_zoom_level_fit_image = 10; @@ -216,7 +216,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); auto result = editor->image().export_bmp_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes); if (result.is_error()) - GUI::MessageBox::show_error(&window, String::formatted("Export to BMP failed: {}", result.error())); + GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Export to BMP failed: {}", result.error())); })); m_export_submenu->add_action( @@ -231,7 +231,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto preserve_alpha_channel = GUI::MessageBox::show(&window, "Do you wish to preserve transparency?"sv, "Preserve transparency?"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); auto result = editor->image().export_png_to_file(response.value(), preserve_alpha_channel == GUI::MessageBox::ExecResult::Yes); if (result.is_error()) - GUI::MessageBox::show_error(&window, String::formatted("Export to PNG failed: {}", result.error())); + GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Export to PNG failed: {}", result.error())); })); m_export_submenu->add_action( @@ -244,7 +244,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) return; auto result = editor->image().export_qoi_to_file(response.value()); if (result.is_error()) - GUI::MessageBox::show_error(&window, String::formatted("Export to QOI failed: {}", result.error())); + GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Export to QOI failed: {}", result.error())); })); m_export_submenu->set_icon(g_icon_bag.file_export); @@ -400,7 +400,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto result = PixelPaint::PaletteWidget::load_palette_file(*response.value()); if (result.is_error()) { - GUI::MessageBox::show_error(&window, String::formatted("Loading color palette failed: {}", result.error())); + GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Loading color palette failed: {}", result.error())); return; } @@ -414,7 +414,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) auto result = PixelPaint::PaletteWidget::save_palette_file(m_palette_widget->colors(), *response.value()); if (result.is_error()) - GUI::MessageBox::show_error(&window, String::formatted("Writing color palette failed: {}", result.error())); + GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Writing color palette failed: {}", result.error())); })); m_view_menu = window.add_menu("&View"); @@ -629,7 +629,7 @@ void MainWidget::initialize_menubar(GUI::Window& window) if (dialog->exec() == GUI::Dialog::ExecResult::OK) { auto layer_or_error = PixelPaint::Layer::try_create_with_size(editor->image(), dialog->layer_size(), dialog->layer_name()); if (layer_or_error.is_error()) { - GUI::MessageBox::show_error(&window, String::formatted("Unable to create layer with size {}", dialog->size())); + GUI::MessageBox::show_error(&window, DeprecatedString::formatted("Unable to create layer with size {}", dialog->size())); return; } editor->image().add_layer(layer_or_error.release_value()); @@ -930,8 +930,8 @@ void MainWidget::initialize_menubar(GUI::Window& window) m_zoom_combobox = toolbar.add(); m_zoom_combobox->set_max_width(75); - m_zoom_combobox->set_model(*GUI::ItemListModel::create(s_suggested_zoom_levels)); - m_zoom_combobox->on_change = [this](String const& value, GUI::ModelIndex const& index) { + m_zoom_combobox->set_model(*GUI::ItemListModel::create(s_suggested_zoom_levels)); + m_zoom_combobox->on_change = [this](DeprecatedString const& value, GUI::ModelIndex const& index) { auto* editor = current_image_editor(); VERIFY(editor); @@ -995,7 +995,7 @@ void MainWidget::open_image(Core::File& file) auto try_load = m_loader.try_load_from_file(file); if (try_load.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("Unable to open file: {}, {}", file.filename(), try_load.error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Unable to open file: {}, {}", file.filename(), try_load.error())); return; } @@ -1105,7 +1105,7 @@ ImageEditor& MainWidget::create_new_editor(NonnullRefPtr image) }; image_editor.on_scale_change = Core::debounce([this](float scale) { - m_zoom_combobox->set_text(String::formatted("{}%", roundf(scale * 100))); + m_zoom_combobox->set_text(DeprecatedString::formatted("{}%", roundf(scale * 100))); current_image_editor()->update_tool_cursor(); }, 100); diff --git a/Userland/Applications/PixelPaint/PaletteWidget.cpp b/Userland/Applications/PixelPaint/PaletteWidget.cpp index 955430a7b71..f2cb94573f5 100644 --- a/Userland/Applications/PixelPaint/PaletteWidget.cpp +++ b/Userland/Applications/PixelPaint/PaletteWidget.cpp @@ -134,7 +134,7 @@ PaletteWidget::PaletteWidget() auto result = load_palette_path("/res/color-palettes/default.palette"); if (result.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("Loading default palette failed: {}", result.error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Loading default palette failed: {}", result.error())); display_color_list(fallback_colors()); return; @@ -225,7 +225,7 @@ Vector PaletteWidget::colors() return colors; } -Result, String> PaletteWidget::load_palette_file(Core::File& file) +Result, DeprecatedString> PaletteWidget::load_palette_file(Core::File& file) { Vector palette; @@ -245,22 +245,22 @@ Result, String> PaletteWidget::load_palette_file(Core::File& file) file.close(); if (palette.is_empty()) - return String { "The palette file did not contain any usable colors"sv }; + return DeprecatedString { "The palette file did not contain any usable colors"sv }; return palette; } -Result, String> PaletteWidget::load_palette_path(String const& file_path) +Result, DeprecatedString> PaletteWidget::load_palette_path(DeprecatedString const& file_path) { auto file_or_error = Core::File::open(file_path, Core::OpenMode::ReadOnly); if (file_or_error.is_error()) - return String { strerror(file_or_error.error().code()) }; + return DeprecatedString { strerror(file_or_error.error().code()) }; auto& file = *file_or_error.value(); return load_palette_file(file); } -Result PaletteWidget::save_palette_file(Vector palette, Core::File& file) +Result PaletteWidget::save_palette_file(Vector palette, Core::File& file) { for (auto& color : palette) { file.write(color.to_string_without_alpha()); diff --git a/Userland/Applications/PixelPaint/PaletteWidget.h b/Userland/Applications/PixelPaint/PaletteWidget.h index 02540db80d1..c2914bcc733 100644 --- a/Userland/Applications/PixelPaint/PaletteWidget.h +++ b/Userland/Applications/PixelPaint/PaletteWidget.h @@ -31,9 +31,9 @@ public: Vector colors(); - static Result, String> load_palette_file(Core::File&); - static Result, String> load_palette_path(String const&); - static Result save_palette_file(Vector, Core::File&); + static Result, DeprecatedString> load_palette_file(Core::File&); + static Result, DeprecatedString> load_palette_path(DeprecatedString const&); + static Result save_palette_file(Vector, Core::File&); static Vector fallback_colors(); void set_image_editor(ImageEditor*); diff --git a/Userland/Applications/PixelPaint/ProjectLoader.cpp b/Userland/Applications/PixelPaint/ProjectLoader.cpp index 3356abbd13a..6acc8d963b8 100644 --- a/Userland/Applications/PixelPaint/ProjectLoader.cpp +++ b/Userland/Applications/PixelPaint/ProjectLoader.cpp @@ -7,9 +7,9 @@ #include "ProjectLoader.h" #include "Image.h" #include "Layer.h" +#include #include #include -#include #include #include #include diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp index e6fd4379b5a..c6c186dfc09 100644 --- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp +++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp @@ -53,7 +53,7 @@ ToolboxWidget::ToolboxWidget() void ToolboxWidget::setup_tools() { auto add_tool = [&](StringView icon_name, GUI::Shortcut const& shortcut, NonnullOwnPtr tool, bool is_default_tool = false) { - auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::try_load_from_file(String::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(), + auto action = GUI::Action::create_checkable(tool->tool_name(), shortcut, Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/pixelpaint/{}.png", icon_name)).release_value_but_fixme_should_propagate_errors(), [this, tool = tool.ptr()](auto& action) { if (action.is_checked()) { on_tool_selection(tool); diff --git a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp index 5ec08bd599f..de08da55707 100644 --- a/Userland/Applications/PixelPaint/Tools/GuideTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/GuideTool.cpp @@ -74,7 +74,7 @@ void GuideTool::on_mousedown(Layer*, MouseEvent& event) if (m_selected_guide) { m_guide_origin = m_selected_guide->offset(); - GUI::Application::the()->show_tooltip_immediately(String::formatted("{}", m_guide_origin), GUI::Application::the()->tooltip_source_widget()); + GUI::Application::the()->show_tooltip_immediately(DeprecatedString::formatted("{}", m_guide_origin), GUI::Application::the()->tooltip_source_widget()); } } @@ -120,7 +120,7 @@ void GuideTool::on_mousemove(Layer*, MouseEvent& event) m_selected_guide->set_offset(new_offset); - GUI::Application::the()->show_tooltip_immediately(String::formatted("{}", new_offset), GUI::Application::the()->tooltip_source_widget()); + GUI::Application::the()->show_tooltip_immediately(DeprecatedString::formatted("{}", new_offset), GUI::Application::the()->tooltip_source_widget()); editor()->layers_did_change(); } @@ -140,7 +140,7 @@ void GuideTool::on_context_menu(Layer*, GUI::ContextMenuEvent& event) return; auto dialog = EditGuideDialog::construct( editor()->window(), - String::formatted("{}", m_context_menu_guide->offset()), + DeprecatedString::formatted("{}", m_context_menu_guide->offset()), m_context_menu_guide->orientation()); if (dialog->exec() != GUI::Dialog::ExecResult::OK) return; diff --git a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp index be3184c5174..ab399506807 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.cpp @@ -205,7 +205,7 @@ GUI::Widget* RectangleSelectTool::get_properties_widget() auto& mode_combo = mode_container.add(); mode_combo.set_only_allow_values_from_model(true); - mode_combo.set_model(*GUI::ItemListModel::create(m_merge_mode_names)); + mode_combo.set_model(*GUI::ItemListModel::create(m_merge_mode_names)); mode_combo.set_selected_index((int)m_merge_mode); mode_combo.on_change = [this](auto&&, GUI::ModelIndex const& index) { VERIFY(index.row() >= 0); diff --git a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.h b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.h index bc7dc30024e..b93dc5d8f6e 100644 --- a/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.h +++ b/Userland/Applications/PixelPaint/Tools/RectangleSelectTool.h @@ -40,7 +40,7 @@ private: }; RefPtr m_properties_widget; - Vector m_merge_mode_names {}; + Vector m_merge_mode_names {}; Selection::MergeMode m_merge_mode { Selection::MergeMode::Set }; float m_edge_feathering { 0.0f }; bool m_selecting { false }; diff --git a/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp b/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp index e94fc8fa581..f308754ef77 100644 --- a/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/WandSelectTool.cpp @@ -120,7 +120,7 @@ GUI::Widget* WandSelectTool::get_properties_widget() auto& mode_combo = mode_container.add(); mode_combo.set_only_allow_values_from_model(true); - mode_combo.set_model(*GUI::ItemListModel::create(m_merge_mode_names)); + mode_combo.set_model(*GUI::ItemListModel::create(m_merge_mode_names)); mode_combo.set_selected_index((int)m_merge_mode); mode_combo.on_change = [this](auto&&, GUI::ModelIndex const& index) { VERIFY(index.row() >= 0); diff --git a/Userland/Applications/PixelPaint/Tools/WandSelectTool.h b/Userland/Applications/PixelPaint/Tools/WandSelectTool.h index 5b2ab35f49e..ca66616edae 100644 --- a/Userland/Applications/PixelPaint/Tools/WandSelectTool.h +++ b/Userland/Applications/PixelPaint/Tools/WandSelectTool.h @@ -31,7 +31,7 @@ private: int m_threshold { 0 }; RefPtr m_properties_widget; - Vector m_merge_mode_names {}; + Vector m_merge_mode_names {}; Selection::MergeMode m_merge_mode { Selection::MergeMode::Set }; }; diff --git a/Userland/Applications/Presenter/Presentation.cpp b/Userland/Applications/Presenter/Presentation.cpp index 68ba7f05af5..18570427bb5 100644 --- a/Userland/Applications/Presenter/Presentation.cpp +++ b/Userland/Applications/Presenter/Presentation.cpp @@ -12,13 +12,13 @@ #include #include -Presentation::Presentation(Gfx::IntSize normative_size, HashMap metadata) +Presentation::Presentation(Gfx::IntSize normative_size, HashMap metadata) : m_normative_size(normative_size) , m_metadata(std::move(metadata)) { } -NonnullOwnPtr Presentation::construct(Gfx::IntSize normative_size, HashMap metadata) +NonnullOwnPtr Presentation::construct(Gfx::IntSize normative_size, HashMap metadata) { return NonnullOwnPtr(NonnullOwnPtr::Adopt, *new Presentation(normative_size, move(metadata))); } @@ -107,9 +107,9 @@ ErrorOr> Presentation::load_from_file(StringView fil return presentation; } -HashMap Presentation::parse_metadata(JsonObject const& metadata_object) +HashMap Presentation::parse_metadata(JsonObject const& metadata_object) { - HashMap metadata; + HashMap metadata; metadata_object.for_each_member([&](auto const& key, auto const& value) { metadata.set(key, value.to_string()); diff --git a/Userland/Applications/Presenter/Presentation.h b/Userland/Applications/Presenter/Presentation.h index e793924181b..6ad200811dc 100644 --- a/Userland/Applications/Presenter/Presentation.h +++ b/Userland/Applications/Presenter/Presentation.h @@ -7,10 +7,10 @@ #pragma once #include "Slide.h" +#include #include #include #include -#include #include #include #include @@ -42,18 +42,18 @@ public: void paint(Gfx::Painter& painter) const; private: - static HashMap parse_metadata(JsonObject const& metadata_object); + static HashMap parse_metadata(JsonObject const& metadata_object); static ErrorOr parse_presentation_size(JsonObject const& metadata_object); - Presentation(Gfx::IntSize normative_size, HashMap metadata); - static NonnullOwnPtr construct(Gfx::IntSize normative_size, HashMap metadata); + Presentation(Gfx::IntSize normative_size, HashMap metadata); + static NonnullOwnPtr construct(Gfx::IntSize normative_size, HashMap metadata); void append_slide(Slide slide); Vector m_slides {}; // This is not a pixel size, but an abstract size used by the slide objects for relative positioning. Gfx::IntSize m_normative_size; - HashMap m_metadata; + HashMap m_metadata; Checked m_current_slide { 0 }; Checked m_current_frame_in_slide { 0 }; diff --git a/Userland/Applications/Presenter/PresenterWidget.cpp b/Userland/Applications/Presenter/PresenterWidget.cpp index b813a6dccee..21d2f7d1599 100644 --- a/Userland/Applications/Presenter/PresenterWidget.cpp +++ b/Userland/Applications/Presenter/PresenterWidget.cpp @@ -75,10 +75,10 @@ void PresenterWidget::set_file(StringView file_name) { auto presentation = Presentation::load_from_file(file_name, *window()); if (presentation.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("The presentation \"{}\" could not be loaded.\n{}", file_name, presentation.error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("The presentation \"{}\" could not be loaded.\n{}", file_name, presentation.error())); } else { m_current_presentation = presentation.release_value(); - window()->set_title(String::formatted(title_template, m_current_presentation->title(), m_current_presentation->author())); + window()->set_title(DeprecatedString::formatted(title_template, m_current_presentation->title(), m_current_presentation->author())); set_min_size(m_current_presentation->normative_size()); // This will apply the new minimum size. update(); diff --git a/Userland/Applications/Presenter/Slide.cpp b/Userland/Applications/Presenter/Slide.cpp index 5a02a645363..ff563bf7ac0 100644 --- a/Userland/Applications/Presenter/Slide.cpp +++ b/Userland/Applications/Presenter/Slide.cpp @@ -12,7 +12,7 @@ #include #include -Slide::Slide(NonnullRefPtrVector slide_objects, String title) +Slide::Slide(NonnullRefPtrVector slide_objects, DeprecatedString title) : m_slide_objects(move(slide_objects)) , m_title(move(title)) { diff --git a/Userland/Applications/Presenter/Slide.h b/Userland/Applications/Presenter/Slide.h index cf96aa8ae82..565a64109c2 100644 --- a/Userland/Applications/Presenter/Slide.h +++ b/Userland/Applications/Presenter/Slide.h @@ -7,9 +7,9 @@ #pragma once #include "SlideObject.h" +#include #include #include -#include #include // A single slide of a presentation. @@ -24,8 +24,8 @@ public: void paint(Gfx::Painter&, unsigned current_frame, Gfx::FloatSize display_scale) const; private: - Slide(NonnullRefPtrVector slide_objects, String title); + Slide(NonnullRefPtrVector slide_objects, DeprecatedString title); NonnullRefPtrVector m_slide_objects; - String m_title; + DeprecatedString m_title; }; diff --git a/Userland/Applications/Presenter/SlideObject.h b/Userland/Applications/Presenter/SlideObject.h index 6c1cb743278..c41202aa9fb 100644 --- a/Userland/Applications/Presenter/SlideObject.h +++ b/Userland/Applications/Presenter/SlideObject.h @@ -71,7 +71,7 @@ public: virtual void paint(Gfx::Painter&, Gfx::FloatSize display_scale) const override; - void set_font(String font) { m_font = move(font); } + void set_font(DeprecatedString font) { m_font = move(font); } StringView font() const { return m_font; } void set_font_size(int font_size) { m_font_size = font_size; } int font_size() const { return m_font_size; } @@ -79,13 +79,13 @@ public: unsigned font_weight() const { return m_font_weight; } void set_text_alignment(Gfx::TextAlignment text_alignment) { m_text_alignment = text_alignment; } Gfx::TextAlignment text_alignment() const { return m_text_alignment; } - void set_text(String text) { m_text = move(text); } + void set_text(DeprecatedString text) { m_text = move(text); } StringView text() const { return m_text; } protected: - String m_text; + DeprecatedString m_text; // The font family, technically speaking. - String m_font; + DeprecatedString m_font; int m_font_size; unsigned m_font_weight; Gfx::TextAlignment m_text_alignment; @@ -110,12 +110,12 @@ public: virtual void paint(Gfx::Painter&, Gfx::FloatSize display_scale) const override; - void set_image_path(String image_path) + void set_image_path(DeprecatedString image_path) { m_image_path = move(image_path); auto result = reload_image(); if (result.is_error()) - GUI::MessageBox::show_error(m_window, String::formatted("Loading image {} failed: {}", m_image_path, result.error())); + GUI::MessageBox::show_error(m_window, DeprecatedString::formatted("Loading image {} failed: {}", m_image_path, result.error())); } StringView image_path() const { return m_image_path; } void set_scaling(ImageScaling scaling) { m_scaling = scaling; } @@ -124,7 +124,7 @@ public: Gfx::Painter::ScalingMode scaling_mode() const { return m_scaling_mode; } protected: - String m_image_path; + DeprecatedString m_image_path; ImageScaling m_scaling { ImageScaling::FitSmallest }; Gfx::Painter::ScalingMode m_scaling_mode { Gfx::Painter::ScalingMode::SmoothPixels }; diff --git a/Userland/Applications/Presenter/main.cpp b/Userland/Applications/Presenter/main.cpp index 17ac0f86fb2..327c7392e04 100644 --- a/Userland/Applications/Presenter/main.cpp +++ b/Userland/Applications/Presenter/main.cpp @@ -17,7 +17,7 @@ ErrorOr serenity_main(Main::Arguments arguments) // rpath is required to load .presenter files, unix, sendfd and recvfd are required to talk to ImageDecoder and WindowServer. TRY(Core::System::pledge("stdio rpath unix sendfd recvfd")); - String file_to_load; + DeprecatedString file_to_load; Core::ArgsParser argument_parser; argument_parser.add_positional_argument(file_to_load, "Presentation to load", "file", Core::ArgsParser::Required::No); argument_parser.parse(arguments); diff --git a/Userland/Applications/Run/RunWindow.cpp b/Userland/Applications/Run/RunWindow.cpp index bd10c91972f..11b6f9231e2 100644 --- a/Userland/Applications/Run/RunWindow.cpp +++ b/Userland/Applications/Run/RunWindow.cpp @@ -28,7 +28,7 @@ RunWindow::RunWindow() : m_path_history() - , m_path_history_model(GUI::ItemListModel::create(m_path_history)) + , m_path_history_model(GUI::ItemListModel::create(m_path_history)) { // FIXME: Handle failure to load history somehow. (void)load_history(); @@ -65,7 +65,7 @@ RunWindow::RunWindow() m_browse_button = *find_descendant_of_type_named("browse_button"); m_browse_button->on_click = [this](auto) { - Optional path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), false, GUI::Dialog::ScreenPosition::Center); + Optional path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), false, GUI::Dialog::ScreenPosition::Center); if (path.has_value()) m_path_combo_box->set_text(path.value().view()); }; @@ -95,7 +95,7 @@ void RunWindow::do_run() if (run_via_launch(run_input) || run_as_command(run_input)) { // Remove any existing history entry, prepend the successful run string to history and save. - m_path_history.remove_all_matching([&](String v) { return v == run_input; }); + m_path_history.remove_all_matching([&](DeprecatedString v) { return v == run_input; }); m_path_history.prepend(run_input); // FIXME: Handle failure to save history somehow. (void)save_history(); @@ -109,7 +109,7 @@ void RunWindow::do_run() show(); } -bool RunWindow::run_as_command(String const& run_input) +bool RunWindow::run_as_command(DeprecatedString const& run_input) { pid_t child_pid; char const* shell_executable = "/bin/Shell"; // TODO query and use the user's preferred shell. @@ -138,7 +138,7 @@ bool RunWindow::run_as_command(String const& run_input) return true; } -bool RunWindow::run_via_launch(String const& run_input) +bool RunWindow::run_via_launch(DeprecatedString const& run_input) { auto url = URL::create_with_url_or_path(run_input); @@ -162,9 +162,9 @@ bool RunWindow::run_via_launch(String const& run_input) return true; } -String RunWindow::history_file_path() +DeprecatedString RunWindow::history_file_path() { - return LexicalPath::canonicalized_path(String::formatted("{}/{}", Core::StandardPaths::config_directory(), "RunHistory.txt")); + return LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", Core::StandardPaths::config_directory(), "RunHistory.txt")); } ErrorOr RunWindow::load_history() @@ -188,7 +188,7 @@ ErrorOr RunWindow::save_history() // Write the first 25 items of history for (int i = 0; i < min(static_cast(m_path_history.size()), 25); i++) - TRY(file->write(String::formatted("{}\n", m_path_history[i]).bytes())); + TRY(file->write(DeprecatedString::formatted("{}\n", m_path_history[i]).bytes())); return {}; } diff --git a/Userland/Applications/Run/RunWindow.h b/Userland/Applications/Run/RunWindow.h index 5ae6b483e1f..28694073936 100644 --- a/Userland/Applications/Run/RunWindow.h +++ b/Userland/Applications/Run/RunWindow.h @@ -24,15 +24,15 @@ private: RunWindow(); void do_run(); - bool run_as_command(String const& run_input); - bool run_via_launch(String const& run_input); + bool run_as_command(DeprecatedString const& run_input); + bool run_via_launch(DeprecatedString const& run_input); - String history_file_path(); + DeprecatedString history_file_path(); ErrorOr load_history(); ErrorOr save_history(); - Vector m_path_history; - NonnullRefPtr> m_path_history_model; + Vector m_path_history; + NonnullRefPtr> m_path_history_model; RefPtr m_icon_image_widget; RefPtr m_ok_button; diff --git a/Userland/Applications/Settings/main.cpp b/Userland/Applications/Settings/main.cpp index 0fdcb92ed30..073bd2b13e4 100644 --- a/Userland/Applications/Settings/main.cpp +++ b/Userland/Applications/Settings/main.cpp @@ -55,7 +55,7 @@ public: return app->icon(); if (role == GUI::ModelRole::Display) { - String name; + DeprecatedString name; if (app->name().ends_with(" Settings"sv)) name = app->name().substring(0, app->name().length() - " Settings"sv.length()); @@ -116,7 +116,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto requires_root = model->data(index, static_cast(SettingsAppsModelCustomRole::RequiresRoot)).as_bool(); auto launch_origin_rect = icon_view->to_widget_rect(icon_view->content_rect(index)).translated(icon_view->screen_relative_rect().location()); - setenv("__libgui_launch_origin_rect", String::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1); + setenv("__libgui_launch_origin_rect", DeprecatedString::formatted("{},{},{},{}", launch_origin_rect.x(), launch_origin_rect.y(), launch_origin_rect.width(), launch_origin_rect.height()).characters(), 1); if (requires_root) GUI::Process::spawn_or_show_error(window, "/bin/Escalator"sv, Array { executable }); diff --git a/Userland/Applications/SoundPlayer/M3UParser.cpp b/Userland/Applications/SoundPlayer/M3UParser.cpp index 8f8a066d303..2ba0b0fead7 100644 --- a/Userland/Applications/SoundPlayer/M3UParser.cpp +++ b/Userland/Applications/SoundPlayer/M3UParser.cpp @@ -20,10 +20,10 @@ NonnullOwnPtr M3UParser::from_file(StringView path) auto file_result = Core::Stream::File::open(path, Core::Stream::OpenMode::Read).release_value_but_fixme_should_propagate_errors(); auto contents = file_result->read_all().release_value_but_fixme_should_propagate_errors(); auto use_utf8 = path.ends_with(".m3u8"sv, CaseSensitivity::CaseInsensitive); - return from_memory(String { contents, NoChomp }, use_utf8); + return from_memory(DeprecatedString { contents, NoChomp }, use_utf8); } -NonnullOwnPtr M3UParser::from_memory(String const& m3u_contents, bool utf8) +NonnullOwnPtr M3UParser::from_memory(DeprecatedString const& m3u_contents, bool utf8) { auto parser = make(); VERIFY(!m3u_contents.is_null() && !m3u_contents.is_empty() && !m3u_contents.is_whitespace()); diff --git a/Userland/Applications/SoundPlayer/M3UParser.h b/Userland/Applications/SoundPlayer/M3UParser.h index 6965fe8fb3c..39e33e79db8 100644 --- a/Userland/Applications/SoundPlayer/M3UParser.h +++ b/Userland/Applications/SoundPlayer/M3UParser.h @@ -6,44 +6,44 @@ #pragma once +#include #include #include -#include #include #include // Extended M3U fields (de facto standard) struct M3UExtendedInfo { Optional track_length_in_seconds; - Optional track_display_title; - Optional group_name; - Optional album_title; - Optional album_artist; - Optional album_genre; + Optional track_display_title; + Optional group_name; + Optional album_title; + Optional album_artist; + Optional album_genre; Optional file_size_in_bytes; Optional embedded_mp3; - Optional cover_path; + Optional cover_path; }; struct M3UEntry { - String path; + DeprecatedString path; Optional extended_info; }; class M3UParser { public: static NonnullOwnPtr from_file(StringView path); - static NonnullOwnPtr from_memory(String const& m3u_contents, bool utf8); + static NonnullOwnPtr from_memory(DeprecatedString const& m3u_contents, bool utf8); NonnullOwnPtr> parse(bool include_extended_info); - Optional& get_playlist_title_metadata() { return m_parsed_playlist_title; } + Optional& get_playlist_title_metadata() { return m_parsed_playlist_title; } M3UParser(); private: - String m_m3u_raw_data; - String m_playlist_path; + DeprecatedString m_m3u_raw_data; + DeprecatedString m_playlist_path; bool m_use_utf8; - Optional m_parsed_playlist_title; + Optional m_parsed_playlist_title; }; diff --git a/Userland/Applications/SoundPlayer/Player.cpp b/Userland/Applications/SoundPlayer/Player.cpp index 47f1cbb0fdc..0b3adf13840 100644 --- a/Userland/Applications/SoundPlayer/Player.cpp +++ b/Userland/Applications/SoundPlayer/Player.cpp @@ -40,7 +40,7 @@ Player::Player(Audio::ConnectionToServer& audio_client_connection) }; } -void Player::play_file_path(String const& path) +void Player::play_file_path(DeprecatedString const& path) { if (path.is_null()) return; @@ -71,7 +71,7 @@ void Player::play_file_path(String const& path) play(); } -bool Player::is_playlist(String const& path) +bool Player::is_playlist(DeprecatedString const& path) { return (path.ends_with(".m3u"sv, AK::CaseSensitivity::CaseInsensitive) || path.ends_with(".m3u8"sv, AK::CaseSensitivity::CaseInsensitive)); diff --git a/Userland/Applications/SoundPlayer/Player.h b/Userland/Applications/SoundPlayer/Player.h index ec2ef786609..c6876459e7e 100644 --- a/Userland/Applications/SoundPlayer/Player.h +++ b/Userland/Applications/SoundPlayer/Player.h @@ -35,11 +35,11 @@ public: explicit Player(Audio::ConnectionToServer& audio_client_connection); virtual ~Player() = default; - void play_file_path(String const& path); - bool is_playlist(String const& path); + void play_file_path(DeprecatedString const& path); + bool is_playlist(DeprecatedString const& path); Playlist& playlist() { return m_playlist; } - String const& loaded_filename() const { return m_loaded_filename; } + DeprecatedString const& loaded_filename() const { return m_loaded_filename; } PlayState play_state() const { return m_play_state; } void set_play_state(PlayState); @@ -97,7 +97,7 @@ private: Audio::ConnectionToServer& m_audio_client_connection; PlaybackManager m_playback_manager; - String m_loaded_filename; + DeprecatedString m_loaded_filename; double m_volume { 0 }; bool m_muted { false }; }; diff --git a/Userland/Applications/SoundPlayer/Playlist.cpp b/Userland/Applications/SoundPlayer/Playlist.cpp index 90eec5a919c..991f368040f 100644 --- a/Userland/Applications/SoundPlayer/Playlist.cpp +++ b/Userland/Applications/SoundPlayer/Playlist.cpp @@ -36,7 +36,7 @@ void Playlist::try_fill_missing_info(Vector& entries, StringView path) for (auto& entry : entries) { if (!LexicalPath { entry.path }.is_absolute()) - entry.path = String::formatted("{}/{}", playlist_path.dirname(), entry.path); + entry.path = DeprecatedString::formatted("{}/{}", playlist_path.dirname(), entry.path); if (!entry.extended_info->file_size_in_bytes.has_value()) { auto size = Core::File::size(entry.path); diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp index b5881d7bd70..8ef466c6f9b 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.cpp +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.cpp @@ -56,24 +56,24 @@ GUI::Variant PlaylistModel::data(const GUI::ModelIndex& index, GUI::ModelRole ro return {}; } -String PlaylistModel::format_filesize(u64 size_in_bytes) +DeprecatedString PlaylistModel::format_filesize(u64 size_in_bytes) { if (size_in_bytes > GiB) - return String::formatted("{:.2f} GiB", (double)size_in_bytes / GiB); + return DeprecatedString::formatted("{:.2f} GiB", (double)size_in_bytes / GiB); else if (size_in_bytes > MiB) - return String::formatted("{:.2f} MiB", (double)size_in_bytes / MiB); + return DeprecatedString::formatted("{:.2f} MiB", (double)size_in_bytes / MiB); else if (size_in_bytes > KiB) - return String::formatted("{:.2f} KiB", (double)size_in_bytes / KiB); + return DeprecatedString::formatted("{:.2f} KiB", (double)size_in_bytes / KiB); else - return String::formatted("{} B", size_in_bytes); + return DeprecatedString::formatted("{} B", size_in_bytes); } -String PlaylistModel::format_duration(u32 duration_in_seconds) +DeprecatedString PlaylistModel::format_duration(u32 duration_in_seconds) { - return String::formatted("{:02}:{:02}:{:02}", duration_in_seconds / 3600, duration_in_seconds / 60, duration_in_seconds % 60); + return DeprecatedString::formatted("{:02}:{:02}:{:02}", duration_in_seconds / 3600, duration_in_seconds / 60, duration_in_seconds % 60); } -String PlaylistModel::column_name(int column) const +DeprecatedString PlaylistModel::column_name(int column) const { switch (column) { case 0: diff --git a/Userland/Applications/SoundPlayer/PlaylistWidget.h b/Userland/Applications/SoundPlayer/PlaylistWidget.h index e1260fd20e0..cc033fc5b85 100644 --- a/Userland/Applications/SoundPlayer/PlaylistWidget.h +++ b/Userland/Applications/SoundPlayer/PlaylistWidget.h @@ -24,14 +24,14 @@ public: int row_count(const GUI::ModelIndex&) const override { return m_playlist_items.size(); } int column_count(const GUI::ModelIndex&) const override { return 6; } GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - String column_name(int column) const override; + DeprecatedString column_name(int column) const override; Vector& items() { return m_playlist_items; } private: Vector m_playlist_items; - static String format_filesize(u64 size_in_bytes); - static String format_duration(u32 duration_in_seconds); + static DeprecatedString format_filesize(u64 size_in_bytes); + static DeprecatedString format_duration(u32 duration_in_seconds); }; class PlaylistTableView : public GUI::TableView { diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index e0fc38422cb..4850544eaf6 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -199,13 +199,13 @@ void SoundPlayerWidgetAdvancedView::shuffle_mode_changed(Player::ShuffleMode) void SoundPlayerWidgetAdvancedView::time_elapsed(int seconds) { - m_timestamp_label->set_text(String::formatted("Elapsed: {:02}:{:02}:{:02}", seconds / 3600, seconds / 60, seconds % 60)); + m_timestamp_label->set_text(DeprecatedString::formatted("Elapsed: {:02}:{:02}:{:02}", seconds / 3600, seconds / 60, seconds % 60)); } void SoundPlayerWidgetAdvancedView::file_name_changed(StringView name) { m_visualization->start_new_file(name); - m_window.set_title(String::formatted("{} - Sound Player", name)); + m_window.set_title(DeprecatedString::formatted("{} - Sound Player", name)); } void SoundPlayerWidgetAdvancedView::total_samples_changed(int total_samples) @@ -225,13 +225,13 @@ void SoundPlayerWidgetAdvancedView::sound_buffer_played(FixedArrayset_text(String::formatted("{}%", static_cast(volume * 100))); + m_volume_label->set_text(DeprecatedString::formatted("{}%", static_cast(volume * 100))); } void SoundPlayerWidgetAdvancedView::playlist_loaded(StringView path, bool loaded) { if (!loaded) { - GUI::MessageBox::show(&m_window, String::formatted("Could not load playlist at \"{}\".", path), "Error opening playlist"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(&m_window, DeprecatedString::formatted("Could not load playlist at \"{}\".", path), "Error opening playlist"sv, GUI::MessageBox::Type::Error); return; } set_playlist_visible(true); @@ -240,6 +240,6 @@ void SoundPlayerWidgetAdvancedView::playlist_loaded(StringView path, bool loaded void SoundPlayerWidgetAdvancedView::audio_load_error(StringView path, StringView error_string) { - GUI::MessageBox::show(&m_window, String::formatted("Failed to load audio file: {} ({})", path, error_string.is_null() ? "Unknown error"sv : error_string), + GUI::MessageBox::show(&m_window, DeprecatedString::formatted("Failed to load audio file: {} ({})", path, error_string.is_null() ? "Unknown error"sv : error_string), "Filetype error"sv, GUI::MessageBox::Type::Error); } diff --git a/Userland/Applications/SoundPlayer/main.cpp b/Userland/Applications/SoundPlayer/main.cpp index baef8a3ce30..4eaed41fac7 100644 --- a/Userland/Applications/SoundPlayer/main.cpp +++ b/Userland/Applications/SoundPlayer/main.cpp @@ -51,7 +51,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto file_menu = TRY(window->try_add_menu("&File")); TRY(file_menu->try_add_action(GUI::CommonActions::make_open_action([&](auto&) { - Optional path = GUI::FilePicker::get_open_filepath(window, "Open sound file..."); + Optional path = GUI::FilePicker::get_open_filepath(window, "Open sound file..."); if (path.has_value()) { player->play_file_path(path.value()); } diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp index cbd8679a673..f30a2882606 100644 --- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp +++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.cpp @@ -94,7 +94,7 @@ void TreeMapWidget::paint_cell_frame(GUI::Painter& painter, TreeMapNode const& n text_rect.take_from_top(font().presentation_size() + 1); painter.draw_text(text_rect, human_readable_size(node.area()), font(), Gfx::TextAlignment::TopLeft, Color::Black); } else { - painter.draw_text(text_rect, String::formatted("{} - {}", node.name(), human_readable_size(node.area())), font(), Gfx::TextAlignment::TopLeft, Color::Black); + painter.draw_text(text_rect, DeprecatedString::formatted("{} - {}", node.name(), human_readable_size(node.area())), font(), Gfx::TextAlignment::TopLeft, Color::Black); } painter.clear_clip_rect(); } diff --git a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h index 14636e7f902..e35e1356947 100644 --- a/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h +++ b/Userland/Applications/SpaceAnalyzer/TreeMapWidget.h @@ -12,7 +12,7 @@ namespace SpaceAnalyzer { struct TreeMapNode { - virtual String name() const = 0; + virtual DeprecatedString name() const = 0; virtual i64 area() const = 0; virtual size_t num_children() const = 0; virtual TreeMapNode const& child_at(size_t i) const = 0; diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index ea3d82351cf..ef0259f8e27 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -34,10 +34,10 @@ static constexpr auto APP_NAME = "Space Analyzer"sv; static constexpr size_t FILES_ENCOUNTERED_UPDATE_STEP_SIZE = 25; struct TreeNode : public SpaceAnalyzer::TreeMapNode { - TreeNode(String name) + TreeNode(DeprecatedString name) : m_name(move(name)) {}; - virtual String name() const override { return m_name; } + virtual DeprecatedString name() const override { return m_name; } virtual i64 area() const override { return m_area; } virtual size_t num_children() const override { @@ -55,13 +55,13 @@ struct TreeNode : public SpaceAnalyzer::TreeMapNode { } } - String m_name; + DeprecatedString m_name; i64 m_area { 0 }; OwnPtr> m_children; }; struct Tree : public SpaceAnalyzer::TreeMap { - Tree(String root_name) + Tree(DeprecatedString root_name) : m_root(move(root_name)) {}; virtual ~Tree() {}; TreeNode m_root; @@ -72,8 +72,8 @@ struct Tree : public SpaceAnalyzer::TreeMap { }; struct MountInfo { - String mount_point; - String source; + DeprecatedString mount_point; + DeprecatedString source; }; static void fill_mounts(Vector& output) @@ -97,12 +97,12 @@ static void fill_mounts(Vector& output) }); } -static MountInfo* find_mount_for_path(String path, Vector& mounts) +static MountInfo* find_mount_for_path(DeprecatedString path, Vector& mounts) { MountInfo* result = nullptr; size_t length = 0; for (auto& mount_info : mounts) { - String& mount_point = mount_info.mount_point; + DeprecatedString& mount_point = mount_info.mount_point; if (path.starts_with(mount_point)) { if (!result || mount_point.length() > length) { result = &mount_info; @@ -153,17 +153,17 @@ static NonnullRefPtr create_progress_window() static void update_progress_label(GUI::Label& progresslabel, size_t files_encountered_count) { - auto text = String::formatted("{} files...", files_encountered_count); + auto text = DeprecatedString::formatted("{} files...", files_encountered_count); progresslabel.set_text(text); Core::EventLoop::current().pump(Core::EventLoop::WaitMode::PollForEvents); } struct QueueEntry { - QueueEntry(String path, TreeNode* node) + QueueEntry(DeprecatedString path, TreeNode* node) : path(move(path)) , node(node) {}; - String path; + DeprecatedString path; TreeNode* node { nullptr }; }; @@ -208,7 +208,7 @@ static void populate_filesize_tree(TreeNode& root, Vector& mounts, Ha if (!(files_encountered_count % FILES_ENCOUNTERED_UPDATE_STEP_SIZE)) update_progress_label(progresslabel, files_encountered_count); - String& name = child.m_name; + DeprecatedString& name = child.m_name; int name_len = name.length(); builder.append(name); struct stat st; @@ -263,7 +263,7 @@ static void analyze(RefPtr tree, SpaceAnalyzer::TreeMapWidget& treemapwidg builder.append({ error, strlen(error) }); builder.append(" ("sv); int value = error_accumulator.get(key).value(); - builder.append(String::number(value)); + builder.append(DeprecatedString::number(value)); if (value == 1) { builder.append(" time"sv); } else { @@ -279,7 +279,7 @@ static void analyze(RefPtr tree, SpaceAnalyzer::TreeMapWidget& treemapwidg treemapwidget.set_tree(tree); } -static bool is_removable(String const& absolute_path) +static bool is_removable(DeprecatedString const& absolute_path) { VERIFY(!absolute_path.is_empty()); int access_result = access(LexicalPath::dirname(absolute_path).characters(), W_OK); @@ -288,7 +288,7 @@ static bool is_removable(String const& absolute_path) return access_result == 0; } -static String get_absolute_path_to_selected_node(SpaceAnalyzer::TreeMapWidget const& treemapwidget, bool include_last_node = true) +static DeprecatedString get_absolute_path_to_selected_node(SpaceAnalyzer::TreeMapWidget const& treemapwidget, bool include_last_node = true) { StringBuilder path_builder; for (size_t k = 0; k < treemapwidget.path_size() - (include_last_node ? 0 : 1); k++) { @@ -348,7 +348,7 @@ ErrorOr serenity_main(Main::Arguments arguments) GUI::Clipboard::the().set_plain_text(get_absolute_path_to_selected_node(treemapwidget)); }); auto delete_action = GUI::CommonActions::make_delete_action([&](auto&) { - String selected_node_path = get_absolute_path_to_selected_node(treemapwidget); + DeprecatedString selected_node_path = get_absolute_path_to_selected_node(treemapwidget); bool try_again = true; while (try_again) { try_again = false; @@ -356,7 +356,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto deletion_result = Core::File::remove(selected_node_path, Core::File::RecursionMode::Allowed, true); if (deletion_result.is_error()) { auto retry_message_result = GUI::MessageBox::show(window, - String::formatted("Failed to delete \"{}\": {}. Retry?", + DeprecatedString::formatted("Failed to delete \"{}\": {}. Retry?", deletion_result.error().file, static_cast(deletion_result.error())), "Deletion failed"sv, @@ -367,7 +367,7 @@ ErrorOr serenity_main(Main::Arguments arguments) } } else { GUI::MessageBox::show(window, - String::formatted("Successfully deleted \"{}\".", selected_node_path), + DeprecatedString::formatted("Successfully deleted \"{}\".", selected_node_path), "Deletion completed"sv, GUI::MessageBox::Type::Information, GUI::MessageBox::InputType::OK); @@ -413,7 +413,7 @@ ErrorOr serenity_main(Main::Arguments arguments) breadcrumbbar.set_selected_segment(treemapwidget.viewpoint()); }; treemapwidget.on_context_menu_request = [&](const GUI::ContextMenuEvent& event) { - String selected_node_path = get_absolute_path_to_selected_node(treemapwidget); + DeprecatedString selected_node_path = get_absolute_path_to_selected_node(treemapwidget); if (selected_node_path.is_empty()) return; delete_action->set_enabled(is_removable(selected_node_path)); diff --git a/Userland/Applications/Spreadsheet/Cell.cpp b/Userland/Applications/Spreadsheet/Cell.cpp index 5544053f68f..eb51a6626f7 100644 --- a/Userland/Applications/Spreadsheet/Cell.cpp +++ b/Userland/Applications/Spreadsheet/Cell.cpp @@ -11,7 +11,7 @@ namespace Spreadsheet { -void Cell::set_data(String new_data) +void Cell::set_data(DeprecatedString new_data) { // If we are a formula, we do not save the beginning '=', if the new_data is "" we can simply change our kind if (m_kind == Formula && m_data.is_empty() && new_data.is_empty()) { @@ -80,7 +80,7 @@ CellType const& Cell::type() const return *CellType::get_by_name("Identity"sv); } -JS::ThrowCompletionOr Cell::typed_display() const +JS::ThrowCompletionOr Cell::typed_display() const { return type().display(const_cast(*this), m_type_metadata); } @@ -156,7 +156,7 @@ JS::Value Cell::js_data() return JS::js_string(m_sheet->interpreter().heap(), m_data); } -String Cell::source() const +DeprecatedString Cell::source() const { StringBuilder builder; if (m_kind == Formula) diff --git a/Userland/Applications/Spreadsheet/Cell.h b/Userland/Applications/Spreadsheet/Cell.h index 0707a557a58..0adf45aee72 100644 --- a/Userland/Applications/Spreadsheet/Cell.h +++ b/Userland/Applications/Spreadsheet/Cell.h @@ -11,7 +11,7 @@ #include "Forward.h" #include "JSIntegration.h" #include "Position.h" -#include +#include #include #include #include @@ -24,7 +24,7 @@ struct Cell : public Weakable { Formula, }; - Cell(String data, Position position, WeakPtr sheet) + Cell(DeprecatedString data, Position position, WeakPtr sheet) : m_dirty(false) , m_data(move(data)) , m_kind(LiteralString) @@ -33,7 +33,7 @@ struct Cell : public Weakable { { } - Cell(String source, JS::Value&& cell_value, Position position, WeakPtr sheet) + Cell(DeprecatedString source, JS::Value&& cell_value, Position position, WeakPtr sheet) : m_dirty(false) , m_data(move(source)) , m_evaluated_data(move(cell_value)) @@ -45,7 +45,7 @@ struct Cell : public Weakable { void reference_from(Cell*); - void set_data(String new_data); + void set_data(DeprecatedString new_data); void set_data(JS::Value new_data); bool dirty() const { return m_dirty; } void clear_dirty() { m_dirty = false; } @@ -55,7 +55,7 @@ struct Cell : public Weakable { if (!m_name_for_javascript.is_empty()) return m_name_for_javascript; - m_name_for_javascript = String::formatted("cell {}", m_position.to_cell_identifier(sheet)); + m_name_for_javascript = DeprecatedString::formatted("cell {}", m_position.to_cell_identifier(sheet)); return m_name_for_javascript; } @@ -67,7 +67,7 @@ struct Cell : public Weakable { return m_thrown_value; } - String const& data() const { return m_data; } + DeprecatedString const& data() const { return m_data; } const JS::Value& evaluated_data() const { return m_evaluated_data; } Kind kind() const { return m_kind; } Vector> const& referencing_cells() const { return m_referencing_cells; } @@ -94,14 +94,14 @@ struct Cell : public Weakable { m_conditional_formats = move(fmts); } - JS::ThrowCompletionOr typed_display() const; + JS::ThrowCompletionOr typed_display() const; JS::ThrowCompletionOr typed_js_data() const; CellType const& type() const; CellTypeMetadata const& type_metadata() const { return m_type_metadata; } CellTypeMetadata& type_metadata() { return m_type_metadata; } - String source() const; + DeprecatedString source() const; JS::Value js_data(); @@ -116,7 +116,7 @@ struct Cell : public Weakable { private: bool m_dirty { false }; bool m_evaluated_externally { false }; - String m_data; + DeprecatedString m_data; JS::Value m_evaluated_data; JS::Value m_thrown_value; Kind m_kind { LiteralString }; @@ -125,7 +125,7 @@ private: CellType const* m_type { nullptr }; CellTypeMetadata m_type_metadata; Position m_position; - mutable String m_name_for_javascript; + mutable DeprecatedString m_name_for_javascript; Vector m_conditional_formats; Format m_evaluated_formats; diff --git a/Userland/Applications/Spreadsheet/CellType/Date.cpp b/Userland/Applications/Spreadsheet/CellType/Date.cpp index 774fe95974b..77d4f3fd44d 100644 --- a/Userland/Applications/Spreadsheet/CellType/Date.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Date.cpp @@ -17,9 +17,9 @@ DateCell::DateCell() { } -JS::ThrowCompletionOr DateCell::display(Cell& cell, CellTypeMetadata const& metadata) const +JS::ThrowCompletionOr DateCell::display(Cell& cell, CellTypeMetadata const& metadata) const { - return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr { + return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr { auto& vm = cell.sheet().global_object().vm(); auto timestamp = TRY(js_value(cell, metadata)); auto string = Core::DateTime::from_timestamp(TRY(timestamp.to_i32(vm))).to_string(metadata.format.is_empty() ? "%Y-%m-%d %H:%M:%S"sv : metadata.format.view()); @@ -39,7 +39,7 @@ JS::ThrowCompletionOr DateCell::js_value(Cell& cell, CellTypeMetadata return JS::Value(value / 1000); // Turn it to seconds } -String DateCell::metadata_hint(MetadataName metadata) const +DeprecatedString DateCell::metadata_hint(MetadataName metadata) const { if (metadata == MetadataName::Format) return "Date format string as supported by `strftime'"; diff --git a/Userland/Applications/Spreadsheet/CellType/Date.h b/Userland/Applications/Spreadsheet/CellType/Date.h index b1aca31f5bd..9a84a790d99 100644 --- a/Userland/Applications/Spreadsheet/CellType/Date.h +++ b/Userland/Applications/Spreadsheet/CellType/Date.h @@ -16,9 +16,9 @@ class DateCell : public CellType { public: DateCell(); virtual ~DateCell() override = default; - virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; + virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const override; - String metadata_hint(MetadataName) const override; + DeprecatedString metadata_hint(MetadataName) const override; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/Format.cpp b/Userland/Applications/Spreadsheet/CellType/Format.cpp index 82e7d31d37d..77b8f32eda0 100644 --- a/Userland/Applications/Spreadsheet/CellType/Format.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Format.cpp @@ -5,8 +5,8 @@ */ #include "Format.h" +#include #include -#include #include namespace Spreadsheet { @@ -37,7 +37,7 @@ struct PrintfImpl : public PrintfImplementation::PrintfImpl IdentityCell::display(Cell& cell, CellTypeMetadata const& metadata) const +JS::ThrowCompletionOr IdentityCell::display(Cell& cell, CellTypeMetadata const& metadata) const { auto& vm = cell.sheet().global_object().vm(); auto data = cell.js_data(); @@ -30,7 +30,7 @@ JS::ThrowCompletionOr IdentityCell::js_value(Cell& cell, CellTypeMeta return cell.js_data(); } -String IdentityCell::metadata_hint(MetadataName metadata) const +DeprecatedString IdentityCell::metadata_hint(MetadataName metadata) const { if (metadata == MetadataName::Length) return "Ignored"; diff --git a/Userland/Applications/Spreadsheet/CellType/Identity.h b/Userland/Applications/Spreadsheet/CellType/Identity.h index 2f43f6c8204..cbca22ad869 100644 --- a/Userland/Applications/Spreadsheet/CellType/Identity.h +++ b/Userland/Applications/Spreadsheet/CellType/Identity.h @@ -15,9 +15,9 @@ class IdentityCell : public CellType { public: IdentityCell(); virtual ~IdentityCell() override = default; - virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; + virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const override; - String metadata_hint(MetadataName) const override; + DeprecatedString metadata_hint(MetadataName) const override; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp index d3444eafba8..06b13d65306 100644 --- a/Userland/Applications/Spreadsheet/CellType/Numeric.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Numeric.cpp @@ -17,12 +17,12 @@ NumericCell::NumericCell() { } -JS::ThrowCompletionOr NumericCell::display(Cell& cell, CellTypeMetadata const& metadata) const +JS::ThrowCompletionOr NumericCell::display(Cell& cell, CellTypeMetadata const& metadata) const { - return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr { + return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr { auto& vm = cell.sheet().global_object().vm(); auto value = TRY(js_value(cell, metadata)); - String string; + DeprecatedString string; if (metadata.format.is_empty()) string = TRY(value.to_string(vm)); else @@ -43,7 +43,7 @@ JS::ThrowCompletionOr NumericCell::js_value(Cell& cell, CellTypeMetad }); } -String NumericCell::metadata_hint(MetadataName metadata) const +DeprecatedString NumericCell::metadata_hint(MetadataName metadata) const { if (metadata == MetadataName::Format) return "Format string as accepted by `printf', all numeric formats refer to the same value (the cell's value)"; diff --git a/Userland/Applications/Spreadsheet/CellType/Numeric.h b/Userland/Applications/Spreadsheet/CellType/Numeric.h index 2bf94e15cc9..da086c0b2a4 100644 --- a/Userland/Applications/Spreadsheet/CellType/Numeric.h +++ b/Userland/Applications/Spreadsheet/CellType/Numeric.h @@ -26,9 +26,9 @@ class NumericCell : public CellType { public: NumericCell(); virtual ~NumericCell() override = default; - virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; + virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const override; - String metadata_hint(MetadataName) const override; + DeprecatedString metadata_hint(MetadataName) const override; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/String.cpp b/Userland/Applications/Spreadsheet/CellType/String.cpp index 1d0a49b41ae..79ebe52cd65 100644 --- a/Userland/Applications/Spreadsheet/CellType/String.cpp +++ b/Userland/Applications/Spreadsheet/CellType/String.cpp @@ -15,7 +15,7 @@ StringCell::StringCell() { } -JS::ThrowCompletionOr StringCell::display(Cell& cell, CellTypeMetadata const& metadata) const +JS::ThrowCompletionOr StringCell::display(Cell& cell, CellTypeMetadata const& metadata) const { auto& vm = cell.sheet().global_object().vm(); auto string = TRY(cell.js_data().to_string(vm)); @@ -31,7 +31,7 @@ JS::ThrowCompletionOr StringCell::js_value(Cell& cell, CellTypeMetada return JS::js_string(cell.sheet().interpreter().heap(), string); } -String StringCell::metadata_hint(MetadataName metadata) const +DeprecatedString StringCell::metadata_hint(MetadataName metadata) const { if (metadata == MetadataName::Format) return "Ignored"; diff --git a/Userland/Applications/Spreadsheet/CellType/String.h b/Userland/Applications/Spreadsheet/CellType/String.h index ed6333af7a9..5989372af4b 100644 --- a/Userland/Applications/Spreadsheet/CellType/String.h +++ b/Userland/Applications/Spreadsheet/CellType/String.h @@ -15,9 +15,9 @@ class StringCell : public CellType { public: StringCell(); virtual ~StringCell() override = default; - virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; + virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const override; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const override; - String metadata_hint(MetadataName) const override; + DeprecatedString metadata_hint(MetadataName) const override; }; } diff --git a/Userland/Applications/Spreadsheet/CellType/Type.cpp b/Userland/Applications/Spreadsheet/CellType/Type.cpp index e75665fbbc3..259cf9f001d 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.cpp +++ b/Userland/Applications/Spreadsheet/CellType/Type.cpp @@ -12,7 +12,7 @@ #include #include -static HashMap s_cell_types; +static HashMap s_cell_types; static Spreadsheet::StringCell s_string_cell; static Spreadsheet::NumericCell s_numeric_cell; static Spreadsheet::IdentityCell s_identity_cell; diff --git a/Userland/Applications/Spreadsheet/CellType/Type.h b/Userland/Applications/Spreadsheet/CellType/Type.h index 2418c900f31..117a67129bd 100644 --- a/Userland/Applications/Spreadsheet/CellType/Type.h +++ b/Userland/Applications/Spreadsheet/CellType/Type.h @@ -8,8 +8,8 @@ #include "../ConditionalFormatting.h" #include "../Forward.h" +#include #include -#include #include #include #include @@ -18,7 +18,7 @@ namespace Spreadsheet { struct CellTypeMetadata { int length { -1 }; - String format; + DeprecatedString format; Gfx::TextAlignment alignment { Gfx::TextAlignment::CenterRight }; Format static_format; }; @@ -35,18 +35,18 @@ public: static CellType const* get_by_name(StringView); static Vector names(); - virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const = 0; + virtual JS::ThrowCompletionOr display(Cell&, CellTypeMetadata const&) const = 0; virtual JS::ThrowCompletionOr js_value(Cell&, CellTypeMetadata const&) const = 0; - virtual String metadata_hint(MetadataName) const { return {}; } + virtual DeprecatedString metadata_hint(MetadataName) const { return {}; } virtual ~CellType() = default; - String const& name() const { return m_name; } + DeprecatedString const& name() const { return m_name; } protected: CellType(StringView name); private: - String m_name; + DeprecatedString m_name; }; } diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp index c3d6a227792..508353a40bd 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp @@ -62,9 +62,9 @@ CellTypeDialog::CellTypeDialog(Vector const& positions, Sheet& sheet, ok_button.on_click = [&](auto) { done(ExecResult::OK); }; } -Vector const g_horizontal_alignments { "Left", "Center", "Right" }; -Vector const g_vertical_alignments { "Top", "Center", "Bottom" }; -Vector g_types; +Vector const g_horizontal_alignments { "Left", "Center", "Right" }; +Vector const g_vertical_alignments { "Top", "Center", "Bottom" }; +Vector g_types; constexpr static CellTypeDialog::VerticalAlignment vertical_alignment_from(Gfx::TextAlignment alignment) { @@ -143,7 +143,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector const& po right_side.set_fixed_width(170); auto& type_list = left_side.add(); - type_list.set_model(*GUI::ItemListModel::create(g_types)); + type_list.set_model(*GUI::ItemListModel::create(g_types)); type_list.set_should_hide_unnecessary_scrollbars(true); type_list.on_selection_change = [&] { const auto& index = type_list.selection().first(); @@ -189,7 +189,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector const& po checkbox.on_checked = [&](auto checked) { editor.set_enabled(checked); if (!checked) - m_format = String::empty(); + m_format = DeprecatedString::empty(); editor.set_text(m_format); }; editor.on_change = [&] { @@ -215,7 +215,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector const& po auto& horizontal_combobox = alignment_tab.add(); horizontal_combobox.set_only_allow_values_from_model(true); - horizontal_combobox.set_model(*GUI::ItemListModel::create(g_horizontal_alignments)); + horizontal_combobox.set_model(*GUI::ItemListModel::create(g_horizontal_alignments)); horizontal_combobox.set_selected_index((int)m_horizontal_alignment); horizontal_combobox.on_change = [&](auto&, const GUI::ModelIndex& index) { switch (index.row()) { @@ -247,7 +247,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector const& po auto& vertical_combobox = alignment_tab.add(); vertical_combobox.set_only_allow_values_from_model(true); - vertical_combobox.set_model(*GUI::ItemListModel::create(g_vertical_alignments)); + vertical_combobox.set_model(*GUI::ItemListModel::create(g_vertical_alignments)); vertical_combobox.set_selected_index((int)m_vertical_alignment); vertical_combobox.on_change = [&](auto&, const GUI::ModelIndex& index) { switch (index.row()) { diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.h b/Userland/Applications/Spreadsheet/CellTypeDialog.h index f260ddf818a..9171e27e9c4 100644 --- a/Userland/Applications/Spreadsheet/CellTypeDialog.h +++ b/Userland/Applications/Spreadsheet/CellTypeDialog.h @@ -39,7 +39,7 @@ private: CellType const* m_type { nullptr }; int m_length { -1 }; - String m_format; + DeprecatedString m_format; HorizontalAlignment m_horizontal_alignment { HorizontalAlignment::Right }; VerticalAlignment m_vertical_alignment { VerticalAlignment::Center }; Format m_static_format; diff --git a/Userland/Applications/Spreadsheet/ConditionalFormatting.h b/Userland/Applications/Spreadsheet/ConditionalFormatting.h index 38d38c187fe..bcd11d85958 100644 --- a/Userland/Applications/Spreadsheet/ConditionalFormatting.h +++ b/Userland/Applications/Spreadsheet/ConditionalFormatting.h @@ -7,7 +7,7 @@ #pragma once #include "Forward.h" -#include +#include #include #include @@ -19,7 +19,7 @@ struct Format { }; struct ConditionalFormat : public Format { - String condition; + DeprecatedString condition; }; enum class FormatType { diff --git a/Userland/Applications/Spreadsheet/ExportDialog.cpp b/Userland/Applications/Spreadsheet/ExportDialog.cpp index 6f5cd8c8f70..7b30aaa5366 100644 --- a/Userland/Applications/Spreadsheet/ExportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ExportDialog.cpp @@ -7,9 +7,9 @@ #include "ExportDialog.h" #include "Spreadsheet.h" #include "Workbook.h" +#include #include #include -#include #include #include #include @@ -35,7 +35,7 @@ CSVExportDialogPage::CSVExportDialogPage(Sheet const& sheet) { m_headers.extend(m_data.take_first()); - auto temp_template = String::formatted("{}/spreadsheet-csv-export.{}.XXXXXX", Core::StandardPaths::tempfile_directory(), getpid()); + auto temp_template = DeprecatedString::formatted("{}/spreadsheet-csv-export.{}.XXXXXX", Core::StandardPaths::tempfile_directory(), getpid()); auto temp_path = ByteBuffer::create_uninitialized(temp_template.length() + 1).release_value_but_fixme_should_propagate_errors(); auto buf = reinterpret_cast(temp_path.data()); auto copy_ok = temp_template.copy_characters_to_buffer(buf, temp_path.size()); @@ -74,7 +74,7 @@ CSVExportDialogPage::CSVExportDialogPage(Sheet const& sheet) m_data_preview_text_editor->set_should_hide_unnecessary_scrollbars(true); - m_quote_escape_combo_box->set_model(GUI::ItemListModel::create(m_quote_escape_items)); + m_quote_escape_combo_box->set_model(GUI::ItemListModel::create(m_quote_escape_items)); // By default, use commas, double quotes with repeat, disable headers, and quote only the fields that require quoting. m_delimiter_comma_radio->set_checked(true); @@ -106,8 +106,8 @@ CSVExportDialogPage::CSVExportDialogPage(Sheet const& sheet) auto CSVExportDialogPage::make_writer() -> Optional { - String delimiter; - String quote; + DeprecatedString delimiter; + DeprecatedString quote; Writer::WriterTraits::QuoteEscape quote_escape; // Delimiter @@ -156,7 +156,7 @@ auto CSVExportDialogPage::make_writer() -> Optional }; auto behaviors = Writer::default_behaviors(); - Vector empty_headers; + Vector empty_headers; auto* headers = &empty_headers; if (should_export_headers) { @@ -213,7 +213,7 @@ void CSVExportDialogPage::update_preview() m_data_preview_text_editor->update(); } -Result CSVExportDialogPage::move_into(String const& target) +Result CSVExportDialogPage::move_into(DeprecatedString const& target) { auto& source = m_temp_output_file_path; @@ -232,26 +232,26 @@ Result CSVExportDialogPage::move_into(String const& target) Core::File::AddDuplicateFileMarker::No); if (result.is_error()) - return String::formatted("{}", static_cast(result.error())); + return DeprecatedString::formatted("{}", static_cast(result.error())); return {}; } perror("rename"); - return String { strerror(saved_errno) }; + return DeprecatedString { strerror(saved_errno) }; } -Result ExportDialog::make_and_run_for(StringView mime, Core::File& file, Workbook& workbook) +Result ExportDialog::make_and_run_for(StringView mime, Core::File& file, Workbook& workbook) { auto wizard = GUI::WizardDialog::construct(GUI::Application::the()->active_window()); wizard->set_title("File Export Wizard"); wizard->set_icon(GUI::Icon::default_icon("app-spreadsheet"sv).bitmap_for_size(16)); - auto export_xsv = [&]() -> Result { + auto export_xsv = [&]() -> Result { // FIXME: Prompt for the user to select a specific sheet to export // For now, export the first sheet (if available) if (!workbook.has_sheets()) - return String { "The workbook has no sheets to export!" }; + return DeprecatedString { "The workbook has no sheets to export!" }; CSVExportDialogPage page { workbook.sheets().first() }; wizard->replace_page(page.page()); @@ -260,18 +260,18 @@ Result ExportDialog::make_and_run_for(StringView mime, Core::File& if (result == GUI::Dialog::ExecResult::OK) { auto& writer = page.writer(); if (!writer.has_value()) - return String { "CSV Export failed" }; + return DeprecatedString { "CSV Export failed" }; if (writer->has_error()) - return String::formatted("CSV Export failed: {}", writer->error_string()); + return DeprecatedString::formatted("CSV Export failed: {}", writer->error_string()); // No error, move the temp file to the expected location return page.move_into(file.filename()); } else { - return String { "CSV Export was cancelled" }; + return DeprecatedString { "CSV Export was cancelled" }; } }; - auto export_worksheet = [&]() -> Result { + auto export_worksheet = [&]() -> Result { JsonArray array; for (auto& sheet : workbook.sheets()) array.append(sheet.to_json()); @@ -299,23 +299,23 @@ Result ExportDialog::make_and_run_for(StringView mime, Core::File& } else { auto page = GUI::WizardPage::construct( "Export File Format", - String::formatted("Select the format you wish to export to '{}' as", LexicalPath::basename(file.filename()))); + DeprecatedString::formatted("Select the format you wish to export to '{}' as", LexicalPath::basename(file.filename()))); page->on_next_page = [] { return nullptr; }; page->body_widget().load_from_gml(select_format_page_gml); auto format_combo_box = page->body_widget().find_descendant_of_type_named("select_format_page_format_combo_box"); - Vector supported_formats { + Vector supported_formats { "CSV (text/csv)", "Spreadsheet Worksheet", }; - format_combo_box->set_model(GUI::ItemListModel::create(supported_formats)); + format_combo_box->set_model(GUI::ItemListModel::create(supported_formats)); wizard->push_page(page); if (wizard->exec() != GUI::Dialog::ExecResult::OK) - return String { "Export was cancelled" }; + return DeprecatedString { "Export was cancelled" }; if (format_combo_box->selected_index() == 0) return export_xsv(); diff --git a/Userland/Applications/Spreadsheet/ExportDialog.h b/Userland/Applications/Spreadsheet/ExportDialog.h index 3618ac0793b..dd473384ef7 100644 --- a/Userland/Applications/Spreadsheet/ExportDialog.h +++ b/Userland/Applications/Spreadsheet/ExportDialog.h @@ -18,21 +18,21 @@ class Sheet; class Workbook; struct CSVExportDialogPage { - using XSV = Writer::XSV>, Vector>; + using XSV = Writer::XSV>, Vector>; explicit CSVExportDialogPage(Sheet const&); NonnullRefPtr page() { return *m_page; } Optional& writer() { return m_previously_made_writer; } - Result move_into(String const& target); + Result move_into(DeprecatedString const& target); protected: void update_preview(); Optional make_writer(); private: - Vector> m_data; - Vector m_headers; + Vector> m_data; + Vector m_headers; Optional m_previously_made_writer; RefPtr m_page; RefPtr m_delimiter_comma_radio; @@ -49,17 +49,17 @@ private: RefPtr m_export_header_check_box; RefPtr m_quote_all_fields_check_box; RefPtr m_data_preview_text_editor; - Vector m_quote_escape_items { + Vector m_quote_escape_items { // Note: Keep in sync with Writer::WriterTraits::QuoteEscape. "Repeat", "Backslash", }; - String m_temp_output_file_path; + DeprecatedString m_temp_output_file_path; }; struct ExportDialog { - static Result make_and_run_for(StringView mime, Core::File& file, Workbook&); + static Result make_and_run_for(StringView mime, Core::File& file, Workbook&); }; } diff --git a/Userland/Applications/Spreadsheet/HelpWindow.cpp b/Userland/Applications/Spreadsheet/HelpWindow.cpp index 2b8e08f06a5..899684c6908 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.cpp +++ b/Userland/Applications/Spreadsheet/HelpWindow.cpp @@ -38,7 +38,7 @@ public: return {}; } - String key(const GUI::ModelIndex& index) const { return m_keys[index.row()]; } + DeprecatedString key(const GUI::ModelIndex& index) const { return m_keys[index.row()]; } void set_from(JsonObject const& object) { @@ -55,7 +55,7 @@ private: { } - Vector m_keys; + Vector m_keys; }; RefPtr HelpWindow::s_the { nullptr }; @@ -86,7 +86,7 @@ HelpWindow::HelpWindow(GUI::Window* parent) auto entry = LexicalPath::basename(url.path()); auto doc_option = m_docs.get(entry); if (!doc_option.is_object()) { - GUI::MessageBox::show_error(this, String::formatted("No documentation entry found for '{}'", url.path())); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("No documentation entry found for '{}'", url.path())); return; } auto& doc = doc_option.as_object(); @@ -94,13 +94,13 @@ HelpWindow::HelpWindow(GUI::Window* parent) auto* example_data_ptr = doc.get_ptr("example_data"sv); if (!example_data_ptr || !example_data_ptr->is_object()) { - GUI::MessageBox::show_error(this, String::formatted("No example data found for '{}'", url.path())); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("No example data found for '{}'", url.path())); return; } auto& example_data = example_data_ptr->as_object(); if (!example_data.has_object(name)) { - GUI::MessageBox::show_error(this, String::formatted("Example '{}' not found for '{}'", name, url.path())); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("Example '{}' not found for '{}'", name, url.path())); return; } auto& value = example_data.get(name); @@ -108,13 +108,13 @@ HelpWindow::HelpWindow(GUI::Window* parent) auto window = GUI::Window::construct(this); window->resize(size()); window->set_icon(icon()); - window->set_title(String::formatted("Spreadsheet Help - Example {} for {}", name, entry)); + window->set_title(DeprecatedString::formatted("Spreadsheet Help - Example {} for {}", name, entry)); window->on_close = [window = window.ptr()] { window->remove_from_parent(); }; auto& widget = window->set_main_widget(window, NonnullRefPtrVector {}, false); auto sheet = Sheet::from_json(value.as_object(), widget.workbook()); if (!sheet) { - GUI::MessageBox::show_error(this, String::formatted("Corrupted example '{}' in '{}'", name, url.path())); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("Corrupted example '{}' in '{}'", name, url.path())); return; } @@ -137,7 +137,7 @@ HelpWindow::HelpWindow(GUI::Window* parent) }; } -String HelpWindow::render(StringView key) +DeprecatedString HelpWindow::render(StringView key) { VERIFY(m_docs.has_object(key)); auto& doc = m_docs.get(key).as_object(); diff --git a/Userland/Applications/Spreadsheet/HelpWindow.h b/Userland/Applications/Spreadsheet/HelpWindow.h index a63c8c06b07..41eb9360630 100644 --- a/Userland/Applications/Spreadsheet/HelpWindow.h +++ b/Userland/Applications/Spreadsheet/HelpWindow.h @@ -32,7 +32,7 @@ public: private: static RefPtr s_the; - String render(StringView key); + DeprecatedString render(StringView key); HelpWindow(GUI::Window* parent = nullptr); JsonObject m_docs; diff --git a/Userland/Applications/Spreadsheet/ImportDialog.cpp b/Userland/Applications/Spreadsheet/ImportDialog.cpp index 7382f6f2bd1..e5000fa931b 100644 --- a/Userland/Applications/Spreadsheet/ImportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ImportDialog.cpp @@ -53,7 +53,7 @@ CSVImportDialogPage::CSVImportDialogPage(StringView csv) m_data_preview_error_label = m_page->body_widget().find_descendant_of_type_named("data_preview_error_label"); m_data_preview_widget = m_page->body_widget().find_descendant_of_type_named("data_preview_widget"); - m_quote_escape_combo_box->set_model(GUI::ItemListModel::create(m_quote_escape_items)); + m_quote_escape_combo_box->set_model(GUI::ItemListModel::create(m_quote_escape_items)); // By default, use commas, double quotes with repeat, and disable headers. m_delimiter_comma_radio->set_checked(true); @@ -86,8 +86,8 @@ CSVImportDialogPage::CSVImportDialogPage(StringView csv) auto CSVImportDialogPage::make_reader() -> Optional { - String delimiter; - String quote; + DeprecatedString delimiter; + DeprecatedString quote; Reader::ParserTraits::QuoteEscape quote_escape; // Delimiter @@ -162,7 +162,7 @@ void CSVImportDialogPage::update_preview() auto& reader = *m_previously_made_reader; if (reader.has_error()) { m_data_preview_table_view->set_model(nullptr); - m_data_preview_error_label->set_text(String::formatted("XSV parse error:\n{}", reader.error_string())); + m_data_preview_error_label->set_text(DeprecatedString::formatted("XSV parse error:\n{}", reader.error_string())); m_data_preview_widget->set_active_widget(m_data_preview_error_label); return; } @@ -170,18 +170,18 @@ void CSVImportDialogPage::update_preview() auto headers = reader.headers(); m_data_preview_table_view->set_model( - GUI::ItemListModel>::create(reader, headers, min(8ul, reader.size()))); + GUI::ItemListModel>::create(reader, headers, min(8ul, reader.size()))); m_data_preview_widget->set_active_widget(m_data_preview_table_view); m_data_preview_table_view->update(); } -Result, String> ImportDialog::make_and_run_for(GUI::Window& parent, StringView mime, Core::File& file, Workbook& workbook) +Result, DeprecatedString> ImportDialog::make_and_run_for(GUI::Window& parent, StringView mime, Core::File& file, Workbook& workbook) { auto wizard = GUI::WizardDialog::construct(&parent); wizard->set_title("File Import Wizard"); wizard->set_icon(GUI::Icon::default_icon("app-spreadsheet"sv).bitmap_for_size(16)); - auto import_xsv = [&]() -> Result, String> { + auto import_xsv = [&]() -> Result, DeprecatedString> { auto contents = file.read_all(); CSVImportDialogPage page { contents }; wizard->replace_page(page.page()); @@ -195,7 +195,7 @@ Result, String> ImportDialog::make_and_run_for(GUI::W if (reader.has_value()) { reader->parse(); if (reader.value().has_error()) - return String::formatted("CSV Import failed: {}", reader.value().error_string()); + return DeprecatedString::formatted("CSV Import failed: {}", reader.value().error_string()); auto sheet = Sheet::from_xsv(reader.value(), workbook); if (sheet) @@ -204,11 +204,11 @@ Result, String> ImportDialog::make_and_run_for(GUI::W return sheets; } else { - return String { "CSV Import was cancelled" }; + return DeprecatedString { "CSV Import was cancelled" }; } }; - auto import_worksheet = [&]() -> Result, String> { + auto import_worksheet = [&]() -> Result, DeprecatedString> { auto json_value_option = JsonParser(file.read_all()).parse(); if (json_value_option.is_error()) { StringBuilder sb; @@ -250,23 +250,23 @@ Result, String> ImportDialog::make_and_run_for(GUI::W } else { auto page = GUI::WizardPage::construct( "Import File Format", - String::formatted("Select the format you wish to import '{}' as", LexicalPath::basename(file.filename()))); + DeprecatedString::formatted("Select the format you wish to import '{}' as", LexicalPath::basename(file.filename()))); page->on_next_page = [] { return nullptr; }; page->body_widget().load_from_gml(select_format_page_gml); auto format_combo_box = page->body_widget().find_descendant_of_type_named("select_format_page_format_combo_box"); - Vector supported_formats { + Vector supported_formats { "CSV (text/csv)", "Spreadsheet Worksheet", }; - format_combo_box->set_model(GUI::ItemListModel::create(supported_formats)); + format_combo_box->set_model(GUI::ItemListModel::create(supported_formats)); wizard->push_page(page); if (wizard->exec() != GUI::Dialog::ExecResult::OK) - return String { "Import was cancelled" }; + return DeprecatedString { "Import was cancelled" }; if (format_combo_box->selected_index() == 0) return import_xsv(); diff --git a/Userland/Applications/Spreadsheet/ImportDialog.h b/Userland/Applications/Spreadsheet/ImportDialog.h index f510af09d1e..4d922207124 100644 --- a/Userland/Applications/Spreadsheet/ImportDialog.h +++ b/Userland/Applications/Spreadsheet/ImportDialog.h @@ -48,7 +48,7 @@ private: RefPtr m_data_preview_table_view; RefPtr m_data_preview_error_label; RefPtr m_data_preview_widget; - Vector m_quote_escape_items { + Vector m_quote_escape_items { // Note: Keep in sync with Reader::ParserTraits::QuoteEscape. "Repeat", "Backslash", @@ -56,7 +56,7 @@ private: }; struct ImportDialog { - static Result, String> make_and_run_for(GUI::Window& parent, StringView mime, Core::File& file, Workbook&); + static Result, DeprecatedString> make_and_run_for(GUI::Window& parent, StringView mime, Core::File& file, Workbook&); }; } diff --git a/Userland/Applications/Spreadsheet/JSIntegration.cpp b/Userland/Applications/Spreadsheet/JSIntegration.cpp index b7e5a07f83b..4fad61a8dd4 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.cpp +++ b/Userland/Applications/Spreadsheet/JSIntegration.cpp @@ -205,7 +205,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents) return JS::js_undefined(); if (cell->kind() == Spreadsheet::Cell::Kind::Formula) - return JS::js_string(vm, String::formatted("={}", cell->data())); + return JS::js_string(vm, DeprecatedString::formatted("={}", cell->data())); return JS::js_string(vm, cell->data()); } @@ -312,7 +312,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_index) auto& sheet = sheet_object->m_sheet; auto column_index = sheet.column_index(column_name_str); if (!column_index.has_value()) - return vm.throw_completion(String::formatted("'{}' is not a valid column", column_name_str)); + return vm.throw_completion(DeprecatedString::formatted("'{}' is not a valid column", column_name_str)); return JS::Value((i32)column_index.value()); } @@ -340,7 +340,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_arithmetic) auto& sheet = sheet_object->m_sheet; auto new_column = sheet.column_arithmetic(column_name_str, offset_number); if (!new_column.has_value()) - return vm.throw_completion(String::formatted("'{}' is not a valid column", column_name_str)); + return vm.throw_completion(DeprecatedString::formatted("'{}' is not a valid column", column_name_str)); return JS::js_string(vm, new_column.release_value()); } @@ -364,7 +364,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_column_bound) auto& sheet = sheet_object->m_sheet; auto maybe_column_index = sheet.column_index(column_name_str); if (!maybe_column_index.has_value()) - return vm.throw_completion(String::formatted("'{}' is not a valid column", column_name_str)); + return vm.throw_completion(DeprecatedString::formatted("'{}' is not a valid column", column_name_str)); auto bounds = sheet.written_data_bounds(*maybe_column_index); return JS::Value(bounds.row); diff --git a/Userland/Applications/Spreadsheet/JSIntegration.h b/Userland/Applications/Spreadsheet/JSIntegration.h index 1d76430ab7d..a071681f349 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.h +++ b/Userland/Applications/Spreadsheet/JSIntegration.h @@ -14,7 +14,7 @@ namespace Spreadsheet { struct FunctionAndArgumentIndex { - String function_name; + DeprecatedString function_name; size_t argument_index { 0 }; }; Optional get_function_and_argument_index(StringView source); diff --git a/Userland/Applications/Spreadsheet/Position.h b/Userland/Applications/Spreadsheet/Position.h index 7bd73a0b705..f798640a121 100644 --- a/Userland/Applications/Spreadsheet/Position.h +++ b/Userland/Applications/Spreadsheet/Position.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -37,7 +37,7 @@ struct Position { return row == other.row && column == other.column; } - String to_cell_identifier(Sheet const& sheet) const; + DeprecatedString to_cell_identifier(Sheet const& sheet) const; URL to_url(Sheet const& sheet) const; size_t column { 0 }; diff --git a/Userland/Applications/Spreadsheet/Readers/XSV.cpp b/Userland/Applications/Spreadsheet/Readers/XSV.cpp index 6a1533aabd1..8943fc9eee5 100644 --- a/Userland/Applications/Spreadsheet/Readers/XSV.cpp +++ b/Userland/Applications/Spreadsheet/Readers/XSV.cpp @@ -25,9 +25,9 @@ void XSV::set_error(ReadError error) m_error = error; } -Vector XSV::headers() const +Vector XSV::headers() const { - Vector headers; + Vector headers; if (has_explicit_headers()) { for (auto& field : m_names) headers.append(field.is_string_view ? field.as_string_view : field.as_string.view()); @@ -37,7 +37,7 @@ Vector XSV::headers() const return headers; for ([[maybe_unused]] auto& field : m_rows.first()) - headers.append(String::empty()); + headers.append(DeprecatedString::empty()); } return headers; diff --git a/Userland/Applications/Spreadsheet/Readers/XSV.h b/Userland/Applications/Spreadsheet/Readers/XSV.h index fe9cd03569b..31d08865a31 100644 --- a/Userland/Applications/Spreadsheet/Readers/XSV.h +++ b/Userland/Applications/Spreadsheet/Readers/XSV.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include #include #include #include @@ -31,8 +31,8 @@ ParserBehavior operator&(ParserBehavior left, ParserBehavior right); ParserBehavior operator|(ParserBehavior left, ParserBehavior right); struct ParserTraits { - String separator; - String quote { "\"" }; + DeprecatedString separator; + DeprecatedString quote { "\"" }; enum QuoteEscape { Repeat, Backslash, @@ -73,7 +73,7 @@ public: void parse(); bool has_error() const { return m_error != ReadError::None; } ReadError error() const { return m_error; } - String error_string() const + DeprecatedString error_string() const { switch (m_error) { #define E(x, y) \ @@ -87,7 +87,7 @@ public: } size_t size() const { return m_rows.size(); } - Vector headers() const; + Vector headers() const; [[nodiscard]] bool has_explicit_headers() const { return (static_cast(m_behaviors) & static_cast(ParserBehavior::ReadHeaders)) != 0; } class Row { @@ -185,7 +185,7 @@ public: private: struct Field { StringView as_string_view; - String as_string; // This member only used if the parser couldn't use the original source verbatim. + DeprecatedString as_string; // This member only used if the parser couldn't use the original source verbatim. bool is_string_view { true }; bool operator==(StringView other) const diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index 8141791e195..f70ab032a85 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -114,9 +114,9 @@ static Optional convert_from_string(StringView str, unsigned base = 26, return value; } -String Sheet::add_column() +DeprecatedString Sheet::add_column() { - auto next_column = String::bijective_base_from(m_columns.size()); + auto next_column = DeprecatedString::bijective_base_from(m_columns.size()); m_columns.append(next_column); return next_column; } @@ -229,7 +229,7 @@ Optional Sheet::column_index(StringView column_name) const return index; } -Optional Sheet::column_arithmetic(StringView column_name, int offset) +Optional Sheet::column_arithmetic(StringView column_name, int offset) { auto maybe_index = column_index(column_name); if (!maybe_index.has_value()) @@ -270,7 +270,7 @@ Optional Sheet::position_from_url(const URL& url) const } // FIXME: Figure out a way to do this cross-process. - VERIFY(url.path() == String::formatted("/{}", getpid())); + VERIFY(url.path() == DeprecatedString::formatted("/{}", getpid())); return parse_cell_name(url.fragment()); } @@ -518,7 +518,7 @@ Position Sheet::written_data_bounds(Optional column_index) const bool Sheet::columns_are_standard() const { for (size_t i = 0; i < m_columns.size(); ++i) { - if (m_columns[i] != String::bijective_base_from(i)) + if (m_columns[i] != DeprecatedString::bijective_base_from(i)) return false; } @@ -605,9 +605,9 @@ JsonObject Sheet::to_json() const return object; } -Vector> Sheet::to_xsv() const +Vector> Sheet::to_xsv() const { - Vector> data; + Vector> data; auto bottom_right = written_data_bounds(); @@ -615,7 +615,7 @@ Vector> Sheet::to_xsv() const size_t column_count = m_columns.size(); if (columns_are_standard()) { column_count = bottom_right.column + 1; - Vector cols; + Vector cols; for (size_t i = 0; i < column_count; ++i) cols.append(m_columns[i]); data.append(move(cols)); @@ -624,7 +624,7 @@ Vector> Sheet::to_xsv() const } for (size_t i = 0; i <= bottom_right.row; ++i) { - Vector row; + Vector row; row.resize(column_count); for (size_t j = 0; j < column_count; ++j) { auto cell = at({ j, i }); @@ -652,7 +652,7 @@ RefPtr Sheet::from_xsv(Reader::XSV const& xsv, Workbook& workbook) } else { sheet->m_columns.ensure_capacity(cols.size()); for (size_t i = 0; i < cols.size(); ++i) - sheet->m_columns.append(String::bijective_base_from(i)); + sheet->m_columns.append(DeprecatedString::bijective_base_from(i)); } for (size_t i = 0; i < max(rows, Sheet::default_row_count); ++i) sheet->add_row(); @@ -712,7 +712,7 @@ JsonObject Sheet::gather_documentation() const return m_cached_documentation.value(); } -String Sheet::generate_inline_documentation_for(StringView function, size_t argument_index) +DeprecatedString Sheet::generate_inline_documentation_for(StringView function, size_t argument_index) { if (!m_cached_documentation.has_value()) gather_documentation(); @@ -720,13 +720,13 @@ String Sheet::generate_inline_documentation_for(StringView function, size_t argu auto& docs = m_cached_documentation.value(); auto entry = docs.get(function); if (entry.is_null() || !entry.is_object()) - return String::formatted("{}(...???{})", function, argument_index); + return DeprecatedString::formatted("{}(...???{})", function, argument_index); auto& entry_object = entry.as_object(); size_t argc = entry_object.get("argc"sv).to_int(0); auto argnames_value = entry_object.get("argnames"sv); if (!argnames_value.is_array()) - return String::formatted("{}(...{}???{})", function, argc, argument_index); + return DeprecatedString::formatted("{}(...{}???{})", function, argc, argument_index); auto& argnames = argnames_value.as_array(); StringBuilder builder; builder.appendff("{}(", function); @@ -748,9 +748,9 @@ String Sheet::generate_inline_documentation_for(StringView function, size_t argu return builder.build(); } -String Position::to_cell_identifier(Sheet const& sheet) const +DeprecatedString Position::to_cell_identifier(Sheet const& sheet) const { - return String::formatted("{}{}", sheet.column(column), row); + return DeprecatedString::formatted("{}{}", sheet.column(column), row); } URL Position::to_url(Sheet const& sheet) const @@ -758,12 +758,12 @@ URL Position::to_url(Sheet const& sheet) const URL url; url.set_scheme("spreadsheet"); url.set_host("cell"); - url.set_paths({ String::number(getpid()) }); + url.set_paths({ DeprecatedString::number(getpid()) }); url.set_fragment(to_cell_identifier(sheet)); return url; } -CellChange::CellChange(Cell& cell, String const& previous_data) +CellChange::CellChange(Cell& cell, DeprecatedString const& previous_data) : m_cell(cell) , m_previous_data(previous_data) { diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.h b/Userland/Applications/Spreadsheet/Spreadsheet.h index 1e178865820..207571e3443 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.h +++ b/Userland/Applications/Spreadsheet/Spreadsheet.h @@ -9,9 +9,9 @@ #include "Cell.h" #include "Forward.h" #include "Readers/XSV.h" +#include #include #include -#include #include #include #include @@ -24,7 +24,7 @@ namespace Spreadsheet { class CellChange { public: - CellChange(Cell&, String const&); + CellChange(Cell&, DeprecatedString const&); auto& cell() { return m_cell; } auto& previous_data() { return m_previous_data; } @@ -32,8 +32,8 @@ public: private: Cell& m_cell; - String m_previous_data; - String m_new_data; + DeprecatedString m_previous_data; + DeprecatedString m_new_data; }; class Sheet : public Core::Object { @@ -47,7 +47,7 @@ public: Optional parse_cell_name(StringView) const; Optional column_index(StringView column_name) const; - Optional column_arithmetic(StringView column_name, int offset); + Optional column_arithmetic(StringView column_name, int offset); Cell* from_url(const URL&); Cell const* from_url(const URL& url) const { return const_cast(this)->from_url(url); } @@ -60,10 +60,10 @@ public: JsonObject to_json() const; static RefPtr from_json(JsonObject const&, Workbook&); - Vector> to_xsv() const; + Vector> to_xsv() const; static RefPtr from_xsv(Reader::XSV const&, Workbook&); - String const& name() const { return m_name; } + DeprecatedString const& name() const { return m_name; } void set_name(StringView name) { m_name = name; } JsonObject gather_documentation() const; @@ -85,17 +85,17 @@ public: if (auto cell = at(position)) return *cell; - m_cells.set(position, make(String::empty(), position, *this)); + m_cells.set(position, make(DeprecatedString::empty(), position, *this)); return *at(position); } size_t add_row(); - String add_column(); + DeprecatedString add_column(); size_t row_count() const { return m_rows; } size_t column_count() const { return m_columns.size(); } - Vector const& columns() const { return m_columns; } - String const& column(size_t index) + Vector const& columns() const { return m_columns; } + DeprecatedString const& column(size_t index) { for (size_t i = column_count(); i < index; ++i) add_column(); @@ -103,7 +103,7 @@ public: VERIFY(column_count() > index); return m_columns[index]; } - String const& column(size_t index) const + DeprecatedString const& column(size_t index) const { VERIFY(column_count() > index); return m_columns[index]; @@ -142,14 +142,14 @@ public: bool columns_are_standard() const; - String generate_inline_documentation_for(StringView function, size_t argument_index); + DeprecatedString generate_inline_documentation_for(StringView function, size_t argument_index); private: explicit Sheet(Workbook&); explicit Sheet(StringView name, Workbook&); - String m_name; - Vector m_columns; + DeprecatedString m_name; + Vector m_columns; size_t m_rows { 0 }; HashMap> m_cells; HashTable m_selected_cells; diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index 8b5d4c8678d..321b85b2241 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -21,9 +21,9 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) if (role == GUI::ModelRole::Display) { auto const* cell = m_sheet->at({ (size_t)index.column(), (size_t)index.row() }); if (!cell) - return String::empty(); + return DeprecatedString::empty(); - Function to_string_as_exception = [&](JS::Value value) { + Function to_string_as_exception = [&](JS::Value value) { auto& vm = cell->sheet().global_object().vm(); StringBuilder builder; builder.append("Error: "sv); @@ -154,7 +154,7 @@ RefPtr SheetModel::mime_data(const GUI::ModelSelection& selectio Position cursor_position { (size_t)cursor->column(), (size_t)cursor->row() }; auto mime_data_buffer = mime_data->data("text/x-spreadsheet-data"); - auto new_data = String::formatted("{}\n{}", + auto new_data = DeprecatedString::formatted("{}\n{}", cursor_position.to_url(m_sheet).to_string(), StringView(mime_data_buffer)); mime_data->set_data("text/x-spreadsheet-data", new_data.to_byte_buffer()); @@ -162,7 +162,7 @@ RefPtr SheetModel::mime_data(const GUI::ModelSelection& selectio return mime_data; } -String SheetModel::column_name(int index) const +DeprecatedString SheetModel::column_name(int index) const { if (index < 0) return {}; @@ -202,7 +202,7 @@ CellsUndoCommand::CellsUndoCommand(Vector cell_changes) m_cell_changes = cell_changes; } -CellsUndoCommand::CellsUndoCommand(Cell& cell, String const& previous_data) +CellsUndoCommand::CellsUndoCommand(Cell& cell, DeprecatedString const& previous_data) { m_cell_changes.append(CellChange(cell, previous_data)); } diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.h b/Userland/Applications/Spreadsheet/SpreadsheetModel.h index 8cdabde0303..346a9bbdea8 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.h @@ -23,7 +23,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->row_count(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->column_count(); } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual RefPtr mime_data(const GUI::ModelSelection&) const override; virtual bool is_editable(const GUI::ModelIndex&) const override; @@ -34,7 +34,7 @@ public: void update(); - Function on_cell_data_change; + Function on_cell_data_change; Function)> on_cells_data_change; private: @@ -48,7 +48,7 @@ private: class CellsUndoCommand : public GUI::Command { public: - CellsUndoCommand(Cell&, String const&); + CellsUndoCommand(Cell&, DeprecatedString const&); CellsUndoCommand(Vector); virtual void undo() override; diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index a83001150a9..b9f781c6852 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -100,8 +100,8 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe auto* sheet_ptr = m_tab_context_menu_sheet_view->sheet_if_available(); VERIFY(sheet_ptr); // How did we get here without a sheet? auto& sheet = *sheet_ptr; - String new_name; - if (GUI::InputBox::show(window(), new_name, String::formatted("New name for '{}'", sheet.name()), "Rename sheet"sv) == GUI::Dialog::ExecResult::OK) { + DeprecatedString new_name; + if (GUI::InputBox::show(window(), new_name, DeprecatedString::formatted("New name for '{}'", sheet.name()), "Rename sheet"sv) == GUI::Dialog::ExecResult::OK) { sheet.set_name(new_name); sheet.update(); m_tab_widget->set_tab_title(static_cast(*m_tab_context_menu_sheet_view), new_name); @@ -109,7 +109,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe }); m_tab_context_menu->add_action(*m_rename_action); m_tab_context_menu->add_action(GUI::Action::create("Add new sheet...", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new-tab.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { - String name; + DeprecatedString name; if (GUI::InputBox::show(window(), name, "Name for new sheet"sv, "Create sheet"sv) == GUI::Dialog::ExecResult::OK) { NonnullRefPtrVector new_sheets; new_sheets.append(m_workbook->add_sheet(name)); @@ -154,7 +154,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe }); m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) { - String name = "workbook"; + DeprecatedString name = "workbook"; auto response = FileSystemAccessClient::Client::the().try_save_file(window(), name, "sheets"); if (response.is_error()) return; @@ -324,7 +324,7 @@ void SpreadsheetWidget::resize_event(GUI::ResizeEvent& event) m_inline_documentation_window->set_rect(m_cell_value_editor->screen_relative_rect().translated(0, m_cell_value_editor->height() + 7).inflated(6, 6)); } -void SpreadsheetWidget::clipboard_content_did_change(String const& mime_type) +void SpreadsheetWidget::clipboard_content_did_change(DeprecatedString const& mime_type) { if (auto* sheet = current_worksheet_if_available()) m_paste_action->set_enabled(!sheet->selected_cells().is_empty() && mime_type.starts_with("text/"sv)); @@ -637,7 +637,7 @@ void SpreadsheetWidget::clipboard_action(bool is_cut) text_builder.append(cell_data->data()); first = false; } - HashMap metadata; + HashMap metadata; metadata.set("text/x-spreadsheet-data", url_builder.to_string()); dbgln(url_builder.to_string()); diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h index 1828f5101a6..3a381567297 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.h +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.h @@ -30,7 +30,7 @@ public: void add_sheet(); void add_sheet(NonnullRefPtr&&); - String const& current_filename() const { return m_workbook->current_filename(); } + DeprecatedString const& current_filename() const { return m_workbook->current_filename(); } SpreadsheetView* current_view() { return static_cast(m_tab_widget->active_widget()); } Sheet* current_worksheet_if_available() { return current_view() ? current_view()->sheet_if_available() : nullptr; } void update_window_title(); @@ -58,7 +58,7 @@ private: virtual void resize_event(GUI::ResizeEvent&) override; // ^GUI::Clipboard::ClipboardClient - virtual void clipboard_content_did_change(String const& mime_type) override; + virtual void clipboard_content_did_change(DeprecatedString const& mime_type) override; explicit SpreadsheetWidget(GUI::Window& window, NonnullRefPtrVector&& sheets = {}, bool should_add_sheet_if_empty = true); diff --git a/Userland/Applications/Spreadsheet/Workbook.cpp b/Userland/Applications/Spreadsheet/Workbook.cpp index 30411b35219..f9adb38a2ec 100644 --- a/Userland/Applications/Spreadsheet/Workbook.cpp +++ b/Userland/Applications/Spreadsheet/Workbook.cpp @@ -43,7 +43,7 @@ Workbook::Workbook(NonnullRefPtrVector&& sheets, GUI::Window& parent_wind m_vm->enable_default_host_import_module_dynamically_hook(); } -bool Workbook::set_filename(String const& filename) +bool Workbook::set_filename(DeprecatedString const& filename) { if (m_current_filename == filename) return false; @@ -52,7 +52,7 @@ bool Workbook::set_filename(String const& filename) return true; } -Result Workbook::open_file(Core::File& file) +Result Workbook::open_file(Core::File& file) { auto mime = Core::guess_mime_type_based_on_filename(file.filename()); @@ -64,7 +64,7 @@ Result Workbook::open_file(Core::File& file) return true; } -Result Workbook::write_to_file(Core::File& file) +Result Workbook::write_to_file(Core::File& file) { auto mime = Core::guess_mime_type_based_on_filename(file.filename()); @@ -76,7 +76,7 @@ Result Workbook::write_to_file(Core::File& file) return true; } -Result Workbook::import_file(Core::File& file) +Result Workbook::import_file(Core::File& file) { auto mime = Core::guess_mime_type_based_on_filename(file.filename()); diff --git a/Userland/Applications/Spreadsheet/Workbook.h b/Userland/Applications/Spreadsheet/Workbook.h index 8ee7e7b8954..34adc769297 100644 --- a/Userland/Applications/Spreadsheet/Workbook.h +++ b/Userland/Applications/Spreadsheet/Workbook.h @@ -17,13 +17,13 @@ class Workbook { public: Workbook(NonnullRefPtrVector&& sheets, GUI::Window& parent_window); - Result open_file(Core::File&); - Result write_to_file(Core::File&); + Result open_file(Core::File&); + Result write_to_file(Core::File&); - Result import_file(Core::File&); + Result import_file(Core::File&); - String const& current_filename() const { return m_current_filename; } - bool set_filename(String const& filename); + DeprecatedString const& current_filename() const { return m_current_filename; } + bool set_filename(DeprecatedString const& filename); bool dirty() { return m_dirty; } void set_dirty(bool dirty) { m_dirty = dirty; } @@ -52,7 +52,7 @@ private: JS::ExecutionContext m_main_execution_context; GUI::Window& m_parent_window; - String m_current_filename; + DeprecatedString m_current_filename; bool m_dirty { false }; }; diff --git a/Userland/Applications/Spreadsheet/Writers/Test/TestXSVWriter.cpp b/Userland/Applications/Spreadsheet/Writers/Test/TestXSVWriter.cpp index 0e356a5ba00..dc7aba367b7 100644 --- a/Userland/Applications/Spreadsheet/Writers/Test/TestXSVWriter.cpp +++ b/Userland/Applications/Spreadsheet/Writers/Test/TestXSVWriter.cpp @@ -55,7 +55,7 @@ TEST_CASE(can_write_with_header) TEST_CASE(can_write_with_different_behaviors) { - Vector> data = { + Vector> data = { { "Well", "Hello\"", "Friends" }, { "We\"ll", "Hello,", " Friends" }, }; diff --git a/Userland/Applications/Spreadsheet/Writers/XSV.h b/Userland/Applications/Spreadsheet/Writers/XSV.h index 7ddc149a9fd..da76f42777e 100644 --- a/Userland/Applications/Spreadsheet/Writers/XSV.h +++ b/Userland/Applications/Spreadsheet/Writers/XSV.h @@ -6,10 +6,10 @@ #pragma once +#include #include #include #include -#include #include #include #include @@ -35,8 +35,8 @@ inline WriterBehavior operator|(WriterBehavior left, WriterBehavior right) } struct WriterTraits { - String separator; - String quote { "\"" }; + DeprecatedString separator; + DeprecatedString quote { "\"" }; enum QuoteEscape { Repeat, Backslash, @@ -79,7 +79,7 @@ public: bool has_error() const { return m_error != WriteError::None; } WriteError error() const { return m_error; } - String error_string() const + DeprecatedString error_string() const { switch (m_error) { #define E(x, y) \ @@ -137,7 +137,7 @@ private: template void write_entry(T&& entry) { - auto string = String::formatted("{}", FormatIfSupported(entry)); + auto string = DeprecatedString::formatted("{}", FormatIfSupported(entry)); auto safe_to_write_normally = (m_behaviors & WriterBehavior::QuoteAll) == WriterBehavior::None && !string.contains('\n') diff --git a/Userland/Applications/SystemMonitor/GraphWidget.h b/Userland/Applications/SystemMonitor/GraphWidget.h index 0b8df57f9c4..e8831343703 100644 --- a/Userland/Applications/SystemMonitor/GraphWidget.h +++ b/Userland/Applications/SystemMonitor/GraphWidget.h @@ -26,7 +26,7 @@ public: struct ValueFormat { Gfx::ColorRole graph_color_role { Gfx::ColorRole::Base }; Color text_shadow_color { Color::Transparent }; - Function text_formatter; + Function text_formatter; }; void set_value_format(size_t index, ValueFormat&& format) { diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp index 6c5ea34f788..d25eee8c882 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp @@ -48,7 +48,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph) layout()->set_margins({ 8, 0, 0 }); layout()->set_spacing(3); - auto build_widgets_for_label = [this](String const& description) -> RefPtr { + auto build_widgets_for_label = [this](DeprecatedString const& description) -> RefPtr { auto& container = add(); container.set_layout(); container.set_fixed_size(275, 12); @@ -75,7 +75,7 @@ void MemoryStatsWidget::set_graph_widget(GraphWidget& graph) m_graph = &graph; } -void MemoryStatsWidget::set_graph_widget_via_name(String name) +void MemoryStatsWidget::set_graph_widget_via_name(DeprecatedString name) { m_graph_widget_name = move(name); if (!m_graph_widget_name.is_null()) { @@ -91,7 +91,7 @@ void MemoryStatsWidget::set_graph_widget_via_name(String name) } } -String MemoryStatsWidget::graph_widget_name() +DeprecatedString MemoryStatsWidget::graph_widget_name() { if (m_graph) return m_graph->name(); @@ -128,12 +128,12 @@ void MemoryStatsWidget::refresh() u64 physical_pages_in_use = physical_allocated; u64 total_userphysical_and_swappable_pages = physical_allocated + physical_committed + physical_uncommitted; - m_kmalloc_space_label->set_text(String::formatted("{}/{}", human_readable_size(kmalloc_allocated), human_readable_size(kmalloc_bytes_total))); - m_physical_pages_label->set_text(String::formatted("{}/{}", human_readable_size(page_count_to_bytes(physical_pages_in_use)), human_readable_size(page_count_to_bytes(physical_pages_total)))); - m_physical_pages_committed_label->set_text(String::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed)))); - m_kmalloc_count_label->set_text(String::formatted("{}", kmalloc_call_count)); - m_kfree_count_label->set_text(String::formatted("{}", kfree_call_count)); - m_kmalloc_difference_label->set_text(String::formatted("{:+}", kmalloc_call_count - kfree_call_count)); + m_kmalloc_space_label->set_text(DeprecatedString::formatted("{}/{}", human_readable_size(kmalloc_allocated), human_readable_size(kmalloc_bytes_total))); + m_physical_pages_label->set_text(DeprecatedString::formatted("{}/{}", human_readable_size(page_count_to_bytes(physical_pages_in_use)), human_readable_size(page_count_to_bytes(physical_pages_total)))); + m_physical_pages_committed_label->set_text(DeprecatedString::formatted("{}", human_readable_size(page_count_to_bytes(physical_committed)))); + m_kmalloc_count_label->set_text(DeprecatedString::formatted("{}", kmalloc_call_count)); + m_kfree_count_label->set_text(DeprecatedString::formatted("{}", kfree_call_count)); + m_kmalloc_difference_label->set_text(DeprecatedString::formatted("{:+}", kmalloc_call_count - kfree_call_count)); // Because the initialization order of us and the graph is unknown, we might get a couple of updates where the graph widget lookup fails. // Therefore, we can retry indefinitely. (Should not be too much of a performance hit, as we don't update that often.) diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.h b/Userland/Applications/SystemMonitor/MemoryStatsWidget.h index b203da11712..3305aaf0d8d 100644 --- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.h +++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.h @@ -22,8 +22,8 @@ public: void set_graph_widget(GraphWidget& graph); - void set_graph_widget_via_name(String name); - String graph_widget_name(); + void set_graph_widget_via_name(DeprecatedString name); + DeprecatedString graph_widget_name(); void refresh(); @@ -33,7 +33,7 @@ private: GraphWidget* m_graph; // Is null if we have a valid graph - String m_graph_widget_name {}; + DeprecatedString m_graph_widget_name {}; RefPtr m_physical_pages_label; RefPtr m_physical_pages_committed_label; RefPtr m_kmalloc_space_label; diff --git a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp index e77f6ee1c80..3b422b6ef08 100644 --- a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp +++ b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp @@ -56,15 +56,15 @@ NetworkStatisticsWidget::NetworkStatisticsWidget() net_adapters_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft); net_adapters_fields.empend("mac_address", "MAC", Gfx::TextAlignment::CenterLeft); net_adapters_fields.empend("Link status", Gfx::TextAlignment::CenterLeft, - [](JsonObject const& object) -> String { + [](JsonObject const& object) -> DeprecatedString { if (!object.get("link_up"sv).as_bool()) return "Down"; - return String::formatted("{} Mb/s {}-duplex", object.get("link_speed"sv).to_i32(), + return DeprecatedString::formatted("{} Mb/s {}-duplex", object.get("link_speed"sv).to_i32(), object.get("link_full_duplex"sv).as_bool() ? "full"sv : "half"sv); }); net_adapters_fields.empend("IPv4", Gfx::TextAlignment::CenterLeft, - [](JsonObject const& object) -> String { + [](JsonObject const& object) -> DeprecatedString { return object.get("ipv4_address"sv).as_string_or(""sv); }); net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight); diff --git a/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp index ba128886904..1f019f532db 100644 --- a/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp @@ -51,7 +51,7 @@ void ProcessFileDescriptorMapWidget::set_pid(pid_t pid) if (m_pid == pid) return; m_pid = pid; - m_model->set_json_path(String::formatted("/proc/{}/fds", m_pid)); + m_model->set_json_path(DeprecatedString::formatted("/proc/{}/fds", m_pid)); } } diff --git a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp index 3ec4d021d0e..25ab4759ddd 100644 --- a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp @@ -57,7 +57,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget() Vector pid_vm_fields; pid_vm_fields.empend( "Address", Gfx::TextAlignment::CenterLeft, - [](auto& object) { return String::formatted("{:p}", object.get("address"sv).to_u64()); }, + [](auto& object) { return DeprecatedString::formatted("{:p}", object.get("address"sv).to_u64()); }, [](auto& object) { return object.get("address"sv).to_u64(); }); pid_vm_fields.empend("size", "Size", Gfx::TextAlignment::CenterRight); pid_vm_fields.empend("amount_resident", "Resident", Gfx::TextAlignment::CenterRight); @@ -117,7 +117,7 @@ void ProcessMemoryMapWidget::set_pid(pid_t pid) if (m_pid == pid) return; m_pid = pid; - m_json_model->set_json_path(String::formatted("/proc/{}/vm", pid)); + m_json_model->set_json_path(DeprecatedString::formatted("/proc/{}/vm", pid)); } void ProcessMemoryMapWidget::refresh() diff --git a/Userland/Applications/SystemMonitor/ProcessModel.cpp b/Userland/Applications/SystemMonitor/ProcessModel.cpp index 791a6c5ed7b..9310688d9c9 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.cpp +++ b/Userland/Applications/SystemMonitor/ProcessModel.cpp @@ -71,7 +71,7 @@ int ProcessModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String ProcessModel::column_name(int column) const +DeprecatedString ProcessModel::column_name(int column) const { switch (column) { case Column::Icon: @@ -288,12 +288,12 @@ GUI::Variant ProcessModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol case Column::PurgeableNonvolatile: return human_readable_size(thread.current_state.amount_purgeable_nonvolatile); case Column::CPU: - return String::formatted("{:.2}", thread.current_state.cpu_percent); + return DeprecatedString::formatted("{:.2}", thread.current_state.cpu_percent); case Column::Processor: return thread.current_state.cpu; case Column::Name: if (thread.current_state.kernel) - return String::formatted("{} (*)", thread.current_state.name); + return DeprecatedString::formatted("{} (*)", thread.current_state.name); return thread.current_state.name; case Column::Command: return thread.current_state.command; @@ -408,16 +408,16 @@ Vector ProcessModel::matches(StringView searching, unsigned fla return found_indices; } -static ErrorOr try_read_command_line(pid_t pid) +static ErrorOr try_read_command_line(pid_t pid) { - auto file = TRY(Core::Stream::File::open(String::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read)); + auto file = TRY(Core::Stream::File::open(DeprecatedString::formatted("/proc/{}/cmdline", pid), Core::Stream::OpenMode::Read)); auto data = TRY(file->read_all()); auto json = TRY(JsonValue::from_string(StringView { data.bytes() })); auto array = json.as_array().values(); - return String::join(" "sv, array); + return DeprecatedString::join(" "sv, array); } -static String read_command_line(pid_t pid) +static DeprecatedString read_command_line(pid_t pid) { auto string_or_error = try_read_command_line(pid); if (string_or_error.is_error()) { diff --git a/Userland/Applications/SystemMonitor/ProcessModel.h b/Userland/Applications/SystemMonitor/ProcessModel.h index 5970f7d8527..9822ffbcccf 100644 --- a/Userland/Applications/SystemMonitor/ProcessModel.h +++ b/Userland/Applications/SystemMonitor/ProcessModel.h @@ -7,9 +7,9 @@ #pragma once +#include #include #include -#include #include #include #include @@ -64,7 +64,7 @@ public: virtual int tree_column() const override { return Column::Name; } virtual int row_count(GUI::ModelIndex const&) const override; virtual int column_count(GUI::ModelIndex const&) const override; - virtual String column_name(int column) const override; + virtual DeprecatedString column_name(int column) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = {}) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; @@ -104,14 +104,14 @@ private: u64 time_user { 0 }; u64 time_kernel { 0 }; bool kernel { false }; - String executable { "" }; - String name { "" }; - String command { "" }; + DeprecatedString executable { "" }; + DeprecatedString name { "" }; + DeprecatedString command { "" }; uid_t uid { 0 }; - String state { "" }; - String user { "" }; - String pledge { "" }; - String veil { "" }; + DeprecatedString state { "" }; + DeprecatedString user { "" }; + DeprecatedString pledge { "" }; + DeprecatedString veil { "" }; u32 cpu { 0 }; u32 priority { 0 }; size_t amount_virtual { 0 }; diff --git a/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp b/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp index ba5a5c51873..dbf549f4742 100644 --- a/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp +++ b/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp @@ -35,7 +35,7 @@ void ProcessUnveiledPathsWidget::set_pid(pid_t pid) if (m_pid == pid) return; m_pid = pid; - m_model->set_json_path(String::formatted("/proc/{}/unveil", m_pid)); + m_model->set_json_path(DeprecatedString::formatted("/proc/{}/unveil", m_pid)); } } diff --git a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp index 3c025499aad..eedd49db96f 100644 --- a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp +++ b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp @@ -30,7 +30,7 @@ public: int row_count(GUI::ModelIndex const&) const override { return m_symbols.size(); }; bool is_column_sortable(int) const override { return false; } - String column_name(int column) const override + DeprecatedString column_name(int column) const override { switch (column) { case Column::Address: @@ -49,7 +49,7 @@ public: auto& symbol = m_symbols[model_index.row()]; switch (model_index.column()) { case Column::Address: - return String::formatted("{:p}", symbol.address); + return DeprecatedString::formatted("{:p}", symbol.address); case Column::Object: return symbol.object; case Column::Symbol: diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp index 5a9cde793ee..a91dfe1f510 100644 --- a/Userland/Applications/SystemMonitor/main.cpp +++ b/Userland/Applications/SystemMonitor/main.cpp @@ -74,7 +74,7 @@ public: auto percentage = index.data(GUI::ModelRole::Custom).to_i32(); auto data = index.data(); - String text; + DeprecatedString text; if (data.is_string()) text = data.as_string(); Gfx::StylePainter::paint_progressbar(painter, rect, palette, 0, 100, percentage, text); @@ -87,8 +87,8 @@ class UnavailableProcessWidget final : public GUI::Frame { public: virtual ~UnavailableProcessWidget() override = default; - String const& text() const { return m_text; } - void set_text(String text) + DeprecatedString const& text() const { return m_text; } + void set_text(DeprecatedString text) { m_text = move(text); update(); @@ -110,7 +110,7 @@ private: painter.draw_text(frame_inner_rect(), text(), Gfx::TextAlignment::Center, palette().window_text(), Gfx::TextElision::Right); } - String m_text; + DeprecatedString m_text; }; class StorageTabWidget final : public GUI::LazyWidget { @@ -193,7 +193,7 @@ public: check(MS_AXALLOWED, "axallowed"sv); check(MS_NOREGULAR, "noregular"sv); if (builder.string_view().is_empty()) - return String("defaults"); + return DeprecatedString("defaults"); return builder.to_string(); }); df_fields.empend("free_block_count", "Free blocks", Gfx::TextAlignment::CenterRight); @@ -287,8 +287,8 @@ ErrorOr serenity_main(Main::Arguments arguments) auto process_model = ProcessModel::create(); process_model->on_state_update = [&](int process_count, int thread_count) { - statusbar->set_text(0, String::formatted("Processes: {}", process_count)); - statusbar->set_text(1, String::formatted("Threads: {}", thread_count)); + statusbar->set_text(0, DeprecatedString::formatted("Processes: {}", process_count)); + statusbar->set_text(1, DeprecatedString::formatted("Threads: {}", thread_count)); }; auto& performance_widget = *tabwidget.find_descendant_of_type_named("performance"); @@ -335,7 +335,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return pid_index.data().to_i32(); }; - auto selected_name = [&](ProcessModel::Column column) -> String { + auto selected_name = [&](ProcessModel::Column column) -> DeprecatedString { if (process_table_view.selection().is_empty()) return {}; auto pid_index = process_table_view.model()->index(process_table_view.selection().first().row(), column, process_table_view.selection().first().parent()); @@ -347,7 +347,7 @@ ErrorOr serenity_main(Main::Arguments arguments) pid_t pid = selected_id(ProcessModel::Column::PID); if (pid == -1) return; - auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); + auto rc = GUI::MessageBox::show(window, DeprecatedString::formatted("Do you really want to kill \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); if (rc == GUI::Dialog::ExecResult::Yes) kill(pid, SIGKILL); }, @@ -358,7 +358,7 @@ ErrorOr serenity_main(Main::Arguments arguments) pid_t pid = selected_id(ProcessModel::Column::PID); if (pid == -1) return; - auto rc = GUI::MessageBox::show(window, String::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); + auto rc = GUI::MessageBox::show(window, DeprecatedString::formatted("Do you really want to stop \"{}\" (PID {})?", selected_name(ProcessModel::Column::Name), pid), "System Monitor"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); if (rc == GUI::Dialog::ExecResult::Yes) kill(pid, SIGSTOP); }, @@ -378,7 +378,7 @@ ErrorOr serenity_main(Main::Arguments arguments) pid_t pid = selected_id(ProcessModel::Column::PID); if (pid == -1) return; - auto pid_string = String::number(pid); + auto pid_string = DeprecatedString::number(pid); GUI::Process::spawn_or_show_error(window, "/bin/Profiler"sv, Array { "--pid", pid_string.characters() }); }, &process_table_view); @@ -434,11 +434,11 @@ ErrorOr serenity_main(Main::Arguments arguments) frequency_action_group.set_exclusive(true); auto make_frequency_action = [&](int seconds) { - auto action = GUI::Action::create_checkable(String::formatted("&{} Sec", seconds), [&refresh_timer, seconds](auto&) { + auto action = GUI::Action::create_checkable(DeprecatedString::formatted("&{} Sec", seconds), [&refresh_timer, seconds](auto&) { Config::write_i32("SystemMonitor"sv, "Monitor"sv, "Frequency"sv, seconds); refresh_timer.restart(seconds * 1000); }); - action->set_status_tip(String::formatted("Refresh every {} seconds", seconds)); + action->set_status_tip(DeprecatedString::formatted("Refresh every {} seconds", seconds)); action->set_checked(frequency == seconds); frequency_action_group.add_action(*action); frequency_menu.add_action(*action); @@ -506,7 +506,7 @@ ErrorOr> build_process_window(pid_t pid) { auto window = GUI::Window::construct(); window->resize(480, 360); - window->set_title(String::formatted("PID {} - System Monitor", pid)); + window->set_title(DeprecatedString::formatted("PID {} - System Monitor", pid)); auto app_icon = GUI::Icon::default_icon("app-system-monitor"sv); window->set_icon(app_icon.bitmap_for_size(16)); @@ -528,7 +528,7 @@ ErrorOr> build_process_window(pid_t pid) main_widget->find_descendant_of_type_named("icon_label")->set_icon(icon_data.as_icon().bitmap_for_size(32)); } - main_widget->find_descendant_of_type_named("process_name")->set_text(String::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_string(), pid)); + main_widget->find_descendant_of_type_named("process_name")->set_text(DeprecatedString::formatted("{} (PID {})", process_index.sibling_at_column(ProcessModel::Column::Name).data().to_string(), pid)); main_widget->find_descendant_of_type_named("process_state")->set_pid(pid); main_widget->find_descendant_of_type_named("open_files")->set_pid(pid); @@ -538,7 +538,7 @@ ErrorOr> build_process_window(pid_t pid) auto& widget_stack = *main_widget->find_descendant_of_type_named("widget_stack"); auto& unavailable_process_widget = *widget_stack.find_descendant_of_type_named("unavailable_process"); - unavailable_process_widget.set_text(String::formatted("Unable to access PID {}", pid)); + unavailable_process_widget.set_text(DeprecatedString::formatted("Unable to access PID {}", pid)); if (can_access_pid(pid)) widget_stack.set_active_widget(widget_stack.find_descendant_of_type_named("available_process")); @@ -568,13 +568,13 @@ void build_performance_tab(GUI::Widget& graphs_container) cpu_graph.set_value_format(0, { .graph_color_role = ColorRole::SyntaxPreprocessorStatement, .text_formatter = [](u64 value) { - return String::formatted("Total: {}%", value); + return DeprecatedString::formatted("Total: {}%", value); }, }); cpu_graph.set_value_format(1, { .graph_color_role = ColorRole::SyntaxPreprocessorValue, .text_formatter = [](u64 value) { - return String::formatted("Kernel: {}%", value); + return DeprecatedString::formatted("Kernel: {}%", value); }, }); cpu_graphs.append(cpu_graph); @@ -587,26 +587,26 @@ void build_performance_tab(GUI::Widget& graphs_container) sum_cpu += cpus[i].total_cpu_percent; } float cpu_usage = sum_cpu / (float)cpus.size(); - statusbar->set_text(2, String::formatted("CPU usage: {}%", (int)roundf(cpu_usage))); + statusbar->set_text(2, DeprecatedString::formatted("CPU usage: {}%", (int)roundf(cpu_usage))); }; auto& memory_graph = *graphs_container.find_descendant_of_type_named("memory_graph"); memory_graph.set_value_format(0, { .graph_color_role = ColorRole::SyntaxComment, .text_formatter = [](u64 bytes) { - return String::formatted("Committed: {}", human_readable_size(bytes)); + return DeprecatedString::formatted("Committed: {}", human_readable_size(bytes)); }, }); memory_graph.set_value_format(1, { .graph_color_role = ColorRole::SyntaxPreprocessorStatement, .text_formatter = [](u64 bytes) { - return String::formatted("Allocated: {}", human_readable_size(bytes)); + return DeprecatedString::formatted("Allocated: {}", human_readable_size(bytes)); }, }); memory_graph.set_value_format(2, { .graph_color_role = ColorRole::SyntaxPreprocessorValue, .text_formatter = [](u64 bytes) { - return String::formatted("Kernel heap: {}", human_readable_size(bytes)); + return DeprecatedString::formatted("Kernel heap: {}", human_readable_size(bytes)); }, }); } diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp index b9f58495479..66fdaad8912 100644 --- a/Userland/Applications/Terminal/main.cpp +++ b/Userland/Applications/Terminal/main.cpp @@ -54,7 +54,7 @@ public: { } - virtual void config_bool_did_change(String const& domain, String const& group, String const& key, bool value) override + virtual void config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) override { VERIFY(domain == "Terminal"); @@ -68,7 +68,7 @@ public: } } - virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override + virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override { VERIFY(domain == "Terminal"); @@ -98,7 +98,7 @@ public: } } - virtual void config_i32_did_change(String const& domain, String const& group, String const& key, i32 value) override + virtual void config_i32_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, i32 value) override { VERIFY(domain == "Terminal"); @@ -115,7 +115,7 @@ private: VT::TerminalWidget& m_parent_terminal; }; -static void utmp_update(String const& tty, pid_t pid, bool create) +static void utmp_update(DeprecatedString const& tty, pid_t pid, bool create) { int utmpupdate_pid = fork(); if (utmpupdate_pid < 0) { @@ -146,9 +146,9 @@ static void utmp_update(String const& tty, pid_t pid, bool create) } } -static ErrorOr run_command(String command, bool keep_open) +static ErrorOr run_command(DeprecatedString command, bool keep_open) { - String shell = "/bin/Shell"; + DeprecatedString shell = "/bin/Shell"; auto* pw = getpwuid(getuid()); if (pw && pw->pw_shell) { shell = pw->pw_shell; @@ -361,7 +361,7 @@ ErrorOr serenity_main(Main::Arguments arguments) }; auto shell_child_process_count = [&] { - Core::DirIterator iterator(String::formatted("/proc/{}/children", shell_pid), Core::DirIterator::Flags::SkipParentAndBaseDir); + Core::DirIterator iterator(DeprecatedString::formatted("/proc/{}/children", shell_pid), Core::DirIterator::Flags::SkipParentAndBaseDir); int background_process_count = 0; while (iterator.has_next()) { ++background_process_count; @@ -373,13 +373,13 @@ ErrorOr serenity_main(Main::Arguments arguments) auto check_terminal_quit = [&]() -> GUI::Dialog::ExecResult { if (!should_confirm_close) return GUI::MessageBox::ExecResult::OK; - Optional close_message; + Optional close_message; if (tty_has_foreground_process()) { close_message = "There is still a process running in this terminal. Closing the terminal will kill it."; } else { auto child_process_count = shell_child_process_count(); if (child_process_count > 1) - close_message = String::formatted("There are {} background processes running in this terminal. Closing the terminal may kill them.", child_process_count); + close_message = DeprecatedString::formatted("There are {} background processes running in this terminal. Closing the terminal may kill them.", child_process_count); else if (child_process_count == 1) close_message = "There is a background process running in this terminal. Closing the terminal may kill it."; } diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp index ca3c9ab51ff..28dab184e21 100644 --- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp +++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.cpp @@ -119,7 +119,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() // The settings window takes a reference to this vector, so it needs to outlive this scope. // As long as we ensure that only one settings window may be open at a time (which we do), // this should cause no problems. - static Vector color_scheme_names; + static Vector color_scheme_names; color_scheme_names.clear(); Core::DirIterator iterator("/res/terminal-colors", Core::DirIterator::SkipParentAndBaseDir); while (iterator.has_next()) { @@ -129,7 +129,7 @@ TerminalSettingsViewWidget::TerminalSettingsViewWidget() quick_sort(color_scheme_names); auto& color_scheme_combo = *find_descendant_of_type_named("color_scheme_combo"); color_scheme_combo.set_only_allow_values_from_model(true); - color_scheme_combo.set_model(*GUI::ItemListModel::create(color_scheme_names)); + color_scheme_combo.set_model(*GUI::ItemListModel::create(color_scheme_names)); color_scheme_combo.set_selected_index(color_scheme_names.find_first_index(m_color_scheme).value()); color_scheme_combo.set_enabled(color_scheme_names.size() > 1); color_scheme_combo.on_change = [&](auto&, const GUI::ModelIndex& index) { @@ -245,7 +245,7 @@ VT::TerminalWidget::BellMode TerminalSettingsMainWidget::parse_bell(StringView b VERIFY_NOT_REACHED(); } -String TerminalSettingsMainWidget::stringify_bell(VT::TerminalWidget::BellMode bell_mode) +DeprecatedString TerminalSettingsMainWidget::stringify_bell(VT::TerminalWidget::BellMode bell_mode) { if (bell_mode == VT::TerminalWidget::BellMode::AudibleBeep) return "AudibleBeep"; diff --git a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.h b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.h index c4cec626714..f5fc21a2f1b 100644 --- a/Userland/Applications/TerminalSettings/TerminalSettingsWidget.h +++ b/Userland/Applications/TerminalSettings/TerminalSettingsWidget.h @@ -24,7 +24,7 @@ private: void write_back_settings() const; static VT::TerminalWidget::BellMode parse_bell(StringView bell_string); - static String stringify_bell(VT::TerminalWidget::BellMode bell_mode); + static DeprecatedString stringify_bell(VT::TerminalWidget::BellMode bell_mode); VT::TerminalWidget::BellMode m_bell_mode { VT::TerminalWidget::BellMode::Disabled }; size_t m_max_history_size; @@ -49,13 +49,13 @@ private: RefPtr m_font; float m_opacity; - String m_color_scheme; + DeprecatedString m_color_scheme; VT::CursorShape m_cursor_shape { VT::CursorShape::Block }; bool m_cursor_is_blinking_set { true }; RefPtr m_original_font; float m_original_opacity; - String m_original_color_scheme; + DeprecatedString m_original_color_scheme; VT::CursorShape m_original_cursor_shape; bool m_original_cursor_is_blinking_set; }; diff --git a/Userland/Applications/TextEditor/FileArgument.cpp b/Userland/Applications/TextEditor/FileArgument.cpp index 128103d22e4..fbbc58bb6e3 100644 --- a/Userland/Applications/TextEditor/FileArgument.cpp +++ b/Userland/Applications/TextEditor/FileArgument.cpp @@ -11,7 +11,7 @@ namespace TextEditor { -FileArgument::FileArgument(String file_argument) +FileArgument::FileArgument(DeprecatedString file_argument) { m_line = {}; m_column = {}; diff --git a/Userland/Applications/TextEditor/FileArgument.h b/Userland/Applications/TextEditor/FileArgument.h index 1646a6b7bba..201d02a1f58 100644 --- a/Userland/Applications/TextEditor/FileArgument.h +++ b/Userland/Applications/TextEditor/FileArgument.h @@ -7,21 +7,21 @@ #pragma once -#include +#include namespace TextEditor { class FileArgument final { public: - explicit FileArgument(String); + explicit FileArgument(DeprecatedString); ~FileArgument() = default; - String filename() { return m_filename; } + DeprecatedString filename() { return m_filename; } Optional line() { return m_line; } Optional column() { return m_column; } private: - String m_filename; + DeprecatedString m_filename; Optional m_line; Optional m_column; }; diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp index 237a693ae2e..3bdbfdaaabf 100644 --- a/Userland/Applications/TextEditor/MainWidget.cpp +++ b/Userland/Applications/TextEditor/MainWidget.cpp @@ -127,7 +127,7 @@ MainWidget::MainWidget() m_editor->insert_at_cursor_or_replace_selection(substitute); } else { GUI::MessageBox::show(window(), - String::formatted("Not found: \"{}\"", needle), + DeprecatedString::formatted("Not found: \"{}\"", needle), "Not found"sv, GUI::MessageBox::Type::Information); } @@ -152,7 +152,7 @@ MainWidget::MainWidget() } } else { GUI::MessageBox::show(window(), - String::formatted("Not found: \"{}\"", needle), + DeprecatedString::formatted("Not found: \"{}\"", needle), "Not found"sv, GUI::MessageBox::Type::Information); } @@ -339,7 +339,7 @@ WebView::OutOfProcessWebView& MainWidget::ensure_web_view() if (!Desktop::Launcher::open(url)) { GUI::MessageBox::show( window(), - String::formatted("The link to '{}' could not be opened.", url), + DeprecatedString::formatted("The link to '{}' could not be opened.", url), "Failed to open link"sv, GUI::MessageBox::Type::Error); } @@ -722,7 +722,7 @@ bool MainWidget::read_file(Core::File& file) return true; } -void MainWidget::open_nonexistent_file(String const& path) +void MainWidget::open_nonexistent_file(DeprecatedString const& path) { m_editor->set_text({}); set_path(path); @@ -847,11 +847,11 @@ void MainWidget::update_statusbar() StringBuilder builder; if (m_editor->has_selection()) { - String selected_text = m_editor->selected_text(); + DeprecatedString selected_text = m_editor->selected_text(); auto word_count = m_editor->number_of_selected_words(); builder.appendff("{} {} ({} {}) selected", selected_text.length(), selected_text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word"); } else { - String text = m_editor->text(); + DeprecatedString text = m_editor->text(); auto word_count = m_editor->number_of_words(); builder.appendff("{} {} ({} {})", text.length(), text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word"); } @@ -861,7 +861,7 @@ void MainWidget::update_statusbar() auto language = m_editor->syntax_highlighter()->language(); m_statusbar->set_text(1, m_editor->syntax_highlighter()->language_string(language)); } - m_statusbar->set_text(2, String::formatted("Ln {}, Col {}", m_editor->cursor().line() + 1, m_editor->cursor().column())); + m_statusbar->set_text(2, DeprecatedString::formatted("Ln {}, Col {}", m_editor->cursor().line() + 1, m_editor->cursor().column())); } void MainWidget::find_text(GUI::TextEditor::SearchDirection direction, ShowMessageIfNoResults show_message) @@ -878,7 +878,7 @@ void MainWidget::find_text(GUI::TextEditor::SearchDirection direction, ShowMessa if (!result.is_valid() && show_message == ShowMessageIfNoResults::Yes) { GUI::MessageBox::show(window(), - String::formatted("Not found: \"{}\"", needle), + DeprecatedString::formatted("Not found: \"{}\"", needle), "Not found"sv, GUI::MessageBox::Type::Information); } diff --git a/Userland/Applications/TextEditor/MainWidget.h b/Userland/Applications/TextEditor/MainWidget.h index 648ab5b71c6..1dea14fe081 100644 --- a/Userland/Applications/TextEditor/MainWidget.h +++ b/Userland/Applications/TextEditor/MainWidget.h @@ -26,7 +26,7 @@ class MainWidget final : public GUI::Widget { public: virtual ~MainWidget() override = default; bool read_file(Core::File&); - void open_nonexistent_file(String const& path); + void open_nonexistent_file(DeprecatedString const& path); bool request_close(); GUI::TextEditor& editor() { return *m_editor; } @@ -64,9 +64,9 @@ private: void find_text(GUI::TextEditor::SearchDirection, ShowMessageIfNoResults); RefPtr m_editor; - String m_path; - String m_name; - String m_extension; + DeprecatedString m_path; + DeprecatedString m_name; + DeprecatedString m_extension; RefPtr m_new_action; RefPtr m_open_action; RefPtr m_save_action; diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp index 4006456491e..86f888f3ac4 100644 --- a/Userland/Applications/ThemeEditor/MainWidget.cpp +++ b/Userland/Applications/ThemeEditor/MainWidget.cpp @@ -250,7 +250,7 @@ ErrorOr MainWidget::initialize_menubar(GUI::Window& window) void MainWidget::update_title() { - window()->set_title(String::formatted("{}[*] - Theme Editor", m_path.value_or("Untitled"))); + window()->set_title(DeprecatedString::formatted("{}[*] - Theme Editor", m_path.value_or("Untitled"))); } GUI::Window::CloseRequestDecision MainWidget::request_close() @@ -272,7 +272,7 @@ GUI::Window::CloseRequestDecision MainWidget::request_close() return GUI::Window::CloseRequestDecision::StayOpen; } -void MainWidget::set_path(String path) +void MainWidget::set_path(DeprecatedString path) { m_path = path; update_title(); @@ -304,7 +304,7 @@ void MainWidget::save_to_file(Core::File& file) auto sync_result = theme->sync(); if (sync_result.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("Failed to save theme file: {}", sync_result.error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to save theme file: {}", sync_result.error())); } else { m_last_modified_time = Time::now_monotonic(); set_path(file.filename()); @@ -525,7 +525,7 @@ void MainWidget::set_metric(Gfx::MetricRole role, int value) set_palette(preview_palette); } -void MainWidget::set_path(Gfx::PathRole role, String value) +void MainWidget::set_path(Gfx::PathRole role, DeprecatedString value) { auto preview_palette = m_current_palette; preview_palette.set_path(role, value); @@ -543,7 +543,7 @@ void MainWidget::set_palette(Gfx::Palette palette) void MainWidget::show_path_picker_dialog(StringView property_display_name, GUI::TextBox& path_input, PathPickerTarget path_picker_target) { bool open_folder = path_picker_target == PathPickerTarget::Folder; - auto window_title = String::formatted(open_folder ? "Select {} folder"sv : "Select {} file"sv, property_display_name); + auto window_title = DeprecatedString::formatted(open_folder ? "Select {} folder"sv : "Select {} file"sv, property_display_name); auto target_path = path_input.text(); if (Core::File::exists(target_path)) { if (!Core::File::is_directory(target_path)) diff --git a/Userland/Applications/ThemeEditor/MainWidget.h b/Userland/Applications/ThemeEditor/MainWidget.h index a54a36578d3..28befade587 100644 --- a/Userland/Applications/ThemeEditor/MainWidget.h +++ b/Userland/Applications/ThemeEditor/MainWidget.h @@ -52,7 +52,7 @@ private: AlignmentModel() = default; struct AlignmentValue { - String title; + DeprecatedString title; Gfx::TextAlignment setting_value; }; Vector m_alignments { @@ -67,12 +67,12 @@ struct Property { }; struct PropertyGroup { - String title; + DeprecatedString title; Vector properties; }; struct PropertyTab { - String title; + DeprecatedString title; Vector property_groups; }; @@ -92,7 +92,7 @@ private: void save_to_file(Core::File&); ErrorOr encode(); - void set_path(String); + void set_path(DeprecatedString); void build_override_controls(); @@ -101,7 +101,7 @@ private: void set_color(Gfx::ColorRole, Gfx::Color); void set_flag(Gfx::FlagRole, bool); void set_metric(Gfx::MetricRole, int); - void set_path(Gfx::PathRole, String); + void set_path(Gfx::PathRole, DeprecatedString); void set_palette(Gfx::Palette); @@ -118,7 +118,7 @@ private: RefPtr m_theme_override_apply; RefPtr m_theme_override_reset; - Optional m_path; + Optional m_path; Gfx::Palette m_current_palette; Time m_last_modified_time { Time::now_monotonic() }; diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index 1b904355e1f..1e60a885c57 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -33,7 +33,7 @@ ErrorOr serenity_main(Main::Arguments arguments) parser.add_positional_argument(file_to_edit, "Theme file to edit", "file", Core::ArgsParser::Required::No); parser.parse(arguments); - Optional path = {}; + Optional path = {}; if (!file_to_edit.is_empty()) path = Core::File::absolute_path(file_to_edit); @@ -55,7 +55,7 @@ ErrorOr serenity_main(Main::Arguments arguments) [&window, &path, &main_widget]() { auto response = FileSystemAccessClient::Client::the().try_request_file_read_only_approved(window, path.value()); if (response.is_error()) - GUI::MessageBox::show_error(window, String::formatted("Opening \"{}\" failed: {}", path.value(), response.error())); + GUI::MessageBox::show_error(window, DeprecatedString::formatted("Opening \"{}\" failed: {}", path.value(), response.error())); else main_widget->load_from_file(response.release_value()); }); diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp index 44d894c1fb4..01018b8e1fc 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp @@ -176,7 +176,7 @@ void VideoPlayerWidget::on_decoding_error(Video::DecoderError const& error) break; } - GUI::MessageBox::show(&m_window, String::formatted(text_format, error.string_literal()), "Video Player encountered an error"sv); + GUI::MessageBox::show(&m_window, DeprecatedString::formatted(text_format, error.string_literal()), "Video Player encountered an error"sv); } void VideoPlayerWidget::update_seek_slider_max() @@ -290,7 +290,7 @@ void VideoPlayerWidget::initialize_menubar(GUI::Window& window) // File menu auto& file_menu = window.add_menu("&File"); file_menu.add_action(GUI::CommonActions::make_open_action([&](auto&) { - Optional path = GUI::FilePicker::get_open_filepath(&window, "Open video file..."); + Optional path = GUI::FilePicker::get_open_filepath(&window, "Open video file..."); if (path.has_value()) open_file(path.value()); })); diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h index bf1697fa111..aa5411c1378 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h @@ -53,7 +53,7 @@ private: GUI::Window& m_window; - String m_path; + DeprecatedString m_path; RefPtr m_video_display; RefPtr m_seek_slider; diff --git a/Userland/Applications/Welcome/WelcomeWidget.cpp b/Userland/Applications/Welcome/WelcomeWidget.cpp index 5769cc5f4cb..d5c82cc558d 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.cpp +++ b/Userland/Applications/Welcome/WelcomeWidget.cpp @@ -25,7 +25,7 @@ WelcomeWidget::WelcomeWidget() load_from_gml(welcome_window_gml); m_web_view = find_descendant_of_type_named("web_view"); - m_web_view->load(URL::create_with_file_scheme(String::formatted("{}/README.md", Core::StandardPaths::home_directory()))); + m_web_view->load(URL::create_with_file_scheme(DeprecatedString::formatted("{}/README.md", Core::StandardPaths::home_directory()))); m_tip_label = find_descendant_of_type_named("tip_label"); m_tip_frame = find_descendant_of_type_named("tip_frame"); @@ -69,7 +69,7 @@ WelcomeWidget::WelcomeWidget() }; if (auto result = open_and_parse_tips_file(); result.is_error()) { - auto error = String::formatted("Opening \"{}/tips.txt\" failed: {}", Core::StandardPaths::documents_directory(), result.error()); + auto error = DeprecatedString::formatted("Opening \"{}/tips.txt\" failed: {}", Core::StandardPaths::documents_directory(), result.error()); m_tip_label->set_text(error); warnln(error); } @@ -79,7 +79,7 @@ WelcomeWidget::WelcomeWidget() ErrorOr WelcomeWidget::open_and_parse_tips_file() { - auto path = String::formatted("{}/tips.txt", Core::StandardPaths::documents_directory()); + auto path = DeprecatedString::formatted("{}/tips.txt", Core::StandardPaths::documents_directory()); auto file = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read)); auto buffered_file = TRY(Core::Stream::BufferedFile::create(move(file))); Array buffer; diff --git a/Userland/Applications/Welcome/WelcomeWidget.h b/Userland/Applications/Welcome/WelcomeWidget.h index ecb278f28c2..0452ded18c8 100644 --- a/Userland/Applications/Welcome/WelcomeWidget.h +++ b/Userland/Applications/Welcome/WelcomeWidget.h @@ -33,5 +33,5 @@ private: RefPtr m_web_view; size_t m_initial_tip_index { 0 }; - Vector m_tips; + Vector m_tips; }; diff --git a/Userland/Demos/Cube/Cube.cpp b/Userland/Demos/Cube/Cube.cpp index 983f2ab2fc5..82f188f5bf9 100644 --- a/Userland/Demos/Cube/Cube.cpp +++ b/Userland/Demos/Cube/Cube.cpp @@ -175,7 +175,7 @@ void Cube::timer_event(Core::TimerEvent&) if ((m_cycles % 50) == 0) { dbgln("{} total cycles. finished 50 in {} ms, avg {} ms", m_cycles, m_accumulated_time, m_accumulated_time / 50); - m_stats->set_text(String::formatted("{} ms", m_accumulated_time / 50)); + m_stats->set_text(DeprecatedString::formatted("{} ms", m_accumulated_time / 50)); m_accumulated_time = 0; } diff --git a/Userland/Demos/Fire/Fire.cpp b/Userland/Demos/Fire/Fire.cpp index 6ba086159b3..9daa47e52f3 100644 --- a/Userland/Demos/Fire/Fire.cpp +++ b/Userland/Demos/Fire/Fire.cpp @@ -155,7 +155,7 @@ void Fire::timer_event(Core::TimerEvent&) if ((cycles % 50) == 0) { dbgln("{} total cycles. finished 50 in {} ms, avg {} ms", cycles, timeAvg, timeAvg / 50); - stats->set_text(String::formatted("{} ms", timeAvg / 50)); + stats->set_text(DeprecatedString::formatted("{} ms", timeAvg / 50)); timeAvg = 0; } diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp index 4f625377cbf..08a80707b18 100644 --- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp +++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp @@ -217,7 +217,7 @@ enum class ImageType { class Mandelbrot : public GUI::Frame { C_OBJECT(Mandelbrot) - void export_image(String const& export_path, ImageType image_type); + void export_image(DeprecatedString const& export_path, ImageType image_type); enum class Zoom { In, @@ -366,7 +366,7 @@ void Mandelbrot::resize_event(GUI::ResizeEvent& event) m_set.resize(event.size()); } -void Mandelbrot::export_image(String const& export_path, ImageType image_type) +void Mandelbrot::export_image(DeprecatedString const& export_path, ImageType image_type) { m_set.resize(Gfx::IntSize { 1920, 1080 }); ByteBuffer encoded_data; @@ -388,7 +388,7 @@ void Mandelbrot::export_image(String const& export_path, ImageType image_type) m_set.resize(size()); auto file = fopen(export_path.characters(), "wb"); if (!file) { - GUI::MessageBox::show(window(), String::formatted("Could not open '{}' for writing.", export_path), "Mandelbrot"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not open '{}' for writing.", export_path), "Mandelbrot"sv, GUI::MessageBox::Type::Error); return; } fwrite(encoded_data.data(), 1, encoded_data.size(), file); @@ -420,21 +420,21 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(export_submenu.try_add_action(GUI::Action::create("As &BMP", [&](GUI::Action&) { - Optional export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "bmp"); + Optional export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "bmp"); if (!export_path.has_value()) return; mandelbrot->export_image(export_path.value(), ImageType::BMP); }))); TRY(export_submenu.try_add_action(GUI::Action::create("As &PNG", { Mod_Ctrl | Mod_Shift, Key_S }, [&](GUI::Action&) { - Optional export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "png"); + Optional export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "png"); if (!export_path.has_value()) return; mandelbrot->export_image(export_path.value(), ImageType::PNG); }))); TRY(export_submenu.try_add_action(GUI::Action::create("As &QOI", [&](GUI::Action&) { - Optional export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "qoi"); + Optional export_path = GUI::FilePicker::get_save_filepath(window, "untitled", "qoi"); if (!export_path.has_value()) return; mandelbrot->export_image(export_path.value(), ImageType::QOI); diff --git a/Userland/Demos/ModelGallery/BasicModel.cpp b/Userland/Demos/ModelGallery/BasicModel.cpp index 10b76e37af6..464fb8fd5c6 100644 --- a/Userland/Demos/ModelGallery/BasicModel.cpp +++ b/Userland/Demos/ModelGallery/BasicModel.cpp @@ -46,7 +46,7 @@ GUI::ModelIndex BasicModel::index(int row, int column, GUI::ModelIndex const& pa return create_index(row, column); } -void BasicModel::add_item(String const& item) +void BasicModel::add_item(DeprecatedString const& item) { begin_insert_rows({}, m_items.size(), m_items.size()); m_items.append(item); diff --git a/Userland/Demos/ModelGallery/BasicModel.h b/Userland/Demos/ModelGallery/BasicModel.h index e0dfd1ed4c5..9034c9fba2d 100644 --- a/Userland/Demos/ModelGallery/BasicModel.h +++ b/Userland/Demos/ModelGallery/BasicModel.h @@ -20,7 +20,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_items.size(); } virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return 1; } - virtual String column_name(int) const override { return "Item"; } + virtual DeprecatedString column_name(int) const override { return "Item"; } virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole = GUI::ModelRole::Display) const override; virtual TriState data_matches(GUI::ModelIndex const&, GUI::Variant const&) const override; @@ -29,7 +29,7 @@ public: Function on_invalidate; - void add_item(String const& item); + void add_item(DeprecatedString const& item); void remove_item(GUI::ModelIndex const&); private: @@ -37,5 +37,5 @@ private: { } - Vector m_items; + Vector m_items; }; diff --git a/Userland/Demos/ModelGallery/GalleryWidget.cpp b/Userland/Demos/ModelGallery/GalleryWidget.cpp index 30412ff69ae..1c4bace5d64 100644 --- a/Userland/Demos/ModelGallery/GalleryWidget.cpp +++ b/Userland/Demos/ModelGallery/GalleryWidget.cpp @@ -34,10 +34,10 @@ ErrorOr GalleryWidget::load_basic_model_tab() m_basic_model->on_invalidate = [&] { m_invalidation_count++; - m_statusbar->set_text(String::formatted("Times invalidated: {}", m_invalidation_count)); + m_statusbar->set_text(DeprecatedString::formatted("Times invalidated: {}", m_invalidation_count)); }; - m_statusbar->set_text(String::formatted("Times invalidated: {}", m_invalidation_count)); + m_statusbar->set_text(DeprecatedString::formatted("Times invalidated: {}", m_invalidation_count)); m_basic_model->add_item("Well..."); m_basic_model->add_item("...hello..."); diff --git a/Userland/Demos/VirGLDemo/VirGLDemo.cpp b/Userland/Demos/VirGLDemo/VirGLDemo.cpp index d0716a236d2..2b6cf8f92b5 100644 --- a/Userland/Demos/VirGLDemo/VirGLDemo.cpp +++ b/Userland/Demos/VirGLDemo/VirGLDemo.cpp @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include #include diff --git a/Userland/Demos/WidgetGallery/DemoWizardDialog.h b/Userland/Demos/WidgetGallery/DemoWizardDialog.h index 7adef3922ec..daaa86faaa7 100644 --- a/Userland/Demos/WidgetGallery/DemoWizardDialog.h +++ b/Userland/Demos/WidgetGallery/DemoWizardDialog.h @@ -17,7 +17,7 @@ class DemoWizardDialog : public GUI::WizardDialog { C_OBJECT(DemoWizardDialog); public: - String page_1_location() { return m_page_1_location_text_box->get_text(); } + DeprecatedString page_1_location() { return m_page_1_location_text_box->get_text(); } private: DemoWizardDialog(GUI::Window* parent_window); diff --git a/Userland/Demos/WidgetGallery/GalleryModels.h b/Userland/Demos/WidgetGallery/GalleryModels.h index ce225ad2902..9b3979f9c84 100644 --- a/Userland/Demos/WidgetGallery/GalleryModels.h +++ b/Userland/Demos/WidgetGallery/GalleryModels.h @@ -27,7 +27,7 @@ public: virtual int row_count(const GUI::ModelIndex&) const override { return m_cursors.size(); } virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } - virtual String column_name(int column_index) const override + virtual DeprecatedString column_name(int column_index) const override { switch (column_index) { case Column::Bitmap: @@ -60,7 +60,7 @@ public: { m_cursors.clear(); - Core::DirIterator iterator(String::formatted("/res/cursor-themes/{}", GUI::ConnectionToWindowServer::the().get_cursor_theme()), Core::DirIterator::Flags::SkipDots); + Core::DirIterator iterator(DeprecatedString::formatted("/res/cursor-themes/{}", GUI::ConnectionToWindowServer::the().get_cursor_theme()), Core::DirIterator::Flags::SkipDots); while (iterator.has_next()) { auto path = iterator.next_full_path(); @@ -90,8 +90,8 @@ private: struct Cursor { RefPtr bitmap; - String path; - String name; + DeprecatedString path; + DeprecatedString name; Gfx::CursorParams params; }; @@ -112,7 +112,7 @@ public: virtual int row_count(const GUI::ModelIndex&) const override { return m_icon_sets.size(); } virtual int column_count(const GUI::ModelIndex&) const override { return Column::__Count; } - virtual String column_name(int column_index) const override + virtual DeprecatedString column_name(int column_index) const override { switch (column_index) { case Column::BigIcon: @@ -194,7 +194,7 @@ private: struct IconSet { RefPtr big_icon; RefPtr little_icon; - String name; + DeprecatedString name; }; Vector m_icon_sets; diff --git a/Userland/Demos/WidgetGallery/GalleryWidget.cpp b/Userland/Demos/WidgetGallery/GalleryWidget.cpp index b569e90a0b3..35a1035d5af 100644 --- a/Userland/Demos/WidgetGallery/GalleryWidget.cpp +++ b/Userland/Demos/WidgetGallery/GalleryWidget.cpp @@ -54,7 +54,7 @@ GalleryWidget::GalleryWidget() m_frame_shapes.append("Sunken Panel"); m_frame_shape_combobox = basics_tab->find_descendant_of_type_named("frame_shape_combobox"); - m_frame_shape_combobox->set_model(*GUI::ItemListModel::create(m_frame_shapes)); + m_frame_shape_combobox->set_model(*GUI::ItemListModel::create(m_frame_shapes)); m_frame_shape_combobox->on_change = [&](auto&, auto const& index) { m_label_frame->set_frame_shape(static_cast((index.row() - 1) % 3 + 1)); @@ -118,7 +118,7 @@ GalleryWidget::GalleryWidget() m_input_button->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/properties.png"sv).release_value_but_fixme_should_propagate_errors()); m_input_button->on_click = [&](auto) { - String value; + DeprecatedString value; if (GUI::InputBox::show(window(), value, "Enter input:"sv, "Input"sv) == GUI::InputBox::ExecResult::OK && !value.is_empty()) m_text_editor->set_text(value); }; @@ -150,7 +150,7 @@ GalleryWidget::GalleryWidget() m_msgbox_buttons.append("Yes No Cancel"); m_msgbox_icon_combobox = basics_tab->find_descendant_of_type_named("msgbox_icon_combobox"); - m_msgbox_icon_combobox->set_model(*GUI::ItemListModel::create(m_msgbox_icons)); + m_msgbox_icon_combobox->set_model(*GUI::ItemListModel::create(m_msgbox_icons)); m_msgbox_icon_combobox->set_selected_index(0); m_msgbox_icon_combobox->on_change = [&](auto&, auto const& index) { @@ -158,7 +158,7 @@ GalleryWidget::GalleryWidget() }; m_msgbox_buttons_combobox = basics_tab->find_descendant_of_type_named("msgbox_buttons_combobox"); - m_msgbox_buttons_combobox->set_model(*GUI::ItemListModel::create(m_msgbox_buttons)); + m_msgbox_buttons_combobox->set_model(*GUI::ItemListModel::create(m_msgbox_buttons)); m_msgbox_buttons_combobox->set_selected_index(0); m_msgbox_buttons_combobox->on_change = [&](auto&, auto const& index) { @@ -269,7 +269,7 @@ GalleryWidget::GalleryWidget() " _||_-\n" }; - m_wizard_output->set_text(String::formatted("{}{}", serenityos_ascii, wizard_ascii)); + m_wizard_output->set_text(DeprecatedString::formatted("{}{}", serenityos_ascii, wizard_ascii)); m_wizard_button->on_click = [&](auto) { StringBuilder sb; @@ -280,9 +280,9 @@ GalleryWidget::GalleryWidget() auto wizard = DemoWizardDialog::try_create(window()).release_value_but_fixme_should_propagate_errors(); auto result = wizard->exec(); - sb.append(String::formatted("\nWizard execution complete.\nDialog ExecResult code: {}", to_underlying(result))); + sb.append(DeprecatedString::formatted("\nWizard execution complete.\nDialog ExecResult code: {}", to_underlying(result))); if (result == GUI::Dialog::ExecResult::OK) - sb.append(String::formatted(" (ExecResult::OK)\n'Installation' location: \"{}\"", wizard->page_1_location())); + sb.append(DeprecatedString::formatted(" (ExecResult::OK)\n'Installation' location: \"{}\"", wizard->page_1_location())); m_wizard_output->set_text(sb.string_view()); }; diff --git a/Userland/Demos/WidgetGallery/GalleryWidget.h b/Userland/Demos/WidgetGallery/GalleryWidget.h index 056ff25f6e0..206b0a5f8d0 100644 --- a/Userland/Demos/WidgetGallery/GalleryWidget.h +++ b/Userland/Demos/WidgetGallery/GalleryWidget.h @@ -61,9 +61,9 @@ private: RefPtr m_opacity_value_slider; RefPtr m_opacity_imagewidget; - Vector m_frame_shapes; - Vector m_msgbox_icons; - Vector m_msgbox_buttons; + Vector m_frame_shapes; + Vector m_msgbox_icons; + Vector m_msgbox_buttons; Vector> m_button_icons; GUI::MessageBox::Type m_msgbox_type; diff --git a/Userland/DevTools/GMLPlayground/main.cpp b/Userland/DevTools/GMLPlayground/main.cpp index 848d78b589e..1a5514fc900 100644 --- a/Userland/DevTools/GMLPlayground/main.cpp +++ b/Userland/DevTools/GMLPlayground/main.cpp @@ -37,14 +37,14 @@ class UnregisteredWidget final : public GUI::Widget { C_OBJECT(UnregisteredWidget); private: - UnregisteredWidget(String const& class_name); + UnregisteredWidget(DeprecatedString const& class_name); virtual void paint_event(GUI::PaintEvent& event) override; - String m_text; + DeprecatedString m_text; }; -UnregisteredWidget::UnregisteredWidget(String const& class_name) +UnregisteredWidget::UnregisteredWidget(DeprecatedString const& class_name) { StringBuilder builder; builder.append(class_name); @@ -104,7 +104,7 @@ ErrorOr serenity_main(Main::Arguments arguments) editor->set_automatic_indentation_enabled(true); editor->set_ruler_visible(true); - String file_path; + DeprecatedString file_path; auto update_title = [&] { StringBuilder builder; if (file_path.is_empty()) @@ -121,7 +121,7 @@ ErrorOr serenity_main(Main::Arguments arguments) editor->on_change = [&] { preview->remove_all_children(); - preview->load_from_gml(editor->text(), [](const String& class_name) -> RefPtr { + preview->load_from_gml(editor->text(), [](const DeprecatedString& class_name) -> RefPtr { return UnregisteredWidget::construct(class_name); }); }; @@ -212,7 +212,7 @@ ErrorOr serenity_main(Main::Arguments arguments) } else { GUI::MessageBox::show( window, - String::formatted("GML could not be formatted: {}", formatted_gml_or_error.error()), + DeprecatedString::formatted("GML could not be formatted: {}", formatted_gml_or_error.error()), "Error"sv, GUI::MessageBox::Type::Error); } @@ -286,7 +286,7 @@ ErrorOr serenity_main(Main::Arguments arguments) window->show(); - if (String(path).is_empty()) { + if (DeprecatedString(path).is_empty()) { editor->set_text(R"~~~(@GUI::Frame { layout: @GUI::VerticalBoxLayout { } diff --git a/Userland/DevTools/HackStudio/AutoCompleteResponse.h b/Userland/DevTools/HackStudio/AutoCompleteResponse.h index 1fcec3cea55..bee9dd9045d 100644 --- a/Userland/DevTools/HackStudio/AutoCompleteResponse.h +++ b/Userland/DevTools/HackStudio/AutoCompleteResponse.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include diff --git a/Userland/DevTools/HackStudio/CodeDocument.cpp b/Userland/DevTools/HackStudio/CodeDocument.cpp index 0ba3f46fd69..152df3e1f0d 100644 --- a/Userland/DevTools/HackStudio/CodeDocument.cpp +++ b/Userland/DevTools/HackStudio/CodeDocument.cpp @@ -9,7 +9,7 @@ namespace HackStudio { -NonnullRefPtr CodeDocument::create(String const& file_path, Client* client) +NonnullRefPtr CodeDocument::create(DeprecatedString const& file_path, Client* client) { return adopt_ref(*new CodeDocument(file_path, client)); } @@ -19,7 +19,7 @@ NonnullRefPtr CodeDocument::create(Client* client) return adopt_ref(*new CodeDocument(client)); } -CodeDocument::CodeDocument(String const& file_path, Client* client) +CodeDocument::CodeDocument(DeprecatedString const& file_path, Client* client) : TextDocument(client) , m_file_path(file_path) { diff --git a/Userland/DevTools/HackStudio/CodeDocument.h b/Userland/DevTools/HackStudio/CodeDocument.h index e496a9fa61c..08489c2fe49 100644 --- a/Userland/DevTools/HackStudio/CodeDocument.h +++ b/Userland/DevTools/HackStudio/CodeDocument.h @@ -16,7 +16,7 @@ namespace HackStudio { class CodeDocument final : public GUI::TextDocument { public: virtual ~CodeDocument() override = default; - static NonnullRefPtr create(String const& file_path, Client* client = nullptr); + static NonnullRefPtr create(DeprecatedString const& file_path, Client* client = nullptr); static NonnullRefPtr create(Client* client = nullptr); Vector const& breakpoint_lines() const { return m_breakpoint_lines; } @@ -24,18 +24,18 @@ public: Optional execution_position() const { return m_execution_position; } void set_execution_position(size_t line) { m_execution_position = line; } void clear_execution_position() { m_execution_position.clear(); } - String const& file_path() const { return m_file_path; } - String const& language_name() const { return m_language_name; }; + DeprecatedString const& file_path() const { return m_file_path; } + DeprecatedString const& language_name() const { return m_language_name; }; Language language() const { return m_language; } virtual bool is_code_document() const override final { return true; } private: - explicit CodeDocument(String const& file_path, Client* client = nullptr); + explicit CodeDocument(DeprecatedString const& file_path, Client* client = nullptr); explicit CodeDocument(Client* client = nullptr); - String m_file_path; - String m_language_name; + DeprecatedString m_file_path; + DeprecatedString m_language_name; Language m_language { Language::Unknown }; Vector m_breakpoint_lines; Optional m_execution_position; diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp index 432dfbab1eb..a600e0e1497 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp @@ -46,7 +46,7 @@ Vector BacktraceModel::create_backtrace(Debug::Proces // We need to go back to the 'call' instruction to get accurate source position information. if (frame_index > 0) --current_instruction; - String name = lib->debug_info->elf().symbolicate(current_instruction - lib->base_address); + DeprecatedString name = lib->debug_info->elf().symbolicate(current_instruction - lib->base_address); if (name.is_null()) { dbgln("BacktraceModel: couldn't find containing function for address: {:p} (library={})", current_instruction, lib->name); name = ""; diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h index 74aedfc4129..43df6afbb05 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.h @@ -27,7 +27,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_frames.size(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } - virtual String column_name(int) const override + virtual DeprecatedString column_name(int) const override { return ""; } @@ -37,7 +37,7 @@ public: virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override; struct FrameInfo { - String function_name; + DeprecatedString function_name; FlatPtr instruction_address { 0 }; FlatPtr frame_base { 0 }; Optional m_source_position; diff --git a/Userland/DevTools/HackStudio/Debugger/BreakpointCallback.h b/Userland/DevTools/HackStudio/Debugger/BreakpointCallback.h index 98d7b30edcd..99be9747930 100644 --- a/Userland/DevTools/HackStudio/Debugger/BreakpointCallback.h +++ b/Userland/DevTools/HackStudio/Debugger/BreakpointCallback.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include #include namespace HackStudio { @@ -17,5 +17,5 @@ enum class BreakpointChange { Removed, }; -using BreakpointChangeCallback = Function; +using BreakpointChangeCallback = Function; } diff --git a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp index 5fe7bd108f2..d31261a050f 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp @@ -105,7 +105,7 @@ RefPtr DebugInfoWidget::get_context_menu_for_variable(const GUI::Mode auto* variable = static_cast(index.internal_data()); if (does_variable_support_writing(variable)) { context_menu->add_action(GUI::Action::create("Change value", [&](auto&) { - String value; + DeprecatedString value; if (GUI::InputBox::show(window(), value, "Enter new value:"sv, "Set variable value"sv) == GUI::InputBox::ExecResult::OK) { auto& model = static_cast(*m_variables_view->model()); model.set_variable_value(index, value, window()); diff --git a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp index 267c155dc8f..c4b08efd929 100644 --- a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp +++ b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp @@ -18,7 +18,7 @@ Debugger& Debugger::the() } void Debugger::initialize( - String source_root, + DeprecatedString source_root, Function on_stop_callback, Function on_continue_callback, Function on_exit_callback) @@ -32,7 +32,7 @@ bool Debugger::is_initialized() } Debugger::Debugger( - String source_root, + DeprecatedString source_root, Function on_stop_callback, Function on_continue_callback, Function on_exit_callback) @@ -45,7 +45,7 @@ Debugger::Debugger( pthread_cond_init(&m_ui_action_cond, nullptr); } -void Debugger::on_breakpoint_change(String const& file, size_t line, BreakpointChange change_type) +void Debugger::on_breakpoint_change(DeprecatedString const& file, size_t line, BreakpointChange change_type) { auto position = create_source_position(file, line); @@ -77,7 +77,7 @@ void Debugger::on_breakpoint_change(String const& file, size_t line, BreakpointC } } -bool Debugger::set_execution_position(String const& file, size_t line) +bool Debugger::set_execution_position(DeprecatedString const& file, size_t line) { auto position = create_source_position(file, line); auto session = Debugger::the().session(); @@ -92,11 +92,11 @@ bool Debugger::set_execution_position(String const& file, size_t line) return true; } -Debug::DebugInfo::SourcePosition Debugger::create_source_position(String const& file, size_t line) +Debug::DebugInfo::SourcePosition Debugger::create_source_position(DeprecatedString const& file, size_t line) { if (file.starts_with('/')) return { file, line + 1 }; - return { LexicalPath::canonicalized_path(String::formatted("{}/{}", m_source_root, file)), line + 1 }; + return { LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_source_root, file)), line + 1 }; } intptr_t Debugger::start_static() diff --git a/Userland/DevTools/HackStudio/Debugger/Debugger.h b/Userland/DevTools/HackStudio/Debugger/Debugger.h index eaf14e5a5c4..67053543ffc 100644 --- a/Userland/DevTools/HackStudio/Debugger/Debugger.h +++ b/Userland/DevTools/HackStudio/Debugger/Debugger.h @@ -26,18 +26,18 @@ public: }; static void initialize( - String source_root, + DeprecatedString source_root, Function on_stop_callback, Function on_continue_callback, Function on_exit_callback); static bool is_initialized(); - void on_breakpoint_change(String const& file, size_t line, BreakpointChange change_type); - bool set_execution_position(String const& file, size_t line); + void on_breakpoint_change(DeprecatedString const& file, size_t line, BreakpointChange change_type); + bool set_execution_position(DeprecatedString const& file, size_t line); - void set_executable_path(String const& path) { m_executable_path = path; } - void set_source_root(String const& source_root) { m_source_root = source_root; } + void set_executable_path(DeprecatedString const& path) { m_executable_path = path; } + void set_source_root(DeprecatedString const& source_root) { m_source_root = source_root; } Debug::DebugSession* session() { return m_debug_session.ptr(); } @@ -90,12 +90,12 @@ private: }; explicit Debugger( - String source_root, + DeprecatedString source_root, Function on_stop_callback, Function on_continue_callback, Function on_exit_callback); - Debug::DebugInfo::SourcePosition create_source_position(String const& file, size_t line); + Debug::DebugInfo::SourcePosition create_source_position(DeprecatedString const& file, size_t line); void start(); int debugger_loop(); @@ -107,7 +107,7 @@ private: void insert_temporary_breakpoint_at_return_address(PtraceRegisters const&); OwnPtr m_debug_session; - String m_source_root; + DeprecatedString m_source_root; DebuggingState m_state; pthread_mutex_t m_ui_action_mutex {}; @@ -116,7 +116,7 @@ private: Vector m_breakpoints; - String m_executable_path; + DeprecatedString m_executable_path; Function m_on_stopped_callback; Function m_on_continue_callback; diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp index cf65671ec1b..81fd38c063c 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.cpp @@ -73,7 +73,7 @@ int DisassemblyModel::row_count(const GUI::ModelIndex&) const return m_instructions.size(); } -String DisassemblyModel::column_name(int column) const +DeprecatedString DisassemblyModel::column_name(int column) const { switch (column) { case Column::Address: @@ -94,7 +94,7 @@ GUI::Variant DisassemblyModel::data(const GUI::ModelIndex& index, GUI::ModelRole if (role == GUI::ModelRole::Display) { if (index.column() == Column::Address) - return String::formatted("{:p}", insn.address); + return DeprecatedString::formatted("{:p}", insn.address); if (index.column() == Column::InstructionBytes) { StringBuilder builder; for (auto ch : insn.bytes) diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h index 10efc05af4a..fdd8e3b03b6 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h @@ -22,7 +22,7 @@ namespace HackStudio { struct InstructionData { X86::Instruction insn; - String disassembly; + DeprecatedString disassembly; StringView bytes; FlatPtr address { 0 }; }; @@ -45,7 +45,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; private: diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.cpp b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.cpp index f2cfe33ae13..bf1c036047b 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.cpp @@ -73,7 +73,7 @@ void DisassemblyWidget::show_disassembly() m_unavailable_disassembly_widget->set_visible(false); } -void DisassemblyWidget::hide_disassembly(String const& reason) +void DisassemblyWidget::hide_disassembly(DeprecatedString const& reason) { m_top_container->set_visible(false); m_disassembly_view->set_visible(false); diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h index 5805c722ad2..9f32350e66e 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyWidget.h @@ -21,18 +21,18 @@ class UnavailableDisassemblyWidget final : public GUI::Frame { public: virtual ~UnavailableDisassemblyWidget() override { } - String const& reason() const { return m_reason; } - void set_reason(String const& text) { m_reason = text; } + DeprecatedString const& reason() const { return m_reason; } + void set_reason(DeprecatedString const& text) { m_reason = text; } private: - UnavailableDisassemblyWidget(String const& reason) + UnavailableDisassemblyWidget(DeprecatedString const& reason) : m_reason(reason) { } virtual void paint_event(GUI::PaintEvent& event) override; - String m_reason; + DeprecatedString m_reason; }; class DisassemblyWidget final : public GUI::Widget { @@ -47,7 +47,7 @@ private: DisassemblyWidget(); void show_disassembly(); - void hide_disassembly(String const&); + void hide_disassembly(DeprecatedString const&); RefPtr m_top_container; RefPtr m_disassembly_view; diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp index 5a12ac4a86a..b67f16b63dc 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.cpp @@ -112,7 +112,7 @@ int RegistersModel::row_count(const GUI::ModelIndex&) const return m_registers.size(); } -String RegistersModel::column_name(int column) const +DeprecatedString RegistersModel::column_name(int column) const { switch (column) { case Column::Register: @@ -140,7 +140,7 @@ GUI::Variant RegistersModel::data(const GUI::ModelIndex& index, GUI::ModelRole r if (index.column() == Column::Register) return reg.name; if (index.column() == Column::Value) - return String::formatted("{:p}", reg.value); + return DeprecatedString::formatted("{:p}", reg.value); return {}; } return {}; diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h index a0e86c19157..f8749f4c476 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h @@ -14,7 +14,7 @@ namespace HackStudio { struct RegisterData { - String name; + DeprecatedString name; FlatPtr value; bool changed { false }; }; @@ -41,7 +41,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; PtraceRegisters const& raw_registers() const { return m_raw_registers; } diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp index 281dd6ba13a..97e51893887 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp @@ -55,7 +55,7 @@ int VariablesModel::row_count(const GUI::ModelIndex& index) const return node->members.size(); } -static String variable_value_as_string(Debug::DebugInfo::VariableInfo const& variable) +static DeprecatedString variable_value_as_string(Debug::DebugInfo::VariableInfo const& variable) { if (variable.location_type != Debug::DebugInfo::VariableInfo::LocationType::Address) return "N/A"; @@ -69,20 +69,20 @@ static String variable_value_as_string(Debug::DebugInfo::VariableInfo const& var return enumerator->constant_data.as_u32 == enumerator_value; }); if (it.is_end()) - return String::formatted("Unknown ({})", value.value()); - return String::formatted("{}::{}", variable.type_name, (*it)->name); + return DeprecatedString::formatted("Unknown ({})", value.value()); + return DeprecatedString::formatted("{}::{}", variable.type_name, (*it)->name); } if (variable.type_name == "int") { auto value = Debugger::the().session()->peek(variable_address); VERIFY(value.has_value()); - return String::formatted("{}", static_cast(value.value())); + return DeprecatedString::formatted("{}", static_cast(value.value())); } if (variable.type_name == "char") { auto value = Debugger::the().session()->peek(variable_address); VERIFY(value.has_value()); - return String::formatted("'{0:c}'", (char)value.value()); + return DeprecatedString::formatted("'{0:c}'", (char)value.value()); } if (variable.type_name == "bool") { @@ -91,13 +91,13 @@ static String variable_value_as_string(Debug::DebugInfo::VariableInfo const& var return (value.value() & 1) ? "true" : "false"; } - return String::formatted("type: {} @ {:p}, ", variable.type_name, variable_address); + return DeprecatedString::formatted("type: {} @ {:p}, ", variable.type_name, variable_address); } static Optional string_to_variable_value(StringView string_value, Debug::DebugInfo::VariableInfo const& variable) { if (variable.is_enum_type()) { - auto prefix_string = String::formatted("{}::", variable.type_name); + auto prefix_string = DeprecatedString::formatted("{}::", variable.type_name); auto string_to_use = string_value; if (string_value.starts_with(prefix_string)) string_to_use = string_value.substring_view(prefix_string.length(), string_value.length() - prefix_string.length()); @@ -143,7 +143,7 @@ void VariablesModel::set_variable_value(const GUI::ModelIndex& index, StringView GUI::MessageBox::show( parent_window, - String::formatted("String value \"{}\" could not be converted to a value of type {}.", string_value, variable->type_name), + DeprecatedString::formatted("String value \"{}\" could not be converted to a value of type {}.", string_value, variable->type_name), "Set value failed"sv, GUI::MessageBox::Type::Error); } @@ -154,7 +154,7 @@ GUI::Variant VariablesModel::data(const GUI::ModelIndex& index, GUI::ModelRole r switch (role) { case GUI::ModelRole::Display: { auto value_as_string = variable_value_as_string(*variable); - return String::formatted("{}: {}", variable->name, value_as_string); + return DeprecatedString::formatted("{}: {}", variable->name, value_as_string); } case GUI::ModelRole::Icon: return m_variable_icon; diff --git a/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp index 8e227625d28..5e41b3a7c13 100644 --- a/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.cpp @@ -32,7 +32,7 @@ GitCommitDialog::GitCommitDialog(GUI::Window* parent) auto line = m_message_editor->cursor().line() + 1; auto col = m_message_editor->cursor().column(); - m_line_and_col_label->set_text(String::formatted("Line: {}, Col: {}", line, col)); + m_line_and_col_label->set_text(DeprecatedString::formatted("Line: {}, Col: {}", line, col)); }; m_commit_button->set_enabled(!m_message_editor->text().is_empty() && on_commit); diff --git a/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.h b/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.h index 346280c0136..1d3d0e321fb 100644 --- a/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.h +++ b/Userland/DevTools/HackStudio/Dialogs/Git/GitCommitDialog.h @@ -15,7 +15,7 @@ namespace HackStudio { -using OnCommitCallback = Function; +using OnCommitCallback = Function; class GitCommitDialog final : public GUI::Dialog { C_OBJECT(GitCommitDialog); diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp index 156cc686740..c6daa392df8 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -10,8 +10,8 @@ #include #include +#include #include -#include #include #include #include @@ -89,7 +89,7 @@ NewProjectDialog::NewProjectDialog(GUI::Window* parent) m_browse_button = *find_descendant_of_type_named("browse_button"); m_browse_button->on_click = [this](auto) { - Optional path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), true); + Optional path = GUI::FilePicker::get_open_filepath(this, {}, Core::StandardPaths::home_directory(), true); if (path.has_value()) m_create_in_input->set_text(path.value().view()); }; @@ -131,7 +131,7 @@ void NewProjectDialog::update_dialog() m_ok_button->set_enabled(m_input_valid); } -Optional NewProjectDialog::get_available_project_name() +Optional NewProjectDialog::get_available_project_name() { auto create_in = m_create_in_input->text(); auto chosen_name = m_name_input->text(); @@ -148,16 +148,16 @@ Optional NewProjectDialog::get_available_project_name() for (int i = 0; i < 1000; i++) { auto candidate = (i == 0) ? chosen_name - : String::formatted("{}-{}", chosen_name, i); + : DeprecatedString::formatted("{}-{}", chosen_name, i); - if (!Core::File::exists(String::formatted("{}/{}", create_in, candidate))) + if (!Core::File::exists(DeprecatedString::formatted("{}/{}", create_in, candidate))) return candidate; } return {}; } -Optional NewProjectDialog::get_project_full_path() +Optional NewProjectDialog::get_project_full_path() { // Do not permit forward-slashes in project names if (m_name_input->text().contains('/')) @@ -189,13 +189,13 @@ void NewProjectDialog::do_create_project() auto create_in = m_create_in_input->text(); if (!Core::File::exists(create_in) || !Core::File::is_directory(create_in)) { - auto result = GUI::MessageBox::show(this, String::formatted("The directory {} does not exist yet, would you like to create it?", create_in), "New project"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); + auto result = GUI::MessageBox::show(this, DeprecatedString::formatted("The directory {} does not exist yet, would you like to create it?", create_in), "New project"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); if (result != GUI::MessageBox::ExecResult::Yes) return; auto created = Core::Directory::create(maybe_project_full_path.value(), Core::Directory::CreateDirectories::Yes); if (created.is_error()) { - GUI::MessageBox::show_error(this, String::formatted("Could not create directory {}", create_in)); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("Could not create directory {}", create_in)); return; } } @@ -206,7 +206,7 @@ void NewProjectDialog::do_create_project() m_created_project_path = maybe_project_full_path.value(); done(ExecResult::OK); } else { - GUI::MessageBox::show_error(this, String::formatted("Could not create project: {}", creation_result.error())); + GUI::MessageBox::show_error(this, DeprecatedString::formatted("Could not create project: {}", creation_result.error())); } } diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.h b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.h index 1158ce0737e..ec74124210e 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.h +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.h @@ -24,15 +24,15 @@ class NewProjectDialog : public GUI::Dialog { public: static ExecResult show(GUI::Window* parent_window); - Optional created_project_path() const { return m_created_project_path; } + Optional created_project_path() const { return m_created_project_path; } private: NewProjectDialog(GUI::Window* parent); virtual ~NewProjectDialog() override = default; void update_dialog(); - Optional get_available_project_name(); - Optional get_project_full_path(); + Optional get_available_project_name(); + Optional get_project_full_path(); void do_create_project(); @@ -53,7 +53,7 @@ private: RefPtr m_cancel_button; RefPtr m_browse_button; - Optional m_created_project_path; + Optional m_created_project_path; }; } diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp index 4b38da2202d..71c8c9db782 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.cpp @@ -53,7 +53,7 @@ int ProjectTemplatesModel::column_count(const GUI::ModelIndex&) const return Column::__Count; } -String ProjectTemplatesModel::column_name(int column) const +DeprecatedString ProjectTemplatesModel::column_name(int column) const { switch (column) { case Column::Icon: diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h index 80f83817cc4..b800760aec0 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h @@ -36,7 +36,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; void update(); diff --git a/Userland/DevTools/HackStudio/Editor.cpp b/Userland/DevTools/HackStudio/Editor.cpp index 47b156ebbae..0fb35f4936f 100644 --- a/Userland/DevTools/HackStudio/Editor.cpp +++ b/Userland/DevTools/HackStudio/Editor.cpp @@ -183,9 +183,9 @@ void Editor::paint_event(GUI::PaintEvent& event) } } -static HashMap& man_paths() +static HashMap& man_paths() { - static HashMap paths; + static HashMap paths; if (paths.is_empty()) { auto json = Config::read_string("HackStudio"sv, "Global"sv, "DocumentationSearchPaths"sv); AK::JsonParser parser(json); @@ -214,7 +214,7 @@ static HashMap& man_paths() return paths; } -void Editor::show_documentation_tooltip_if_available(String const& hovered_token, Gfx::IntPoint const& screen_location) +void Editor::show_documentation_tooltip_if_available(DeprecatedString const& hovered_token, Gfx::IntPoint const& screen_location) { auto it = man_paths().find(hovered_token); if (it == man_paths().end()) { @@ -406,11 +406,11 @@ void Editor::leave_event(Core::Event& event) GUI::TextEditor::leave_event(event); } -static HashMap& include_paths() +static HashMap& include_paths() { - static HashMap paths; + static HashMap paths; - auto add_directory = [](String base, Optional recursive, auto handle_directory) -> void { + auto add_directory = [](DeprecatedString base, Optional recursive, auto handle_directory) -> void { Core::DirIterator it(recursive.value_or(base), Core::DirIterator::Flags::SkipDots); while (it.has_next()) { auto path = it.next_full_path(); @@ -434,7 +434,7 @@ static HashMap& include_paths() return paths; } -void Editor::navigate_to_include_if_available(String path) +void Editor::navigate_to_include_if_available(DeprecatedString path) { auto it = include_paths().find(path); if (it == include_paths().end()) { @@ -609,7 +609,7 @@ void Editor::on_identifier_click(const GUI::TextDocumentSpan& span) if (!m_language_client) return; - m_language_client->on_declaration_found = [](String const& file, size_t line, size_t column) { + m_language_client->on_declaration_found = [](DeprecatedString const& file, size_t line, size_t column) { HackStudio::open_file(file, line, column); }; m_language_client->search_declaration(code_document().file_path(), span.range.start().line(), span.range.start().column()); @@ -713,7 +713,7 @@ void Editor::handle_function_parameters_hint_request() if (!m_language_client) return; - m_language_client->on_function_parameters_hint_result = [this](Vector const& params, size_t argument_index) { + m_language_client->on_function_parameters_hint_result = [this](Vector const& params, size_t argument_index) { dbgln("on_function_parameters_hint_result"); StringBuilder html; diff --git a/Userland/DevTools/HackStudio/Editor.h b/Userland/DevTools/HackStudio/Editor.h index 103524093f4..acd3f00f963 100644 --- a/Userland/DevTools/HackStudio/Editor.h +++ b/Userland/DevTools/HackStudio/Editor.h @@ -29,7 +29,7 @@ public: virtual ~Editor() override = default; Function on_focus; - Function on_open; + Function on_open; EditorWrapper& wrapper(); EditorWrapper const& wrapper() const; @@ -71,8 +71,8 @@ private: virtual void leave_event(Core::Event&) override; virtual void keydown_event(GUI::KeyEvent&) override; - void show_documentation_tooltip_if_available(String const&, Gfx::IntPoint const& screen_location); - void navigate_to_include_if_available(String); + void show_documentation_tooltip_if_available(DeprecatedString const&, Gfx::IntPoint const& screen_location); + void navigate_to_include_if_available(DeprecatedString); void on_navigatable_link_click(const GUI::TextDocumentSpan&); void on_identifier_click(const GUI::TextDocumentSpan&); @@ -111,7 +111,7 @@ private: explicit Editor(); - String m_last_parsed_token; + DeprecatedString m_last_parsed_token; GUI::TextPosition m_previous_text_position { 0, 0 }; bool m_hovering_editor { false }; bool m_hovering_clickable { false }; diff --git a/Userland/DevTools/HackStudio/EditorWrapper.cpp b/Userland/DevTools/HackStudio/EditorWrapper.cpp index 802d984e922..7512896bb95 100644 --- a/Userland/DevTools/HackStudio/EditorWrapper.cpp +++ b/Userland/DevTools/HackStudio/EditorWrapper.cpp @@ -34,7 +34,7 @@ EditorWrapper::EditorWrapper() set_current_editor_wrapper(this); }; - m_editor->on_open = [](String const& path) { + m_editor->on_open = [](DeprecatedString const& path) { open_file(path); }; @@ -63,7 +63,7 @@ void EditorWrapper::set_mode_non_displayable() editor().document().set_text("The contents of this file could not be displayed. Is it a binary file?"sv); } -void EditorWrapper::set_filename(String const& filename) +void EditorWrapper::set_filename(DeprecatedString const& filename) { m_filename = filename; update_title(); @@ -74,7 +74,7 @@ void EditorWrapper::save() { if (filename().is_empty()) { auto file_picker_action = GUI::CommonActions::make_save_as_action([&](auto&) { - Optional save_path = GUI::FilePicker::get_save_filepath(window(), "file"sv, "txt"sv, project_root().value()); + Optional save_path = GUI::FilePicker::get_save_filepath(window(), "file"sv, "txt"sv, project_root().value()); set_filename(save_path.value()); }); file_picker_action->activate(); @@ -90,7 +90,7 @@ void EditorWrapper::update_diff() m_hunks = Diff::parse_hunks(m_git_repo->unstaged_diff(filename()).value()); } -void EditorWrapper::set_project_root(String const& project_root) +void EditorWrapper::set_project_root(DeprecatedString const& project_root) { m_project_root = project_root; auto result = GitRepo::try_to_create(*m_project_root); diff --git a/Userland/DevTools/HackStudio/EditorWrapper.h b/Userland/DevTools/HackStudio/EditorWrapper.h index 7e410d3303b..ba11dea9449 100644 --- a/Userland/DevTools/HackStudio/EditorWrapper.h +++ b/Userland/DevTools/HackStudio/EditorWrapper.h @@ -37,12 +37,12 @@ public: void set_mode_displayable(); void set_mode_non_displayable(); void set_debug_mode(bool); - void set_filename(String const&); - String const& filename() const { return m_filename; } - String const& filename_title() const { return m_filename_title; } + void set_filename(DeprecatedString const&); + DeprecatedString const& filename() const { return m_filename; } + DeprecatedString const& filename_title() const { return m_filename_title; } - Optional const& project_root() const { return m_project_root; } - void set_project_root(String const& project_root); + Optional const& project_root() const { return m_project_root; } + void set_project_root(DeprecatedString const& project_root); GitRepo const* git_repo() const { return m_git_repo; } @@ -59,11 +59,11 @@ private: void update_title(); - String m_filename; - String m_filename_title; + DeprecatedString m_filename; + DeprecatedString m_filename_title; RefPtr m_editor; - Optional m_project_root; + Optional m_project_root; RefPtr m_git_repo; Vector m_hunks; }; diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp index 86c1788c092..a53ac64a74a 100644 --- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp @@ -17,9 +17,9 @@ namespace HackStudio { struct Match { - String filename; + DeprecatedString filename; GUI::TextRange range; - String text; + DeprecatedString text; }; class SearchResultsModel final : public GUI::Model { @@ -39,7 +39,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_matches.size(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override + virtual DeprecatedString column_name(int column) const override { switch (column) { case Column::Filename: diff --git a/Userland/DevTools/HackStudio/GMLPreviewWidget.cpp b/Userland/DevTools/HackStudio/GMLPreviewWidget.cpp index 054d2ddd20b..692b858e361 100644 --- a/Userland/DevTools/HackStudio/GMLPreviewWidget.cpp +++ b/Userland/DevTools/HackStudio/GMLPreviewWidget.cpp @@ -10,13 +10,13 @@ namespace HackStudio { -GMLPreviewWidget::GMLPreviewWidget(String const& gml_content) +GMLPreviewWidget::GMLPreviewWidget(DeprecatedString const& gml_content) { set_layout(); load_gml(gml_content); } -void GMLPreviewWidget::load_gml(String const& gml) +void GMLPreviewWidget::load_gml(DeprecatedString const& gml) { remove_all_children(); @@ -27,8 +27,8 @@ void GMLPreviewWidget::load_gml(String const& gml) return; } - load_from_gml(gml, [](String const& name) -> RefPtr { - return GUI::Label::construct(String::formatted("{} is not registered as a GML element!", name)); + load_from_gml(gml, [](DeprecatedString const& name) -> RefPtr { + return GUI::Label::construct(DeprecatedString::formatted("{} is not registered as a GML element!", name)); }); if (children().is_empty()) { diff --git a/Userland/DevTools/HackStudio/GMLPreviewWidget.h b/Userland/DevTools/HackStudio/GMLPreviewWidget.h index ef1f1529bef..77419c502e0 100644 --- a/Userland/DevTools/HackStudio/GMLPreviewWidget.h +++ b/Userland/DevTools/HackStudio/GMLPreviewWidget.h @@ -14,10 +14,10 @@ namespace HackStudio { class GMLPreviewWidget final : public GUI::Widget { C_OBJECT(GMLPreviewWidget) public: - void load_gml(String const&); + void load_gml(DeprecatedString const&); private: - explicit GMLPreviewWidget(String const&); + explicit GMLPreviewWidget(DeprecatedString const&); }; } diff --git a/Userland/DevTools/HackStudio/Git/DiffViewer.cpp b/Userland/DevTools/HackStudio/Git/DiffViewer.cpp index 0e6aa9fcea5..66d15297cbf 100644 --- a/Userland/DevTools/HackStudio/Git/DiffViewer.cpp +++ b/Userland/DevTools/HackStudio/Git/DiffViewer.cpp @@ -71,7 +71,7 @@ void DiffViewer::paint_event(GUI::PaintEvent& event) } } -void DiffViewer::draw_line(GUI::Painter& painter, String const& line, size_t y_offset, LinePosition line_position, LineType line_type) +void DiffViewer::draw_line(GUI::Painter& painter, DeprecatedString const& line, size_t y_offset, LinePosition line_position, LineType line_type) { size_t line_width = font().width(line); @@ -131,7 +131,7 @@ Gfx::IntRect DiffViewer::separator_rect() const frame_inner_rect().height() }; } -void DiffViewer::set_content(String const& original, String const& diff) +void DiffViewer::set_content(DeprecatedString const& original, DeprecatedString const& diff) { m_original_lines = split_to_lines(original); m_hunks = Diff::parse_hunks(diff); @@ -147,7 +147,7 @@ DiffViewer::DiffViewer() setup_properties(); } -DiffViewer::DiffViewer(String const& original, String const& diff) +DiffViewer::DiffViewer(DeprecatedString const& original, DeprecatedString const& diff) : m_original_lines(split_to_lines(original)) , m_hunks(Diff::parse_hunks(diff)) { @@ -161,10 +161,10 @@ void DiffViewer::setup_properties() set_foreground_role(ColorRole::BaseText); } -Vector DiffViewer::split_to_lines(String const& text) +Vector DiffViewer::split_to_lines(DeprecatedString const& text) { // NOTE: This is slightly different than text.split('\n') - Vector lines; + Vector lines; size_t next_line_start_index = 0; for (size_t i = 0; i < text.length(); ++i) { if (text[i] == '\n') { diff --git a/Userland/DevTools/HackStudio/Git/DiffViewer.h b/Userland/DevTools/HackStudio/Git/DiffViewer.h index a700809a4f6..337fb7650f3 100644 --- a/Userland/DevTools/HackStudio/Git/DiffViewer.h +++ b/Userland/DevTools/HackStudio/Git/DiffViewer.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -18,10 +18,10 @@ class DiffViewer final : public GUI::AbstractScrollableWidget { public: virtual ~DiffViewer() override = default; - void set_content(String const& original, String const& diff); + void set_content(DeprecatedString const& original, DeprecatedString const& diff); private: - DiffViewer(String const& original, String const& diff); + DiffViewer(DeprecatedString const& original, DeprecatedString const& diff); DiffViewer(); void setup_properties(); @@ -43,9 +43,9 @@ private: Missing, }; - void draw_line(GUI::Painter&, String const& line, size_t y_offset, LinePosition, LineType); + void draw_line(GUI::Painter&, DeprecatedString const& line, size_t y_offset, LinePosition, LineType); - static Vector split_to_lines(String const& text); + static Vector split_to_lines(DeprecatedString const& text); static Gfx::Color red_background(); static Gfx::Color green_background(); @@ -55,7 +55,7 @@ private: Gfx::IntRect separator_rect() const; - Vector m_original_lines; + Vector m_original_lines; Vector m_hunks; }; } diff --git a/Userland/DevTools/HackStudio/Git/GitFilesModel.cpp b/Userland/DevTools/HackStudio/Git/GitFilesModel.cpp index 62648e260c2..4897c7f1027 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesModel.cpp +++ b/Userland/DevTools/HackStudio/Git/GitFilesModel.cpp @@ -8,12 +8,12 @@ namespace HackStudio { -NonnullRefPtr GitFilesModel::create(Vector&& files) +NonnullRefPtr GitFilesModel::create(Vector&& files) { return adopt_ref(*new GitFilesModel(move(files))); } -GitFilesModel::GitFilesModel(Vector&& files) +GitFilesModel::GitFilesModel(Vector&& files) : m_files(move(files)) { } diff --git a/Userland/DevTools/HackStudio/Git/GitFilesModel.h b/Userland/DevTools/HackStudio/Git/GitFilesModel.h index c95ab244eff..5f3c985b6e3 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesModel.h +++ b/Userland/DevTools/HackStudio/Git/GitFilesModel.h @@ -14,12 +14,12 @@ namespace HackStudio { class GitFilesModel final : public GUI::Model { public: - static NonnullRefPtr create(Vector&& files); + static NonnullRefPtr create(Vector&& files); virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_files.size(); } virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; } - virtual String column_name(int) const override + virtual DeprecatedString column_name(int) const override { return ""; } @@ -29,7 +29,7 @@ public: virtual GUI::ModelIndex index(int row, int column, const GUI::ModelIndex&) const override; private: - explicit GitFilesModel(Vector&& files); - Vector m_files; + explicit GitFilesModel(Vector&& files); + Vector m_files; }; } diff --git a/Userland/DevTools/HackStudio/Git/GitFilesView.h b/Userland/DevTools/HackStudio/Git/GitFilesView.h index ae9f9a34f1c..bdc82be6060 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesView.h +++ b/Userland/DevTools/HackStudio/Git/GitFilesView.h @@ -13,7 +13,7 @@ namespace HackStudio { // A "GitFileAction" is either the staging or the unstaging of a file. -using GitFileActionCallback = Function; +using GitFileActionCallback = Function; class GitFilesView : public GUI::ListView { C_OBJECT(GitFilesView) diff --git a/Userland/DevTools/HackStudio/Git/GitRepo.cpp b/Userland/DevTools/HackStudio/Git/GitRepo.cpp index d0109ce0f33..eb14f9cef1c 100644 --- a/Userland/DevTools/HackStudio/Git/GitRepo.cpp +++ b/Userland/DevTools/HackStudio/Git/GitRepo.cpp @@ -9,7 +9,7 @@ namespace HackStudio { -GitRepo::CreateResult GitRepo::try_to_create(String const& repository_root) +GitRepo::CreateResult GitRepo::try_to_create(DeprecatedString const& repository_root) { if (!git_is_installed()) { return { CreateResult::Type::GitProgramNotFound, nullptr }; @@ -21,7 +21,7 @@ GitRepo::CreateResult GitRepo::try_to_create(String const& repository_root) return { CreateResult::Type::Success, adopt_ref(*new GitRepo(repository_root)) }; } -RefPtr GitRepo::initialize_repository(String const& repository_root) +RefPtr GitRepo::initialize_repository(DeprecatedString const& repository_root) { auto res = command_wrapper({ "init" }, repository_root); if (res.is_null()) @@ -31,7 +31,7 @@ RefPtr GitRepo::initialize_repository(String const& repository_root) return adopt_ref(*new GitRepo(repository_root)); } -Vector GitRepo::unstaged_files() const +Vector GitRepo::unstaged_files() const { auto modified = modified_files(); auto untracked = untracked_files(); @@ -39,7 +39,7 @@ Vector GitRepo::unstaged_files() const return modified; } // -Vector GitRepo::staged_files() const +Vector GitRepo::staged_files() const { auto raw_result = command({ "diff", "--cached", "--name-only" }); if (raw_result.is_null()) @@ -47,7 +47,7 @@ Vector GitRepo::staged_files() const return parse_files_list(raw_result); } -Vector GitRepo::modified_files() const +Vector GitRepo::modified_files() const { auto raw_result = command({ "ls-files", "--modified", "--exclude-standard" }); if (raw_result.is_null()) @@ -55,7 +55,7 @@ Vector GitRepo::modified_files() const return parse_files_list(raw_result); } -Vector GitRepo::untracked_files() const +Vector GitRepo::untracked_files() const { auto raw_result = command({ "ls-files", "--others", "--exclude-standard" }); if (raw_result.is_null()) @@ -63,22 +63,22 @@ Vector GitRepo::untracked_files() const return parse_files_list(raw_result); } -Vector GitRepo::parse_files_list(String const& raw_result) +Vector GitRepo::parse_files_list(DeprecatedString const& raw_result) { auto lines = raw_result.split('\n'); - Vector files; + Vector files; for (auto const& line : lines) { files.empend(line); } return files; } -String GitRepo::command(Vector const& command_parts) const +DeprecatedString GitRepo::command(Vector const& command_parts) const { return command_wrapper(command_parts, m_repository_root); } -String GitRepo::command_wrapper(Vector const& command_parts, String const& chdir) +DeprecatedString GitRepo::command_wrapper(Vector const& command_parts, DeprecatedString const& chdir) { auto result = Core::command("git", command_parts, LexicalPath(chdir)); if (result.is_error() || result.value().exit_code != 0) @@ -91,37 +91,37 @@ bool GitRepo::git_is_installed() return !command_wrapper({ "--help" }, "/").is_null(); } -bool GitRepo::git_repo_exists(String const& repo_root) +bool GitRepo::git_repo_exists(DeprecatedString const& repo_root) { return !command_wrapper({ "status" }, repo_root).is_null(); } -bool GitRepo::stage(String const& file) +bool GitRepo::stage(DeprecatedString const& file) { return !command({ "add", file }).is_null(); } -bool GitRepo::unstage(String const& file) +bool GitRepo::unstage(DeprecatedString const& file) { return !command({ "reset", "HEAD", "--", file }).is_null(); } -bool GitRepo::commit(String const& message) +bool GitRepo::commit(DeprecatedString const& message) { return !command({ "commit", "-m", message }).is_null(); } -Optional GitRepo::original_file_content(String const& file) const +Optional GitRepo::original_file_content(DeprecatedString const& file) const { - return command({ "show", String::formatted("HEAD:{}", file) }); + return command({ "show", DeprecatedString::formatted("HEAD:{}", file) }); } -Optional GitRepo::unstaged_diff(String const& file) const +Optional GitRepo::unstaged_diff(DeprecatedString const& file) const { return command({ "diff", file.characters() }); } -bool GitRepo::is_tracked(String const& file) const +bool GitRepo::is_tracked(DeprecatedString const& file) const { auto res = command({ "ls-files", file }); if (res.is_null()) diff --git a/Userland/DevTools/HackStudio/Git/GitRepo.h b/Userland/DevTools/HackStudio/Git/GitRepo.h index a956aaa5e6e..dec84e76fdd 100644 --- a/Userland/DevTools/HackStudio/Git/GitRepo.h +++ b/Userland/DevTools/HackStudio/Git/GitRepo.h @@ -7,11 +7,11 @@ #pragma once +#include #include #include #include #include -#include #include namespace HackStudio { @@ -28,37 +28,37 @@ public: RefPtr repo; }; - static CreateResult try_to_create(String const& repository_root); - static RefPtr initialize_repository(String const& repository_root); + static CreateResult try_to_create(DeprecatedString const& repository_root); + static RefPtr initialize_repository(DeprecatedString const& repository_root); - bool stage(String const& file); - bool unstage(String const& file); - bool commit(String const& message); - bool is_tracked(String const& file) const; + bool stage(DeprecatedString const& file); + bool unstage(DeprecatedString const& file); + bool commit(DeprecatedString const& message); + bool is_tracked(DeprecatedString const& file) const; - Vector unstaged_files() const; - Vector staged_files() const; - Optional original_file_content(String const& file) const; - Optional unstaged_diff(String const& file) const; + Vector unstaged_files() const; + Vector staged_files() const; + Optional original_file_content(DeprecatedString const& file) const; + Optional unstaged_diff(DeprecatedString const& file) const; private: static bool git_is_installed(); - static bool git_repo_exists(String const& repo_root); + static bool git_repo_exists(DeprecatedString const& repo_root); - static String command_wrapper(Vector const& command_parts, String const& chdir); - static Vector parse_files_list(String const&); + static DeprecatedString command_wrapper(Vector const& command_parts, DeprecatedString const& chdir); + static Vector parse_files_list(DeprecatedString const&); - explicit GitRepo(String const& repository_root) + explicit GitRepo(DeprecatedString const& repository_root) : m_repository_root(repository_root) { } - Vector modified_files() const; - Vector untracked_files() const; + Vector modified_files() const; + Vector untracked_files() const; - String command(Vector const& command_parts) const; + DeprecatedString command(Vector const& command_parts) const; - String m_repository_root; + DeprecatedString m_repository_root; }; } diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.cpp b/Userland/DevTools/HackStudio/Git/GitWidget.cpp index 97aeb37d6ad..6223dee459e 100644 --- a/Userland/DevTools/HackStudio/Git/GitWidget.cpp +++ b/Userland/DevTools/HackStudio/Git/GitWidget.cpp @@ -21,7 +21,7 @@ namespace HackStudio { -GitWidget::GitWidget(String const& repo_root) +GitWidget::GitWidget(DeprecatedString const& repo_root) : m_repo_root(repo_root) { set_layout(); @@ -117,7 +117,7 @@ void GitWidget::refresh() m_staged_files->set_model(GitFilesModel::create(m_git_repo->staged_files())); } -void GitWidget::stage_file(String const& file) +void GitWidget::stage_file(DeprecatedString const& file) { dbgln("staging: {}", file); bool rc = m_git_repo->stage(file); @@ -125,7 +125,7 @@ void GitWidget::stage_file(String const& file) refresh(); } -void GitWidget::unstage_file(String const& file) +void GitWidget::unstage_file(DeprecatedString const& file) { dbgln("unstaging: {}", file); bool rc = m_git_repo->unstage(file); @@ -153,7 +153,7 @@ void GitWidget::set_view_diff_callback(ViewDiffCallback callback) m_view_diff_callback = move(callback); } -void GitWidget::show_diff(String const& file_path) +void GitWidget::show_diff(DeprecatedString const& file_path) { if (!m_git_repo->is_tracked(file_path)) { auto file = Core::File::construct(file_path); @@ -163,7 +163,7 @@ void GitWidget::show_diff(String const& file_path) } auto content = file->read_all(); - String content_string((char*)content.data(), content.size()); + DeprecatedString content_string((char*)content.data(), content.size()); m_view_diff_callback("", Diff::generate_only_additions(content_string)); return; } @@ -173,7 +173,7 @@ void GitWidget::show_diff(String const& file_path) m_view_diff_callback(original_content.value(), diff.value()); } -void GitWidget::change_repo(String const& repo_root) +void GitWidget::change_repo(DeprecatedString const& repo_root) { m_repo_root = repo_root; m_git_repo = nullptr; diff --git a/Userland/DevTools/HackStudio/Git/GitWidget.h b/Userland/DevTools/HackStudio/Git/GitWidget.h index a0ff4ac209c..47c0f076093 100644 --- a/Userland/DevTools/HackStudio/Git/GitWidget.h +++ b/Userland/DevTools/HackStudio/Git/GitWidget.h @@ -14,7 +14,7 @@ namespace HackStudio { -using ViewDiffCallback = Function; +using ViewDiffCallback = Function; class GitWidget final : public GUI::Widget { C_OBJECT(GitWidget) @@ -24,19 +24,19 @@ public: void refresh(); void set_view_diff_callback(ViewDiffCallback callback); bool initialized() const { return !m_git_repo.is_null(); }; - void change_repo(String const& repo_root); + void change_repo(DeprecatedString const& repo_root); private: - explicit GitWidget(String const& repo_root); + explicit GitWidget(DeprecatedString const& repo_root); bool initialize(); bool initialize_if_needed(); - void stage_file(String const&); - void unstage_file(String const&); + void stage_file(DeprecatedString const&); + void unstage_file(DeprecatedString const&); void commit(); - void show_diff(String const&); + void show_diff(DeprecatedString const&); - String m_repo_root; + DeprecatedString m_repo_root; RefPtr m_unstaged_files; RefPtr m_staged_files; RefPtr m_git_repo; diff --git a/Userland/DevTools/HackStudio/HackStudio.h b/Userland/DevTools/HackStudio/HackStudio.h index cb4698900dc..0dfabeec757 100644 --- a/Userland/DevTools/HackStudio/HackStudio.h +++ b/Userland/DevTools/HackStudio/HackStudio.h @@ -9,17 +9,17 @@ #include "EditorWrapper.h" #include "LanguageClients/ConnectionsToServer.h" #include "Project.h" -#include +#include #include namespace HackStudio { GUI::TextEditor& current_editor(); -void open_file(String const&); +void open_file(DeprecatedString const&); RefPtr current_editor_wrapper(); -void open_file(String const&, size_t line, size_t column); +void open_file(DeprecatedString const&, size_t line, size_t column); Project& project(); -String currently_open_file(); +DeprecatedString currently_open_file(); void set_current_editor_wrapper(RefPtr); void update_editor_window_title(); void for_each_open_file(Function); diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index 8ab63ff730b..360ed38e2a7 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -78,7 +78,7 @@ namespace HackStudio { -HackStudioWidget::HackStudioWidget(String path_to_project) +HackStudioWidget::HackStudioWidget(DeprecatedString path_to_project) : m_editor_font(read_editor_font_from_config()) { set_fill_with_background_color(true); @@ -175,7 +175,7 @@ HackStudioWidget::HackStudioWidget(String path_to_project) return; if (event.event_path.starts_with(project().root_path())) { - String relative_path = LexicalPath::relative_path(event.event_path, project().root_path()); + DeprecatedString relative_path = LexicalPath::relative_path(event.event_path, project().root_path()); handle_external_file_deletion(relative_path); } else { handle_external_file_deletion(event.event_path); @@ -213,7 +213,7 @@ void HackStudioWidget::on_action_tab_change() } } -Vector HackStudioWidget::read_recent_projects() +Vector HackStudioWidget::read_recent_projects() { auto json = Config::read_string("HackStudio"sv, "Global"sv, "RecentProjects"sv); AK::JsonParser parser(json); @@ -225,7 +225,7 @@ Vector HackStudioWidget::read_recent_projects() if (!value.is_array()) return {}; - Vector paths; + Vector paths; for (auto& json_value : value.as_array().values()) { if (!json_value.is_string()) return {}; @@ -235,7 +235,7 @@ Vector HackStudioWidget::read_recent_projects() return paths; } -void HackStudioWidget::open_project(String const& root_path) +void HackStudioWidget::open_project(DeprecatedString const& root_path) { if (warn_unsaved_changes("There are unsaved changes, do you want to save before closing current project?") == ContinueDecision::No) return; @@ -283,16 +283,16 @@ void HackStudioWidget::open_project(String const& root_path) update_recent_projects_submenu(); } -Vector HackStudioWidget::selected_file_paths() const +Vector HackStudioWidget::selected_file_paths() const { - Vector files; + Vector files; m_project_tree_view->selection().for_each_index([&](const GUI::ModelIndex& index) { - String sub_path = index.data().as_string(); + DeprecatedString sub_path = index.data().as_string(); GUI::ModelIndex parent_or_invalid = index.parent(); while (parent_or_invalid.is_valid()) { - sub_path = String::formatted("{}/{}", parent_or_invalid.data().as_string(), sub_path); + sub_path = DeprecatedString::formatted("{}/{}", parent_or_invalid.data().as_string(), sub_path); parent_or_invalid = parent_or_invalid.parent(); } @@ -302,9 +302,9 @@ Vector HackStudioWidget::selected_file_paths() const return files; } -bool HackStudioWidget::open_file(String const& full_filename, size_t line, size_t column) +bool HackStudioWidget::open_file(DeprecatedString const& full_filename, size_t line, size_t column) { - String filename = full_filename; + DeprecatedString filename = full_filename; if (full_filename.starts_with(project().root_path())) { filename = LexicalPath::relative_path(full_filename, project().root_path()); } @@ -369,7 +369,7 @@ bool HackStudioWidget::open_file(String const& full_filename, size_t line, size_ set_edit_mode(EditMode::Text); - String relative_file_path = filename; + DeprecatedString relative_file_path = filename; if (filename.starts_with(m_project->root_path())) relative_file_path = filename.substring(m_project->root_path().length() + 1); @@ -388,16 +388,16 @@ bool HackStudioWidget::open_file(String const& full_filename, size_t line, size_ return true; } -void HackStudioWidget::close_file_in_all_editors(String const& filename) +void HackStudioWidget::close_file_in_all_editors(DeprecatedString const& filename) { m_open_files.remove(filename); m_open_files_vector.remove_all_matching( - [&filename](String const& element) { return element == filename; }); + [&filename](DeprecatedString const& element) { return element == filename; }); for (auto& editor_wrapper : m_all_editor_wrappers) { Editor& editor = editor_wrapper.editor(); - String editor_file_path = editor.code_document().file_path(); - String relative_editor_file_path = LexicalPath::relative_path(editor_file_path, project().root_path()); + DeprecatedString editor_file_path = editor.code_document().file_path(); + DeprecatedString relative_editor_file_path = LexicalPath::relative_path(editor_file_path, project().root_path()); if (relative_editor_file_path == filename) { if (m_open_files_vector.is_empty()) { @@ -514,41 +514,41 @@ NonnullRefPtr HackStudioWidget::create_project_tree_view_context_menu return project_tree_view_context_menu; } -NonnullRefPtr HackStudioWidget::create_new_file_action(String const& label, String const& icon, String const& extension) +NonnullRefPtr HackStudioWidget::create_new_file_action(DeprecatedString const& label, DeprecatedString const& icon, DeprecatedString const& extension) { return GUI::Action::create(label, Gfx::Bitmap::try_load_from_file(icon).release_value_but_fixme_should_propagate_errors(), [this, extension](const GUI::Action&) { - String filename; + DeprecatedString filename; if (GUI::InputBox::show(window(), filename, "Enter name of new file:"sv, "Add new file to project"sv) != GUI::InputBox::ExecResult::OK) return; - if (!extension.is_empty() && !filename.ends_with(String::formatted(".{}", extension))) { - filename = String::formatted("{}.{}", filename, extension); + if (!extension.is_empty() && !filename.ends_with(DeprecatedString::formatted(".{}", extension))) { + filename = DeprecatedString::formatted("{}.{}", filename, extension); } auto path_to_selected = selected_file_paths(); - String filepath; + DeprecatedString filepath; if (!path_to_selected.is_empty()) { VERIFY(Core::File::exists(path_to_selected.first())); LexicalPath selected(path_to_selected.first()); - String dir_path; + DeprecatedString dir_path; if (Core::File::is_directory(selected.string())) dir_path = selected.string(); else dir_path = selected.dirname(); - filepath = String::formatted("{}/", dir_path); + filepath = DeprecatedString::formatted("{}/", dir_path); } - filepath = String::formatted("{}{}", filepath, filename); + filepath = DeprecatedString::formatted("{}{}", filepath, filename); auto file = Core::File::construct(filepath); if (!file->open((Core::OpenMode)(Core::OpenMode::WriteOnly | Core::OpenMode::MustBeNew))) { - GUI::MessageBox::show(window(), String::formatted("Failed to create '{}'", filepath), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Failed to create '{}'", filepath), "Error"sv, GUI::MessageBox::Type::Error); return; } open_file(filepath); @@ -558,7 +558,7 @@ NonnullRefPtr HackStudioWidget::create_new_file_action(String const NonnullRefPtr HackStudioWidget::create_new_directory_action() { return GUI::Action::create("&Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { - String directory_name; + DeprecatedString directory_name; if (GUI::InputBox::show(window(), directory_name, "Enter name of new directory:"sv, "Add new folder to project"sv) != GUI::InputBox::ExecResult::OK) return; @@ -567,17 +567,17 @@ NonnullRefPtr HackStudioWidget::create_new_directory_action() if (!path_to_selected.is_empty()) { LexicalPath selected(path_to_selected.first()); - String dir_path; + DeprecatedString dir_path; if (Core::File::is_directory(selected.string())) dir_path = selected.string(); else dir_path = selected.dirname(); - directory_name = String::formatted("{}/{}", dir_path, directory_name); + directory_name = DeprecatedString::formatted("{}/{}", dir_path, directory_name); } - auto formatted_dir_name = LexicalPath::canonicalized_path(String::formatted("{}/{}", m_project->model().root_path(), directory_name)); + auto formatted_dir_name = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_project->model().root_path(), directory_name)); int rc = mkdir(formatted_dir_name.characters(), 0755); if (rc < 0) { GUI::MessageBox::show(window(), "Failed to create new directory"sv, "Error"sv, GUI::MessageBox::Type::Error); @@ -616,7 +616,7 @@ NonnullRefPtr HackStudioWidget::create_copy_relative_path_action() auto copy_relative_path_action = GUI::Action::create("Copy &Relative Path", [this](const GUI::Action&) { auto paths = selected_file_paths(); VERIFY(!paths.is_empty()); - auto paths_string = String::join('\n', paths); + auto paths_string = DeprecatedString::join('\n', paths); GUI::Clipboard::the().set_plain_text(paths_string); }); copy_relative_path_action->set_enabled(true); @@ -630,10 +630,10 @@ NonnullRefPtr HackStudioWidget::create_copy_full_path_action() auto copy_full_path_action = GUI::Action::create("Copy &Full Path", [this](const GUI::Action&) { auto paths = selected_file_paths(); VERIFY(!paths.is_empty()); - Vector full_paths; + Vector full_paths; for (auto& path : paths) full_paths.append(get_absolute_path(path)); - auto paths_string = String::join('\n', full_paths); + auto paths_string = DeprecatedString::join('\n', full_paths); GUI::Clipboard::the().set_plain_text(paths_string); }); copy_full_path_action->set_enabled(true); @@ -649,12 +649,12 @@ NonnullRefPtr HackStudioWidget::create_delete_action() if (files.is_empty()) return; - String message; + DeprecatedString message; if (files.size() == 1) { LexicalPath file(files[0]); - message = String::formatted("Really remove {} from disk?", file.basename()); + message = DeprecatedString::formatted("Really remove {} from disk?", file.basename()); } else { - message = String::formatted("Really remove {} files from disk?", files.size()); + message = DeprecatedString::formatted("Really remove {} files from disk?", files.size()); } auto result = GUI::MessageBox::show(window(), @@ -669,7 +669,7 @@ NonnullRefPtr HackStudioWidget::create_delete_action() struct stat st; if (lstat(file.characters(), &st) < 0) { GUI::MessageBox::show(window(), - String::formatted("lstat ({}) failed: {}", file, strerror(errno)), + DeprecatedString::formatted("lstat ({}) failed: {}", file, strerror(errno)), "Removal failed"sv, GUI::MessageBox::Type::Error); break; @@ -680,12 +680,12 @@ NonnullRefPtr HackStudioWidget::create_delete_action() auto& error = result.error(); if (is_directory) { GUI::MessageBox::show(window(), - String::formatted("Removing directory {} from the project failed: {}", error.file, static_cast(error)), + DeprecatedString::formatted("Removing directory {} from the project failed: {}", error.file, static_cast(error)), "Removal failed"sv, GUI::MessageBox::Type::Error); } else { GUI::MessageBox::show(window(), - String::formatted("Removing file {} from the project failed: {}", error.file, static_cast(error)), + DeprecatedString::formatted("Removing file {} from the project failed: {}", error.file, static_cast(error)), "Removal failed"sv, GUI::MessageBox::Type::Error); } @@ -890,7 +890,7 @@ NonnullRefPtr HackStudioWidget::create_save_as_action() auto const old_filename = current_editor_wrapper().filename(); LexicalPath const old_path(old_filename); - Optional save_path = GUI::FilePicker::get_save_filepath(window(), + Optional save_path = GUI::FilePicker::get_save_filepath(window(), old_filename.is_null() ? "Untitled"sv : old_path.title(), old_filename.is_null() ? "txt"sv : old_path.extension(), Core::File::absolute_path(old_path.dirname())); @@ -898,7 +898,7 @@ NonnullRefPtr HackStudioWidget::create_save_as_action() return; } - String const relative_file_path = LexicalPath::relative_path(save_path.value(), m_project->root_path()); + DeprecatedString const relative_file_path = LexicalPath::relative_path(save_path.value(), m_project->root_path()); if (current_editor_wrapper().filename().is_null()) { current_editor_wrapper().set_filename(relative_file_path); } else { @@ -987,7 +987,7 @@ NonnullRefPtr HackStudioWidget::create_debug_action() { return GUI::Action::create("&Debug", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/debug-run.png"sv).release_value_but_fixme_should_propagate_errors(), [this](auto&) { if (!Core::File::exists(get_project_executable_path())) { - GUI::MessageBox::show(window(), String::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not find file: {}. (did you build the project?)", get_project_executable_path()), "Error"sv, GUI::MessageBox::Type::Error); return; } if (Debugger::the().session()) { @@ -1078,7 +1078,7 @@ void HackStudioWidget::initialize_debugger() }); } -String HackStudioWidget::get_full_path_of_serenity_source(String const& file) +DeprecatedString HackStudioWidget::get_full_path_of_serenity_source(DeprecatedString const& file) { auto path_parts = LexicalPath(file).parts(); while (!path_parts.is_empty() && path_parts[0] == "..") { @@ -1088,10 +1088,10 @@ String HackStudioWidget::get_full_path_of_serenity_source(String const& file) relative_path_builder.join('/', path_parts); constexpr char SERENITY_LIBS_PREFIX[] = "/usr/src/serenity"; LexicalPath serenity_sources_base(SERENITY_LIBS_PREFIX); - return String::formatted("{}/{}", serenity_sources_base, relative_path_builder.to_string()); + return DeprecatedString::formatted("{}/{}", serenity_sources_base, relative_path_builder.to_string()); } -String HackStudioWidget::get_absolute_path(String const& path) const +DeprecatedString HackStudioWidget::get_absolute_path(DeprecatedString const& path) const { // TODO: We can probably do a more specific condition here, something like // "if (file.starts_with("../Libraries/") || file.starts_with("../AK/"))" @@ -1101,9 +1101,9 @@ String HackStudioWidget::get_absolute_path(String const& path) const return m_project->to_absolute_path(path); } -RefPtr HackStudioWidget::get_editor_of_file(String const& filename) +RefPtr HackStudioWidget::get_editor_of_file(DeprecatedString const& filename) { - String file_path = filename; + DeprecatedString file_path = filename; if (filename.starts_with("../"sv)) { file_path = get_full_path_of_serenity_source(filename); @@ -1114,19 +1114,19 @@ RefPtr HackStudioWidget::get_editor_of_file(String const& filenam return current_editor_wrapper(); } -String HackStudioWidget::get_project_executable_path() const +DeprecatedString HackStudioWidget::get_project_executable_path() const { // FIXME: Dumb heuristic ahead! // e.g /my/project => /my/project/project // TODO: Perhaps a Makefile rule for getting the value of $(PROGRAM) would be better? - return String::formatted("{}/{}", m_project->root_path(), LexicalPath::basename(m_project->root_path())); + return DeprecatedString::formatted("{}/{}", m_project->root_path(), LexicalPath::basename(m_project->root_path())); } void HackStudioWidget::build() { auto result = m_project_builder->build(active_file()); if (result.is_error()) { - GUI::MessageBox::show(window(), String::formatted("{}", result.error()), "Build failed"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("{}", result.error()), "Build failed"sv, GUI::MessageBox::Type::Error); m_build_action->set_enabled(true); m_stop_action->set_enabled(false); } else { @@ -1138,7 +1138,7 @@ void HackStudioWidget::run() { auto result = m_project_builder->run(active_file()); if (result.is_error()) { - GUI::MessageBox::show(window(), String::formatted("{}", result.error()), "Run failed"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window(), DeprecatedString::formatted("{}", result.error()), "Run failed"sv, GUI::MessageBox::Type::Error); m_run_action->set_enabled(true); m_stop_action->set_enabled(false); } else { @@ -1172,7 +1172,7 @@ void HackStudioWidget::set_current_editor_wrapper(RefPtr editor_w update_statusbar(); } -void HackStudioWidget::file_renamed(String const& old_name, String const& new_name) +void HackStudioWidget::file_renamed(DeprecatedString const& old_name, DeprecatedString const& new_name) { auto editor_or_none = m_all_editor_wrappers.first_matching([&old_name](auto const& editor) { return editor->filename() == old_name; @@ -1242,7 +1242,7 @@ void HackStudioWidget::configure_project_tree_view() void HackStudioWidget::create_open_files_view(GUI::Widget& parent) { m_open_files_view = parent.add(); - auto open_files_model = GUI::ItemListModel::create(m_open_files_vector); + auto open_files_model = GUI::ItemListModel::create(m_open_files_vector); m_open_files_view->set_model(open_files_model); m_open_files_view->on_activation = [this](auto& index) { @@ -1554,17 +1554,17 @@ void HackStudioWidget::update_statusbar() { StringBuilder builder; if (current_editor().has_selection()) { - String selected_text = current_editor().selected_text(); + DeprecatedString selected_text = current_editor().selected_text(); auto word_count = current_editor().number_of_selected_words(); builder.appendff("Selected: {} {} ({} {})", selected_text.length(), selected_text.length() == 1 ? "character" : "characters", word_count, word_count != 1 ? "words" : "word"); } m_statusbar->set_text(0, builder.to_string()); m_statusbar->set_text(1, current_editor_wrapper().editor().code_document().language_name()); - m_statusbar->set_text(2, String::formatted("Ln {}, Col {}", current_editor().cursor().line() + 1, current_editor().cursor().column())); + m_statusbar->set_text(2, DeprecatedString::formatted("Ln {}, Col {}", current_editor().cursor().line() + 1, current_editor().cursor().column())); } -void HackStudioWidget::handle_external_file_deletion(String const& filepath) +void HackStudioWidget::handle_external_file_deletion(DeprecatedString const& filepath) { close_file_in_all_editors(filepath); } @@ -1602,7 +1602,7 @@ HackStudioWidget::~HackStudioWidget() stop_debugger_if_running(); } -HackStudioWidget::ContinueDecision HackStudioWidget::warn_unsaved_changes(String const& prompt) +HackStudioWidget::ContinueDecision HackStudioWidget::warn_unsaved_changes(DeprecatedString const& prompt) { if (!any_document_is_dirty()) return ContinueDecision::Yes; @@ -1647,7 +1647,7 @@ void HackStudioWidget::update_tree_view() void HackStudioWidget::update_window_title() { - window()->set_title(String::formatted("{} - {} - Hack Studio", m_current_editor_wrapper->filename_title(), m_project->name())); + window()->set_title(DeprecatedString::formatted("{} - {} - Hack Studio", m_current_editor_wrapper->filename_title(), m_project->name())); window()->set_modified(any_document_is_dirty()); } @@ -1725,7 +1725,7 @@ NonnullRefPtr HackStudioWidget::create_open_project_configuration_a if (!Core::File::exists(absolute_config_file_path)) { if (Core::File::exists(parent_directory) && !Core::File::is_directory(parent_directory)) { - GUI::MessageBox::show_error(window(), String::formatted("Cannot create the '{}' directory because there is already a file with that name", parent_directory)); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Cannot create the '{}' directory because there is already a file with that name", parent_directory)); return; } @@ -1787,7 +1787,7 @@ void HackStudioWidget::change_editor_font(RefPtr font) Config::write_i32("HackStudio"sv, "EditorFont"sv, "Size"sv, m_editor_font->presentation_size()); } -void HackStudioWidget::open_coredump(String const& coredump_path) +void HackStudioWidget::open_coredump(DeprecatedString const& coredump_path) { open_project("/usr/src/serenity"); m_mode = Mode::Coredump; diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h index 32082713f18..1148f3d5c0a 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.h +++ b/Userland/DevTools/HackStudio/HackStudioWidget.h @@ -38,8 +38,8 @@ class HackStudioWidget : public GUI::Widget { public: virtual ~HackStudioWidget() override; - bool open_file(String const& filename, size_t line = 0, size_t column = 0); - void close_file_in_all_editors(String const& filename); + bool open_file(DeprecatedString const& filename, size_t line = 0, size_t column = 0); + void close_file_in_all_editors(DeprecatedString const& filename); void update_actions(); Project& project(); @@ -53,7 +53,7 @@ public: GUI::TabWidget& current_editor_tab_widget(); GUI::TabWidget const& current_editor_tab_widget() const; - String const& active_file() const { return m_current_editor_wrapper->filename(); } + DeprecatedString const& active_file() const { return m_current_editor_wrapper->filename(); } void initialize_menubar(GUI::Window&); Locator& locator() @@ -66,18 +66,18 @@ public: No, Yes }; - ContinueDecision warn_unsaved_changes(String const& prompt); + ContinueDecision warn_unsaved_changes(DeprecatedString const& prompt); enum class Mode { Code, Coredump }; - void open_coredump(String const& coredump_path); + void open_coredump(DeprecatedString const& coredump_path); void for_each_open_file(Function); bool semantic_syntax_highlighting_is_enabled() const; - static Vector read_recent_projects(); + static Vector read_recent_projects(); void update_current_editor_title(); void update_window_title(); @@ -85,12 +85,12 @@ public: private: static constexpr size_t recent_projects_history_size = 15; - static String get_full_path_of_serenity_source(String const& file); - String get_absolute_path(String const&) const; - Vector selected_file_paths() const; + static DeprecatedString get_full_path_of_serenity_source(DeprecatedString const& file); + DeprecatedString get_absolute_path(DeprecatedString const&) const; + Vector selected_file_paths() const; - HackStudioWidget(String path_to_project); - void open_project(String const& root_path); + HackStudioWidget(DeprecatedString path_to_project); + void open_project(DeprecatedString const& root_path); enum class EditMode { Text, @@ -100,7 +100,7 @@ private: void set_edit_mode(EditMode); NonnullRefPtr create_project_tree_view_context_menu(); - NonnullRefPtr create_new_file_action(String const& label, String const& icon, String const& extension); + NonnullRefPtr create_new_file_action(DeprecatedString const& label, DeprecatedString const& icon, DeprecatedString const& extension); NonnullRefPtr create_new_directory_action(); NonnullRefPtr create_open_selected_action(); NonnullRefPtr create_open_selected_in_new_tab_action(); @@ -131,15 +131,15 @@ private: void add_new_editor_tab_widget(GUI::Widget& parent); void add_new_editor(GUI::TabWidget& parent); - RefPtr get_editor_of_file(String const& filename); - String get_project_executable_path() const; + RefPtr get_editor_of_file(DeprecatedString const& filename); + DeprecatedString get_project_executable_path() const; void on_action_tab_change(); void reveal_action_tab(GUI::Widget&); void initialize_debugger(); void update_statusbar(); - void handle_external_file_deletion(String const& filepath); + void handle_external_file_deletion(DeprecatedString const& filepath); void stop_debugger_if_running(); void close_current_project(); @@ -164,10 +164,10 @@ private: void update_gml_preview(); void update_tree_view(); void on_cursor_change(); - void file_renamed(String const& old_name, String const& new_name); + void file_renamed(DeprecatedString const& old_name, DeprecatedString const& new_name); struct ProjectLocation { - String filename; + DeprecatedString filename; size_t line { 0 }; size_t column { 0 }; }; @@ -180,9 +180,9 @@ private: NonnullRefPtrVector m_all_editor_tab_widgets; RefPtr m_current_editor_tab_widget; - HashMap> m_open_files; + HashMap> m_open_files; RefPtr m_file_watcher; - Vector m_open_files_vector; // NOTE: This contains the keys from m_open_files and m_file_watchers + Vector m_open_files_vector; // NOTE: This contains the keys from m_open_files and m_file_watchers OwnPtr m_project; diff --git a/Userland/DevTools/HackStudio/Language.cpp b/Userland/DevTools/HackStudio/Language.cpp index 794297da9f5..81ab6a970d1 100644 --- a/Userland/DevTools/HackStudio/Language.cpp +++ b/Userland/DevTools/HackStudio/Language.cpp @@ -37,7 +37,7 @@ Language language_from_file(LexicalPath const& file) return Language::Unknown; } -Language language_from_name(String const& name) +Language language_from_name(DeprecatedString const& name) { if (name == "Cpp") return Language::Cpp; @@ -51,7 +51,7 @@ Language language_from_name(String const& name) return Language::Unknown; } -String language_name_from_file(LexicalPath const& file) +DeprecatedString language_name_from_file(LexicalPath const& file) { if (file.title() == "COMMIT_EDITMSG") return "GitCommit"; diff --git a/Userland/DevTools/HackStudio/Language.h b/Userland/DevTools/HackStudio/Language.h index 16a70d1d172..2dc73e6c29b 100644 --- a/Userland/DevTools/HackStudio/Language.h +++ b/Userland/DevTools/HackStudio/Language.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include namespace HackStudio { enum class Language { @@ -24,7 +24,7 @@ enum class Language { }; Language language_from_file(LexicalPath const&); -Language language_from_name(String const&); -String language_name_from_file(LexicalPath const&); +Language language_from_name(DeprecatedString const&); +DeprecatedString language_name_from_file(LexicalPath const&); } diff --git a/Userland/DevTools/HackStudio/LanguageClient.cpp b/Userland/DevTools/HackStudio/LanguageClient.cpp index 4b87233ab61..c75db038236 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.cpp +++ b/Userland/DevTools/HackStudio/LanguageClient.cpp @@ -8,7 +8,7 @@ #include "HackStudio.h" #include "ProjectDeclarations.h" #include "ToDoEntries.h" -#include +#include #include #include @@ -32,7 +32,7 @@ void ConnectionToServer::declaration_location(CodeComprehension::ProjectLocation m_current_language_client->declaration_found(location.file, location.line, location.column); } -void ConnectionToServer::parameters_hint_result(Vector const& params, int argument_index) +void ConnectionToServer::parameters_hint_result(Vector const& params, int argument_index) { if (!m_current_language_client) { dbgln("Language Server connection has no attached language client"); @@ -60,35 +60,35 @@ void ConnectionToServer::die() m_wrapper->on_crash(); } -void LanguageClient::open_file(String const& path, int fd) +void LanguageClient::open_file(DeprecatedString const& path, int fd) { if (!m_connection_wrapper.connection()) return; m_connection_wrapper.connection()->async_file_opened(path, fd); } -void LanguageClient::set_file_content(String const& path, String const& content) +void LanguageClient::set_file_content(DeprecatedString const& path, DeprecatedString const& content) { if (!m_connection_wrapper.connection()) return; m_connection_wrapper.connection()->async_set_file_content(path, content); } -void LanguageClient::insert_text(String const& path, String const& text, size_t line, size_t column) +void LanguageClient::insert_text(DeprecatedString const& path, DeprecatedString const& text, size_t line, size_t column) { if (!m_connection_wrapper.connection()) return; m_connection_wrapper.connection()->async_file_edit_insert_text(path, text, line, column); } -void LanguageClient::remove_text(String const& path, size_t from_line, size_t from_column, size_t to_line, size_t to_column) +void LanguageClient::remove_text(DeprecatedString const& path, size_t from_line, size_t from_column, size_t to_line, size_t to_column) { if (!m_connection_wrapper.connection()) return; m_connection_wrapper.connection()->async_file_edit_remove_text(path, from_line, from_column, to_line, to_column); } -void LanguageClient::request_autocomplete(String const& path, size_t cursor_line, size_t cursor_column) +void LanguageClient::request_autocomplete(DeprecatedString const& path, size_t cursor_line, size_t cursor_column) { if (!m_connection_wrapper.connection()) return; @@ -118,19 +118,19 @@ bool LanguageClient::is_active_client() const return m_connection_wrapper.connection()->active_client() == this; } -HashMap> ConnectionToServerInstances::s_instance_for_language; +HashMap> ConnectionToServerInstances::s_instance_for_language; -void ConnectionToServer::declarations_in_document(String const& filename, Vector const& declarations) +void ConnectionToServer::declarations_in_document(DeprecatedString const& filename, Vector const& declarations) { ProjectDeclarations::the().set_declared_symbols(filename, declarations); } -void ConnectionToServer::todo_entries_in_document(String const& filename, Vector const& todo_entries) +void ConnectionToServer::todo_entries_in_document(DeprecatedString const& filename, Vector const& todo_entries) { ToDoEntries::the().set_entries(filename, move(todo_entries)); } -void LanguageClient::search_declaration(String const& path, size_t line, size_t column) +void LanguageClient::search_declaration(DeprecatedString const& path, size_t line, size_t column) { if (!m_connection_wrapper.connection()) return; @@ -138,7 +138,7 @@ void LanguageClient::search_declaration(String const& path, size_t line, size_t m_connection_wrapper.connection()->async_find_declaration(CodeComprehension::ProjectLocation { path, line, column }); } -void LanguageClient::get_parameters_hint(String const& path, size_t line, size_t column) +void LanguageClient::get_parameters_hint(DeprecatedString const& path, size_t line, size_t column) { if (!m_connection_wrapper.connection()) return; @@ -146,7 +146,7 @@ void LanguageClient::get_parameters_hint(String const& path, size_t line, size_t m_connection_wrapper.connection()->async_get_parameters_hint(CodeComprehension::ProjectLocation { path, line, column }); } -void LanguageClient::get_tokens_info(String const& filename) +void LanguageClient::get_tokens_info(DeprecatedString const& filename) { if (!m_connection_wrapper.connection()) return; @@ -154,7 +154,7 @@ void LanguageClient::get_tokens_info(String const& filename) m_connection_wrapper.connection()->async_get_tokens_info(filename); } -void LanguageClient::declaration_found(String const& file, size_t line, size_t column) const +void LanguageClient::declaration_found(DeprecatedString const& file, size_t line, size_t column) const { if (!on_declaration_found) { dbgln("on_declaration_found callback is not set"); @@ -163,7 +163,7 @@ void LanguageClient::declaration_found(String const& file, size_t line, size_t c on_declaration_found(file, line, column); } -void LanguageClient::parameters_hint_result(Vector const& params, size_t argument_index) const +void LanguageClient::parameters_hint_result(Vector const& params, size_t argument_index) const { if (!on_function_parameters_hint_result) { dbgln("on_function_parameters_hint_result callback is not set"); @@ -172,17 +172,17 @@ void LanguageClient::parameters_hint_result(Vector const& params, size_t on_function_parameters_hint_result(params, argument_index); } -void ConnectionToServerInstances::set_instance_for_language(String const& language_name, NonnullOwnPtr&& connection_wrapper) +void ConnectionToServerInstances::set_instance_for_language(DeprecatedString const& language_name, NonnullOwnPtr&& connection_wrapper) { s_instance_for_language.set(language_name, move(connection_wrapper)); } -void ConnectionToServerInstances::remove_instance_for_language(String const& language_name) +void ConnectionToServerInstances::remove_instance_for_language(DeprecatedString const& language_name) { s_instance_for_language.remove(language_name); } -ConnectionToServerWrapper* ConnectionToServerInstances::get_instance_wrapper(String const& language_name) +ConnectionToServerWrapper* ConnectionToServerInstances::get_instance_wrapper(DeprecatedString const& language_name) { if (auto instance = s_instance_for_language.get(language_name); instance.has_value()) { return const_cast(instance.value()); @@ -219,11 +219,11 @@ void ConnectionToServerWrapper::show_crash_notification() const auto notification = GUI::Notification::construct(); notification->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/32x32/app-hack-studio.png"sv).release_value_but_fixme_should_propagate_errors()); notification->set_title("Oops!"); - notification->set_text(String::formatted("LanguageServer has crashed")); + notification->set_text(DeprecatedString::formatted("LanguageServer has crashed")); notification->show(); } -ConnectionToServerWrapper::ConnectionToServerWrapper(String const& language_name, Function()> connection_creator) +ConnectionToServerWrapper::ConnectionToServerWrapper(DeprecatedString const& language_name, Function()> connection_creator) : m_language(language_from_name(language_name)) , m_connection_creator(move(connection_creator)) { diff --git a/Userland/DevTools/HackStudio/LanguageClient.h b/Userland/DevTools/HackStudio/LanguageClient.h index f98d38da891..7d1e45101fd 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.h +++ b/Userland/DevTools/HackStudio/LanguageClient.h @@ -31,7 +31,7 @@ class ConnectionToServer friend class ConnectionToServerWrapper; public: - ConnectionToServer(NonnullOwnPtr socket, String const& project_path) + ConnectionToServer(NonnullOwnPtr socket, DeprecatedString const& project_path) : IPC::ConnectionToServer(*this, move(socket)) { m_project_path = project_path; @@ -39,7 +39,7 @@ public: } WeakPtr language_client() { return m_current_language_client; } - String const& project_path() const { return m_project_path; } + DeprecatedString const& project_path() const { return m_project_path; } virtual void die() override; @@ -48,13 +48,13 @@ public: protected: virtual void auto_complete_suggestions(Vector const&) override; virtual void declaration_location(CodeComprehension::ProjectLocation const&) override; - virtual void declarations_in_document(String const&, Vector const&) override; - virtual void todo_entries_in_document(String const&, Vector const&) override; - virtual void parameters_hint_result(Vector const&, int index) override; + virtual void declarations_in_document(DeprecatedString const&, Vector const&) override; + virtual void todo_entries_in_document(DeprecatedString const&, Vector const&) override; + virtual void parameters_hint_result(Vector const&, int index) override; virtual void tokens_info_result(Vector const&) override; void set_wrapper(ConnectionToServerWrapper& wrapper) { m_wrapper = &wrapper; } - String m_project_path; + DeprecatedString m_project_path; WeakPtr m_current_language_client; ConnectionToServerWrapper* m_wrapper { nullptr }; }; @@ -63,11 +63,11 @@ class ConnectionToServerWrapper { AK_MAKE_NONCOPYABLE(ConnectionToServerWrapper); public: - explicit ConnectionToServerWrapper(String const& language_name, Function()> connection_creator); + explicit ConnectionToServerWrapper(DeprecatedString const& language_name, Function()> connection_creator); ~ConnectionToServerWrapper() = default; template - static ConnectionToServerWrapper& get_or_create(String const& project_path); + static ConnectionToServerWrapper& get_or_create(DeprecatedString const& project_path); Language language() const { return m_language; } ConnectionToServer* connection(); @@ -93,13 +93,13 @@ private: class ConnectionToServerInstances { public: - static void set_instance_for_language(String const& language_name, NonnullOwnPtr&& connection_wrapper); - static void remove_instance_for_language(String const& language_name); + static void set_instance_for_language(DeprecatedString const& language_name, NonnullOwnPtr&& connection_wrapper); + static void remove_instance_for_language(DeprecatedString const& language_name); - static ConnectionToServerWrapper* get_instance_wrapper(String const& language_name); + static ConnectionToServerWrapper* get_instance_wrapper(DeprecatedString const& language_name); private: - static HashMap> s_instance_for_language; + static HashMap> s_instance_for_language; }; class LanguageClient : public Weakable { @@ -128,23 +128,23 @@ public: Language language() const { return m_connection_wrapper.language(); } void set_active_client(); bool is_active_client() const; - virtual void open_file(String const& path, int fd); - virtual void set_file_content(String const& path, String const& content); - virtual void insert_text(String const& path, String const& text, size_t line, size_t column); - virtual void remove_text(String const& path, size_t from_line, size_t from_column, size_t to_line, size_t to_column); - virtual void request_autocomplete(String const& path, size_t cursor_line, size_t cursor_column); - virtual void search_declaration(String const& path, size_t line, size_t column); - virtual void get_parameters_hint(String const& path, size_t line, size_t column); - virtual void get_tokens_info(String const& filename); + virtual void open_file(DeprecatedString const& path, int fd); + virtual void set_file_content(DeprecatedString const& path, DeprecatedString const& content); + virtual void insert_text(DeprecatedString const& path, DeprecatedString const& text, size_t line, size_t column); + virtual void remove_text(DeprecatedString const& path, size_t from_line, size_t from_column, size_t to_line, size_t to_column); + virtual void request_autocomplete(DeprecatedString const& path, size_t cursor_line, size_t cursor_column); + virtual void search_declaration(DeprecatedString const& path, size_t line, size_t column); + virtual void get_parameters_hint(DeprecatedString const& path, size_t line, size_t column); + virtual void get_tokens_info(DeprecatedString const& filename); void provide_autocomplete_suggestions(Vector const&) const; - void declaration_found(String const& file, size_t line, size_t column) const; - void parameters_hint_result(Vector const& params, size_t argument_index) const; + void declaration_found(DeprecatedString const& file, size_t line, size_t column) const; + void parameters_hint_result(Vector const& params, size_t argument_index) const; // Callbacks that get called when the result of a language server query is ready Function)> on_autocomplete_suggestions; - Function on_declaration_found; - Function const&, size_t)> on_function_parameters_hint_result; + Function on_declaration_found; + Function const&, size_t)> on_function_parameters_hint_result; Function const&)> on_tokens_info_result; private: @@ -153,13 +153,13 @@ private: }; template -static inline NonnullOwnPtr get_language_client(String const& project_path) +static inline NonnullOwnPtr get_language_client(DeprecatedString const& project_path) { return make(ConnectionToServerWrapper::get_or_create(project_path)); } template -ConnectionToServerWrapper& ConnectionToServerWrapper::get_or_create(String const& project_path) +ConnectionToServerWrapper& ConnectionToServerWrapper::get_or_create(DeprecatedString const& project_path) { auto* wrapper = ConnectionToServerInstances::get_instance_wrapper(LanguageServerType::language_name()); if (wrapper) diff --git a/Userland/DevTools/HackStudio/LanguageClients/ConnectionsToServer.h b/Userland/DevTools/HackStudio/LanguageClients/ConnectionsToServer.h index 512e21cb6c7..f79ec414845 100644 --- a/Userland/DevTools/HackStudio/LanguageClients/ConnectionsToServer.h +++ b/Userland/DevTools/HackStudio/LanguageClients/ConnectionsToServer.h @@ -12,22 +12,22 @@ #include #include -#define LANGUAGE_CLIENT(language_name_, socket_name) \ - namespace language_name_ { \ - class ConnectionToServer final : public HackStudio::ConnectionToServer { \ - IPC_CLIENT_CONNECTION(ConnectionToServer, "/tmp/session/%sid/portal/language/" socket_name) \ - public: \ - static char const* language_name() \ - { \ - return #language_name_; \ - } \ - \ - private: \ - ConnectionToServer(NonnullOwnPtr socket, String const& project_path) \ - : HackStudio::ConnectionToServer(move(socket), project_path) \ - { \ - } \ - }; \ +#define LANGUAGE_CLIENT(language_name_, socket_name) \ + namespace language_name_ { \ + class ConnectionToServer final : public HackStudio::ConnectionToServer { \ + IPC_CLIENT_CONNECTION(ConnectionToServer, "/tmp/session/%sid/portal/language/" socket_name) \ + public: \ + static char const* language_name() \ + { \ + return #language_name_; \ + } \ + \ + private: \ + ConnectionToServer(NonnullOwnPtr socket, DeprecatedString const& project_path) \ + : HackStudio::ConnectionToServer(move(socket), project_path) \ + { \ + } \ + }; \ } namespace LanguageClients { diff --git a/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp index 7bf24c7cc92..8efddd65fd4 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp @@ -27,7 +27,7 @@ void ConnectionFromClient::die() exit(0); } -void ConnectionFromClient::greet(String const& project_root) +void ConnectionFromClient::greet(DeprecatedString const& project_root) { m_filedb.set_project_root(project_root); if (unveil(project_root.characters(), "r") < 0) { @@ -40,7 +40,7 @@ void ConnectionFromClient::greet(String const& project_root) } } -void ConnectionFromClient::file_opened(String const& filename, IPC::File const& file) +void ConnectionFromClient::file_opened(DeprecatedString const& filename, IPC::File const& file) { if (m_filedb.is_open(filename)) { return; @@ -49,7 +49,7 @@ void ConnectionFromClient::file_opened(String const& filename, IPC::File const& m_autocomplete_engine->file_opened(filename); } -void ConnectionFromClient::file_edit_insert_text(String const& filename, String const& text, i32 start_line, i32 start_column) +void ConnectionFromClient::file_edit_insert_text(DeprecatedString const& filename, DeprecatedString const& text, i32 start_line, i32 start_column) { dbgln_if(LANGUAGE_SERVER_DEBUG, "InsertText for file: {}", filename); dbgln_if(LANGUAGE_SERVER_DEBUG, "Text: {}", text); @@ -58,7 +58,7 @@ void ConnectionFromClient::file_edit_insert_text(String const& filename, String m_autocomplete_engine->on_edit(filename); } -void ConnectionFromClient::file_edit_remove_text(String const& filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column) +void ConnectionFromClient::file_edit_remove_text(DeprecatedString const& filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column) { dbgln_if(LANGUAGE_SERVER_DEBUG, "RemoveText for file: {}", filename); dbgln_if(LANGUAGE_SERVER_DEBUG, "[{}:{} - {}:{}]", start_line, start_column, end_line, end_column); @@ -81,7 +81,7 @@ void ConnectionFromClient::auto_complete_suggestions(CodeComprehension::ProjectL async_auto_complete_suggestions(move(suggestions)); } -void ConnectionFromClient::set_file_content(String const& filename, String const& content) +void ConnectionFromClient::set_file_content(DeprecatedString const& filename, DeprecatedString const& content) { dbgln_if(LANGUAGE_SERVER_DEBUG, "SetFileContent: {}", filename); auto document = m_filedb.get_document(filename); @@ -140,7 +140,7 @@ void ConnectionFromClient::get_parameters_hint(CodeComprehension::ProjectLocatio async_parameters_hint_result(params->params, params->current_index); } -void ConnectionFromClient::get_tokens_info(String const& filename) +void ConnectionFromClient::get_tokens_info(DeprecatedString const& filename) { dbgln_if(LANGUAGE_SERVER_DEBUG, "GetTokenInfo: {}", filename); auto document = m_filedb.get_document(filename); diff --git a/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h index 87563eba118..17facfe8f96 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h +++ b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h @@ -27,15 +27,15 @@ public: virtual void die() override; protected: - virtual void greet(String const&) override; - virtual void file_opened(String const&, IPC::File const&) override; - virtual void file_edit_insert_text(String const&, String const&, i32, i32) override; - virtual void file_edit_remove_text(String const&, i32, i32, i32, i32) override; - virtual void set_file_content(String const&, String const&) override; + virtual void greet(DeprecatedString const&) override; + virtual void file_opened(DeprecatedString const&, IPC::File const&) override; + virtual void file_edit_insert_text(DeprecatedString const&, DeprecatedString const&, i32, i32) override; + virtual void file_edit_remove_text(DeprecatedString const&, i32, i32, i32, i32) override; + virtual void set_file_content(DeprecatedString const&, DeprecatedString const&) override; virtual void auto_complete_suggestions(CodeComprehension::ProjectLocation const&) override; virtual void find_declaration(CodeComprehension::ProjectLocation const&) override; virtual void get_parameters_hint(CodeComprehension::ProjectLocation const&) override; - virtual void get_tokens_info(String const&) override; + virtual void get_tokens_info(DeprecatedString const&) override; FileDB m_filedb; OwnPtr m_autocomplete_engine; diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ConnectionFromClient.h b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ConnectionFromClient.h index 13ab5634747..17fa4b45eaa 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ConnectionFromClient.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ConnectionFromClient.h @@ -19,10 +19,10 @@ private: : LanguageServers::ConnectionFromClient(move(socket)) { m_autocomplete_engine = adopt_own(*new CodeComprehension::Cpp::CppComprehensionEngine(m_filedb)); - m_autocomplete_engine->set_declarations_of_document_callback = [this](String const& filename, Vector&& declarations) { + m_autocomplete_engine->set_declarations_of_document_callback = [this](DeprecatedString const& filename, Vector&& declarations) { async_declarations_in_document(filename, move(declarations)); }; - m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector&& todo_entries) { + m_autocomplete_engine->set_todo_entries_of_document_callback = [this](DeprecatedString const& filename, Vector&& todo_entries) { async_todo_entries_in_document(filename, move(todo_entries)); }; } diff --git a/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp b/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp index f704407368b..d318d016321 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp @@ -12,7 +12,7 @@ namespace LanguageServers { -RefPtr FileDB::get_document(String const& filename) const +RefPtr FileDB::get_document(DeprecatedString const& filename) const { auto absolute_path = to_absolute_path(filename); auto document_optional = m_open_files.get(absolute_path); @@ -22,7 +22,7 @@ RefPtr FileDB::get_document(String const& filename) con return *document_optional.value(); } -RefPtr FileDB::get_document(String const& filename) +RefPtr FileDB::get_document(DeprecatedString const& filename) { auto document = reinterpret_cast(this)->get_document(filename); if (document.is_null()) @@ -30,7 +30,7 @@ RefPtr FileDB::get_document(String const& filename) return adopt_ref(*const_cast(document.leak_ref())); } -Optional FileDB::get_or_read_from_filesystem(StringView filename) const +Optional FileDB::get_or_read_from_filesystem(StringView filename) const { auto absolute_path = to_absolute_path(filename); auto document = get_document(absolute_path); @@ -43,12 +43,12 @@ Optional FileDB::get_or_read_from_filesystem(StringView filename) const return {}; } -bool FileDB::is_open(String const& filename) const +bool FileDB::is_open(DeprecatedString const& filename) const { return m_open_files.contains(to_absolute_path(filename)); } -bool FileDB::add(String const& filename, int fd) +bool FileDB::add(DeprecatedString const& filename, int fd) { auto document = create_from_fd(fd); if (!document) @@ -58,17 +58,17 @@ bool FileDB::add(String const& filename, int fd) return true; } -String FileDB::to_absolute_path(String const& filename) const +DeprecatedString FileDB::to_absolute_path(DeprecatedString const& filename) const { if (LexicalPath { filename }.is_absolute()) { return filename; } if (m_project_root.is_null()) return filename; - return LexicalPath { String::formatted("{}/{}", m_project_root, filename) }.string(); + return LexicalPath { DeprecatedString::formatted("{}/{}", m_project_root, filename) }.string(); } -RefPtr FileDB::create_from_filesystem(String const& filename) const +RefPtr FileDB::create_from_filesystem(DeprecatedString const& filename) const { auto file = Core::File::open(to_absolute_path(filename), Core::OpenMode::ReadOnly); if (file.is_error()) { @@ -116,7 +116,7 @@ RefPtr FileDB::create_from_file(Core::File& file) const return document; } -void FileDB::on_file_edit_insert_text(String const& filename, String const& inserted_text, size_t start_line, size_t start_column) +void FileDB::on_file_edit_insert_text(DeprecatedString const& filename, DeprecatedString const& inserted_text, size_t start_line, size_t start_column) { VERIFY(is_open(filename)); auto document = get_document(filename); @@ -127,7 +127,7 @@ void FileDB::on_file_edit_insert_text(String const& filename, String const& inse dbgln_if(FILE_CONTENT_DEBUG, "{}", document->text()); } -void FileDB::on_file_edit_remove_text(String const& filename, size_t start_line, size_t start_column, size_t end_line, size_t end_column) +void FileDB::on_file_edit_remove_text(DeprecatedString const& filename, size_t start_line, size_t start_column, size_t end_line, size_t end_column) { // TODO: If file is not open - need to get its contents // Otherwise- somehow verify that respawned language server is synced with all file contents @@ -144,7 +144,7 @@ void FileDB::on_file_edit_remove_text(String const& filename, size_t start_line, dbgln_if(FILE_CONTENT_DEBUG, "{}", document->text()); } -RefPtr FileDB::create_with_content(String const& content) +RefPtr FileDB::create_with_content(DeprecatedString const& content) { StringView content_view(content); auto document = GUI::TextDocument::create(&s_default_document_client); @@ -152,7 +152,7 @@ RefPtr FileDB::create_with_content(String const& content) return document; } -bool FileDB::add(String const& filename, String const& content) +bool FileDB::add(DeprecatedString const& filename, DeprecatedString const& content) { auto document = create_with_content(content); if (!document) { diff --git a/Userland/DevTools/HackStudio/LanguageServers/FileDB.h b/Userland/DevTools/HackStudio/LanguageServers/FileDB.h index b25bd0b7b52..20b9638ac32 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/FileDB.h +++ b/Userland/DevTools/HackStudio/LanguageServers/FileDB.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include #include @@ -17,28 +17,28 @@ namespace LanguageServers { class FileDB final : public CodeComprehension::FileDB { public: FileDB() = default; - virtual Optional get_or_read_from_filesystem(StringView filename) const override; + virtual Optional get_or_read_from_filesystem(StringView filename) const override; - RefPtr get_document(String const& filename) const; - RefPtr get_document(String const& filename); + RefPtr get_document(DeprecatedString const& filename) const; + RefPtr get_document(DeprecatedString const& filename); - bool add(String const& filename, int fd); - bool add(String const& filename, String const& content); + bool add(DeprecatedString const& filename, int fd); + bool add(DeprecatedString const& filename, DeprecatedString const& content); - void on_file_edit_insert_text(String const& filename, String const& inserted_text, size_t start_line, size_t start_column); - void on_file_edit_remove_text(String const& filename, size_t start_line, size_t start_column, size_t end_line, size_t end_column); - String to_absolute_path(String const& filename) const; - bool is_open(String const& filename) const; + void on_file_edit_insert_text(DeprecatedString const& filename, DeprecatedString const& inserted_text, size_t start_line, size_t start_column); + void on_file_edit_remove_text(DeprecatedString const& filename, size_t start_line, size_t start_column, size_t end_line, size_t end_column); + DeprecatedString to_absolute_path(DeprecatedString const& filename) const; + bool is_open(DeprecatedString const& filename) const; private: - RefPtr create_from_filesystem(String const& filename) const; + RefPtr create_from_filesystem(DeprecatedString const& filename) const; RefPtr create_from_fd(int fd) const; RefPtr create_from_file(Core::File&) const; - static RefPtr create_with_content(String const&); + static RefPtr create_with_content(DeprecatedString const&); private: - HashMap> m_open_files; - String m_project_root; + HashMap> m_open_files; + DeprecatedString m_project_root; }; } diff --git a/Userland/DevTools/HackStudio/LanguageServers/LanguageClient.ipc b/Userland/DevTools/HackStudio/LanguageServers/LanguageClient.ipc index e4088ad3c4b..68f724762fc 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/LanguageClient.ipc +++ b/Userland/DevTools/HackStudio/LanguageServers/LanguageClient.ipc @@ -2,8 +2,8 @@ endpoint LanguageClient { auto_complete_suggestions(Vector suggestions) =| declaration_location(CodeComprehension::ProjectLocation location) =| - declarations_in_document(String filename, Vector declarations) =| - todo_entries_in_document(String filename, Vector todo_entries) =| - parameters_hint_result(Vector params, int current_index) =| + declarations_in_document(DeprecatedString filename, Vector declarations) =| + todo_entries_in_document(DeprecatedString filename, Vector todo_entries) =| + parameters_hint_result(Vector params, int current_index) =| tokens_info_result(Vector tokens_info) =| } diff --git a/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc b/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc index 1f97dbc97db..23dfe681b9e 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc +++ b/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc @@ -1,15 +1,15 @@ endpoint LanguageServer { - greet(String project_root) =| + greet(DeprecatedString project_root) =| - file_opened(String filename, IPC::File file) =| - file_edit_insert_text(String filename, String text, i32 start_line, i32 start_column) =| - file_edit_remove_text(String filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column) =| - set_file_content(String filename, String content) =| + file_opened(DeprecatedString filename, IPC::File file) =| + file_edit_insert_text(DeprecatedString filename, DeprecatedString text, i32 start_line, i32 start_column) =| + file_edit_remove_text(DeprecatedString filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column) =| + set_file_content(DeprecatedString filename, DeprecatedString content) =| auto_complete_suggestions(CodeComprehension::ProjectLocation location) =| find_declaration(CodeComprehension::ProjectLocation location) =| get_parameters_hint(CodeComprehension::ProjectLocation location) =| - get_tokens_info(String filename) =| + get_tokens_info(DeprecatedString filename) =| } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ConnectionFromClient.h b/Userland/DevTools/HackStudio/LanguageServers/Shell/ConnectionFromClient.h index 58864ddd979..6471b3c6594 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ConnectionFromClient.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ConnectionFromClient.h @@ -20,10 +20,10 @@ private: : LanguageServers::ConnectionFromClient(move(socket)) { m_autocomplete_engine = make(m_filedb); - m_autocomplete_engine->set_declarations_of_document_callback = [this](String const& filename, Vector&& declarations) { + m_autocomplete_engine->set_declarations_of_document_callback = [this](DeprecatedString const& filename, Vector&& declarations) { async_declarations_in_document(filename, move(declarations)); }; - m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector&& todo_entries) { + m_autocomplete_engine->set_todo_entries_of_document_callback = [this](DeprecatedString const& filename, Vector&& todo_entries) { async_todo_entries_in_document(filename, move(todo_entries)); }; } diff --git a/Userland/DevTools/HackStudio/Locator.cpp b/Userland/DevTools/HackStudio/Locator.cpp index 3217874b9e1..b43e31eedde 100644 --- a/Userland/DevTools/HackStudio/Locator.cpp +++ b/Userland/DevTools/HackStudio/Locator.cpp @@ -21,13 +21,13 @@ namespace HackStudio { class LocatorSuggestionModel final : public GUI::Model { public: struct Suggestion { - static Suggestion create_filename(String const& filename); + static Suggestion create_filename(DeprecatedString const& filename); static Suggestion create_symbol_declaration(CodeComprehension::Declaration const&); bool is_filename() const { return as_filename.has_value(); } bool is_symbol_declaration() const { return as_symbol_declaration.has_value(); } - Optional as_filename; + Optional as_filename; Optional as_symbol_declaration; }; @@ -62,7 +62,7 @@ public: if (index.column() == Column::Name) { if (suggestion.as_symbol_declaration.value().scope.is_null()) return suggestion.as_symbol_declaration.value().name; - return String::formatted("{}::{}", suggestion.as_symbol_declaration.value().scope, suggestion.as_symbol_declaration.value().name); + return DeprecatedString::formatted("{}::{}", suggestion.as_symbol_declaration.value().scope, suggestion.as_symbol_declaration.value().name); } if (index.column() == Column::Filename) return suggestion.as_symbol_declaration.value().position.file; @@ -82,7 +82,7 @@ private: Vector m_suggestions; }; -LocatorSuggestionModel::Suggestion LocatorSuggestionModel::Suggestion::create_filename(String const& filename) +LocatorSuggestionModel::Suggestion LocatorSuggestionModel::Suggestion::create_filename(DeprecatedString const& filename) { LocatorSuggestionModel::Suggestion s; s.as_filename = filename; diff --git a/Userland/DevTools/HackStudio/Project.cpp b/Userland/DevTools/HackStudio/Project.cpp index f13139c5ae9..f78472771d2 100644 --- a/Userland/DevTools/HackStudio/Project.cpp +++ b/Userland/DevTools/HackStudio/Project.cpp @@ -10,13 +10,13 @@ namespace HackStudio { -Project::Project(String const& root_path) +Project::Project(DeprecatedString const& root_path) : m_root_path(root_path) { m_model = GUI::FileSystemModel::create(root_path, GUI::FileSystemModel::Mode::FilesAndDirectories); } -OwnPtr Project::open_with_root_path(String const& root_path) +OwnPtr Project::open_with_root_path(DeprecatedString const& root_path) { if (!Core::File::is_directory(root_path)) return {}; @@ -45,18 +45,18 @@ void Project::for_each_text_file(Function callback) co }); } -NonnullRefPtr Project::create_file(String const& path) const +NonnullRefPtr Project::create_file(DeprecatedString const& path) const { auto full_path = to_absolute_path(path); return ProjectFile::construct_with_name(full_path); } -String Project::to_absolute_path(String const& path) const +DeprecatedString Project::to_absolute_path(DeprecatedString const& path) const { if (LexicalPath { path }.is_absolute()) { return path; } - return LexicalPath { String::formatted("{}/{}", m_root_path, path) }.string(); + return LexicalPath { DeprecatedString::formatted("{}/{}", m_root_path, path) }.string(); } bool Project::project_is_serenity() const diff --git a/Userland/DevTools/HackStudio/Project.h b/Userland/DevTools/HackStudio/Project.h index 7d32ec953de..62522a8626c 100644 --- a/Userland/DevTools/HackStudio/Project.h +++ b/Userland/DevTools/HackStudio/Project.h @@ -20,28 +20,28 @@ class Project { AK_MAKE_NONMOVABLE(Project); public: - static OwnPtr open_with_root_path(String const& root_path); + static OwnPtr open_with_root_path(DeprecatedString const& root_path); GUI::FileSystemModel& model() { return *m_model; } const GUI::FileSystemModel& model() const { return *m_model; } - String name() const { return LexicalPath::basename(m_root_path); } - String root_path() const { return m_root_path; } + DeprecatedString name() const { return LexicalPath::basename(m_root_path); } + DeprecatedString root_path() const { return m_root_path; } - NonnullRefPtr create_file(String const& path) const; + NonnullRefPtr create_file(DeprecatedString const& path) const; void for_each_text_file(Function) const; - String to_absolute_path(String const&) const; + DeprecatedString to_absolute_path(DeprecatedString const&) const; bool project_is_serenity() const; static constexpr auto config_file_path = ".hackstudio/config.json"sv; NonnullOwnPtr config() const; private: - explicit Project(String const& root_path); + explicit Project(DeprecatedString const& root_path); RefPtr m_model; - String m_root_path; + DeprecatedString m_root_path; }; } diff --git a/Userland/DevTools/HackStudio/ProjectBuilder.cpp b/Userland/DevTools/HackStudio/ProjectBuilder.cpp index 69a66eb1bf7..04e9b6621e5 100644 --- a/Userland/DevTools/HackStudio/ProjectBuilder.cpp +++ b/Userland/DevTools/HackStudio/ProjectBuilder.cpp @@ -35,7 +35,7 @@ ErrorOr ProjectBuilder::build(StringView active_file) return Error::from_string_literal("no active file"); if (active_file.ends_with(".js"sv)) { - TRY(m_terminal->run_command(String::formatted("js -A {}", active_file))); + TRY(m_terminal->run_command(DeprecatedString::formatted("js -A {}", active_file))); return {}; } @@ -61,7 +61,7 @@ ErrorOr ProjectBuilder::run(StringView active_file) return Error::from_string_literal("no active file"); if (active_file.ends_with(".js"sv)) { - TRY(m_terminal->run_command(String::formatted("js {}", active_file))); + TRY(m_terminal->run_command(DeprecatedString::formatted("js {}", active_file))); return {}; } @@ -105,11 +105,11 @@ ErrorOr ProjectBuilder::update_active_file(StringView active_file) ErrorOr ProjectBuilder::build_serenity_component() { TRY(verify_make_is_installed()); - TRY(m_terminal->run_command(String::formatted("make {}", m_serenity_component_name), build_directory(), TerminalWrapper::WaitForExit::Yes, "Make failed"sv)); + TRY(m_terminal->run_command(DeprecatedString::formatted("make {}", m_serenity_component_name), build_directory(), TerminalWrapper::WaitForExit::Yes, "Make failed"sv)); return {}; } -ErrorOr ProjectBuilder::component_name(StringView cmake_file_path) +ErrorOr ProjectBuilder::component_name(StringView cmake_file_path) { auto content = TRY(Core::File::open(cmake_file_path, Core::OpenMode::ReadOnly))->read_all(); @@ -118,7 +118,7 @@ ErrorOr ProjectBuilder::component_name(StringView cmake_file_path) if (!component_name.search(StringView { content }, result)) return Error::from_string_literal("component not found"); - return String { result.capture_group_matches.at(0).at(0).view.string_view() }; + return DeprecatedString { result.capture_group_matches.at(0).at(0).view.string_view() }; } ErrorOr ProjectBuilder::initialize_build_directory() @@ -136,15 +136,15 @@ ErrorOr ProjectBuilder::initialize_build_directory() auto cmake_file = TRY(Core::File::open(cmake_file_path, Core::OpenMode::WriteOnly)); cmake_file->write(generate_cmake_file_content()); - TRY(m_terminal->run_command(String::formatted("cmake -S {} -DHACKSTUDIO_BUILD=ON -DHACKSTUDIO_BUILD_CMAKE_FILE={}" - " -DENABLE_UNICODE_DATABASE_DOWNLOAD=OFF", + TRY(m_terminal->run_command(DeprecatedString::formatted("cmake -S {} -DHACKSTUDIO_BUILD=ON -DHACKSTUDIO_BUILD_CMAKE_FILE={}" + " -DENABLE_UNICODE_DATABASE_DOWNLOAD=OFF", m_project_root, cmake_file_path), build_directory(), TerminalWrapper::WaitForExit::Yes, "CMake error"sv)); return {}; } -Optional ProjectBuilder::find_cmake_file_for(StringView file_path) const +Optional ProjectBuilder::find_cmake_file_for(StringView file_path) const { auto directory = LexicalPath::dirname(file_path); while (!directory.is_empty()) { @@ -156,7 +156,7 @@ Optional ProjectBuilder::find_cmake_file_for(StringView file_path) const return {}; } -String ProjectBuilder::generate_cmake_file_content() const +DeprecatedString ProjectBuilder::generate_cmake_file_content() const { StringBuilder builder; builder.appendff("add_subdirectory({})\n", LexicalPath::dirname(m_serenity_component_cmake_file)); @@ -173,20 +173,20 @@ String ProjectBuilder::generate_cmake_file_content() const // all of their direct dependencies in the CMakeLists file. // For example, a target may directly use LibGFX but only specify LibGUI as a dependency (which in turn depends on LibGFX). // In this example, if we don't specify the dependencies of LibGUI in the CMake file, linking will fail because of undefined LibGFX symbols. - builder.appendff("target_link_libraries({} INTERFACE {})\n", library.key, String::join(' ', library.value->dependencies)); + builder.appendff("target_link_libraries({} INTERFACE {})\n", library.key, DeprecatedString::join(' ', library.value->dependencies)); } return builder.to_string(); } -HashMap> ProjectBuilder::get_defined_libraries() +HashMap> ProjectBuilder::get_defined_libraries() { - HashMap> libraries; + HashMap> libraries; - for_each_library_definition([&libraries](String name, String path) { + for_each_library_definition([&libraries](DeprecatedString name, DeprecatedString path) { libraries.set(name, make(move(path))); }); - for_each_library_dependencies([&libraries](String name, Vector const& dependencies) { + for_each_library_dependencies([&libraries](DeprecatedString name, Vector const& dependencies) { auto library = libraries.get(name); if (!library.has_value()) return; @@ -198,9 +198,9 @@ HashMap> ProjectBuilder::get_ return libraries; } -void ProjectBuilder::for_each_library_definition(Function func) +void ProjectBuilder::for_each_library_definition(Function func) { - Vector arguments = { "-c", "find Userland -name CMakeLists.txt | xargs grep serenity_lib" }; + Vector arguments = { "-c", "find Userland -name CMakeLists.txt | xargs grep serenity_lib" }; auto res = Core::command("/bin/sh", arguments, {}); if (res.is_error()) { warnln("{}", res.error()); @@ -217,7 +217,7 @@ void ProjectBuilder::for_each_library_definition(Function auto library_name = result.capture_group_matches.at(0).at(0).view.string_view(); auto library_obj_name = result.capture_group_matches.at(0).at(1).view.string_view(); - auto so_path = String::formatted("{}.so", LexicalPath::join("/usr/lib"sv, String::formatted("lib{}", library_obj_name)).string()); + auto so_path = DeprecatedString::formatted("{}.so", LexicalPath::join("/usr/lib"sv, DeprecatedString::formatted("lib{}", library_obj_name)).string()); func(library_name, so_path); } @@ -225,9 +225,9 @@ void ProjectBuilder::for_each_library_definition(Function func("ssp", "/usr/lib/libssp.a"); } -void ProjectBuilder::for_each_library_dependencies(Function)> func) +void ProjectBuilder::for_each_library_dependencies(Function)> func) { - Vector arguments = { "-c", "find Userland/Libraries -name CMakeLists.txt | xargs grep target_link_libraries" }; + Vector arguments = { "-c", "find Userland/Libraries -name CMakeLists.txt | xargs grep target_link_libraries" }; auto res = Core::command("/bin/sh", arguments, {}); if (res.is_error()) { warnln("{}", res.error()); @@ -266,7 +266,7 @@ ErrorOr ProjectBuilder::verify_make_is_installed() return Error::from_string_literal("Make port is not installed"); } -String ProjectBuilder::build_directory() const +DeprecatedString ProjectBuilder::build_directory() const { return LexicalPath::join(m_project_root, "Build"sv).string(); } diff --git a/Userland/DevTools/HackStudio/ProjectBuilder.h b/Userland/DevTools/HackStudio/ProjectBuilder.h index bb2d97da210..f5808b0ff38 100644 --- a/Userland/DevTools/HackStudio/ProjectBuilder.h +++ b/Userland/DevTools/HackStudio/ProjectBuilder.h @@ -33,27 +33,27 @@ private: ErrorOr build_serenity_component(); ErrorOr run_serenity_component(); ErrorOr initialize_build_directory(); - Optional find_cmake_file_for(StringView file_path) const; - String generate_cmake_file_content() const; + Optional find_cmake_file_for(StringView file_path) const; + DeprecatedString generate_cmake_file_content() const; ErrorOr update_active_file(StringView active_file); - String build_directory() const; + DeprecatedString build_directory() const; struct LibraryInfo { - String path; - Vector dependencies {}; + DeprecatedString path; + Vector dependencies {}; }; - static HashMap> get_defined_libraries(); - static void for_each_library_definition(Function); - static void for_each_library_dependencies(Function)>); - static ErrorOr component_name(StringView cmake_file_path); + static HashMap> get_defined_libraries(); + static void for_each_library_definition(Function); + static void for_each_library_dependencies(Function)>); + static ErrorOr component_name(StringView cmake_file_path); static ErrorOr verify_cmake_is_installed(); static ErrorOr verify_make_is_installed(); - String m_project_root; + DeprecatedString m_project_root; Project const& m_project; NonnullRefPtr m_terminal; IsSerenityRepo m_is_serenity { IsSerenityRepo::No }; - String m_serenity_component_cmake_file; - String m_serenity_component_name; + DeprecatedString m_serenity_component_cmake_file; + DeprecatedString m_serenity_component_name; }; } diff --git a/Userland/DevTools/HackStudio/ProjectConfig.cpp b/Userland/DevTools/HackStudio/ProjectConfig.cpp index 2f064870c60..e52edc380d7 100644 --- a/Userland/DevTools/HackStudio/ProjectConfig.cpp +++ b/Userland/DevTools/HackStudio/ProjectConfig.cpp @@ -15,7 +15,7 @@ ProjectConfig::ProjectConfig(JsonObject config) { } -ErrorOr> ProjectConfig::try_load_project_config(String path) +ErrorOr> ProjectConfig::try_load_project_config(DeprecatedString path) { auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly)); auto file_contents = file->read_all(); @@ -34,7 +34,7 @@ NonnullOwnPtr ProjectConfig::create_empty() return adopt_own(*new ProjectConfig(empty)); } -Optional ProjectConfig::read_key(String key_name) const +Optional ProjectConfig::read_key(DeprecatedString key_name) const { auto const& value = m_config.get(key_name); if (!value.is_string()) diff --git a/Userland/DevTools/HackStudio/ProjectConfig.h b/Userland/DevTools/HackStudio/ProjectConfig.h index f916de35678..10181639ac3 100644 --- a/Userland/DevTools/HackStudio/ProjectConfig.h +++ b/Userland/DevTools/HackStudio/ProjectConfig.h @@ -16,16 +16,16 @@ namespace HackStudio { class ProjectConfig { public: - static ErrorOr> try_load_project_config(String path); + static ErrorOr> try_load_project_config(DeprecatedString path); static NonnullOwnPtr create_empty(); ProjectConfig(JsonObject); - Optional build_command() const { return read_key("build_command"); } - Optional run_command() const { return read_key("run_command"); } + Optional build_command() const { return read_key("build_command"); } + Optional run_command() const { return read_key("run_command"); } private: - Optional read_key(String key_name) const; + Optional read_key(DeprecatedString key_name) const; JsonObject m_config; }; diff --git a/Userland/DevTools/HackStudio/ProjectDeclarations.cpp b/Userland/DevTools/HackStudio/ProjectDeclarations.cpp index 7413ae89f06..422cba72fe1 100644 --- a/Userland/DevTools/HackStudio/ProjectDeclarations.cpp +++ b/Userland/DevTools/HackStudio/ProjectDeclarations.cpp @@ -11,7 +11,7 @@ HackStudio::ProjectDeclarations& HackStudio::ProjectDeclarations::the() static ProjectDeclarations s_instance; return s_instance; } -void HackStudio::ProjectDeclarations::set_declared_symbols(String const& filename, Vector const& declarations) +void HackStudio::ProjectDeclarations::set_declared_symbols(DeprecatedString const& filename, Vector const& declarations) { m_document_to_declarations.set(filename, declarations); if (on_update) diff --git a/Userland/DevTools/HackStudio/ProjectDeclarations.h b/Userland/DevTools/HackStudio/ProjectDeclarations.h index c8e3e2b0d7a..ee1e6f53de9 100644 --- a/Userland/DevTools/HackStudio/ProjectDeclarations.h +++ b/Userland/DevTools/HackStudio/ProjectDeclarations.h @@ -6,10 +6,10 @@ #pragma once +#include #include #include #include -#include #include #include @@ -23,7 +23,7 @@ public: template void for_each_declared_symbol(Func); - void set_declared_symbols(String const& filename, Vector const&); + void set_declared_symbols(DeprecatedString const& filename, Vector const&); static Optional get_icon_for(CodeComprehension::DeclarationType); @@ -31,7 +31,7 @@ public: private: ProjectDeclarations() = default; - HashMap> m_document_to_declarations; + HashMap> m_document_to_declarations; }; template diff --git a/Userland/DevTools/HackStudio/ProjectFile.cpp b/Userland/DevTools/HackStudio/ProjectFile.cpp index 70e8b9073d0..5fcdb21deab 100644 --- a/Userland/DevTools/HackStudio/ProjectFile.cpp +++ b/Userland/DevTools/HackStudio/ProjectFile.cpp @@ -9,7 +9,7 @@ namespace HackStudio { -ProjectFile::ProjectFile(String const& name) +ProjectFile::ProjectFile(DeprecatedString const& name) : m_name(name) { } diff --git a/Userland/DevTools/HackStudio/ProjectFile.h b/Userland/DevTools/HackStudio/ProjectFile.h index e2b3c96404a..b4e38eca73d 100644 --- a/Userland/DevTools/HackStudio/ProjectFile.h +++ b/Userland/DevTools/HackStudio/ProjectFile.h @@ -8,20 +8,20 @@ #include "CodeDocument.h" #include +#include #include #include -#include namespace HackStudio { class ProjectFile : public RefCounted { public: - static NonnullRefPtr construct_with_name(String const& name) + static NonnullRefPtr construct_with_name(DeprecatedString const& name) { return adopt_ref(*new ProjectFile(name)); } - String const& name() const { return m_name; } + DeprecatedString const& name() const { return m_name; } bool could_render_text() const { return m_could_render_text; } GUI::TextDocument& document() const; @@ -33,10 +33,10 @@ public: void horizontal_scroll_value(int); private: - explicit ProjectFile(String const& name); + explicit ProjectFile(DeprecatedString const& name); void create_document_if_needed() const; - String m_name; + DeprecatedString m_name; mutable RefPtr m_document; mutable bool m_could_render_text { false }; int m_vertical_scroll_value { 0 }; diff --git a/Userland/DevTools/HackStudio/ProjectTemplate.cpp b/Userland/DevTools/HackStudio/ProjectTemplate.cpp index a4b64df8b32..ef0ebbf755a 100644 --- a/Userland/DevTools/HackStudio/ProjectTemplate.cpp +++ b/Userland/DevTools/HackStudio/ProjectTemplate.cpp @@ -5,8 +5,8 @@ */ #include "ProjectTemplate.h" +#include #include -#include #include #include #include @@ -19,7 +19,7 @@ namespace HackStudio { -ProjectTemplate::ProjectTemplate(String const& id, String const& name, String const& description, const GUI::Icon& icon, int priority) +ProjectTemplate::ProjectTemplate(DeprecatedString const& id, DeprecatedString const& name, DeprecatedString const& description, const GUI::Icon& icon, int priority) : m_id(id) , m_name(name) , m_description(description) @@ -28,7 +28,7 @@ ProjectTemplate::ProjectTemplate(String const& id, String const& name, String co { } -RefPtr ProjectTemplate::load_from_manifest(String const& manifest_path) +RefPtr ProjectTemplate::load_from_manifest(DeprecatedString const& manifest_path) { auto maybe_config = Core::ConfigFile::open(manifest_path); if (maybe_config.is_error()) @@ -50,7 +50,7 @@ RefPtr ProjectTemplate::load_from_manifest(String const& manife // Fallback to a generic executable icon if one isn't found auto icon = GUI::Icon::default_icon("filetype-executable"sv); - auto bitmap_path_32 = String::formatted("/res/icons/hackstudio/templates-32x32/{}.png", config->read_entry("HackStudioTemplate", "IconName32x")); + auto bitmap_path_32 = DeprecatedString::formatted("/res/icons/hackstudio/templates-32x32/{}.png", config->read_entry("HackStudioTemplate", "IconName32x")); if (Core::File::exists(bitmap_path_32)) { auto bitmap_or_error = Gfx::Bitmap::try_load_from_file(bitmap_path_32); @@ -61,11 +61,11 @@ RefPtr ProjectTemplate::load_from_manifest(String const& manife return adopt_ref(*new ProjectTemplate(id, name, description, icon, priority)); } -Result ProjectTemplate::create_project(String const& name, String const& path) +Result ProjectTemplate::create_project(DeprecatedString const& name, DeprecatedString const& path) { // Check if a file or directory already exists at the project path if (Core::File::exists(path)) - return String("File or directory already exists at specified location."); + return DeprecatedString("File or directory already exists at specified location."); dbgln("Creating project at path '{}' with name '{}'", path, name); @@ -75,19 +75,19 @@ Result ProjectTemplate::create_project(String const& name, String auto result = Core::File::copy_file_or_directory(path, content_path()); dbgln("Copying {} -> {}", content_path(), path); if (result.is_error()) - return String::formatted("Failed to copy template contents. Error code: {}", static_cast(result.error())); + return DeprecatedString::formatted("Failed to copy template contents. Error code: {}", static_cast(result.error())); } else { dbgln("No template content directory found for '{}', creating an empty directory for the project.", m_id); int rc; if ((rc = mkdir(path.characters(), 0755)) < 0) { - return String::formatted("Failed to mkdir empty project directory, error: {}, rc: {}.", strerror(errno), rc); + return DeprecatedString::formatted("Failed to mkdir empty project directory, error: {}, rc: {}.", strerror(errno), rc); } } // Check for an executable post-create script in $TEMPLATES_DIR/$ID.postcreate, // and run it with the path and name - auto postcreate_script_path = LexicalPath::canonicalized_path(String::formatted("{}/{}.postcreate", templates_path(), m_id)); + auto postcreate_script_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}.postcreate", templates_path(), m_id)); struct stat postcreate_st; int result = stat(postcreate_script_path.characters(), &postcreate_st); if (result == 0 && (postcreate_st.st_mode & S_IXOTH) == S_IXOTH) { @@ -101,19 +101,19 @@ Result ProjectTemplate::create_project(String const& name, String if ((errno = posix_spawn(&child_pid, postcreate_script_path.characters(), nullptr, nullptr, const_cast(argv), environ))) { perror("posix_spawn"); - return String("Failed to spawn project post-create script."); + return DeprecatedString("Failed to spawn project post-create script."); } // Command spawned, wait for exit. int status; if (waitpid(child_pid, &status, 0) < 0) - return String("Failed to spawn project post-create script."); + return DeprecatedString("Failed to spawn project post-create script."); int child_error = WEXITSTATUS(status); dbgln("Post-create script exited with code {}", child_error); if (child_error != 0) - return String("Project post-creation script exited with non-zero error code."); + return DeprecatedString("Project post-creation script exited with non-zero error code."); } return {}; diff --git a/Userland/DevTools/HackStudio/ProjectTemplate.h b/Userland/DevTools/HackStudio/ProjectTemplate.h index 7a42e90d5d0..3d3bb85322c 100644 --- a/Userland/DevTools/HackStudio/ProjectTemplate.h +++ b/Userland/DevTools/HackStudio/ProjectTemplate.h @@ -7,10 +7,10 @@ #pragma once #include +#include #include #include #include -#include #include #include @@ -18,28 +18,28 @@ namespace HackStudio { class ProjectTemplate : public RefCounted { public: - static String templates_path() { return "/res/devel/templates"; } + static DeprecatedString templates_path() { return "/res/devel/templates"; } - static RefPtr load_from_manifest(String const& manifest_path); + static RefPtr load_from_manifest(DeprecatedString const& manifest_path); - explicit ProjectTemplate(String const& id, String const& name, String const& description, const GUI::Icon& icon, int priority); + explicit ProjectTemplate(DeprecatedString const& id, DeprecatedString const& name, DeprecatedString const& description, const GUI::Icon& icon, int priority); - Result create_project(String const& name, String const& path); + Result create_project(DeprecatedString const& name, DeprecatedString const& path); - String const& id() const { return m_id; } - String const& name() const { return m_name; } - String const& description() const { return m_description; } + DeprecatedString const& id() const { return m_id; } + DeprecatedString const& name() const { return m_name; } + DeprecatedString const& description() const { return m_description; } const GUI::Icon& icon() const { return m_icon; } - const String content_path() const + const DeprecatedString content_path() const { - return LexicalPath::canonicalized_path(String::formatted("{}/{}", templates_path(), m_id)); + return LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", templates_path(), m_id)); } int priority() const { return m_priority; } private: - String m_id; - String m_name; - String m_description; + DeprecatedString m_id; + DeprecatedString m_name; + DeprecatedString m_description; GUI::Icon m_icon; int m_priority { 0 }; }; diff --git a/Userland/DevTools/HackStudio/TerminalWrapper.cpp b/Userland/DevTools/HackStudio/TerminalWrapper.cpp index bb9ed98c3a8..a7bb513fcb2 100644 --- a/Userland/DevTools/HackStudio/TerminalWrapper.cpp +++ b/Userland/DevTools/HackStudio/TerminalWrapper.cpp @@ -6,7 +6,7 @@ */ #include "TerminalWrapper.h" -#include +#include #include #include #include @@ -24,7 +24,7 @@ namespace HackStudio { -ErrorOr TerminalWrapper::run_command(String const& command, Optional working_directory, WaitForExit wait_for_exit, Optional failure_message) +ErrorOr TerminalWrapper::run_command(DeprecatedString const& command, Optional working_directory, WaitForExit wait_for_exit, Optional failure_message) { if (m_pid != -1) { GUI::MessageBox::show(window(), @@ -92,11 +92,11 @@ ErrorOr TerminalWrapper::setup_master_pseudoterminal(WaitForChildOnExit wai int wstatus = result.release_value().status; if (WIFEXITED(wstatus)) { - m_terminal_widget->inject_string(String::formatted("\033[{};1m(Command exited with code {})\033[0m\r\n", wstatus == 0 ? 32 : 31, WEXITSTATUS(wstatus))); + m_terminal_widget->inject_string(DeprecatedString::formatted("\033[{};1m(Command exited with code {})\033[0m\r\n", wstatus == 0 ? 32 : 31, WEXITSTATUS(wstatus))); } else if (WIFSTOPPED(wstatus)) { m_terminal_widget->inject_string("\033[34;1m(Command stopped!)\033[0m\r\n"sv); } else if (WIFSIGNALED(wstatus)) { - m_terminal_widget->inject_string(String::formatted("\033[34;1m(Command signaled with {}!)\033[0m\r\n", strsignal(WTERMSIG(wstatus)))); + m_terminal_widget->inject_string(DeprecatedString::formatted("\033[34;1m(Command signaled with {}!)\033[0m\r\n", strsignal(WTERMSIG(wstatus)))); } m_child_exit_status = WEXITSTATUS(wstatus); diff --git a/Userland/DevTools/HackStudio/TerminalWrapper.h b/Userland/DevTools/HackStudio/TerminalWrapper.h index 28373a79422..e4e94031f1d 100644 --- a/Userland/DevTools/HackStudio/TerminalWrapper.h +++ b/Userland/DevTools/HackStudio/TerminalWrapper.h @@ -21,7 +21,7 @@ public: No, Yes }; - ErrorOr run_command(String const&, Optional working_directory = {}, WaitForExit = WaitForExit::No, Optional failure_message = {}); + ErrorOr run_command(DeprecatedString const&, Optional working_directory = {}, WaitForExit = WaitForExit::No, Optional failure_message = {}); ErrorOr kill_running_command(); void clear_including_history(); diff --git a/Userland/DevTools/HackStudio/ToDoEntries.cpp b/Userland/DevTools/HackStudio/ToDoEntries.cpp index af6309e7fb0..9c81dce40d3 100644 --- a/Userland/DevTools/HackStudio/ToDoEntries.cpp +++ b/Userland/DevTools/HackStudio/ToDoEntries.cpp @@ -14,7 +14,7 @@ ToDoEntries& HackStudio::ToDoEntries::the() return s_instance; } -void ToDoEntries::set_entries(String const& filename, Vector const&& entries) +void ToDoEntries::set_entries(DeprecatedString const& filename, Vector const&& entries) { m_document_to_entries.set(filename, move(entries)); if (on_update) diff --git a/Userland/DevTools/HackStudio/ToDoEntries.h b/Userland/DevTools/HackStudio/ToDoEntries.h index a0a8917ef73..d693e1945e3 100644 --- a/Userland/DevTools/HackStudio/ToDoEntries.h +++ b/Userland/DevTools/HackStudio/ToDoEntries.h @@ -6,10 +6,10 @@ #pragma once +#include #include #include #include -#include #include namespace HackStudio { @@ -20,7 +20,7 @@ class ToDoEntries { public: static ToDoEntries& the(); - void set_entries(String const& filename, Vector const&& entries); + void set_entries(DeprecatedString const& filename, Vector const&& entries); Vector get_entries(); @@ -30,7 +30,7 @@ public: private: ToDoEntries() = default; - HashMap> m_document_to_entries; + HashMap> m_document_to_entries; }; } diff --git a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp index 0177ba43291..4371d2a73e2 100644 --- a/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp +++ b/Userland/DevTools/HackStudio/ToDoEntriesWidget.cpp @@ -30,7 +30,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return m_matches.size(); } virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int column) const override + virtual DeprecatedString column_name(int column) const override { switch (column) { case Column::Filename: @@ -63,9 +63,9 @@ public: case Column::Text: return match.content; case Column::Line: - return String::formatted("{}", match.line + 1); + return DeprecatedString::formatted("{}", match.line + 1); case Column::Column: - return String::formatted("{}", match.column); + return DeprecatedString::formatted("{}", match.column); } } return {}; diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp index 14900079a8f..c237cec69a9 100644 --- a/Userland/DevTools/HackStudio/main.cpp +++ b/Userland/DevTools/HackStudio/main.cpp @@ -32,7 +32,7 @@ static WeakPtr s_hack_studio_widget; static bool make_is_available(); static void notify_make_not_available(); static void update_path_environment_variable(); -static Optional last_opened_project_path(); +static Optional last_opened_project_path(); ErrorOr serenity_main(Main::Arguments arguments) { @@ -71,7 +71,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto hack_studio_widget = TRY(window->try_set_main_widget(project_path)); s_hack_studio_widget = hack_studio_widget; - window->set_title(String::formatted("{} - Hack Studio", hack_studio_widget->project().name())); + window->set_title(DeprecatedString::formatted("{} - Hack Studio", hack_studio_widget->project().name())); hack_studio_widget->initialize_menubar(*window); @@ -132,7 +132,7 @@ static void update_path_environment_variable() setenv("PATH", path.to_string().characters(), true); } -static Optional last_opened_project_path() +static Optional last_opened_project_path() { auto projects = HackStudioWidget::read_recent_projects(); if (projects.size() == 0) @@ -151,12 +151,12 @@ GUI::TextEditor& current_editor() return s_hack_studio_widget->current_editor(); } -void open_file(String const& filename) +void open_file(DeprecatedString const& filename) { s_hack_studio_widget->open_file(filename); } -void open_file(String const& filename, size_t line, size_t column) +void open_file(DeprecatedString const& filename, size_t line, size_t column) { s_hack_studio_widget->open_file(filename, line, column); } @@ -173,7 +173,7 @@ Project& project() return s_hack_studio_widget->project(); } -String currently_open_file() +DeprecatedString currently_open_file() { if (!s_hack_studio_widget) return {}; diff --git a/Userland/DevTools/Inspector/RemoteObject.h b/Userland/DevTools/Inspector/RemoteObject.h index 742275f3daf..344e02c1da9 100644 --- a/Userland/DevTools/Inspector/RemoteObject.h +++ b/Userland/DevTools/Inspector/RemoteObject.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include namespace Inspector { @@ -25,8 +25,8 @@ public: FlatPtr address { 0 }; FlatPtr parent_address { 0 }; - String class_name; - String name; + DeprecatedString class_name; + DeprecatedString name; JsonObject json; diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp index 254731d23ec..0644923625a 100644 --- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp +++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp @@ -87,7 +87,7 @@ GUI::Variant RemoteObjectGraphModel::data(const GUI::ModelIndex& index, GUI::Mod return m_object_icon; } if (role == GUI::ModelRole::Display) - return String::formatted("{}({:p})", remote_object->class_name, remote_object->address); + return DeprecatedString::formatted("{}({:p})", remote_object->class_name, remote_object->address); return {}; } diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp index c9f73d000ad..44b25823cc7 100644 --- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp +++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.cpp @@ -33,7 +33,7 @@ int RemoteObjectPropertyModel::row_count(const GUI::ModelIndex& index) const } } -String RemoteObjectPropertyModel::column_name(int column) const +DeprecatedString RemoteObjectPropertyModel::column_name(int column) const { switch (column) { case Column::Name: @@ -57,9 +57,9 @@ GUI::Variant RemoteObjectPropertyModel::data(const GUI::ModelIndex& index, GUI:: case Column::Value: { auto data = path->resolve(m_object.json); if (data.is_array()) - return String::formatted("" : "s>"); + return DeprecatedString::formatted("" : "s>"); if (data.is_object()) - return String::formatted("" : "ies>"); + return DeprecatedString::formatted("" : "ies>"); return data; } } @@ -90,7 +90,7 @@ GUI::ModelIndex RemoteObjectPropertyModel::index(int row, int column, const GUI: path->extend(parent_path); int row_index = n; if (value.is_object()) { - String property_name; + DeprecatedString property_name; auto& object = value.as_object(); object.for_each_member([&](auto& name, auto&) { if (row_index > 0) { diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h index 5b724996e05..265a75d3581 100644 --- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h +++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h @@ -31,7 +31,7 @@ public: virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; virtual void set_data(const GUI::ModelIndex&, const GUI::Variant&) override; virtual bool is_editable(const GUI::ModelIndex& index) const override { return index.column() == Column::Value; } diff --git a/Userland/DevTools/Inspector/RemoteProcess.h b/Userland/DevTools/Inspector/RemoteProcess.h index a012424ef18..c90c25bf52b 100644 --- a/Userland/DevTools/Inspector/RemoteProcess.h +++ b/Userland/DevTools/Inspector/RemoteProcess.h @@ -22,7 +22,7 @@ public: void update(); pid_t pid() const { return m_pid; } - String const& process_name() const { return m_process_name; } + DeprecatedString const& process_name() const { return m_process_name; } RemoteObjectGraphModel& object_graph_model() { return *m_object_graph_model; } NonnullOwnPtrVector const& roots() const { return m_roots; } @@ -42,7 +42,7 @@ private: void send_request(JsonObject const&); pid_t m_pid { -1 }; - String m_process_name; + DeprecatedString m_process_name; NonnullRefPtr m_object_graph_model; NonnullOwnPtrVector m_roots; RefPtr m_client; diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp index 77802c64521..9bea0ab93d5 100644 --- a/Userland/DevTools/Inspector/main.cpp +++ b/Userland/DevTools/Inspector/main.cpp @@ -56,7 +56,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return 0; pid = process_chooser->pid(); } else { - auto pid_opt = String(arguments.strings[1]).to_int(); + auto pid_opt = DeprecatedString(arguments.strings[1]).to_int(); if (!pid_opt.has_value()) print_usage_and_exit(); pid = pid_opt.value(); @@ -74,7 +74,7 @@ ErrorOr serenity_main(Main::Arguments arguments) RemoteProcess remote_process(pid); if (!remote_process.is_inspectable()) { - GUI::MessageBox::show(window, String::formatted("Process pid={} is not inspectable", remote_process.pid()), "Error"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(window, DeprecatedString::formatted("Process pid={} is not inspectable", remote_process.pid()), "Error"sv, GUI::MessageBox::Type::Error); if (gui_mode) { goto choose_pid; } else { @@ -107,7 +107,7 @@ ErrorOr serenity_main(Main::Arguments arguments) remote_process.on_update = [&] { if (!remote_process.process_name().is_null()) - window->set_title(String::formatted("{} ({}) - Inspector", remote_process.process_name(), remote_process.pid())); + window->set_title(DeprecatedString::formatted("{} ({}) - Inspector", remote_process.process_name(), remote_process.pid())); }; auto& tree_view = splitter.add(); diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp index b43512e6d73..564d5d0ff08 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.cpp +++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp @@ -48,7 +48,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node) if (elf == nullptr) return; if (g_kernel_debug_info == nullptr) - g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, String::empty(), base_address); + g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, DeprecatedString::empty(), base_address); debug_info = g_kernel_debug_info.ptr(); } else { auto const& process = node.process(); @@ -128,7 +128,7 @@ int DisassemblyModel::row_count(GUI::ModelIndex const&) const return m_instructions.size(); } -String DisassemblyModel::column_name(int column) const +DeprecatedString DisassemblyModel::column_name(int column) const { switch (column) { case Column::SampleCount: @@ -192,7 +192,7 @@ GUI::Variant DisassemblyModel::data(GUI::ModelIndex const& index, GUI::ModelRole } if (index.column() == Column::Address) - return String::formatted("{:p}", insn.address); + return DeprecatedString::formatted("{:p}", insn.address); if (index.column() == Column::InstructionBytes) { StringBuilder builder; diff --git a/Userland/DevTools/Profiler/DisassemblyModel.h b/Userland/DevTools/Profiler/DisassemblyModel.h index e1f419ec292..77dd6662a27 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.h +++ b/Userland/DevTools/Profiler/DisassemblyModel.h @@ -18,7 +18,7 @@ class ProfileNode; struct InstructionData { X86::Instruction insn; - String disassembly; + DeprecatedString disassembly; StringView bytes; FlatPtr address { 0 }; u32 event_count { 0 }; @@ -46,7 +46,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/FilesystemEventModel.cpp b/Userland/DevTools/Profiler/FilesystemEventModel.cpp index 5dfe2899497..246fbff744e 100644 --- a/Userland/DevTools/Profiler/FilesystemEventModel.cpp +++ b/Userland/DevTools/Profiler/FilesystemEventModel.cpp @@ -22,7 +22,7 @@ FileEventModel::~FileEventModel() { } -FileEventNode& FileEventNode::find_or_create_node(String const& searched_path) +FileEventNode& FileEventNode::find_or_create_node(DeprecatedString const& searched_path) { // TODO: Optimize this function. @@ -61,7 +61,7 @@ FileEventNode& FileEventNode::find_or_create_node(String const& searched_path) } } -FileEventNode& FileEventNode::create_recursively(String new_path) +FileEventNode& FileEventNode::create_recursively(DeprecatedString new_path) { auto const lex_path = LexicalPath(new_path); auto parts = lex_path.parts(); @@ -142,7 +142,7 @@ int FileEventModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String FileEventModel::column_name(int column) const +DeprecatedString FileEventModel::column_name(int column) const { switch (column) { case Column::Path: diff --git a/Userland/DevTools/Profiler/FilesystemEventModel.h b/Userland/DevTools/Profiler/FilesystemEventModel.h index afea32653a7..697be2e3c1d 100644 --- a/Userland/DevTools/Profiler/FilesystemEventModel.h +++ b/Userland/DevTools/Profiler/FilesystemEventModel.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include namespace Profiler { @@ -17,23 +17,23 @@ class Profile; class FileEventNode : public RefCounted { public: - static NonnullRefPtr create(String const& path, FileEventNode* parent = nullptr) + static NonnullRefPtr create(DeprecatedString const& path, FileEventNode* parent = nullptr) { return adopt_ref(*new FileEventNode(path, parent)); } - FileEventNode& find_or_create_node(String const&); + FileEventNode& find_or_create_node(DeprecatedString const&); Vector>& children() { return m_children; } Vector> const& children() const { return m_children; } FileEventNode* parent() { return m_parent; }; - FileEventNode& create_recursively(String); + FileEventNode& create_recursively(DeprecatedString); void for_each_parent_node(Function callback); - String const& path() const { return m_path; } + DeprecatedString const& path() const { return m_path; } void increment_count() { m_count++; } u64 count() const { return m_count; } @@ -42,13 +42,13 @@ public: u64 duration() const { return m_duration; } private: - FileEventNode(String const& path, FileEventNode* parent = nullptr) + FileEventNode(DeprecatedString const& path, FileEventNode* parent = nullptr) : m_path(path) , m_count(0) , m_duration(0) , m_parent(parent) {}; - String m_path; + DeprecatedString m_path; u64 m_count; u64 m_duration; @@ -74,7 +74,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; diff --git a/Userland/DevTools/Profiler/FlameGraphView.cpp b/Userland/DevTools/Profiler/FlameGraphView.cpp index 35f33828328..e151c593a91 100644 --- a/Userland/DevTools/Profiler/FlameGraphView.cpp +++ b/Userland/DevTools/Profiler/FlameGraphView.cpp @@ -89,7 +89,7 @@ void FlameGraphView::mousemove_event(GUI::MouseEvent& event) if (on_hover_change) on_hover_change(); - String label = ""; + DeprecatedString label = ""; if (m_hovered_bar != nullptr && m_hovered_bar->index.is_valid()) { label = bar_label(*m_hovered_bar); } @@ -175,10 +175,10 @@ void FlameGraphView::paint_event(GUI::PaintEvent& event) } } -String FlameGraphView::bar_label(StackBar const& bar) const +DeprecatedString FlameGraphView::bar_label(StackBar const& bar) const { auto label_index = bar.index.sibling_at_column(m_text_column); - String label = "All"; + DeprecatedString label = "All"; if (label_index.is_valid()) { label = m_model.data(label_index).to_string(); } diff --git a/Userland/DevTools/Profiler/FlameGraphView.h b/Userland/DevTools/Profiler/FlameGraphView.h index 97035e3d8bf..ca98ebe6476 100644 --- a/Userland/DevTools/Profiler/FlameGraphView.h +++ b/Userland/DevTools/Profiler/FlameGraphView.h @@ -46,7 +46,7 @@ private: bool selected; }; - String bar_label(StackBar const&) const; + DeprecatedString bar_label(StackBar const&) const; void layout_bars(); void layout_children(GUI::ModelIndex& parent, int depth, int left, int right, Vector& selected); diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.cpp b/Userland/DevTools/Profiler/IndividualSampleModel.cpp index ba27683f583..715a9ef4e2d 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.cpp +++ b/Userland/DevTools/Profiler/IndividualSampleModel.cpp @@ -29,7 +29,7 @@ int IndividualSampleModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String IndividualSampleModel::column_name(int column) const +DeprecatedString IndividualSampleModel::column_name(int column) const { switch (column) { case Column::Address: @@ -50,7 +50,7 @@ GUI::Variant IndividualSampleModel::data(GUI::ModelIndex const& index, GUI::Mode if (role == GUI::ModelRole::Display) { if (index.column() == Column::Address) - return String::formatted("{:p}", frame.address); + return DeprecatedString::formatted("{:p}", frame.address); if (index.column() == Column::Symbol) { return frame.symbol; diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.h b/Userland/DevTools/Profiler/IndividualSampleModel.h index d499f623385..5487c6fd515 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.h +++ b/Userland/DevTools/Profiler/IndividualSampleModel.h @@ -31,7 +31,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; private: diff --git a/Userland/DevTools/Profiler/Process.cpp b/Userland/DevTools/Profiler/Process.cpp index f2c09a40321..6dc67b33d2e 100644 --- a/Userland/DevTools/Profiler/Process.cpp +++ b/Userland/DevTools/Profiler/Process.cpp @@ -41,9 +41,9 @@ void Process::handle_thread_exit(pid_t tid, EventSerialNumber serial) thread->end_valid = serial; } -HashMap> g_mapped_object_cache; +HashMap> g_mapped_object_cache; -static MappedObject* get_or_create_mapped_object(String const& path) +static MappedObject* get_or_create_mapped_object(DeprecatedString const& path) { if (auto it = g_mapped_object_cache.find(path); it != g_mapped_object_cache.end()) return it->value.ptr(); @@ -67,7 +67,7 @@ static MappedObject* get_or_create_mapped_object(String const& path) return ptr; } -void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name) +void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name) { StringView path; if (name.contains("Loader.so"sv)) @@ -82,25 +82,25 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name) // associated base address and size as new regions are discovered. // We don't allocate a temporary String object if an entry already exists. - // This assumes that String::hash and StringView::hash return the same result. + // This assumes that DeprecatedString::hash and StringView::hash return the same result. auto string_view_compare = [&path](auto& entry) { return path == entry.key.view(); }; if (auto existing_it = m_libraries.find(path.hash(), string_view_compare); existing_it != m_libraries.end()) { auto& entry = *existing_it->value; entry.base = min(entry.base, base); entry.size = max(entry.size + size, base - entry.base + size); } else { - String path_string = path.to_string(); - String full_path; + DeprecatedString path_string = path.to_string(); + DeprecatedString full_path; if (path_string.starts_with('/')) full_path = path_string; else if (Core::File::looks_like_shared_library(path_string)) - full_path = String::formatted("/usr/lib/{}", path); + full_path = DeprecatedString::formatted("/usr/lib/{}", path); else full_path = path_string; auto* mapped_object = get_or_create_mapped_object(full_path); if (!mapped_object) { - full_path = String::formatted("/usr/local/lib/{}", path); + full_path = DeprecatedString::formatted("/usr/local/lib/{}", path); mapped_object = get_or_create_mapped_object(full_path); if (!mapped_object) return; @@ -112,14 +112,14 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name) Debug::DebugInfo const& LibraryMetadata::Library::load_debug_info(FlatPtr base_address) const { if (debug_info == nullptr) - debug_info = make(object->elf, String::empty(), base_address); + debug_info = make(object->elf, DeprecatedString::empty(), base_address); return *debug_info.ptr(); } -String LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const +DeprecatedString LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const { if (!object) - return String::formatted("?? <{:p}>", ptr); + return DeprecatedString::formatted("?? <{:p}>", ptr); return object->elf.symbolicate(ptr - base, offset); } diff --git a/Userland/DevTools/Profiler/Process.h b/Userland/DevTools/Profiler/Process.h index 3d059d1e665..f47f7c5d181 100644 --- a/Userland/DevTools/Profiler/Process.h +++ b/Userland/DevTools/Profiler/Process.h @@ -21,27 +21,27 @@ struct MappedObject { ELF::Image elf; }; -extern HashMap> g_mapped_object_cache; +extern HashMap> g_mapped_object_cache; class LibraryMetadata { public: struct Library { FlatPtr base; size_t size; - String name; + DeprecatedString name; MappedObject* object { nullptr }; // This is loaded lazily because we only need it in disassembly view mutable OwnPtr debug_info; - String symbolicate(FlatPtr, u32* offset) const; + DeprecatedString symbolicate(FlatPtr, u32* offset) const; Debug::DebugInfo const& load_debug_info(FlatPtr base_address) const; }; - void handle_mmap(FlatPtr base, size_t size, String const& name); + void handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name); Library const* library_containing(FlatPtr) const; private: - mutable HashMap> m_libraries; + mutable HashMap> m_libraries; }; struct Thread { @@ -57,8 +57,8 @@ struct Thread { struct Process { pid_t pid {}; - String executable; - String basename; + DeprecatedString executable; + DeprecatedString basename; HashMap> threads {}; LibraryMetadata library_metadata {}; EventSerialNumber start_valid; diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index f9f7c8c369a..d1170f3b11f 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -257,7 +257,7 @@ ErrorOr> Profile::load_from_perfcore_file(StringView path if (!strings_value || !strings_value->is_array()) return Error::from_string_literal("Malformed profile (strings is not an array)"); - HashMap profile_strings; + HashMap profile_strings; for (FlatPtr string_id = 0; string_id < strings_value->as_array().size(); ++string_id) { auto const& value = strings_value->as_array().at(string_id); profile_strings.set(string_id, value.to_string()); @@ -302,7 +302,7 @@ ErrorOr> Profile::load_from_perfcore_file(StringView path } else if (type_string == "signpost"sv) { auto string_id = perf_event.get("arg1"sv).to_number(); event.data = Event::SignpostData { - .string = profile_strings.get(string_id).value_or(String::formatted("Signpost #{}", string_id)), + .string = profile_strings.get(string_id).value_or(DeprecatedString::formatted("Signpost #{}", string_id)), .arg = perf_event.get("arg2"sv).to_number(), }; } else if (type_string == "mmap"sv) { @@ -411,13 +411,13 @@ ErrorOr> Profile::load_from_perfcore_file(StringView path auto ptr = frame.to_number(); u32 offset = 0; FlyString object_name; - String symbol; + DeprecatedString symbol; if (maybe_kernel_base.has_value() && ptr >= maybe_kernel_base.value()) { if (g_kernel_debuginfo_object.has_value()) { symbol = g_kernel_debuginfo_object->elf.symbolicate(ptr - maybe_kernel_base.value(), &offset); } else { - symbol = String::formatted("?? <{:p}>", ptr); + symbol = DeprecatedString::formatted("?? <{:p}>", ptr); } } else { auto it = current_processes.find(event.pid); @@ -429,7 +429,7 @@ ErrorOr> Profile::load_from_perfcore_file(StringView path object_name = library->name; symbol = library->symbolicate(ptr, &offset); } else { - symbol = String::formatted("?? <{:p}>", ptr); + symbol = DeprecatedString::formatted("?? <{:p}>", ptr); } } @@ -610,7 +610,7 @@ ProfileNode::ProfileNode(Process const& process) { } -ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) +ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) : m_process(process) , m_symbol(move(symbol)) , m_pid(pid) @@ -618,7 +618,7 @@ ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, S , m_offset(offset) , m_timestamp(timestamp) { - String object; + DeprecatedString object; if (object_name.ends_with(": .text"sv)) { object = object_name.view().substring_view(0, object_name.length() - 7); } else { diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index 27f24d48176..eb374002a07 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -34,7 +34,7 @@ extern OwnPtr g_kernel_debug_info; class ProfileNode : public RefCounted { public: - static NonnullRefPtr create(Process const& process, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) + static NonnullRefPtr create(Process const& process, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) { return adopt_ref(*new ProfileNode(process, object_name, move(symbol), address, offset, timestamp, pid)); } @@ -54,7 +54,7 @@ public: void did_see_event(size_t event_index) { m_seen_events.set(event_index, true); } FlyString const& object_name() const { return m_object_name; } - String const& symbol() const { return m_symbol; } + DeprecatedString const& symbol() const { return m_symbol; } FlatPtr address() const { return m_address; } u32 offset() const { return m_offset; } u64 timestamp() const { return m_timestamp; } @@ -74,7 +74,7 @@ public: m_children.append(child); } - ProfileNode& find_or_create_child(FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) + ProfileNode& find_or_create_child(FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) { for (size_t i = 0; i < m_children.size(); ++i) { auto& child = m_children[i]; @@ -112,13 +112,13 @@ public: private: explicit ProfileNode(Process const&); - explicit ProfileNode(Process const&, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t); + explicit ProfileNode(Process const&, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t); bool m_root { false }; Process const& m_process; ProfileNode* m_parent { nullptr }; FlyString m_object_name; - String m_symbol; + DeprecatedString m_symbol; pid_t m_pid { 0 }; FlatPtr m_address { 0 }; u32 m_offset { 0 }; @@ -167,7 +167,7 @@ public: struct Frame { FlyString object_name; - String symbol; + DeprecatedString symbol; FlatPtr address { 0 }; u32 offset { 0 }; }; @@ -195,14 +195,14 @@ public: }; struct SignpostData { - String string; + DeprecatedString string; FlatPtr arg {}; }; struct MmapData { FlatPtr ptr {}; size_t size {}; - String name; + DeprecatedString name; }; struct MunmapData { @@ -212,11 +212,11 @@ public: struct ProcessCreateData { pid_t parent_pid { 0 }; - String executable; + DeprecatedString executable; }; struct ProcessExecData { - String executable; + DeprecatedString executable; }; struct ThreadCreateData { @@ -226,7 +226,7 @@ public: struct ReadData { int fd; size_t size; - String path; + DeprecatedString path; size_t start_timestamp; bool success; }; diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp index e86868202af..338593f087c 100644 --- a/Userland/DevTools/Profiler/ProfileModel.cpp +++ b/Userland/DevTools/Profiler/ProfileModel.cpp @@ -72,7 +72,7 @@ int ProfileModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String ProfileModel::column_name(int column) const +DeprecatedString ProfileModel::column_name(int column) const { switch (column) { case Column::SampleCount: @@ -117,7 +117,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol * 100.f / static_cast(m_profile.filtered_event_indices().size()) * percent_digits_rounding); - return String::formatted( + return DeprecatedString::formatted( "{}.{:02}", percentage_full_precision / percent_digits_rounding, percentage_full_precision % percent_digits_rounding); @@ -136,7 +136,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol return node->object_name(); if (index.column() == Column::StackFrame) { if (node->is_root()) { - return String::formatted("{} ({})", node->process().basename, node->process().pid); + return DeprecatedString::formatted("{} ({})", node->process().basename, node->process().pid); } return node->symbol(); } @@ -146,7 +146,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol auto const* library = node->process().library_metadata.library_containing(node->address()); if (!library) return ""; - return String::formatted("{:p} (offset {:p})", node->address(), node->address() - library->base); + return DeprecatedString::formatted("{:p} (offset {:p})", node->address(), node->address() - library->base); } return {}; } diff --git a/Userland/DevTools/Profiler/ProfileModel.h b/Userland/DevTools/Profiler/ProfileModel.h index 285e95f77f0..cf4ce9d1730 100644 --- a/Userland/DevTools/Profiler/ProfileModel.h +++ b/Userland/DevTools/Profiler/ProfileModel.h @@ -37,7 +37,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; diff --git a/Userland/DevTools/Profiler/SamplesModel.cpp b/Userland/DevTools/Profiler/SamplesModel.cpp index e6dd0f005ab..405154604bc 100644 --- a/Userland/DevTools/Profiler/SamplesModel.cpp +++ b/Userland/DevTools/Profiler/SamplesModel.cpp @@ -28,7 +28,7 @@ int SamplesModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String SamplesModel::column_name(int column) const +DeprecatedString SamplesModel::column_name(int column) const { switch (column) { case Column::SampleIndex: diff --git a/Userland/DevTools/Profiler/SamplesModel.h b/Userland/DevTools/Profiler/SamplesModel.h index 144307b5bf2..06ab6c6ae86 100644 --- a/Userland/DevTools/Profiler/SamplesModel.h +++ b/Userland/DevTools/Profiler/SamplesModel.h @@ -36,7 +36,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/SignpostsModel.cpp b/Userland/DevTools/Profiler/SignpostsModel.cpp index 237be28fb83..03737bb7209 100644 --- a/Userland/DevTools/Profiler/SignpostsModel.cpp +++ b/Userland/DevTools/Profiler/SignpostsModel.cpp @@ -26,7 +26,7 @@ int SignpostsModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String SignpostsModel::column_name(int column) const +DeprecatedString SignpostsModel::column_name(int column) const { switch (column) { case Column::SignpostIndex: diff --git a/Userland/DevTools/Profiler/SignpostsModel.h b/Userland/DevTools/Profiler/SignpostsModel.h index f227f3a9520..094c76b7097 100644 --- a/Userland/DevTools/Profiler/SignpostsModel.h +++ b/Userland/DevTools/Profiler/SignpostsModel.h @@ -35,7 +35,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/SourceModel.cpp b/Userland/DevTools/Profiler/SourceModel.cpp index 29f374de65f..ca478adc240 100644 --- a/Userland/DevTools/Profiler/SourceModel.cpp +++ b/Userland/DevTools/Profiler/SourceModel.cpp @@ -18,7 +18,7 @@ namespace Profiler { class SourceFile final { public: struct Line { - String content; + DeprecatedString content; size_t num_samples { 0 }; }; @@ -26,7 +26,7 @@ public: SourceFile(StringView filename) { - String source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly); + DeprecatedString source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly); auto try_read_lines = [&]() -> ErrorOr { auto unbuffered_file = TRY(Core::Stream::File::open(source_file_name, Core::Stream::OpenMode::Read)); @@ -71,7 +71,7 @@ SourceModel::SourceModel(Profile& profile, ProfileNode& node) return; base_address = maybe_kernel_base.release_value(); if (g_kernel_debug_info == nullptr) - g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, String::empty(), base_address); + g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, DeprecatedString::empty(), base_address); debug_info = g_kernel_debug_info.ptr(); } else { auto const& process = node.process(); @@ -87,7 +87,7 @@ SourceModel::SourceModel(Profile& profile, ProfileNode& node) VERIFY(debug_info != nullptr); // Try to read all source files contributing to the selected function and aggregate the samples by line. - HashMap source_files; + HashMap source_files; for (auto const& pair : node.events_per_address()) { auto position = debug_info->get_source_position(pair.key - base_address); if (position.has_value()) { @@ -123,7 +123,7 @@ int SourceModel::row_count(GUI::ModelIndex const&) const return m_source_lines.size(); } -String SourceModel::column_name(int column) const +DeprecatedString SourceModel::column_name(int column) const { switch (column) { case Column::SampleCount: diff --git a/Userland/DevTools/Profiler/SourceModel.h b/Userland/DevTools/Profiler/SourceModel.h index 9e2fa08f9f1..0012f4e33ad 100644 --- a/Userland/DevTools/Profiler/SourceModel.h +++ b/Userland/DevTools/Profiler/SourceModel.h @@ -16,9 +16,9 @@ class ProfileNode; struct SourceLineData { u32 event_count { 0 }; float percent { 0 }; - String location; + DeprecatedString location; u32 line_number { 0 }; - String source_code; + DeprecatedString source_code; }; class SourceModel final : public GUI::Model { @@ -38,7 +38,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/TimelineHeader.cpp b/Userland/DevTools/Profiler/TimelineHeader.cpp index 9bdc51a511b..4a4e99ab748 100644 --- a/Userland/DevTools/Profiler/TimelineHeader.cpp +++ b/Userland/DevTools/Profiler/TimelineHeader.cpp @@ -25,7 +25,7 @@ TimelineHeader::TimelineHeader(Profile& profile, Process const& process) update_selection(); m_icon = GUI::FileIconProvider::icon_for_executable(m_process.executable).bitmap_for_size(32); - m_text = String::formatted("{} ({})", LexicalPath::basename(m_process.executable), m_process.pid); + m_text = DeprecatedString::formatted("{} ({})", LexicalPath::basename(m_process.executable), m_process.pid); } void TimelineHeader::paint_event(GUI::PaintEvent& event) diff --git a/Userland/DevTools/Profiler/TimelineHeader.h b/Userland/DevTools/Profiler/TimelineHeader.h index 6040b6d0aac..e484a1233a0 100644 --- a/Userland/DevTools/Profiler/TimelineHeader.h +++ b/Userland/DevTools/Profiler/TimelineHeader.h @@ -33,7 +33,7 @@ private: Profile& m_profile; Process const& m_process; RefPtr m_icon; - String m_text; + DeprecatedString m_text; bool m_selected; }; diff --git a/Userland/DevTools/Profiler/TimelineTrack.cpp b/Userland/DevTools/Profiler/TimelineTrack.cpp index 4689a4d96da..8bd8ae59954 100644 --- a/Userland/DevTools/Profiler/TimelineTrack.cpp +++ b/Userland/DevTools/Profiler/TimelineTrack.cpp @@ -130,7 +130,7 @@ void TimelineTrack::mousemove_event(GUI::MouseEvent& event) Gfx::IntRect hoverable_rect { x - hoverable_padding, frame_thickness(), hoverable_padding * 2, height() - frame_thickness() * 2 }; if (hoverable_rect.contains_horizontally(event.x())) { auto const& data = signpost.data.template get(); - GUI::Application::the()->show_tooltip_immediately(String::formatted("{}, {}", data.string, data.arg), this); + GUI::Application::the()->show_tooltip_immediately(DeprecatedString::formatted("{}, {}", data.string, data.arg), this); hovering_a_signpost = true; return IterationDecision::Break; } diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index 2d3ed547d3d..2c398582cb7 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -60,18 +60,18 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-profiler"sv)); - String perfcore_file; + DeprecatedString perfcore_file; if (!perfcore_file_arg) { if (!generate_profile(pid)) return 0; - perfcore_file = String::formatted("/proc/{}/perf_events", pid); + perfcore_file = DeprecatedString::formatted("/proc/{}/perf_events", pid); } else { perfcore_file = perfcore_file_arg; } auto profile_or_error = Profile::load_from_perfcore_file(perfcore_file); if (profile_or_error.is_error()) { - GUI::MessageBox::show(nullptr, String::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(nullptr, DeprecatedString::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error); return 0; } @@ -223,11 +223,11 @@ ErrorOr serenity_main(Main::Arguments arguments) }; // FIXME: Make this constexpr once String is able to. - auto const sample_count_percent_format_string = String::formatted("{{:.{}f}}%", number_of_percent_digits); + auto const sample_count_percent_format_string = DeprecatedString::formatted("{{:.{}f}}%", number_of_percent_digits); auto const format_sample_count = [&profile, sample_count_percent_format_string](auto const sample_count) { if (profile->show_percentages()) - return String::formatted(sample_count_percent_format_string, sample_count.as_float_or(0.0)); - return String::formatted("{} Samples", sample_count.to_i32()); + return DeprecatedString::formatted(sample_count_percent_format_string, sample_count.as_float_or(0.0)); + return DeprecatedString::formatted("{} Samples", sample_count.to_i32()); }; auto statusbar = TRY(main_widget->try_add()); @@ -310,10 +310,10 @@ ErrorOr serenity_main(Main::Arguments arguments) return app->exec(); } -static bool prompt_to_stop_profiling(pid_t pid, String const& process_name) +static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_name) { auto window = GUI::Window::construct(); - window->set_title(String::formatted("Profiling {}({})", process_name, pid)); + window->set_title(DeprecatedString::formatted("Profiling {}({})", process_name, pid)); window->resize(240, 100); window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors()); window->center_on_screen(); @@ -327,7 +327,7 @@ static bool prompt_to_stop_profiling(pid_t pid, String const& process_name) Core::ElapsedTimer clock; clock.start(); auto update_timer = Core::Timer::construct(100, [&] { - timer_label.set_text(String::formatted("{:.1} seconds", clock.elapsed() / 1000.0f)); + timer_label.set_text(DeprecatedString::formatted("{:.1} seconds", clock.elapsed() / 1000.0f)); }); auto& stop_button = widget.add("Stop"); @@ -349,7 +349,7 @@ bool generate_profile(pid_t& pid) pid = process_chooser->pid(); } - String process_name; + DeprecatedString process_name; auto all_processes = Core::ProcessStatisticsReader::get_all(); if (all_processes.has_value()) { @@ -367,7 +367,7 @@ bool generate_profile(pid_t& pid) if (profiling_enable(pid, event_mask) < 0) { int saved_errno = errno; - GUI::MessageBox::show(nullptr, String::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(nullptr, DeprecatedString::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler"sv, GUI::MessageBox::Type::Error); return false; } diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp index 929ed1dff68..4bc1adbd11b 100644 --- a/Userland/DevTools/SQLStudio/MainWidget.cpp +++ b/Userland/DevTools/SQLStudio/MainWidget.cpp @@ -55,7 +55,7 @@ MainWidget::MainWidget() return; auto save_attempt = editor->save(); if (save_attempt.is_error()) - GUI::MessageBox::show_error(window(), String::formatted("Failed to save\n{}", save_attempt.release_error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to save\n{}", save_attempt.release_error())); }); m_save_as_action = GUI::CommonActions::make_save_as_action([&](auto&) { @@ -66,7 +66,7 @@ MainWidget::MainWidget() return; auto save_attempt = editor->save_as(); if (save_attempt.is_error()) - GUI::MessageBox::show_error(window(), String::formatted("Failed to save\n{}", save_attempt.release_error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to save\n{}", save_attempt.release_error())); }); m_save_all_action = GUI::Action::create("Save All", { Mod_Ctrl | Mod_Alt, Key_S }, [this](auto&) { @@ -88,7 +88,7 @@ MainWidget::MainWidget() return IterationDecision::Break; }); if (error.is_error()) - GUI::MessageBox::show_error(window(), String::formatted("Failed to save all files\n{}", error.release_error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to save all files\n{}", error.release_error())); m_tab_widget->set_active_widget(current_active_widget); }); @@ -177,7 +177,7 @@ MainWidget::MainWidget() return; auto close_attempt = editor->attempt_to_close(); if (close_attempt.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("Failed to save before closing\n{}", close_attempt.release_error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to save before closing\n{}", close_attempt.release_error())); return; } if (close_attempt.release_value()) { @@ -217,7 +217,7 @@ MainWidget::MainWidget() m_sql_client->on_execution_success = [this](int, bool, int, int, int) { read_next_sql_statement_of_editor(); }; - m_sql_client->on_next_result = [this](int, Vector const& row) { + m_sql_client->on_next_result = [this](int, Vector const& row) { m_results.append(row); }; m_sql_client->on_results_exhausted = [this](int, int) { @@ -227,7 +227,7 @@ MainWidget::MainWidget() return; Vector query_result_fields; for (size_t i = 0; i < m_results[0].size(); i++) - query_result_fields.empend(String::formatted("column_{}", i + 1), String::formatted("Column {}", i + 1), Gfx::TextAlignment::CenterLeft); + query_result_fields.empend(DeprecatedString::formatted("column_{}", i + 1), DeprecatedString::formatted("Column {}", i + 1), Gfx::TextAlignment::CenterLeft); auto query_results_model = GUI::JsonArrayModel::create("{}", move(query_result_fields)); m_query_results_table_view->set_model(MUST(GUI::SortingProxyModel::create(*query_results_model))); for (auto& result_row : m_results) { @@ -273,7 +273,7 @@ void MainWidget::initialize_menu(GUI::Window* window) void MainWidget::open_new_script() { - auto new_script_name = String::formatted("New Script - {}", m_new_script_counter); + auto new_script_name = DeprecatedString::formatted("New Script - {}", m_new_script_counter); ++m_new_script_counter; auto& editor = m_tab_widget->add_tab(new_script_name); @@ -291,7 +291,7 @@ void MainWidget::open_script_from_file(LexicalPath const& file_path) auto& editor = m_tab_widget->add_tab(file_path.title()); auto maybe_error = editor.open_script_from_file(file_path); if (maybe_error.is_error()) { - GUI::MessageBox::show_error(window(), String::formatted("Failed to open {}\n{}", file_path, maybe_error.release_error())); + GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Failed to open {}\n{}", file_path, maybe_error.release_error())); return; } @@ -344,7 +344,7 @@ void MainWidget::update_title() { auto editor = dynamic_cast(m_tab_widget->active_widget()); if (editor) { - window()->set_title(String::formatted("{} - SQL Studio", editor->name())); + window()->set_title(DeprecatedString::formatted("{} - SQL Studio", editor->name())); } else { window()->set_title("SQL Studio"); } @@ -368,14 +368,14 @@ void MainWidget::update_statusbar(ScriptEditor* editor) if (editor->has_selection()) { auto character_count = editor->selected_text().length(); auto word_count = editor->number_of_selected_words(); - m_statusbar->set_text(1, String::formatted("{} {} ({} {}) selected", character_count, character_count == 1 ? "character" : "characters", word_count, word_count == 1 ? "word" : "words")); + m_statusbar->set_text(1, DeprecatedString::formatted("{} {} ({} {}) selected", character_count, character_count == 1 ? "character" : "characters", word_count, word_count == 1 ? "word" : "words")); } else { auto character_count = editor->text().length(); auto word_count = editor->number_of_words(); - m_statusbar->set_text(1, String::formatted("{} {} ({} {})", character_count, character_count == 1 ? "character" : "characters", word_count, word_count == 1 ? "word" : "words")); + m_statusbar->set_text(1, DeprecatedString::formatted("{} {} ({} {})", character_count, character_count == 1 ? "character" : "characters", word_count, word_count == 1 ? "word" : "words")); } - m_statusbar->set_text(2, String::formatted("Ln {}, Col {}", editor->cursor().line() + 1, editor->cursor().column())); + m_statusbar->set_text(2, DeprecatedString::formatted("Ln {}, Col {}", editor->cursor().line() + 1, editor->cursor().column())); } void MainWidget::update_editor_actions(ScriptEditor* editor) @@ -428,7 +428,7 @@ void MainWidget::drop_event(GUI::DropEvent& drop_event) } } -String MainWidget::read_next_sql_statement_of_editor() +DeprecatedString MainWidget::read_next_sql_statement_of_editor() { StringBuilder piece; do { @@ -484,13 +484,13 @@ String MainWidget::read_next_sql_statement_of_editor() return piece.to_string(); } -Optional MainWidget::read_next_line_of_editor() +Optional MainWidget::read_next_line_of_editor() { auto editor = dynamic_cast(m_tab_widget->active_widget()); if (!editor) return {}; if (m_current_line_for_parsing < editor->document().line_count()) { - String result = editor->document().line(m_current_line_for_parsing).to_utf8(); + DeprecatedString result = editor->document().line(m_current_line_for_parsing).to_utf8(); m_current_line_for_parsing++; return result; } else { diff --git a/Userland/DevTools/SQLStudio/MainWidget.h b/Userland/DevTools/SQLStudio/MainWidget.h index f813aa83eae..93b267df9e9 100644 --- a/Userland/DevTools/SQLStudio/MainWidget.h +++ b/Userland/DevTools/SQLStudio/MainWidget.h @@ -59,10 +59,10 @@ private: RefPtr m_query_results_table_view; RefPtr m_sql_client; - Vector> m_results; + Vector> m_results; - String read_next_sql_statement_of_editor(); - Optional read_next_line_of_editor(); + DeprecatedString read_next_sql_statement_of_editor(); + Optional read_next_line_of_editor(); size_t m_current_line_for_parsing { 0 }; int m_editor_line_level { 0 }; int m_connection_id { 0 }; diff --git a/Userland/DevTools/SQLStudio/ScriptEditor.cpp b/Userland/DevTools/SQLStudio/ScriptEditor.cpp index fcc0e0611d2..4cf7cd3fa61 100644 --- a/Userland/DevTools/SQLStudio/ScriptEditor.cpp +++ b/Userland/DevTools/SQLStudio/ScriptEditor.cpp @@ -21,7 +21,7 @@ ScriptEditor::ScriptEditor() set_ruler_visible(true); } -void ScriptEditor::new_script_with_temp_name(String name) +void ScriptEditor::new_script_with_temp_name(DeprecatedString name) { set_name(name); } diff --git a/Userland/DevTools/SQLStudio/ScriptEditor.h b/Userland/DevTools/SQLStudio/ScriptEditor.h index 32c0ad56480..c927af46e8d 100644 --- a/Userland/DevTools/SQLStudio/ScriptEditor.h +++ b/Userland/DevTools/SQLStudio/ScriptEditor.h @@ -17,7 +17,7 @@ class ScriptEditor : public GUI::TextEditor { public: virtual ~ScriptEditor() = default; - void new_script_with_temp_name(String); + void new_script_with_temp_name(DeprecatedString); ErrorOr open_script_from_file(LexicalPath const&); ErrorOr save(); @@ -27,7 +27,7 @@ public: private: ScriptEditor(); - String m_path; + DeprecatedString m_path; }; } diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 2b795b81555..641ce3d4c41 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -44,7 +44,7 @@ Emulator& Emulator::the() return *s_the; } -Emulator::Emulator(String const& executable_path, Vector const& arguments, Vector const& environment) +Emulator::Emulator(DeprecatedString const& executable_path, Vector const& arguments, Vector const& environment) : m_executable_path(executable_path) , m_arguments(arguments) , m_environment(environment) @@ -72,7 +72,7 @@ Emulator::Emulator(String const& executable_path, Vector const& argu setup_signal_trampoline(); } -Vector Emulator::generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, String const& executable_path, int executable_fd) const +Vector Emulator::generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, DeprecatedString const& executable_path, int executable_fd) const { // FIXME: This is not fully compatible with the auxiliary vector the kernel generates, this is just the bare // minimum to get the loader going. @@ -229,7 +229,7 @@ int Emulator::exec() size_t instructions_until_next_profile_dump = profile_instruction_interval(); if (is_profiling() && m_loader_text_size.has_value()) - emit_profile_event(profile_stream(), "mmap"sv, String::formatted(R"("ptr": {}, "size": {}, "name": "/usr/lib/Loader.so")", *m_loader_text_base, *m_loader_text_size)); + emit_profile_event(profile_stream(), "mmap"sv, DeprecatedString::formatted(R"("ptr": {}, "size": {}, "name": "/usr/lib/Loader.so")", *m_loader_text_base, *m_loader_text_size)); while (!m_shutdown) { if (m_steps_til_pause) [[likely]] { @@ -421,13 +421,13 @@ MmapRegion const* Emulator::load_library_from_address(FlatPtr address) if (!region) return {}; - String lib_name = region->lib_name(); + DeprecatedString lib_name = region->lib_name(); if (lib_name.is_null()) return {}; - String lib_path = lib_name; + DeprecatedString lib_path = lib_name; if (Core::File::looks_like_shared_library(lib_name)) - lib_path = String::formatted("/usr/lib/{}", lib_path); + lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_path); if (!m_dynamic_library_cache.contains(lib_path)) { auto file_or_error = Core::MappedFile::map(lib_path); @@ -465,7 +465,7 @@ Optional Emulator::symbol_at(FlatPtr address) VERIFY(first_region); auto lib_path = lib_name; if (Core::File::looks_like_shared_library(lib_name)) { - lib_path = String::formatted("/usr/lib/{}", lib_name); + lib_path = DeprecatedString::formatted("/usr/lib/{}", lib_name); } auto it = m_dynamic_library_cache.find(lib_path); @@ -476,18 +476,18 @@ Optional Emulator::symbol_at(FlatPtr address) return { { lib_name, symbol, source_position } }; } -String Emulator::create_backtrace_line(FlatPtr address) +DeprecatedString Emulator::create_backtrace_line(FlatPtr address) { auto maybe_symbol = symbol_at(address); if (!maybe_symbol.has_value()) { - return String::formatted("=={}== {:p}", getpid(), address); + return DeprecatedString::formatted("=={}== {:p}", getpid(), address); } if (!maybe_symbol->source_position.has_value()) { - return String::formatted("=={}== {:p} [{}]: {}", getpid(), address, maybe_symbol->lib_name, maybe_symbol->symbol); + return DeprecatedString::formatted("=={}== {:p} [{}]: {}", getpid(), address, maybe_symbol->lib_name, maybe_symbol->symbol); } auto const& source_position = maybe_symbol->source_position.value(); - return String::formatted("=={}== {:p} [{}]: {} (\e[34;1m{}\e[0m:{})", getpid(), address, maybe_symbol->lib_name, maybe_symbol->symbol, LexicalPath::basename(source_position.file_path), source_position.line_number); + return DeprecatedString::formatted("=={}== {:p} [{}]: {} (\e[34;1m{}\e[0m:{})", getpid(), address, maybe_symbol->lib_name, maybe_symbol->symbol, LexicalPath::basename(source_position.file_path), source_position.line_number); } void Emulator::dump_backtrace(Vector const& backtrace) @@ -515,7 +515,7 @@ void Emulator::emit_profile_sample(AK::OutputStream& output) output.write_or_error(builder.string_view().bytes()); } -void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_name, String const& contents) +void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_name, DeprecatedString const& contents) { StringBuilder builder; timeval tv {}; @@ -525,13 +525,13 @@ void Emulator::emit_profile_event(AK::OutputStream& output, StringView event_nam output.write_or_error(builder.string_view().bytes()); } -String Emulator::create_instruction_line(FlatPtr address, X86::Instruction const& insn) +DeprecatedString Emulator::create_instruction_line(FlatPtr address, X86::Instruction const& insn) { auto symbol = symbol_at(address); if (!symbol.has_value() || !symbol->source_position.has_value()) - return String::formatted("{:p}: {}", address, insn.to_string(address)); + return DeprecatedString::formatted("{:p}: {}", address, insn.to_string(address)); - return String::formatted("{:p}: {} \e[34;1m{}\e[0m:{}", address, insn.to_string(address), LexicalPath::basename(symbol->source_position->file_path), symbol->source_position.value().line_number); + return DeprecatedString::formatted("{:p}: {} \e[34;1m{}\e[0m:{}", address, insn.to_string(address), LexicalPath::basename(symbol->source_position->file_path), symbol->source_position.value().line_number); } static void emulator_signal_handler(int signum, siginfo_t* signal_info, void* context) diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.h b/Userland/DevTools/UserspaceEmulator/Emulator.h index fe7ae3efe2d..92b0c1d44ba 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.h +++ b/Userland/DevTools/UserspaceEmulator/Emulator.h @@ -31,9 +31,9 @@ class Emulator { public: static Emulator& the(); - Emulator(String const& executable_path, Vector const& arguments, Vector const& environment); + Emulator(DeprecatedString const& executable_path, Vector const& arguments, Vector const& environment); - void set_profiling_details(bool should_dump_profile, size_t instruction_interval, OutputFileStream* profile_stream, NonnullOwnPtrVector* profiler_strings, Vector* profiler_string_id_map) + void set_profiling_details(bool should_dump_profile, size_t instruction_interval, OutputFileStream* profile_stream, NonnullOwnPtrVector* profiler_strings, Vector* profiler_string_id_map) { m_is_profiling = should_dump_profile; m_profile_instruction_interval = instruction_interval; @@ -48,7 +48,7 @@ public: } OutputFileStream& profile_stream() { return *m_profile_stream; } - NonnullOwnPtrVector& profiler_strings() { return *m_profiler_strings; } + NonnullOwnPtrVector& profiler_strings() { return *m_profiler_strings; } Vector& profiler_string_id_map() { return *m_profiler_string_id_map; } bool is_profiling() const { return m_is_profiling; } @@ -114,8 +114,8 @@ public: } struct SymbolInfo { - String lib_name; - String symbol; + DeprecatedString lib_name; + DeprecatedString symbol; Optional source_position; }; @@ -124,9 +124,9 @@ public: void dump_regions() const; private: - const String m_executable_path; + const DeprecatedString m_executable_path; Vector const m_arguments; - Vector const m_environment; + Vector const m_environment; SoftMMU m_mmu; NonnullOwnPtr m_cpu; @@ -134,14 +134,14 @@ private: OwnPtr m_malloc_tracer; void setup_stack(Vector); - Vector generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, String const& executable_path, int executable_fd) const; + Vector generate_auxiliary_vector(FlatPtr load_base, FlatPtr entry_eip, DeprecatedString const& executable_path, int executable_fd) const; void register_signal_handlers(); void setup_signal_trampoline(); void send_signal(int); void emit_profile_sample(AK::OutputStream&); - void emit_profile_event(AK::OutputStream&, StringView event_name, String const& contents); + void emit_profile_event(AK::OutputStream&, StringView event_name, DeprecatedString const& contents); int virt$accept4(FlatPtr); int virt$access(FlatPtr, size_t, int); @@ -256,8 +256,8 @@ private: MmapRegion const* find_text_region(FlatPtr address); MmapRegion const* load_library_from_address(FlatPtr address); MmapRegion const* first_region_for_object(StringView name); - String create_backtrace_line(FlatPtr address); - String create_instruction_line(FlatPtr address, X86::Instruction const& insn); + DeprecatedString create_backtrace_line(FlatPtr address); + DeprecatedString create_instruction_line(FlatPtr address, X86::Instruction const& insn); bool m_shutdown { false }; int m_exit_status { 0 }; @@ -292,13 +292,13 @@ private: NonnullOwnPtr image; }; - HashMap m_dynamic_library_cache; + HashMap m_dynamic_library_cache; RangeAllocator m_range_allocator; OutputFileStream* m_profile_stream { nullptr }; Vector* m_profiler_string_id_map { nullptr }; - NonnullOwnPtrVector* m_profiler_strings { nullptr }; + NonnullOwnPtrVector* m_profiler_strings { nullptr }; bool m_is_profiling { false }; size_t m_profile_instruction_interval { 0 }; diff --git a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp index ddd44cccb0f..d213227e491 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator_syscalls.cpp @@ -297,7 +297,7 @@ FlatPtr Emulator::virt$perf_event(int event, FlatPtr arg1, FlatPtr arg2) if (event == PERF_EVENT_SIGNPOST) { if (is_profiling()) { if (profiler_string_id_map().size() > arg1) - emit_profile_event(profile_stream(), "signpost"sv, String::formatted("\"arg1\": {}, \"arg2\": {}", arg1, arg2)); + emit_profile_event(profile_stream(), "signpost"sv, DeprecatedString::formatted("\"arg1\": {}, \"arg2\": {}", arg1, arg2)); syscall(SC_perf_event, PERF_EVENT_SIGNPOST, profiler_string_id_map().at(arg1), arg2); } else { syscall(SC_perf_event, PERF_EVENT_SIGNPOST, arg1, arg2); @@ -316,7 +316,7 @@ FlatPtr Emulator::virt$perf_register_string(FlatPtr string, size_t size) auto ret = (int)syscall(SC_perf_register_string, buffer, size + 4); if (ret >= 0 && is_profiling()) { - profiler_strings().append(make(StringView { buffer + 4, size })); + profiler_strings().append(make(StringView { buffer + 4, size })); profiler_string_id_map().append(ret); ret = profiler_string_id_map().size() - 1; } @@ -586,7 +586,7 @@ int Emulator::virt$set_mmap_name(FlatPtr params_addr) auto* region = mmu().find_region({ 0x23, (FlatPtr)params.addr }); if (!region || !is(*region)) return -EINVAL; - static_cast(*region).set_name(String::copy(name)); + static_cast(*region).set_name(DeprecatedString::copy(name)); return 0; } @@ -608,7 +608,7 @@ int Emulator::virt$set_process_name(FlatPtr user_buffer, int size) if (size < 0) return -EINVAL; auto host_buffer = mmu().copy_buffer_from_vm(user_buffer, size); - auto name = String::formatted("(UE) {}", StringView { host_buffer.data(), host_buffer.size() }); + auto name = DeprecatedString::formatted("(UE) {}", StringView { host_buffer.data(), host_buffer.size() }); return syscall(SC_set_process_name, name.characters(), name.length()); } @@ -846,7 +846,7 @@ static void round_to_page_size(FlatPtr& address, size_t& size) u32 Emulator::virt$munmap(FlatPtr address, size_t size) { if (is_profiling()) - emit_profile_event(profile_stream(), "munmap"sv, String::formatted("\"ptr\": {}, \"size\": {}", address, size)); + emit_profile_event(profile_stream(), "munmap"sv, DeprecatedString::formatted("\"ptr\": {}, \"size\": {}", address, size)); round_to_page_size(address, size); Vector marked_for_deletion; bool has_non_mmap_region = false; @@ -905,7 +905,7 @@ u32 Emulator::virt$mmap(u32 params_addr) final_address = result.value().base().get(); auto final_size = result.value().size(); - String name_str; + DeprecatedString name_str; if (params.name.characters) { auto buffer_result = ByteBuffer::create_uninitialized(params.name.length); if (buffer_result.is_error()) @@ -916,7 +916,7 @@ u32 Emulator::virt$mmap(u32 params_addr) } if (is_profiling()) - emit_profile_event(profile_stream(), "mmap"sv, String::formatted(R"("ptr": {}, "size": {}, "name": "{}")", final_address, final_size, name_str)); + emit_profile_event(profile_stream(), "mmap"sv, DeprecatedString::formatted(R"("ptr": {}, "size": {}, "name": "{}")", final_address, final_size, name_str)); if (params.flags & MAP_ANONYMOUS) { mmu().add_region(MmapRegion::create_anonymous(final_address, final_size, params.prot, move(name_str))); @@ -1230,15 +1230,15 @@ int Emulator::virt$execve(FlatPtr params_addr) Syscall::SC_execve_params params; mmu().copy_from_vm(¶ms, params_addr, sizeof(params)); - auto path = String::copy(mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length)); - Vector arguments; - Vector environment; + auto path = DeprecatedString::copy(mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length)); + Vector arguments; + Vector environment; auto copy_string_list = [this](auto& output_vector, auto& string_list) { for (size_t i = 0; i < string_list.length; ++i) { Syscall::StringArgument string; mmu().copy_from_vm(&string, (FlatPtr)&string_list.strings[i], sizeof(string)); - output_vector.append(String::copy(mmu().copy_buffer_from_vm((FlatPtr)string.characters, string.length))); + output_vector.append(DeprecatedString::copy(mmu().copy_buffer_from_vm((FlatPtr)string.characters, string.length))); } }; @@ -1284,7 +1284,7 @@ int Emulator::virt$stat(FlatPtr params_addr) Syscall::SC_stat_params params; mmu().copy_from_vm(¶ms, params_addr, sizeof(params)); - auto path = String::copy(mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length)); + auto path = DeprecatedString::copy(mmu().copy_buffer_from_vm((FlatPtr)params.path.characters, params.path.length)); struct stat host_statbuf; int rc; if (params.follow_symlinks) @@ -1523,7 +1523,7 @@ int Emulator::virt$scheduler_set_parameters(FlatPtr user_addr) int Emulator::virt$set_thread_name(pid_t pid, FlatPtr name_addr, size_t name_length) { auto user_name = mmu().copy_buffer_from_vm(name_addr, name_length); - auto name = String::formatted("(UE) {}", StringView { user_name.data(), user_name.size() }); + auto name = DeprecatedString::formatted("(UE) {}", StringView { user_name.data(), user_name.size() }); return syscall(SC_set_thread_name, pid, name.characters(), name.length()); } diff --git a/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp b/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp index bfd31253def..981b2977e9b 100644 --- a/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp +++ b/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp @@ -26,20 +26,20 @@ static void free_pages(void* ptr, size_t bytes) VERIFY(rc == 0); } -NonnullOwnPtr MmapRegion::create_anonymous(u32 base, u32 size, u32 prot, String name) +NonnullOwnPtr MmapRegion::create_anonymous(u32 base, u32 size, u32 prot, DeprecatedString name) { - auto* data = (u8*)mmap_initialized(size, 0, String::formatted("(UE) {}", name).characters()); + auto* data = (u8*)mmap_initialized(size, 0, DeprecatedString::formatted("(UE) {}", name).characters()); auto* shadow_data = (u8*)mmap_initialized(size, 1, "MmapRegion ShadowData"); auto region = adopt_own(*new MmapRegion(base, size, prot, data, shadow_data)); region->m_name = move(name); return region; } -NonnullOwnPtr MmapRegion::create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, String name) +NonnullOwnPtr MmapRegion::create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, DeprecatedString name) { // Since we put the memory to an arbitrary location, do not pass MAP_FIXED and MAP_FIXED_NOREPLACE to the Kernel. auto real_flags = flags & ~(MAP_FIXED | MAP_FIXED_NOREPLACE); - auto* data = (u8*)mmap_with_name(nullptr, size, prot, real_flags, fd, offset, name.is_empty() ? nullptr : String::formatted("(UE) {}", name).characters()); + auto* data = (u8*)mmap_with_name(nullptr, size, prot, real_flags, fd, offset, name.is_empty() ? nullptr : DeprecatedString::formatted("(UE) {}", name).characters()); VERIFY(data != MAP_FAILED); auto* shadow_data = (u8*)mmap_initialized(size, 1, "MmapRegion ShadowData"); auto region = adopt_own(*new MmapRegion(base, size, prot, data, shadow_data)); @@ -318,10 +318,10 @@ void MmapRegion::set_prot(int prot) } } -void MmapRegion::set_name(String name) +void MmapRegion::set_name(DeprecatedString name) { m_name = move(name); - set_mmap_name(range().base().as_ptr(), range().size(), String::formatted("(UE) {}", m_name).characters()); + set_mmap_name(range().base().as_ptr(), range().size(), DeprecatedString::formatted("(UE) {}", m_name).characters()); } } diff --git a/Userland/DevTools/UserspaceEmulator/MmapRegion.h b/Userland/DevTools/UserspaceEmulator/MmapRegion.h index 62d0e503082..a4f37f45253 100644 --- a/Userland/DevTools/UserspaceEmulator/MmapRegion.h +++ b/Userland/DevTools/UserspaceEmulator/MmapRegion.h @@ -16,8 +16,8 @@ class MallocTracer; class MmapRegion final : public Region { public: - static NonnullOwnPtr create_anonymous(u32 base, u32 size, u32 prot, String name); - static NonnullOwnPtr create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, String name); + static NonnullOwnPtr create_anonymous(u32 base, u32 size, u32 prot, DeprecatedString name); + static NonnullOwnPtr create_file_backed(u32 base, u32 size, u32 prot, int flags, int fd, off_t offset, DeprecatedString name); virtual ~MmapRegion() override; virtual ValueWithShadow read8(u32 offset) override; @@ -51,8 +51,8 @@ public: MallocRegionMetadata* malloc_metadata() { return m_malloc_metadata; } void set_malloc_metadata(Badge, NonnullOwnPtr metadata) { m_malloc_metadata = move(metadata); } - String const& name() const { return m_name; } - String lib_name() const + DeprecatedString const& name() const { return m_name; } + DeprecatedString lib_name() const { if (m_name.contains("Loader.so"sv)) return "Loader.so"; @@ -61,7 +61,7 @@ public: return {}; return m_name.substring(0, *maybe_separator); } - void set_name(String name); + void set_name(DeprecatedString name); private: MmapRegion(u32 base, u32 size, int prot, u8* data, u8* shadow_data); @@ -72,7 +72,7 @@ private: bool m_malloc { false }; OwnPtr m_malloc_metadata; - String m_name; + DeprecatedString m_name; }; template<> diff --git a/Userland/DevTools/UserspaceEmulator/SoftFPU.h b/Userland/DevTools/UserspaceEmulator/SoftFPU.h index 4d3d0f4f2c2..5b61fcb9f3e 100644 --- a/Userland/DevTools/UserspaceEmulator/SoftFPU.h +++ b/Userland/DevTools/UserspaceEmulator/SoftFPU.h @@ -114,7 +114,7 @@ private: } } - String fpu_exception_string(FPU_Exception ex) + DeprecatedString fpu_exception_string(FPU_Exception ex) { switch (ex) { case FPU_Exception::StackFault: diff --git a/Userland/DevTools/UserspaceEmulator/main.cpp b/Userland/DevTools/UserspaceEmulator/main.cpp index f011b5442dd..430afeae0a9 100644 --- a/Userland/DevTools/UserspaceEmulator/main.cpp +++ b/Userland/DevTools/UserspaceEmulator/main.cpp @@ -23,7 +23,7 @@ int main(int argc, char** argv, char** env) { Vector arguments; bool pause_on_startup { false }; - String profile_dump_path; + DeprecatedString profile_dump_path; FILE* profile_output_file { nullptr }; bool enable_roi_mode { false }; bool dump_profile { false }; @@ -45,7 +45,7 @@ int main(int argc, char** argv, char** env) if (dump_profile && profile_instruction_interval == 0) profile_instruction_interval = 128; - String executable_path; + DeprecatedString executable_path; if (arguments[0].contains("/"sv)) executable_path = Core::File::real_path_for(arguments[0]); else @@ -56,10 +56,10 @@ int main(int argc, char** argv, char** env) } if (dump_profile && profile_dump_path.is_empty()) - profile_dump_path = String::formatted("{}.{}.profile", LexicalPath(executable_path).basename(), getpid()); + profile_dump_path = DeprecatedString::formatted("{}.{}.profile", LexicalPath(executable_path).basename(), getpid()); OwnPtr profile_stream; - OwnPtr> profile_strings; + OwnPtr> profile_strings; OwnPtr> profile_string_id_map; if (dump_profile) { @@ -70,20 +70,20 @@ int main(int argc, char** argv, char** env) return 1; } profile_stream = make(profile_output_file); - profile_strings = make>(); + profile_strings = make>(); profile_string_id_map = make>(); profile_stream->write_or_error(R"({"events":[)"sv.bytes()); timeval tv {}; gettimeofday(&tv, nullptr); profile_stream->write_or_error( - String::formatted( + DeprecatedString::formatted( R"~({{"type": "process_create", "parent_pid": 1, "executable": "{}", "pid": {}, "tid": {}, "timestamp": {}, "lost_samples": 0, "stack": []}})~", executable_path, getpid(), gettid(), tv.tv_sec * 1000 + tv.tv_usec / 1000) .bytes()); } - Vector environment; + Vector environment; for (int i = 0; env[i]; ++i) { environment.append(env[i]); } @@ -119,8 +119,8 @@ int main(int argc, char** argv, char** env) emulator.profile_stream().write_or_error("], \"strings\": ["sv.bytes()); if (emulator.profiler_strings().size()) { for (size_t i = 0; i < emulator.profiler_strings().size() - 1; ++i) - emulator.profile_stream().write_or_error(String::formatted("\"{}\", ", emulator.profiler_strings().at(i)).bytes()); - emulator.profile_stream().write_or_error(String::formatted("\"{}\"", emulator.profiler_strings().last()).bytes()); + emulator.profile_stream().write_or_error(DeprecatedString::formatted("\"{}\", ", emulator.profiler_strings().at(i)).bytes()); + emulator.profile_stream().write_or_error(DeprecatedString::formatted("\"{}\"", emulator.profiler_strings().last()).bytes()); } emulator.profile_stream().write_or_error("]}"sv.bytes()); } diff --git a/Userland/DynamicLoader/main.cpp b/Userland/DynamicLoader/main.cpp index 38504ab18fc..5e6c0a5d42a 100644 --- a/Userland/DynamicLoader/main.cpp +++ b/Userland/DynamicLoader/main.cpp @@ -83,7 +83,7 @@ void _entry(int argc, char** argv, char** envp) init_libc(); int main_program_fd = -1; - String main_program_path; + DeprecatedString main_program_path; bool is_secure = false; for (; auxvp->a_type != AT_NULL; ++auxvp) { if (auxvp->a_type == ELF::AuxiliaryValue::ExecFileDescriptor) { diff --git a/Userland/Games/2048/BoardView.cpp b/Userland/Games/2048/BoardView.cpp index 8d9df5a2440..f48d700a72a 100644 --- a/Userland/Games/2048/BoardView.cpp +++ b/Userland/Games/2048/BoardView.cpp @@ -45,7 +45,7 @@ void BoardView::set_board(Game::Board const* board) void BoardView::pick_font() { - String best_font_name; + DeprecatedString best_font_name; int best_font_size = -1; auto& font_database = Gfx::FontDatabase::the(); font_database.for_each_font([&](Gfx::Font const& font) { @@ -234,7 +234,7 @@ void BoardView::paint_event(GUI::PaintEvent& event) auto rect = Gfx::IntRect::centered_on(center, tile_size); painter.fill_rect(rect, background_color_for_cell(sliding_tile.value_from)); - painter.draw_text(rect, String::number(sliding_tile.value_from), font(), Gfx::TextAlignment::Center, text_color_for_cell(sliding_tile.value_from)); + painter.draw_text(rect, DeprecatedString::number(sliding_tile.value_from), font(), Gfx::TextAlignment::Center, text_color_for_cell(sliding_tile.value_from)); } } else { for (size_t column = 0; column < columns(); ++column) { @@ -249,7 +249,7 @@ void BoardView::paint_event(GUI::PaintEvent& event) auto entry = tiles[row][column]; painter.fill_rect(rect, background_color_for_cell(entry)); if (entry > 0) - painter.draw_text(rect, String::number(entry), font(), Gfx::TextAlignment::Center, text_color_for_cell(entry)); + painter.draw_text(rect, DeprecatedString::number(entry), font(), Gfx::TextAlignment::Center, text_color_for_cell(entry)); } } } diff --git a/Userland/Games/2048/Game.cpp b/Userland/Games/2048/Game.cpp index 1a1552f8f41..8076e1d8527 100644 --- a/Userland/Games/2048/Game.cpp +++ b/Userland/Games/2048/Game.cpp @@ -6,9 +6,9 @@ #include "Game.h" #include +#include #include #include -#include #include Game::Game(size_t grid_size, size_t target_tile, bool evil_ai) diff --git a/Userland/Games/2048/GameSizeDialog.cpp b/Userland/Games/2048/GameSizeDialog.cpp index 7fd537cacd6..20c21b4cef8 100644 --- a/Userland/Games/2048/GameSizeDialog.cpp +++ b/Userland/Games/2048/GameSizeDialog.cpp @@ -33,7 +33,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta board_size_spinbox->set_value(m_board_size); auto tile_value_label = main_widget.find_descendant_of_type_named("tile_value_label"); - tile_value_label->set_text(String::number(target_tile())); + tile_value_label->set_text(DeprecatedString::number(target_tile())); auto target_spinbox = main_widget.find_descendant_of_type_named("target_spinbox"); target_spinbox->set_max(Game::max_power_for_board(m_board_size)); target_spinbox->set_value(m_target_tile_power); @@ -45,7 +45,7 @@ GameSizeDialog::GameSizeDialog(GUI::Window* parent, size_t board_size, size_t ta target_spinbox->on_change = [this, tile_value_label](auto value) { m_target_tile_power = value; - tile_value_label->set_text(String::number(target_tile())); + tile_value_label->set_text(DeprecatedString::number(target_tile())); }; auto evil_ai_checkbox = main_widget.find_descendant_of_type_named("evil_ai_checkbox"); diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp index 68f09fd4ec4..d92cb70f83d 100644 --- a/Userland/Games/2048/main.cpp +++ b/Userland/Games/2048/main.cpp @@ -90,7 +90,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto update = [&]() { board_view->set_board(&game.board()); board_view->update(); - statusbar->set_text(String::formatted("Score: {}", game.score())); + statusbar->set_text(DeprecatedString::formatted("Score: {}", game.score())); }; update(); @@ -149,7 +149,7 @@ ErrorOr serenity_main(Main::Arguments arguments) case Game::MoveOutcome::Won: { update(); auto want_to_continue = GUI::MessageBox::show(window, - String::formatted("You won the game in {} turns with a score of {}. Would you like to continue?", game.turns(), game.score()), + DeprecatedString::formatted("You won the game in {} turns with a score of {}. Would you like to continue?", game.turns(), game.score()), "Congratulations!"sv, GUI::MessageBox::Type::Question, GUI::MessageBox::InputType::YesNo); @@ -162,7 +162,7 @@ ErrorOr serenity_main(Main::Arguments arguments) case Game::MoveOutcome::GameOver: update(); GUI::MessageBox::show(window, - String::formatted("You reached {} in {} turns with a score of {}", game.largest_tile(), game.turns(), game.score()), + DeprecatedString::formatted("You reached {} in {} turns with a score of {}", game.largest_tile(), game.turns(), game.score()), "You lost!"sv, GUI::MessageBox::Type::Information); start_a_new_game(); diff --git a/Userland/Games/BrickGame/BrickGame.cpp b/Userland/Games/BrickGame/BrickGame.cpp index 0ab704c671d..d969ca61d14 100644 --- a/Userland/Games/BrickGame/BrickGame.cpp +++ b/Userland/Games/BrickGame/BrickGame.cpp @@ -496,7 +496,7 @@ void BrickGame::paint_cell(GUI::Painter& painter, Gfx::IntRect rect, bool is_on) painter.fill_rect(rect, is_on ? m_front_color : m_shadow_color); } -void BrickGame::paint_text(GUI::Painter& painter, int row, String const& text) +void BrickGame::paint_text(GUI::Painter& painter, int row, DeprecatedString const& text) { auto const text_width { font().width(text) }; auto const entire_area_rect { frame_inner_rect() }; @@ -541,9 +541,9 @@ void BrickGame::paint_game(GUI::Painter& painter, Gfx::IntRect const& rect) paint_cell(painter, cell_rect(position), (*m_brick_game)[board_position]); } - paint_text(painter, 0, String::formatted("Score: {}", m_brick_game->score())); - paint_text(painter, 1, String::formatted("Level: {}", m_brick_game->level())); - paint_text(painter, 4, String::formatted("Hi-Score: {}", m_high_score)); + paint_text(painter, 0, DeprecatedString::formatted("Score: {}", m_brick_game->score())); + paint_text(painter, 1, DeprecatedString::formatted("Level: {}", m_brick_game->level())); + paint_text(painter, 4, DeprecatedString::formatted("Hi-Score: {}", m_high_score)); paint_text(painter, 12, "Next:"); auto const hint_rect = Gfx::IntRect { diff --git a/Userland/Games/BrickGame/BrickGame.h b/Userland/Games/BrickGame/BrickGame.h index 202d8898f0d..f97f569dfdc 100644 --- a/Userland/Games/BrickGame/BrickGame.h +++ b/Userland/Games/BrickGame/BrickGame.h @@ -25,7 +25,7 @@ private: virtual void keydown_event(GUI::KeyEvent&) override; virtual void timer_event(Core::TimerEvent&) override; - void paint_text(GUI::Painter&, int row, String const&); + void paint_text(GUI::Painter&, int row, DeprecatedString const&); void paint_cell(GUI::Painter&, Gfx::IntRect, bool); void paint_game(GUI::Painter&, Gfx::IntRect const&); void game_over(); diff --git a/Userland/Games/Chess/ChessWidget.cpp b/Userland/Games/Chess/ChessWidget.cpp index 939645905cb..c02fdfd5e80 100644 --- a/Userland/Games/Chess/ChessWidget.cpp +++ b/Userland/Games/Chess/ChessWidget.cpp @@ -6,8 +6,8 @@ #include "ChessWidget.h" #include "PromotionDialog.h" +#include #include -#include #include #include #include @@ -370,7 +370,7 @@ void ChessWidget::keydown_event(GUI::KeyEvent& event) update(); } -static String set_path = String("/res/icons/chess/sets/"); +static DeprecatedString set_path = DeprecatedString("/res/icons/chess/sets/"); static RefPtr get_piece(StringView set, StringView image) { @@ -521,7 +521,7 @@ void ChessWidget::playback_move(PlaybackDirection direction) update(); } -String ChessWidget::get_fen() const +DeprecatedString ChessWidget::get_fen() const { return m_playback ? m_board_playback.to_fen() : m_board.to_fen(); } @@ -547,10 +547,10 @@ void ChessWidget::import_pgn(Core::File& file) bool recursive_annotation = false; bool future_expansion = false; Chess::Color turn = Chess::Color::White; - String movetext; + DeprecatedString movetext; for (size_t j = i; j < lines.size(); j++) - movetext = String::formatted("{}{}", movetext, lines.at(i).to_string()); + movetext = DeprecatedString::formatted("{}{}", movetext, lines.at(i).to_string()); for (auto token : movetext.split(' ')) { token = token.trim_whitespace(); @@ -626,16 +626,16 @@ void ChessWidget::export_pgn(Core::File& file) const // Tag Pair Section file.write("[Event \"Casual Game\"]\n"sv); file.write("[Site \"SerenityOS Chess\"]\n"sv); - file.write(String::formatted("[Date \"{}\"]\n", Core::DateTime::now().to_string("%Y.%m.%d"sv))); + file.write(DeprecatedString::formatted("[Date \"{}\"]\n", Core::DateTime::now().to_string("%Y.%m.%d"sv))); file.write("[Round \"1\"]\n"sv); - String username(getlogin()); - const String player1 = (!username.is_empty() ? username.view() : "?"sv); - const String player2 = (!m_engine.is_null() ? "SerenityOS ChessEngine"sv : "?"sv); - file.write(String::formatted("[White \"{}\"]\n", m_side == Chess::Color::White ? player1 : player2)); - file.write(String::formatted("[Black \"{}\"]\n", m_side == Chess::Color::Black ? player1 : player2)); + DeprecatedString username(getlogin()); + const DeprecatedString player1 = (!username.is_empty() ? username.view() : "?"sv); + const DeprecatedString player2 = (!m_engine.is_null() ? "SerenityOS ChessEngine"sv : "?"sv); + file.write(DeprecatedString::formatted("[White \"{}\"]\n", m_side == Chess::Color::White ? player1 : player2)); + file.write(DeprecatedString::formatted("[Black \"{}\"]\n", m_side == Chess::Color::Black ? player1 : player2)); - file.write(String::formatted("[Result \"{}\"]\n", Chess::Board::result_to_points(m_board.game_result(), m_board.turn()))); + file.write(DeprecatedString::formatted("[Result \"{}\"]\n", Chess::Board::result_to_points(m_board.game_result(), m_board.turn()))); file.write("[WhiteElo \"?\"]\n"sv); file.write("[BlackElo \"?\"]\n"sv); file.write("[Variant \"Standard\"]\n"sv); @@ -645,13 +645,13 @@ void ChessWidget::export_pgn(Core::File& file) const // Movetext Section for (size_t i = 0, move_no = 1; i < m_board.moves().size(); i += 2, move_no++) { - const String white = m_board.moves().at(i).to_algebraic(); + const DeprecatedString white = m_board.moves().at(i).to_algebraic(); if (i + 1 < m_board.moves().size()) { - const String black = m_board.moves().at(i + 1).to_algebraic(); - file.write(String::formatted("{}. {} {} ", move_no, white, black)); + const DeprecatedString black = m_board.moves().at(i + 1).to_algebraic(); + file.write(DeprecatedString::formatted("{}. {} {} ", move_no, white, black)); } else { - file.write(String::formatted("{}. {} ", move_no, white)); + file.write(DeprecatedString::formatted("{}. {} ", move_no, white)); } } @@ -688,7 +688,7 @@ int ChessWidget::resign() set_drag_enabled(false); update(); - const String msg = Chess::Board::result_to_string(m_board.game_result(), m_board.turn()); + const DeprecatedString msg = Chess::Board::result_to_string(m_board.game_result(), m_board.turn()); GUI::MessageBox::show(window(), msg, "Game Over"sv, GUI::MessageBox::Type::Information); return 0; diff --git a/Userland/Games/Chess/ChessWidget.h b/Userland/Games/Chess/ChessWidget.h index 0a1b6db3217..cc45e76ef96 100644 --- a/Userland/Games/Chess/ChessWidget.h +++ b/Userland/Games/Chess/ChessWidget.h @@ -36,7 +36,7 @@ public: void set_side(Chess::Color side) { m_side = side; }; void set_piece_set(StringView set); - String const& piece_set() const { return m_piece_set; }; + DeprecatedString const& piece_set() const { return m_piece_set; }; Chess::Square mouse_to_square(GUI::MouseEvent& event) const; @@ -47,7 +47,7 @@ public: bool show_available_moves() const { return m_show_available_moves; } void set_show_available_moves(bool e) { m_show_available_moves = e; } - String get_fen() const; + DeprecatedString get_fen() const; void import_pgn(Core::File&); void export_pgn(Core::File&) const; @@ -56,7 +56,7 @@ public: void reset(); struct BoardTheme { - String name; + DeprecatedString name; Color dark_square_color; Color light_square_color; }; @@ -120,7 +120,7 @@ private: Color m_marking_secondary_color { Color::from_argb(0x6655dd55) }; Chess::Color m_side { Chess::Color::White }; HashMap> m_pieces; - String m_piece_set; + DeprecatedString m_piece_set; Chess::Square m_moving_square { 50, 50 }; Gfx::IntPoint m_drag_point; bool m_dragging_piece { false }; diff --git a/Userland/Games/Chess/Engine.cpp b/Userland/Games/Chess/Engine.cpp index 5bc0f7626e8..e28c9b08ee8 100644 --- a/Userland/Games/Chess/Engine.cpp +++ b/Userland/Games/Chess/Engine.cpp @@ -36,7 +36,7 @@ Engine::Engine(StringView command) posix_spawn_file_actions_adddup2(&file_actions, wpipefds[0], STDIN_FILENO); posix_spawn_file_actions_adddup2(&file_actions, rpipefds[1], STDOUT_FILENO); - String cstr(command); + DeprecatedString cstr(command); char const* argv[] = { cstr.characters(), nullptr }; if (posix_spawnp(&m_pid, cstr.characters(), &file_actions, nullptr, const_cast(argv), environ) < 0) { perror("posix_spawnp"); diff --git a/Userland/Games/Chess/main.cpp b/Userland/Games/Chess/main.cpp index bfd497fdb12..4ea167e4c0d 100644 --- a/Userland/Games/Chess/main.cpp +++ b/Userland/Games/Chess/main.cpp @@ -169,7 +169,7 @@ ErrorOr serenity_main(Main::Arguments arguments) } }); engines_action_group.add_action(*action); - if (engine == String("Human")) + if (engine == DeprecatedString("Human")) action->set_checked(true); TRY(engine_submenu->try_add_action(*action)); diff --git a/Userland/Games/FlappyBug/Game.cpp b/Userland/Games/FlappyBug/Game.cpp index e8fc4946bd8..df15cbbb178 100644 --- a/Userland/Games/FlappyBug/Game.cpp +++ b/Userland/Games/FlappyBug/Game.cpp @@ -71,9 +71,9 @@ void Game::paint_event(GUI::PaintEvent& event) painter.draw_scaled_bitmap(enclosing_int_rect(m_bug.rect()), *m_bug.current_bitmap(), m_bug.flapping_bitmap->rect()); if (m_active) { - painter.draw_text(m_score_rect, String::formatted("{:.0}", m_difficulty), Gfx::TextAlignment::TopLeft, Color::White); + painter.draw_text(m_score_rect, DeprecatedString::formatted("{:.0}", m_difficulty), Gfx::TextAlignment::TopLeft, Color::White); } else if (m_high_score.has_value()) { - auto message = String::formatted("Your score: {:.0}\nHigh score: {:.0}\n\n{}", m_last_score, m_high_score.value(), m_restart_cooldown < 0 ? "Press any key to play again" : " "); + auto message = DeprecatedString::formatted("Your score: {:.0}\nHigh score: {:.0}\n\n{}", m_last_score, m_high_score.value(), m_restart_cooldown < 0 ? "Press any key to play again" : " "); painter.draw_text(m_text_rect, message, Gfx::TextAlignment::Center, Color::White); } else { painter.draw_text(m_text_rect, "Press any key to start"sv, Gfx::TextAlignment::Center, Color::White); diff --git a/Userland/Games/Flood/SettingsDialog.cpp b/Userland/Games/Flood/SettingsDialog.cpp index 1d7a97bf29b..98335612ceb 100644 --- a/Userland/Games/Flood/SettingsDialog.cpp +++ b/Userland/Games/Flood/SettingsDialog.cpp @@ -46,7 +46,7 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, size_t board_rows, size_t bo m_board_columns = value; }; - static Vector color_scheme_names; + static Vector color_scheme_names; color_scheme_names.clear(); Core::DirIterator iterator("/res/terminal-colors", Core::DirIterator::SkipParentAndBaseDir); while (iterator.has_next()) { @@ -57,7 +57,7 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, size_t board_rows, size_t bo auto color_scheme_combo = main_widget.find_descendant_of_type_named("color_scheme_combo"); color_scheme_combo->set_only_allow_values_from_model(true); - color_scheme_combo->set_model(*GUI::ItemListModel::create(color_scheme_names)); + color_scheme_combo->set_model(*GUI::ItemListModel::create(color_scheme_names)); color_scheme_combo->set_selected_index(color_scheme_names.find_first_index(m_color_scheme).value()); color_scheme_combo->set_enabled(color_scheme_names.size() > 1); color_scheme_combo->on_change = [&](auto&, const GUI::ModelIndex& index) { diff --git a/Userland/Games/Flood/SettingsDialog.h b/Userland/Games/Flood/SettingsDialog.h index 4b40c8223ec..b2438029dbd 100644 --- a/Userland/Games/Flood/SettingsDialog.h +++ b/Userland/Games/Flood/SettingsDialog.h @@ -21,5 +21,5 @@ private: size_t m_board_rows; size_t m_board_columns; - String m_color_scheme; + DeprecatedString m_color_scheme; }; diff --git a/Userland/Games/Flood/main.cpp b/Userland/Games/Flood/main.cpp index 8361258368e..69bca1deb61 100644 --- a/Userland/Games/Flood/main.cpp +++ b/Userland/Games/Flood/main.cpp @@ -42,10 +42,10 @@ static ErrorOr> get_color_scheme_from_string(StringView name) "White"sv }; - auto const path = String::formatted("/res/terminal-colors/{}.ini", name); + auto const path = DeprecatedString::formatted("/res/terminal-colors/{}.ini", name); auto color_config_or_error = Core::ConfigFile::open(path); if (color_config_or_error.is_error()) { - return Error::from_string_view(String::formatted("Unable to read color scheme file '{}': {}", path, color_config_or_error.error())); + return Error::from_string_view(DeprecatedString::formatted("Unable to read color scheme file '{}': {}", path, color_config_or_error.error())); } auto const color_config = color_config_or_error.release_value(); Vector colors; @@ -118,7 +118,7 @@ ErrorOr serenity_main(Main::Arguments arguments) size_t board_rows = Config::read_i32("Flood"sv, ""sv, "board_rows"sv, 16); size_t board_columns = Config::read_i32("Flood"sv, ""sv, "board_columns"sv, 16); - String color_scheme = Config::read_string("Flood"sv, ""sv, "color_scheme"sv, "Default"sv); + DeprecatedString color_scheme = Config::read_string("Flood"sv, ""sv, "color_scheme"sv, "Default"sv); Config::write_i32("Flood"sv, ""sv, "board_rows"sv, board_rows); Config::write_i32("Flood"sv, ""sv, "board_columns"sv, board_columns); @@ -155,7 +155,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto update = [&]() { board_widget->update(); - statusbar->set_text(String::formatted("Moves remaining: {}", ai_moves - moves_made)); + statusbar->set_text(DeprecatedString::formatted("Moves remaining: {}", ai_moves - moves_made)); }; update(); @@ -198,12 +198,12 @@ ErrorOr serenity_main(Main::Arguments arguments) board_widget->board()->update_values(); update(); if (board_widget->board()->is_flooded()) { - String dialog_text("You have tied with the AI."sv); + DeprecatedString dialog_text("You have tied with the AI."sv); auto dialog_title("Congratulations!"sv); if (ai_moves - moves_made == 1) dialog_text = "You defeated the AI by 1 move."sv; else if (ai_moves - moves_made > 1) - dialog_text = String::formatted("You defeated the AI by {} moves.", ai_moves - moves_made); + dialog_text = DeprecatedString::formatted("You defeated the AI by {} moves.", ai_moves - moves_made); else dialog_title = "Game over!"sv; GUI::MessageBox::show(window, diff --git a/Userland/Games/GameOfLife/BoardWidget.cpp b/Userland/Games/GameOfLife/BoardWidget.cpp index 6daffc53903..0dc944f0502 100644 --- a/Userland/Games/GameOfLife/BoardWidget.cpp +++ b/Userland/Games/GameOfLife/BoardWidget.cpp @@ -255,7 +255,7 @@ void BoardWidget::place_pattern(size_t row, size_t column) void BoardWidget::setup_patterns() { - auto add_pattern = [&](String name, NonnullOwnPtr pattern) { + auto add_pattern = [&](DeprecatedString name, NonnullOwnPtr pattern) { auto action = GUI::Action::create(move(name), [this, pattern = pattern.ptr()](const GUI::Action&) { on_pattern_selection(pattern); }); @@ -263,29 +263,29 @@ void BoardWidget::setup_patterns() m_patterns.append(move(pattern)); }; - Vector blinker = { + Vector blinker = { "OOO" }; - Vector toad = { + Vector toad = { ".OOO", "OOO." }; - Vector glider = { + Vector glider = { ".O.", "..O", "OOO", }; - Vector lightweight_spaceship = { + Vector lightweight_spaceship = { ".OO..", "OOOO.", "OO.OO", "..OO." }; - Vector middleweight_spaceship = { + Vector middleweight_spaceship = { ".OOOOO", "O....O", ".....O", @@ -293,7 +293,7 @@ void BoardWidget::setup_patterns() "..O..." }; - Vector heavyweight_spaceship = { + Vector heavyweight_spaceship = { "..OO...", "O....O.", "......O", @@ -301,9 +301,9 @@ void BoardWidget::setup_patterns() ".OOOOOO" }; - Vector infinite_1 = { "OOOOOOOO.OOOOO...OOO......OOOOOOO.OOOOO" }; + Vector infinite_1 = { "OOOOOOOO.OOOOO...OOO......OOOOOOO.OOOOO" }; - Vector infinite_2 = { + Vector infinite_2 = { "......O.", "....O.OO", "....O.O.", @@ -312,7 +312,7 @@ void BoardWidget::setup_patterns() "O.O....." }; - Vector infinite_3 = { + Vector infinite_3 = { "OOO.O", "O....", "...OO", @@ -320,7 +320,7 @@ void BoardWidget::setup_patterns() "O.O.O" }; - Vector simkin_glider_gun = { + Vector simkin_glider_gun = { "OO.....OO........................", "OO.....OO........................", ".................................", @@ -343,7 +343,7 @@ void BoardWidget::setup_patterns() ".....................OOO.........", ".......................O........." }; - Vector gosper_glider_gun = { + Vector gosper_glider_gun = { "........................O...........", "......................O.O...........", "............OO......OO............OO", @@ -355,19 +355,19 @@ void BoardWidget::setup_patterns() "............OO......................" }; - Vector r_pentomino = { + Vector r_pentomino = { ".OO", "OO.", ".O." }; - Vector diehard = { + Vector diehard = { "......O.", "OO......", ".O...OOO" }; - Vector acorn = { + Vector acorn = { ".O.....", "...O...", "OO..OOO" diff --git a/Userland/Games/GameOfLife/Pattern.cpp b/Userland/Games/GameOfLife/Pattern.cpp index 5c26c6dc849..e2a2c32d6fd 100644 --- a/Userland/Games/GameOfLife/Pattern.cpp +++ b/Userland/Games/GameOfLife/Pattern.cpp @@ -6,13 +6,13 @@ */ #include "Pattern.h" -#include +#include #include #include #include #include -Pattern::Pattern(Vector pattern) +Pattern::Pattern(Vector pattern) { m_pattern = move(pattern); } @@ -24,7 +24,7 @@ void Pattern::set_action(GUI::Action* action) void Pattern::rotate_clockwise() { - Vector rotated; + Vector rotated; for (size_t i = 0; i < m_pattern.first().length(); i++) { StringBuilder builder; for (int j = m_pattern.size() - 1; j >= 0; j--) { diff --git a/Userland/Games/GameOfLife/Pattern.h b/Userland/Games/GameOfLife/Pattern.h index c7b15149637..9a445a4d566 100644 --- a/Userland/Games/GameOfLife/Pattern.h +++ b/Userland/Games/GameOfLife/Pattern.h @@ -14,13 +14,13 @@ class Pattern final { public: - Pattern(Vector); - Vector pattern() { return m_pattern; }; + Pattern(Vector); + Vector pattern() { return m_pattern; }; GUI::Action* action() { return m_action; } void set_action(GUI::Action*); void rotate_clockwise(); private: RefPtr m_action; - Vector m_pattern; + Vector m_pattern; }; diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index 36893eebc21..58ec70bdcbd 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -162,7 +162,7 @@ void Game::show_score_card(bool game_over) score_dialog->exec(); } -void Game::setup(String player_name, int hand_number) +void Game::setup(DeprecatedString player_name, int hand_number) { m_players[0].name = move(player_name); @@ -409,7 +409,7 @@ void Game::let_player_play_card() if (&player == &m_players[0]) on_status_change("Select a card to play."); else - on_status_change(String::formatted("Waiting for {} to play a card...", player)); + on_status_change(DeprecatedString::formatted("Waiting for {} to play a card...", player)); if (player.is_human) { m_human_can_play = true; @@ -618,7 +618,7 @@ void Game::play_card(Player& player, size_t card_index) 0); } -bool Game::is_valid_play(Player& player, Card& card, String* explanation) const +bool Game::is_valid_play(Player& player, Card& card, DeprecatedString* explanation) const { // First card must be 2 of Clubs. if (m_trick_number == 0 && m_trick.is_empty()) { @@ -691,14 +691,14 @@ void Game::card_clicked_during_passing(size_t, Card& card) void Game::card_clicked_during_play(size_t card_index, Card& card) { - String explanation; + DeprecatedString explanation; if (!is_valid_play(m_players[0], card, &explanation)) { if (m_inverted_card) m_inverted_card->set_inverted(false); card.set_inverted(true); update(card.rect()); m_inverted_card = card; - on_status_change(String::formatted("You can't play this card: {}", explanation)); + on_status_change(DeprecatedString::formatted("You can't play this card: {}", explanation)); continue_game_after_delay(); return; } diff --git a/Userland/Games/Hearts/Game.h b/Userland/Games/Hearts/Game.h index 6d5582f1108..823a53b5b33 100644 --- a/Userland/Games/Hearts/Game.h +++ b/Userland/Games/Hearts/Game.h @@ -26,9 +26,9 @@ public: virtual ~Game() override = default; - void setup(String player_name, int hand_number = 0); + void setup(DeprecatedString player_name, int hand_number = 0); - Function on_status_change; + Function on_status_change; private: Game(); @@ -41,7 +41,7 @@ private: void play_card(Player& player, size_t card_index); bool are_hearts_broken() const; - bool is_valid_play(Player& player, Card& card, String* explanation = nullptr) const; + bool is_valid_play(Player& player, Card& card, DeprecatedString* explanation = nullptr) const; void let_player_play_card(); void continue_game_after_delay(int interval_ms = 750); void advance_game(); diff --git a/Userland/Games/Hearts/Player.h b/Userland/Games/Hearts/Player.h index 4d573eba52a..9c6746728f1 100644 --- a/Userland/Games/Hearts/Player.h +++ b/Userland/Games/Hearts/Player.h @@ -55,7 +55,7 @@ public: Gfx::IntRect name_position; Gfx::TextAlignment name_alignment; Gfx::IntPoint taken_cards_target; - String name; + DeprecatedString name; bool is_human { false }; }; diff --git a/Userland/Games/Hearts/ScoreCard.cpp b/Userland/Games/Hearts/ScoreCard.cpp index 68d872b2ce5..23251a5d989 100644 --- a/Userland/Games/Hearts/ScoreCard.cpp +++ b/Userland/Games/Hearts/ScoreCard.cpp @@ -70,7 +70,7 @@ void ScoreCard::paint_event(GUI::PaintEvent& event) text_color); for (int score_index = 0; score_index < (int)player.scores.size(); score_index++) { auto text_rect = cell_rect(player_index, 1 + score_index); - auto score_text = String::formatted("{}", player.scores[score_index]); + auto score_text = DeprecatedString::formatted("{}", player.scores[score_index]); auto score_text_width = font.width(score_text); if (score_index != (int)player.scores.size() - 1) { painter.draw_line( diff --git a/Userland/Games/Hearts/SettingsDialog.cpp b/Userland/Games/Hearts/SettingsDialog.cpp index c9e185cdedb..f218d9b3370 100644 --- a/Userland/Games/Hearts/SettingsDialog.cpp +++ b/Userland/Games/Hearts/SettingsDialog.cpp @@ -10,7 +10,7 @@ #include #include -SettingsDialog::SettingsDialog(GUI::Window* parent, String player_name) +SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name) : GUI::Dialog(parent) , m_player_name(move(player_name)) { diff --git a/Userland/Games/Hearts/SettingsDialog.h b/Userland/Games/Hearts/SettingsDialog.h index 6f0648a5f0f..1933537960b 100644 --- a/Userland/Games/Hearts/SettingsDialog.h +++ b/Userland/Games/Hearts/SettingsDialog.h @@ -12,10 +12,10 @@ class SettingsDialog : public GUI::Dialog { C_OBJECT(SettingsDialog) public: - String const& player_name() const { return m_player_name; } + DeprecatedString const& player_name() const { return m_player_name; } private: - SettingsDialog(GUI::Window* parent, String player_name); + SettingsDialog(GUI::Window* parent, DeprecatedString player_name); - String m_player_name { "Gunnar" }; + DeprecatedString m_player_name { "Gunnar" }; }; diff --git a/Userland/Games/Hearts/main.cpp b/Userland/Games/Hearts/main.cpp index f3109c37969..0b05ed00cfd 100644 --- a/Userland/Games/Hearts/main.cpp +++ b/Userland/Games/Hearts/main.cpp @@ -58,7 +58,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto& statusbar = *widget->find_descendant_of_type_named("statusbar"); statusbar.set_text(0, "Score: 0"); - String player_name = Config::read_string("Hearts"sv, ""sv, "player_name"sv, "Gunnar"sv); + DeprecatedString player_name = Config::read_string("Hearts"sv, ""sv, "player_name"sv, "Gunnar"sv); game.on_status_change = [&](const AK::StringView& status) { statusbar.set_override_text(status); diff --git a/Userland/Games/MasterWord/WordGame.cpp b/Userland/Games/MasterWord/WordGame.cpp index 7791177d900..a1df9313505 100644 --- a/Userland/Games/MasterWord/WordGame.cpp +++ b/Userland/Games/MasterWord/WordGame.cpp @@ -36,7 +36,7 @@ void WordGame::reset() if (maybe_word.has_value()) m_current_word = maybe_word.value(); else { - GUI::MessageBox::show(window(), String::formatted("Could not get a random {} letter word. Defaulting to 5.", m_num_letters), "MasterWord"sv); + GUI::MessageBox::show(window(), DeprecatedString::formatted("Could not get a random {} letter word. Defaulting to 5.", m_num_letters), "MasterWord"sv); if (m_num_letters != 5) { m_num_letters = 5; reset(); @@ -47,7 +47,7 @@ void WordGame::reset() void WordGame::pick_font() { - String best_font_name; + DeprecatedString best_font_name; auto best_font_size = -1; auto& font_database = Gfx::FontDatabase::the(); font_database.for_each_font([&](Gfx::Font const& font) { @@ -74,7 +74,7 @@ void WordGame::keydown_event(GUI::KeyEvent& event) { // If we can still add a letter and the key was alpha if (m_current_guess.length() < m_num_letters && is_ascii_alpha(event.code_point())) { - m_current_guess = String::formatted("{}{}", m_current_guess, event.text().to_uppercase()); + m_current_guess = DeprecatedString::formatted("{}{}", m_current_guess, event.text().to_uppercase()); m_last_word_not_in_dictionary = false; } // If backspace pressed and already have some letters entered @@ -93,7 +93,7 @@ void WordGame::keydown_event(GUI::KeyEvent& event) GUI::MessageBox::show(window(), "You win!"sv, "MasterWord"sv); reset(); } else if (m_guesses.size() == m_max_guesses) { - GUI::MessageBox::show(window(), String::formatted("You lose!\nThe word was {}", m_current_word), "MasterWord"sv); + GUI::MessageBox::show(window(), DeprecatedString::formatted("You lose!\nThe word was {}", m_current_word), "MasterWord"sv); reset(); } } else { @@ -180,7 +180,7 @@ void WordGame::read_words() } } -Optional WordGame::random_word(size_t length) +Optional WordGame::random_word(size_t length) { auto words_for_length = m_words.get(length); if (words_for_length.has_value()) { diff --git a/Userland/Games/MasterWord/WordGame.h b/Userland/Games/MasterWord/WordGame.h index 02cf32e4b98..b7f723404dd 100644 --- a/Userland/Games/MasterWord/WordGame.h +++ b/Userland/Games/MasterWord/WordGame.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include @@ -24,7 +24,7 @@ public: void set_max_guesses(size_t max_guesses); Gfx::IntSize game_size() const; - Optional random_word(size_t length); + Optional random_word(size_t length); size_t shortest_word(); size_t longest_word(); bool is_checking_guesses() const; @@ -67,13 +67,13 @@ private: }; struct Guess { - AK::String text; + AK::DeprecatedString text; AK::Vector letter_states; }; AK::Vector m_guesses; - AK::String m_current_guess; - AK::String m_current_word; + AK::DeprecatedString m_current_guess; + AK::DeprecatedString m_current_word; - HashMap> m_words; + HashMap> m_words; }; diff --git a/Userland/Games/MasterWord/main.cpp b/Userland/Games/MasterWord/main.cpp index 9f26e3344d4..5b4ec79b3ef 100644 --- a/Userland/Games/MasterWord/main.cpp +++ b/Userland/Games/MasterWord/main.cpp @@ -69,11 +69,11 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(settings_menu->try_add_action(GUI::Action::create("Set &Word Length", [&](auto&) { auto word_length = Config::read_i32("MasterWord"sv, ""sv, "word_length"sv, 5); - auto word_length_string = String::number(word_length); + auto word_length_string = DeprecatedString::number(word_length); if (GUI::InputBox::show(window, word_length_string, "Word length:"sv, "MasterWord"sv) == GUI::InputBox::ExecResult::OK && !word_length_string.is_empty()) { auto maybe_word_length = word_length_string.template to_uint(); if (!maybe_word_length.has_value() || maybe_word_length.value() < shortest_word || maybe_word_length.value() > longest_word) { - GUI::MessageBox::show(window, String::formatted("Please enter a number between {} and {}.", shortest_word, longest_word), "MasterWord"sv); + GUI::MessageBox::show(window, DeprecatedString::formatted("Please enter a number between {} and {}.", shortest_word, longest_word), "MasterWord"sv); return; } @@ -85,7 +85,7 @@ ErrorOr serenity_main(Main::Arguments arguments) }))); TRY(settings_menu->try_add_action(GUI::Action::create("Set &Number Of Guesses", [&](auto&) { auto max_guesses = Config::read_i32("MasterWord"sv, ""sv, "max_guesses"sv, 5); - auto max_guesses_string = String::number(max_guesses); + auto max_guesses_string = DeprecatedString::number(max_guesses); if (GUI::InputBox::show(window, max_guesses_string, "Maximum number of guesses:"sv, "MasterWord"sv) == GUI::InputBox::ExecResult::OK && !max_guesses_string.is_empty()) { auto maybe_max_guesses = max_guesses_string.template to_uint(); if (!maybe_max_guesses.has_value() || maybe_max_guesses.value() < 1 || maybe_max_guesses.value() > 20) { diff --git a/Userland/Games/Minesweeper/Field.cpp b/Userland/Games/Minesweeper/Field.cpp index 01059d69589..530cab42ce1 100644 --- a/Userland/Games/Minesweeper/Field.cpp +++ b/Userland/Games/Minesweeper/Field.cpp @@ -127,7 +127,7 @@ Field::Field(GUI::Label& flag_label, GUI::Label& time_label, GUI::Button& face_b m_good_face_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-good.png"sv).release_value_but_fixme_should_propagate_errors(); m_bad_face_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/minesweeper/face-bad.png"sv).release_value_but_fixme_should_propagate_errors(); for (int i = 0; i < 8; ++i) - m_number_bitmap[i] = Gfx::Bitmap::try_load_from_file(String::formatted("/res/icons/minesweeper/{}.png", i + 1)).release_value_but_fixme_should_propagate_errors(); + m_number_bitmap[i] = Gfx::Bitmap::try_load_from_file(DeprecatedString::formatted("/res/icons/minesweeper/{}.png", i + 1)).release_value_but_fixme_should_propagate_errors(); // Square with mine will be filled with background color later, i.e. red m_mine_palette.set_color(Gfx::ColorRole::Base, Color::from_rgb(0xff4040)); @@ -202,7 +202,7 @@ void Field::reset() m_time_elapsed = 0; m_time_label.set_text("00:00"); m_flags_left = m_mine_count; - m_flag_label.set_text(String::number(m_flags_left)); + m_flag_label.set_text(DeprecatedString::number(m_flags_left)); m_timer->stop(); set_greedy_for_hits(false); set_face(Face::Default); @@ -415,7 +415,7 @@ void Field::set_flag(Square& square, bool flag) } square.has_flag = flag; - m_flag_label.set_text(String::number(m_flags_left)); + m_flag_label.set_text(DeprecatedString::number(m_flags_left)); square.button->set_icon(square.has_flag ? m_flag_bitmap : nullptr); square.button->update(); } @@ -427,7 +427,7 @@ void Field::on_square_middle_clicked(Square& square) if (square.has_flag) { ++m_flags_left; square.has_flag = false; - m_flag_label.set_text(String::number(m_flags_left)); + m_flag_label.set_text(DeprecatedString::number(m_flags_left)); } square.is_considering = !square.is_considering; square.button->set_icon(square.is_considering ? m_consider_bitmap : nullptr); diff --git a/Userland/Games/Snake/SnakeGame.cpp b/Userland/Games/Snake/SnakeGame.cpp index 1afc46a39e2..f826081aadd 100644 --- a/Userland/Games/Snake/SnakeGame.cpp +++ b/Userland/Games/Snake/SnakeGame.cpp @@ -50,7 +50,7 @@ SnakeGame::SnakeGame() reset(); m_high_score = Config::read_i32("Snake"sv, "Snake"sv, "HighScore"sv, 0); - m_high_score_text = String::formatted("Best: {}", m_high_score); + m_high_score_text = DeprecatedString::formatted("Best: {}", m_high_score); } void SnakeGame::reset() @@ -148,11 +148,11 @@ void SnakeGame::timer_event(Core::TimerEvent&) if (m_head == m_fruit) { ++m_length; ++m_score; - m_score_text = String::formatted("Score: {}", m_score); + m_score_text = DeprecatedString::formatted("Score: {}", m_score); if (m_score > m_high_score) { m_is_new_high_score = true; m_high_score = m_score; - m_high_score_text = String::formatted("Best: {}", m_high_score); + m_high_score_text = DeprecatedString::formatted("Best: {}", m_high_score); update(high_score_rect()); Config::write_i32("Snake"sv, "Snake"sv, "HighScore"sv, m_high_score); } diff --git a/Userland/Games/Snake/SnakeGame.h b/Userland/Games/Snake/SnakeGame.h index 75cec5f3de0..32e08ff5cdf 100644 --- a/Userland/Games/Snake/SnakeGame.h +++ b/Userland/Games/Snake/SnakeGame.h @@ -65,9 +65,9 @@ private: size_t m_length { 0 }; unsigned m_score { 0 }; - String m_score_text; + DeprecatedString m_score_text; unsigned m_high_score { 0 }; - String m_high_score_text; + DeprecatedString m_high_score_text; bool m_is_new_high_score { false }; NonnullRefPtrVector m_food_bitmaps; diff --git a/Userland/Games/Solitaire/main.cpp b/Userland/Games/Solitaire/main.cpp index 7d324fe5023..2d52635479a 100644 --- a/Userland/Games/Solitaire/main.cpp +++ b/Userland/Games/Solitaire/main.cpp @@ -83,7 +83,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto& statusbar = *widget->find_descendant_of_type_named("statusbar"); statusbar.set_text(0, "Score: 0"); - statusbar.set_text(1, String::formatted("High Score: {}", high_score())); + statusbar.set_text(1, DeprecatedString::formatted("High Score: {}", high_score())); statusbar.set_text(2, "Time: 00:00:00"); app->on_action_enter = [&](GUI::Action& action) { @@ -98,7 +98,7 @@ ErrorOr serenity_main(Main::Arguments arguments) }; game.on_score_update = [&](uint32_t score) { - statusbar.set_text(0, String::formatted("Score: {}", score)); + statusbar.set_text(0, DeprecatedString::formatted("Score: {}", score)); }; uint64_t seconds_elapsed = 0; @@ -110,7 +110,7 @@ ErrorOr serenity_main(Main::Arguments arguments) uint64_t minutes = (seconds_elapsed / 60) % 60; uint64_t seconds = seconds_elapsed % 60; - statusbar.set_text(2, String::formatted("Time: {:02}:{:02}:{:02}", hours, minutes, seconds)); + statusbar.set_text(2, DeprecatedString::formatted("Time: {:02}:{:02}:{:02}", hours, minutes, seconds)); }); game.on_game_start = [&]() { @@ -125,13 +125,13 @@ ErrorOr serenity_main(Main::Arguments arguments) if (reason == Solitaire::GameOverReason::Victory) { if (seconds_elapsed >= 30) { uint32_t bonus = (20'000 / seconds_elapsed) * 35; - statusbar.set_text(0, String::formatted("Score: {} (Bonus: {})", score, bonus)); + statusbar.set_text(0, DeprecatedString::formatted("Score: {} (Bonus: {})", score, bonus)); score += bonus; } if (score > high_score()) { update_high_score(score); - statusbar.set_text(1, String::formatted("High Score: {}", score)); + statusbar.set_text(1, DeprecatedString::formatted("High Score: {}", score)); } } statusbar.set_text(2, "Timer starts after your first move"); @@ -160,7 +160,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto single_card_draw_action = GUI::Action::create_checkable("&Single Card Draw", [&](auto&) { update_mode(Solitaire::Mode::SingleCardDraw); - statusbar.set_text(1, String::formatted("High Score: {}", high_score())); + statusbar.set_text(1, DeprecatedString::formatted("High Score: {}", high_score())); game.setup(mode); }); single_card_draw_action->set_checked(mode == Solitaire::Mode::SingleCardDraw); @@ -169,7 +169,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto three_card_draw_action = GUI::Action::create_checkable("&Three Card Draw", [&](auto&) { update_mode(Solitaire::Mode::ThreeCardDraw); - statusbar.set_text(1, String::formatted("High Score: {}", high_score())); + statusbar.set_text(1, DeprecatedString::formatted("High Score: {}", high_score())); game.setup(mode); }); three_card_draw_action->set_checked(mode == Solitaire::Mode::ThreeCardDraw); diff --git a/Userland/Games/Spider/main.cpp b/Userland/Games/Spider/main.cpp index 3f4ae68b419..4a1d8d8f140 100644 --- a/Userland/Games/Spider/main.cpp +++ b/Userland/Games/Spider/main.cpp @@ -29,13 +29,13 @@ enum class StatisticDisplay : u8 { __Count }; -static String format_seconds(uint64_t seconds_elapsed) +static DeprecatedString format_seconds(uint64_t seconds_elapsed) { uint64_t hours = seconds_elapsed / 3600; uint64_t minutes = (seconds_elapsed / 60) % 60; uint64_t seconds = seconds_elapsed % 60; - return String::formatted("{:02}:{:02}:{:02}", hours, minutes, seconds); + return DeprecatedString::formatted("{:02}:{:02}:{:02}", hours, minutes, seconds); } ErrorOr serenity_main(Main::Arguments arguments) @@ -126,10 +126,10 @@ ErrorOr serenity_main(Main::Arguments arguments) auto reset_statistic_status = [&]() { switch (statistic_display) { case StatisticDisplay::HighScore: - statusbar.set_text(1, String::formatted("High Score: {}", high_score())); + statusbar.set_text(1, DeprecatedString::formatted("High Score: {}", high_score())); break; case StatisticDisplay::BestTime: - statusbar.set_text(1, String::formatted("Best Time: {}", format_seconds(best_time()))); + statusbar.set_text(1, DeprecatedString::formatted("Best Time: {}", format_seconds(best_time()))); break; default: VERIFY_NOT_REACHED(); @@ -152,7 +152,7 @@ ErrorOr serenity_main(Main::Arguments arguments) }; game.on_score_update = [&](uint32_t score) { - statusbar.set_text(0, String::formatted("Score: {}", score)); + statusbar.set_text(0, DeprecatedString::formatted("Score: {}", score)); }; uint64_t seconds_elapsed = 0; @@ -160,7 +160,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto timer = Core::Timer::create_repeating(1000, [&]() { ++seconds_elapsed; - statusbar.set_text(2, String::formatted("Time: {}", format_seconds(seconds_elapsed))); + statusbar.set_text(2, DeprecatedString::formatted("Time: {}", format_seconds(seconds_elapsed))); }); game.on_game_start = [&]() { diff --git a/Userland/Libraries/LibArchive/Tar.cpp b/Userland/Libraries/LibArchive/Tar.cpp index a91fc1fdffd..ebb968da1ee 100644 --- a/Userland/Libraries/LibArchive/Tar.cpp +++ b/Userland/Libraries/LibArchive/Tar.cpp @@ -27,7 +27,7 @@ unsigned TarFileHeader::expected_checksum() const void TarFileHeader::calculate_checksum() { memset(m_checksum, ' ', sizeof(m_checksum)); - VERIFY(String::formatted("{:06o}", expected_checksum()).copy_characters_to_buffer(m_checksum, sizeof(m_checksum))); + VERIFY(DeprecatedString::formatted("{:06o}", expected_checksum()).copy_characters_to_buffer(m_checksum, sizeof(m_checksum))); } bool TarFileHeader::is_zero_block() const diff --git a/Userland/Libraries/LibArchive/Tar.h b/Userland/Libraries/LibArchive/Tar.h index 6600be810c1..c5741dc6de1 100644 --- a/Userland/Libraries/LibArchive/Tar.h +++ b/Userland/Libraries/LibArchive/Tar.h @@ -8,7 +8,7 @@ #pragma once -#include +#include #include #include #include @@ -84,7 +84,7 @@ static void set_field(char (&field)[N], TSource&& source) template static void set_octal_field(char (&field)[N], TSource&& source) { - set_field(field, String::formatted("{:o}", forward(source))); + set_field(field, DeprecatedString::formatted("{:o}", forward(source))); } class [[gnu::packed]] TarFileHeader { diff --git a/Userland/Libraries/LibArchive/TarStream.cpp b/Userland/Libraries/LibArchive/TarStream.cpp index 7810d0bc525..3a967d3ea6b 100644 --- a/Userland/Libraries/LibArchive/TarStream.cpp +++ b/Userland/Libraries/LibArchive/TarStream.cpp @@ -142,12 +142,12 @@ TarOutputStream::TarOutputStream(OutputStream& stream) { } -void TarOutputStream::add_directory(String const& path, mode_t mode) +void TarOutputStream::add_directory(DeprecatedString const& path, mode_t mode) { VERIFY(!m_finished); TarFileHeader header {}; header.set_size(0); - header.set_filename_and_prefix(String::formatted("{}/", path)); // Old tar implementations assume directory names end with a / + header.set_filename_and_prefix(DeprecatedString::formatted("{}/", path)); // Old tar implementations assume directory names end with a / header.set_type_flag(TarFileType::Directory); header.set_mode(mode); header.set_magic(gnu_magic); @@ -158,7 +158,7 @@ void TarOutputStream::add_directory(String const& path, mode_t mode) VERIFY(m_stream.write_or_error(Bytes { &padding, block_size - sizeof(header) })); } -void TarOutputStream::add_file(String const& path, mode_t mode, ReadonlyBytes bytes) +void TarOutputStream::add_file(DeprecatedString const& path, mode_t mode, ReadonlyBytes bytes) { VERIFY(!m_finished); TarFileHeader header {}; @@ -179,7 +179,7 @@ void TarOutputStream::add_file(String const& path, mode_t mode, ReadonlyBytes by VERIFY(m_stream.write_or_error(ReadonlyBytes { &padding, block_size - (n_written % block_size) })); } -void TarOutputStream::add_link(String const& path, mode_t mode, StringView link_name) +void TarOutputStream::add_link(DeprecatedString const& path, mode_t mode, StringView link_name) { VERIFY(!m_finished); TarFileHeader header {}; diff --git a/Userland/Libraries/LibArchive/TarStream.h b/Userland/Libraries/LibArchive/TarStream.h index d779ea55fe0..0f967807b24 100644 --- a/Userland/Libraries/LibArchive/TarStream.h +++ b/Userland/Libraries/LibArchive/TarStream.h @@ -59,9 +59,9 @@ private: class TarOutputStream { public: TarOutputStream(OutputStream&); - void add_file(String const& path, mode_t, ReadonlyBytes); - void add_link(String const& path, mode_t, StringView); - void add_directory(String const& path, mode_t); + void add_file(DeprecatedString const& path, mode_t, ReadonlyBytes); + void add_link(DeprecatedString const& path, mode_t, StringView); + void add_directory(DeprecatedString const& path, mode_t); void finish(); private: diff --git a/Userland/Libraries/LibArchive/Zip.cpp b/Userland/Libraries/LibArchive/Zip.cpp index 024e139715d..bf842d9a0d0 100644 --- a/Userland/Libraries/LibArchive/Zip.cpp +++ b/Userland/Libraries/LibArchive/Zip.cpp @@ -93,7 +93,7 @@ bool Zip::for_each_member(Function callback char null_terminated_name[central_directory_record.name_length + 1]; memcpy(null_terminated_name, central_directory_record.name, central_directory_record.name_length); null_terminated_name[central_directory_record.name_length] = 0; - member.name = String { null_terminated_name }; + member.name = DeprecatedString { null_terminated_name }; member.compressed_data = { local_file_header.compressed_data, central_directory_record.compressed_size }; member.compression_method = central_directory_record.compression_method; member.uncompressed_size = central_directory_record.uncompressed_size; diff --git a/Userland/Libraries/LibArchive/Zip.h b/Userland/Libraries/LibArchive/Zip.h index 33c687c84e1..704b46e2cb4 100644 --- a/Userland/Libraries/LibArchive/Zip.h +++ b/Userland/Libraries/LibArchive/Zip.h @@ -8,10 +8,10 @@ #pragma once #include +#include #include #include #include -#include #include #include @@ -225,7 +225,7 @@ struct [[gnu::packed]] LocalFileHeader { }; struct ZipMember { - String name; + DeprecatedString name; ReadonlyBytes compressed_data; // TODO: maybe the decompression/compression should be handled by LibArchive instead of the user? ZipCompressionMethod compression_method; u32 uncompressed_size; diff --git a/Userland/Libraries/LibAudio/FlacLoader.cpp b/Userland/Libraries/LibAudio/FlacLoader.cpp index 8ea55fe0eb9..d7606d98ce5 100644 --- a/Userland/Libraries/LibAudio/FlacLoader.cpp +++ b/Userland/Libraries/LibAudio/FlacLoader.cpp @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -12,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -63,11 +63,11 @@ MaybeLoaderError FlacLoaderPlugin::parse_header() auto bit_input = LOADER_TRY(BigEndianInputBitStream::construct(*m_stream)); // A mixture of VERIFY and the non-crashing TRY(). -#define FLAC_VERIFY(check, category, msg) \ - do { \ - if (!(check)) { \ - return LoaderError { category, static_cast(m_data_start_location), String::formatted("FLAC header: {}", msg) }; \ - } \ +#define FLAC_VERIFY(check, category, msg) \ + do { \ + if (!(check)) { \ + return LoaderError { category, static_cast(m_data_start_location), DeprecatedString::formatted("FLAC header: {}", msg) }; \ + } \ } while (0) // Magic number @@ -280,7 +280,7 @@ MaybeLoaderError FlacLoaderPlugin::seek(int int_sample_index) dbgln_if(AFLACLOADER_DEBUG, "Seeking to seektable: sample index {}, byte offset {}, sample count {}", target_seekpoint.sample_index, target_seekpoint.byte_offset, target_seekpoint.num_samples); auto position = target_seekpoint.byte_offset + m_data_start_location; if (m_stream->seek(static_cast(position), Core::Stream::SeekMode::SetPosition).is_error()) - return LoaderError { LoaderError::Category::IO, m_loaded_samples, String::formatted("Invalid seek position {}", position) }; + return LoaderError { LoaderError::Category::IO, m_loaded_samples, DeprecatedString::formatted("Invalid seek position {}", position) }; auto remaining_samples_after_seekpoint = sample_index - m_data_start_location; if (remaining_samples_after_seekpoint > 0) @@ -326,11 +326,11 @@ LoaderSamples FlacLoaderPlugin::get_more_samples(size_t max_bytes_to_read_from_i // 11.21. FRAME MaybeLoaderError FlacLoaderPlugin::next_frame(Span target_vector) { -#define FLAC_VERIFY(check, category, msg) \ - do { \ - if (!(check)) { \ - return LoaderError { category, static_cast(m_current_sample_or_frame), String::formatted("FLAC header: {}", msg) }; \ - } \ +#define FLAC_VERIFY(check, category, msg) \ + do { \ + if (!(check)) { \ + return LoaderError { category, static_cast(m_current_sample_or_frame), DeprecatedString::formatted("FLAC header: {}", msg) }; \ + } \ } while (0) auto bit_stream = LOADER_TRY(BigEndianInputBitStream::construct(*m_stream)); @@ -561,7 +561,7 @@ ErrorOr FlacLoaderPlugin::convert_bit_depth_code(u case 7: return LoaderError { LoaderError::Category::Format, static_cast(m_current_sample_or_frame), "Reserved sample size" }; default: - return LoaderError { LoaderError::Category::Format, static_cast(m_current_sample_or_frame), String::formatted("Unsupported sample size {}", bit_depth_code) }; + return LoaderError { LoaderError::Category::Format, static_cast(m_current_sample_or_frame), DeprecatedString::formatted("Unsupported sample size {}", bit_depth_code) }; } } @@ -818,7 +818,7 @@ ErrorOr, LoaderError> FlacLoaderPlugin::decode_fixed_lpc(FlacSubfram decoded[i] += 4 * decoded[i - 1] - 6 * decoded[i - 2] + 4 * decoded[i - 3] - decoded[i - 4]; break; default: - return LoaderError { LoaderError::Category::Format, static_cast(m_current_sample_or_frame), String::formatted("Unrecognized predictor order {}", subframe.order) }; + return LoaderError { LoaderError::Category::Format, static_cast(m_current_sample_or_frame), DeprecatedString::formatted("Unrecognized predictor order {}", subframe.order) }; } return decoded; } diff --git a/Userland/Libraries/LibAudio/FlacLoader.h b/Userland/Libraries/LibAudio/FlacLoader.h index 0cf1e74a46a..ed23669200a 100644 --- a/Userland/Libraries/LibAudio/FlacLoader.h +++ b/Userland/Libraries/LibAudio/FlacLoader.h @@ -62,7 +62,7 @@ public: virtual int total_samples() override { return static_cast(m_total_samples); } virtual u32 sample_rate() override { return m_sample_rate; } virtual u16 num_channels() override { return m_num_channels; } - virtual String format_name() override { return "FLAC (.flac)"; } + virtual DeprecatedString format_name() override { return "FLAC (.flac)"; } virtual PcmSampleFormat pcm_format() override { return m_sample_format; } bool is_fixed_blocksize_stream() const { return m_min_block_size == m_max_block_size; } diff --git a/Userland/Libraries/LibAudio/GenericTypes.h b/Userland/Libraries/LibAudio/GenericTypes.h index d47434ea454..4d485473cd5 100644 --- a/Userland/Libraries/LibAudio/GenericTypes.h +++ b/Userland/Libraries/LibAudio/GenericTypes.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Audio { @@ -40,7 +40,7 @@ enum class ID3PictureType : u32 { // Note: This was first implemented for Flac but is compatible with ID3v2 struct PictureData { ID3PictureType type {}; - String mime_string {}; + DeprecatedString mime_string {}; Vector description_string {}; u32 width {}; diff --git a/Userland/Libraries/LibAudio/Loader.h b/Userland/Libraries/LibAudio/Loader.h index e217609238b..d351ed36370 100644 --- a/Userland/Libraries/LibAudio/Loader.h +++ b/Userland/Libraries/LibAudio/Loader.h @@ -52,7 +52,7 @@ public: virtual u16 num_channels() = 0; // Human-readable name of the file format, of the form (.) - virtual String format_name() = 0; + virtual DeprecatedString format_name() = 0; virtual PcmSampleFormat pcm_format() = 0; Vector const& pictures() const { return m_pictures; }; @@ -77,7 +77,7 @@ public: int total_samples() const { return m_plugin->total_samples(); } u32 sample_rate() const { return m_plugin->sample_rate(); } u16 num_channels() const { return m_plugin->num_channels(); } - String format_name() const { return m_plugin->format_name(); } + DeprecatedString format_name() const { return m_plugin->format_name(); } u16 bits_per_sample() const { return pcm_bits_per_sample(m_plugin->pcm_format()); } Vector const& pictures() const { return m_plugin->pictures(); }; diff --git a/Userland/Libraries/LibAudio/LoaderError.h b/Userland/Libraries/LibAudio/LoaderError.h index 58455c355ff..78e47e5e6c4 100644 --- a/Userland/Libraries/LibAudio/LoaderError.h +++ b/Userland/Libraries/LibAudio/LoaderError.h @@ -28,7 +28,7 @@ struct LoaderError { Category category { Category::Unknown }; // Binary index: where in the file the error occurred. size_t index { 0 }; - FlyString description { String::empty() }; + FlyString description { DeprecatedString::empty() }; constexpr LoaderError() = default; LoaderError(Category category, size_t index, FlyString description) @@ -54,7 +54,7 @@ struct LoaderError { { if (error.is_errno()) { auto code = error.code(); - description = String::formatted("{} ({})", strerror(code), code); + description = DeprecatedString::formatted("{} ({})", strerror(code), code); if (code == EBADF || code == EBUSY || code == EEXIST || code == EIO || code == EISDIR || code == ENOENT || code == ENOMEM || code == EPIPE) category = Category::IO; } else { diff --git a/Userland/Libraries/LibAudio/MP3Loader.h b/Userland/Libraries/LibAudio/MP3Loader.h index 4f1d729fb15..94cd21db055 100644 --- a/Userland/Libraries/LibAudio/MP3Loader.h +++ b/Userland/Libraries/LibAudio/MP3Loader.h @@ -39,7 +39,7 @@ public: virtual u32 sample_rate() override { return m_sample_rate; } virtual u16 num_channels() override { return m_num_channels; } virtual PcmSampleFormat pcm_format() override { return m_sample_format; } - virtual String format_name() override { return "MP3 (.mp3)"; } + virtual DeprecatedString format_name() override { return "MP3 (.mp3)"; } private: MaybeLoaderError initialize(); diff --git a/Userland/Libraries/LibAudio/SampleFormats.cpp b/Userland/Libraries/LibAudio/SampleFormats.cpp index 882628bc780..d45507df135 100644 --- a/Userland/Libraries/LibAudio/SampleFormats.cpp +++ b/Userland/Libraries/LibAudio/SampleFormats.cpp @@ -27,10 +27,10 @@ u16 pcm_bits_per_sample(PcmSampleFormat format) } } -String sample_format_name(PcmSampleFormat format) +DeprecatedString sample_format_name(PcmSampleFormat format) { bool is_float = format == PcmSampleFormat::Float32 || format == PcmSampleFormat::Float64; - return String::formatted("PCM {}bit {}", pcm_bits_per_sample(format), is_float ? "Float" : "LE"); + return DeprecatedString::formatted("PCM {}bit {}", pcm_bits_per_sample(format), is_float ? "Float" : "LE"); } } diff --git a/Userland/Libraries/LibAudio/SampleFormats.h b/Userland/Libraries/LibAudio/SampleFormats.h index 567489303a7..9f160d55b30 100644 --- a/Userland/Libraries/LibAudio/SampleFormats.h +++ b/Userland/Libraries/LibAudio/SampleFormats.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Audio { @@ -23,5 +23,5 @@ enum class PcmSampleFormat : u8 { // Most of the read code only cares about how many bits to read or write u16 pcm_bits_per_sample(PcmSampleFormat format); -String sample_format_name(PcmSampleFormat format); +DeprecatedString sample_format_name(PcmSampleFormat format); } diff --git a/Userland/Libraries/LibAudio/WavLoader.cpp b/Userland/Libraries/LibAudio/WavLoader.cpp index d7477df5903..07c0e140570 100644 --- a/Userland/Libraries/LibAudio/WavLoader.cpp +++ b/Userland/Libraries/LibAudio/WavLoader.cpp @@ -210,10 +210,10 @@ MaybeLoaderError WavLoaderPlugin::parse_header() return value; }; -#define CHECK_OK(category, msg) \ - do { \ - if (!ok) \ - return LoaderError { category, String::formatted("Parsing failed: {}", msg) }; \ +#define CHECK_OK(category, msg) \ + do { \ + if (!ok) \ + return LoaderError { category, DeprecatedString::formatted("Parsing failed: {}", msg) }; \ } while (0) u32 riff = TRY(read_u32()); diff --git a/Userland/Libraries/LibAudio/WavLoader.h b/Userland/Libraries/LibAudio/WavLoader.h index 2c1bbdfb763..43df0846277 100644 --- a/Userland/Libraries/LibAudio/WavLoader.h +++ b/Userland/Libraries/LibAudio/WavLoader.h @@ -7,11 +7,11 @@ #pragma once +#include #include #include #include #include -#include #include #include #include @@ -45,7 +45,7 @@ public: virtual int total_samples() override { return static_cast(m_total_samples); } virtual u32 sample_rate() override { return m_sample_rate; } virtual u16 num_channels() override { return m_num_channels; } - virtual String format_name() override { return "RIFF WAVE (.wav)"; } + virtual DeprecatedString format_name() override { return "RIFF WAVE (.wav)"; } virtual PcmSampleFormat pcm_format() override { return m_sample_format; } private: diff --git a/Userland/Libraries/LibAudio/WavWriter.cpp b/Userland/Libraries/LibAudio/WavWriter.cpp index a7230b3cdce..521a0a15f83 100644 --- a/Userland/Libraries/LibAudio/WavWriter.cpp +++ b/Userland/Libraries/LibAudio/WavWriter.cpp @@ -33,7 +33,7 @@ void WavWriter::set_file(StringView path) { m_file = Core::File::construct(path); if (!m_file->open(Core::OpenMode::ReadWrite)) { - m_error_string = String::formatted("Can't open file: {}", m_file->error_string()); + m_error_string = DeprecatedString::formatted("Can't open file: {}", m_file->error_string()); return; } m_file->seek(44); diff --git a/Userland/Libraries/LibAudio/WavWriter.h b/Userland/Libraries/LibAudio/WavWriter.h index 87cb4b7becb..7d6b31eeb5f 100644 --- a/Userland/Libraries/LibAudio/WavWriter.h +++ b/Userland/Libraries/LibAudio/WavWriter.h @@ -38,12 +38,12 @@ public: void set_sample_rate(int sample_rate) { m_sample_rate = sample_rate; } void set_bits_per_sample(int bits_per_sample) { m_bits_per_sample = bits_per_sample; } - void clear_error() { m_error_string = String(); } + void clear_error() { m_error_string = DeprecatedString(); } private: void write_header(); RefPtr m_file; - String m_error_string; + DeprecatedString m_error_string; bool m_finalized { false }; u32 m_sample_rate; diff --git a/Userland/Libraries/LibC/bits/dlfcn_integration.h b/Userland/Libraries/LibC/bits/dlfcn_integration.h index bf5a20ae605..4a975b90573 100644 --- a/Userland/Libraries/LibC/bits/dlfcn_integration.h +++ b/Userland/Libraries/LibC/bits/dlfcn_integration.h @@ -7,11 +7,11 @@ #pragma once +#include #include -#include struct DlErrorMessage { - DlErrorMessage(String&& other) + DlErrorMessage(DeprecatedString&& other) : text(move(other)) { } @@ -21,7 +21,7 @@ struct DlErrorMessage { // from the one in libc.so virtual ~DlErrorMessage() = default; - String text; + DeprecatedString text; }; struct __Dl_info; diff --git a/Userland/Libraries/LibC/dlfcn.cpp b/Userland/Libraries/LibC/dlfcn.cpp index 189609aa5f6..15a21c0133c 100644 --- a/Userland/Libraries/LibC/dlfcn.cpp +++ b/Userland/Libraries/LibC/dlfcn.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -25,7 +25,7 @@ __thread char* s_dlerror_text = NULL; __thread bool s_dlerror_retrieved = false; #endif -static void store_error(String const& error) +static void store_error(DeprecatedString const& error) { free(s_dlerror_text); s_dlerror_text = strdup(error.characters()); diff --git a/Userland/Libraries/LibC/grp.cpp b/Userland/Libraries/LibC/grp.cpp index f3a5501b31c..e5058066855 100644 --- a/Userland/Libraries/LibC/grp.cpp +++ b/Userland/Libraries/LibC/grp.cpp @@ -5,8 +5,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include -#include #include #include #include diff --git a/Userland/Libraries/LibC/netdb.cpp b/Userland/Libraries/LibC/netdb.cpp index aeeb5e66d13..82042e1d16c 100644 --- a/Userland/Libraries/LibC/netdb.cpp +++ b/Userland/Libraries/LibC/netdb.cpp @@ -6,8 +6,8 @@ #include #include +#include #include -#include #include #include #include @@ -47,8 +47,8 @@ static char const* services_path = "/etc/services"; static bool fill_getserv_buffers(char const* line, ssize_t read); static servent __getserv_buffer; -static String __getserv_name_buffer; -static String __getserv_protocol_buffer; +static DeprecatedString __getserv_name_buffer; +static DeprecatedString __getserv_protocol_buffer; static int __getserv_port_buffer; static Vector __getserv_alias_list_buffer; static Vector __getserv_alias_list; @@ -61,7 +61,7 @@ static char const* protocols_path = "/etc/protocols"; static bool fill_getproto_buffers(char const* line, ssize_t read); static protoent __getproto_buffer; -static String __getproto_name_buffer; +static DeprecatedString __getproto_name_buffer; static Vector __getproto_alias_list_buffer; static Vector __getproto_alias_list; static int __getproto_protocol_buffer; @@ -89,7 +89,7 @@ static int connect_to_lookup_server() return fd; } -static String gethostbyname_name_buffer; +static DeprecatedString gethostbyname_name_buffer; hostent* gethostbyname(char const* name) { @@ -211,7 +211,7 @@ hostent* gethostbyname(char const* name) return &__gethostbyname_buffer; } -static String gethostbyaddr_name_buffer; +static DeprecatedString gethostbyaddr_name_buffer; hostent* gethostbyaddr(void const* addr, socklen_t addr_size, int type) { @@ -467,7 +467,7 @@ static bool fill_getserv_buffers(char const* line, ssize_t read) } __getserv_name_buffer = split_line[0]; - auto port_protocol_split = String(split_line[1]).split('/'); + auto port_protocol_split = DeprecatedString(split_line[1]).split('/'); if (port_protocol_split.size() < 2) { warnln("getservent(): malformed services file"); return false; @@ -634,7 +634,7 @@ void endprotoent() static bool fill_getproto_buffers(char const* line, ssize_t read) { - String string_line = String(line, read); + DeprecatedString string_line = DeprecatedString(line, read); auto split_line = string_line.replace(" "sv, "\t"sv, ReplaceMode::All).split('\t'); // This indicates an incorrect file format. Protocols file entries should diff --git a/Userland/Libraries/LibC/pwd.cpp b/Userland/Libraries/LibC/pwd.cpp index 12aed499730..ba2424e4525 100644 --- a/Userland/Libraries/LibC/pwd.cpp +++ b/Userland/Libraries/LibC/pwd.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include -#include #include #include #include diff --git a/Userland/Libraries/LibC/semaphore.cpp b/Userland/Libraries/LibC/semaphore.cpp index cebee805e80..12d39eb4ee7 100644 --- a/Userland/Libraries/LibC/semaphore.cpp +++ b/Userland/Libraries/LibC/semaphore.cpp @@ -8,9 +8,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -31,7 +31,7 @@ static constexpr u32 POST_WAKES = 1 << 31; static constexpr auto sem_path_prefix = "/tmp/semaphore/"sv; static constexpr auto SEM_NAME_MAX = PATH_MAX - sem_path_prefix.length(); -static ErrorOr sem_name_to_path(char const* name) +static ErrorOr sem_name_to_path(char const* name) { if (name[0] != '/') return EINVAL; @@ -58,7 +58,7 @@ struct NamedSemaphore { sem_t* sem { nullptr }; }; -static HashMap s_named_semaphores; +static HashMap s_named_semaphores; static pthread_mutex_t s_sem_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_once_t s_sem_once = PTHREAD_ONCE_INIT; diff --git a/Userland/Libraries/LibC/shadow.cpp b/Userland/Libraries/LibC/shadow.cpp index 53739944f8e..9464e87d42b 100644 --- a/Userland/Libraries/LibC/shadow.cpp +++ b/Userland/Libraries/LibC/shadow.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -21,8 +21,8 @@ static FILE* s_stream = nullptr; static unsigned s_line_number = 0; static struct spwd s_shadow_entry; -static String s_name; -static String s_pwdp; +static DeprecatedString s_name; +static DeprecatedString s_pwdp; void setspent() { @@ -62,7 +62,7 @@ struct spwd* getspnam(char const* name) return nullptr; } -static bool parse_shadow_entry(String const& line) +static bool parse_shadow_entry(DeprecatedString const& line) { auto parts = line.split_view(':', SplitBehavior::KeepEmpty); if (parts.size() != 9) { @@ -169,7 +169,7 @@ struct spwd* getspent() if ((!s || !s[0]) && feof(s_stream)) return nullptr; - String line(s, Chomp); + DeprecatedString line(s, Chomp); if (parse_shadow_entry(line)) return &s_shadow_entry; // Otherwise, proceed to the next line. diff --git a/Userland/Libraries/LibC/stdio.cpp b/Userland/Libraries/LibC/stdio.cpp index 9bd8c6545e1..f95fb2aab1c 100644 --- a/Userland/Libraries/LibC/stdio.cpp +++ b/Userland/Libraries/LibC/stdio.cpp @@ -6,11 +6,11 @@ */ #include +#include #include #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibC/syslog.cpp b/Userland/Libraries/LibC/syslog.cpp index 9c563a22f71..d509cd863cd 100644 --- a/Userland/Libraries/LibC/syslog.cpp +++ b/Userland/Libraries/LibC/syslog.cpp @@ -7,7 +7,7 @@ // Has to be defined before including due to legacy Unices #define SYSLOG_NAMES 1 -#include +#include #include #include #include @@ -124,7 +124,7 @@ void vsyslog_r(int priority, struct syslog_data* data, char const* message, va_l combined.appendff("{}: ", get_syslog_ident(data)); combined.appendvf(message, args); - String combined_string = combined.build(); + DeprecatedString combined_string = combined.build(); if (data->logopt & LOG_CONS) dbgputstr(combined_string.characters(), combined_string.length()); diff --git a/Userland/Libraries/LibC/termcap.cpp b/Userland/Libraries/LibC/termcap.cpp index 171b440eb7c..210e5d167f2 100644 --- a/Userland/Libraries/LibC/termcap.cpp +++ b/Userland/Libraries/LibC/termcap.cpp @@ -5,8 +5,8 @@ */ #include +#include #include -#include #include #include #include @@ -27,13 +27,13 @@ int __attribute__((weak)) tgetent([[maybe_unused]] char* bp, [[maybe_unused]] ch return 1; } -static HashMap* caps = nullptr; +static HashMap* caps = nullptr; static void ensure_caps() { if (caps) return; - caps = new HashMap; + caps = new HashMap; caps->set("DC", "\033[%p1%dP"); caps->set("IC", "\033[%p1%d@"); caps->set("ce", "\033[K"); @@ -114,7 +114,7 @@ int __attribute__((weak)) tgetnum(char const* id) static Vector s_tgoto_buffer; char* __attribute__((weak)) tgoto([[maybe_unused]] char const* cap, [[maybe_unused]] int col, [[maybe_unused]] int row) { - auto cap_str = StringView { cap, strlen(cap) }.replace("%p1%d"sv, String::number(col), ReplaceMode::FirstOnly).replace("%p2%d"sv, String::number(row), ReplaceMode::FirstOnly); + auto cap_str = StringView { cap, strlen(cap) }.replace("%p1%d"sv, DeprecatedString::number(col), ReplaceMode::FirstOnly).replace("%p2%d"sv, DeprecatedString::number(row), ReplaceMode::FirstOnly); s_tgoto_buffer.clear_with_capacity(); s_tgoto_buffer.ensure_capacity(cap_str.length()); diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index 2c93bcbe3dd..aab3884f5f8 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include diff --git a/Userland/Libraries/LibC/unistd.cpp b/Userland/Libraries/LibC/unistd.cpp index b48dadec113..e3fbca0e9ff 100644 --- a/Userland/Libraries/LibC/unistd.cpp +++ b/Userland/Libraries/LibC/unistd.cpp @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include -#include #include #include #include @@ -189,12 +189,12 @@ int execvpe(char const* filename, char* const argv[], char* const envp[]) ScopedValueRollback errno_rollback(errno); // TODO: Make this use the PATH search implementation from Core::File. - String path = getenv("PATH"); + DeprecatedString path = getenv("PATH"); if (path.is_empty()) path = DEFAULT_PATH; auto parts = path.split(':'); for (auto& part : parts) { - auto candidate = String::formatted("{}/{}", part, filename); + auto candidate = DeprecatedString::formatted("{}/{}", part, filename); int rc = execve(candidate.characters(), argv, envp); if (rc < 0 && errno != ENOENT) { errno_rollback.set_override_rollback_value(errno); @@ -854,13 +854,13 @@ void sync() syscall(SC_sync); } -static String getlogin_buffer; +static DeprecatedString getlogin_buffer; char* getlogin() { if (getlogin_buffer.is_null()) { if (auto* passwd = getpwuid(getuid())) { - getlogin_buffer = String(passwd->pw_name); + getlogin_buffer = DeprecatedString(passwd->pw_name); } endpwent(); } diff --git a/Userland/Libraries/LibCards/CardGame.cpp b/Userland/Libraries/LibCards/CardGame.cpp index 2640dbd2661..bdfcb7deb76 100644 --- a/Userland/Libraries/LibCards/CardGame.cpp +++ b/Userland/Libraries/LibCards/CardGame.cpp @@ -100,7 +100,7 @@ void CardGame::dump_layout() const dbgln("{}", stack); } -void CardGame::config_string_did_change(String const& domain, String const& group, String const& key, String const& value) +void CardGame::config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) { if (domain == "Games" && group == "Cards") { if (key == "BackgroundColor") { diff --git a/Userland/Libraries/LibCards/CardGame.h b/Userland/Libraries/LibCards/CardGame.h index 7ca1645ac2f..f3c8f0f3a4e 100644 --- a/Userland/Libraries/LibCards/CardGame.h +++ b/Userland/Libraries/LibCards/CardGame.h @@ -43,7 +43,7 @@ protected: CardGame(); private: - virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value) override; + virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override; NonnullRefPtrVector m_stacks; diff --git a/Userland/Libraries/LibCards/CardPainter.cpp b/Userland/Libraries/LibCards/CardPainter.cpp index b8c583d077e..2b46cacdee1 100644 --- a/Userland/Libraries/LibCards/CardPainter.cpp +++ b/Userland/Libraries/LibCards/CardPainter.cpp @@ -128,7 +128,7 @@ NonnullRefPtr CardPainter::card_back_inverted() return *m_card_back_inverted; } -void CardPainter::set_background_image_path(String path) +void CardPainter::set_background_image_path(DeprecatedString path) { if (m_background_image_path == path) return; diff --git a/Userland/Libraries/LibCards/CardPainter.h b/Userland/Libraries/LibCards/CardPainter.h index 301ea517499..6911f361a41 100644 --- a/Userland/Libraries/LibCards/CardPainter.h +++ b/Userland/Libraries/LibCards/CardPainter.h @@ -21,7 +21,7 @@ public: NonnullRefPtr card_front_inverted(Suit, Rank); NonnullRefPtr card_back_inverted(); - void set_background_image_path(String path); + void set_background_image_path(DeprecatedString path); private: CardPainter(); @@ -35,7 +35,7 @@ private: RefPtr m_card_back; RefPtr m_card_back_inverted; - String m_background_image_path; + DeprecatedString m_background_image_path; }; } diff --git a/Userland/Libraries/LibChess/Chess.cpp b/Userland/Libraries/LibChess/Chess.cpp index 9cfbe3817ec..d7a5edf4b33 100644 --- a/Userland/Libraries/LibChess/Chess.cpp +++ b/Userland/Libraries/LibChess/Chess.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include @@ -13,7 +13,7 @@ namespace Chess { -String char_for_piece(Chess::Type type) +DeprecatedString char_for_piece(Chess::Type type) { switch (type) { case Type::Knight: @@ -34,7 +34,7 @@ String char_for_piece(Chess::Type type) Chess::Type piece_for_char_promotion(StringView str) { - String string = String(str).to_lowercase(); + DeprecatedString string = DeprecatedString(str).to_lowercase(); if (string == "") return Type::None; if (string == "n") @@ -77,7 +77,7 @@ Square::Square(StringView name) } } -String Square::to_algebraic() const +DeprecatedString Square::to_algebraic() const { StringBuilder builder; builder.append(file + 'a'); @@ -92,7 +92,7 @@ Move::Move(StringView long_algebraic) { } -String Move::to_long_algebraic() const +DeprecatedString Move::to_long_algebraic() const { StringBuilder builder; builder.append(from.to_algebraic()); @@ -103,7 +103,7 @@ String Move::to_long_algebraic() const Move Move::from_algebraic(StringView algebraic, const Color turn, Board const& board) { - String move_string = algebraic; + DeprecatedString move_string = algebraic; Move move({ 50, 50 }, { 50, 50 }); if (move_string.contains('-')) { @@ -176,7 +176,7 @@ Move Move::from_algebraic(StringView algebraic, const Color turn, Board const& b return move; } -String Move::to_algebraic() const +DeprecatedString Move::to_algebraic() const { if (piece.type == Type::King && from.file == 4) { if (to.file == 2) @@ -269,7 +269,7 @@ Board Board::clone_without_history() const return result; } -String Board::to_fen() const +DeprecatedString Board::to_fen() const { StringBuilder builder; @@ -283,17 +283,17 @@ String Board::to_fen() const continue; } if (empty > 0) { - builder.append(String::number(empty)); + builder.append(DeprecatedString::number(empty)); empty = 0; } - String piece = char_for_piece(p.type); + DeprecatedString piece = char_for_piece(p.type); if (piece == "") piece = "P"; builder.append(p.color == Color::Black ? piece.to_lowercase() : piece); } if (empty > 0) { - builder.append(String::number(empty)); + builder.append(DeprecatedString::number(empty)); empty = 0; } if (rank < 7) @@ -327,11 +327,11 @@ String Board::to_fen() const builder.append(' '); // 5. Halfmove clock - builder.append(String::number(min(m_moves_since_capture, m_moves_since_pawn_advance))); + builder.append(DeprecatedString::number(min(m_moves_since_capture, m_moves_since_pawn_advance))); builder.append(' '); // 6. Fullmove number - builder.append(String::number(1 + m_moves.size() / 2)); + builder.append(DeprecatedString::number(1 + m_moves.size() / 2)); return builder.to_string(); } @@ -886,7 +886,7 @@ void Board::set_resigned(Chess::Color c) m_resigned = c; } -String Board::result_to_string(Result result, Color turn) +DeprecatedString Board::result_to_string(Result result, Color turn) { switch (result) { case Result::CheckMate: @@ -915,7 +915,7 @@ String Board::result_to_string(Result result, Color turn) } } -String Board::result_to_points(Result result, Color turn) +DeprecatedString Board::result_to_points(Result result, Color turn) { switch (result) { case Result::CheckMate: diff --git a/Userland/Libraries/LibChess/Chess.h b/Userland/Libraries/LibChess/Chess.h index 44a542c8dd4..fd9501e156b 100644 --- a/Userland/Libraries/LibChess/Chess.h +++ b/Userland/Libraries/LibChess/Chess.h @@ -25,7 +25,7 @@ enum class Type : u8 { None, }; -String char_for_piece(Type type); +DeprecatedString char_for_piece(Type type); Chess::Type piece_for_char_promotion(StringView str); enum class Color : u8 { @@ -85,7 +85,7 @@ struct Square { bool in_bounds() const { return rank >= 0 && file >= 0 && rank < 8 && file < 8; } bool is_light() const { return (rank % 2) != (file % 2); } - String to_algebraic() const; + DeprecatedString to_algebraic() const; }; class Board; @@ -110,8 +110,8 @@ struct Move { bool operator==(Move const& other) const { return from == other.from && to == other.to && promote_to == other.promote_to; } static Move from_algebraic(StringView algebraic, const Color turn, Board const& board); - String to_long_algebraic() const; - String to_algebraic() const; + DeprecatedString to_long_algebraic() const; + DeprecatedString to_algebraic() const; }; class Board { @@ -130,7 +130,7 @@ public: bool apply_move(Move const&, Color color = Color::None); Optional const& last_move() const { return m_last_move; } - String to_fen() const; + DeprecatedString to_fen() const; enum class Result { CheckMate, @@ -145,8 +145,8 @@ public: NotFinished, }; - static String result_to_string(Result, Color turn); - static String result_to_points(Result, Color turn); + static DeprecatedString result_to_string(Result, Color turn); + static DeprecatedString result_to_points(Result, Color turn); template void generate_moves(Callback callback, Color color = Color::None) const; diff --git a/Userland/Libraries/LibChess/UCICommand.cpp b/Userland/Libraries/LibChess/UCICommand.cpp index 23c022a7ed9..7cad448658d 100644 --- a/Userland/Libraries/LibChess/UCICommand.cpp +++ b/Userland/Libraries/LibChess/UCICommand.cpp @@ -17,7 +17,7 @@ UCICommand UCICommand::from_string(StringView command) return UCICommand(); } -String UCICommand::to_string() const +DeprecatedString UCICommand::to_string() const { return "uci\n"; } @@ -35,7 +35,7 @@ DebugCommand DebugCommand::from_string(StringView command) VERIFY_NOT_REACHED(); } -String DebugCommand::to_string() const +DeprecatedString DebugCommand::to_string() const { if (flag() == Flag::On) { return "debug on\n"; @@ -52,7 +52,7 @@ IsReadyCommand IsReadyCommand::from_string(StringView command) return IsReadyCommand(); } -String IsReadyCommand::to_string() const +DeprecatedString IsReadyCommand::to_string() const { return "isready\n"; } @@ -95,7 +95,7 @@ SetOptionCommand SetOptionCommand::from_string(StringView command) return SetOptionCommand(name.to_string().trim_whitespace(), value.to_string().trim_whitespace()); } -String SetOptionCommand::to_string() const +DeprecatedString SetOptionCommand::to_string() const { StringBuilder builder; builder.append("setoption name "sv); @@ -115,7 +115,7 @@ PositionCommand PositionCommand::from_string(StringView command) VERIFY(tokens[0] == "position"); VERIFY(tokens[2] == "moves"); - Optional fen; + Optional fen; if (tokens[1] != "startpos") fen = tokens[1]; @@ -126,7 +126,7 @@ PositionCommand PositionCommand::from_string(StringView command) return PositionCommand(fen, moves); } -String PositionCommand::to_string() const +DeprecatedString PositionCommand::to_string() const { StringBuilder builder; builder.append("position "sv); @@ -190,7 +190,7 @@ GoCommand GoCommand::from_string(StringView command) return go_command; } -String GoCommand::to_string() const +DeprecatedString GoCommand::to_string() const { StringBuilder builder; builder.append("go"sv); @@ -238,7 +238,7 @@ StopCommand StopCommand::from_string(StringView command) return StopCommand(); } -String StopCommand::to_string() const +DeprecatedString StopCommand::to_string() const { return "stop\n"; } @@ -263,7 +263,7 @@ IdCommand IdCommand::from_string(StringView command) VERIFY_NOT_REACHED(); } -String IdCommand::to_string() const +DeprecatedString IdCommand::to_string() const { StringBuilder builder; builder.append("id "sv); @@ -285,7 +285,7 @@ UCIOkCommand UCIOkCommand::from_string(StringView command) return UCIOkCommand(); } -String UCIOkCommand::to_string() const +DeprecatedString UCIOkCommand::to_string() const { return "uciok\n"; } @@ -298,7 +298,7 @@ ReadyOkCommand ReadyOkCommand::from_string(StringView command) return ReadyOkCommand(); } -String ReadyOkCommand::to_string() const +DeprecatedString ReadyOkCommand::to_string() const { return "readyok\n"; } @@ -311,7 +311,7 @@ BestMoveCommand BestMoveCommand::from_string(StringView command) return BestMoveCommand(Move(tokens[1])); } -String BestMoveCommand::to_string() const +DeprecatedString BestMoveCommand::to_string() const { StringBuilder builder; builder.append("bestmove "sv); @@ -326,7 +326,7 @@ InfoCommand InfoCommand::from_string([[maybe_unused]] StringView command) VERIFY_NOT_REACHED(); } -String InfoCommand::to_string() const +DeprecatedString InfoCommand::to_string() const { // FIXME: Implement this. VERIFY_NOT_REACHED(); diff --git a/Userland/Libraries/LibChess/UCICommand.h b/Userland/Libraries/LibChess/UCICommand.h index 80a99805669..ef2f8f0e5e6 100644 --- a/Userland/Libraries/LibChess/UCICommand.h +++ b/Userland/Libraries/LibChess/UCICommand.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include #include #include @@ -44,7 +44,7 @@ public: { } - virtual String to_string() const = 0; + virtual DeprecatedString to_string() const = 0; virtual ~Command() = default; }; @@ -58,7 +58,7 @@ public: static UCICommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; }; class DebugCommand : public Command { @@ -76,7 +76,7 @@ public: static DebugCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; Flag flag() const { return m_flag; } @@ -93,12 +93,12 @@ public: static IsReadyCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; }; class SetOptionCommand : public Command { public: - explicit SetOptionCommand(StringView name, Optional value = {}) + explicit SetOptionCommand(StringView name, Optional value = {}) : Command(Command::Type::SetOption) , m_name(name) , m_value(value) @@ -107,19 +107,19 @@ public: static SetOptionCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; - String const& name() const { return m_name; } - Optional const& value() const { return m_value; } + DeprecatedString const& name() const { return m_name; } + Optional const& value() const { return m_value; } private: - String m_name; - Optional m_value; + DeprecatedString m_name; + Optional m_value; }; class PositionCommand : public Command { public: - explicit PositionCommand(Optional const& fen, Vector const& moves) + explicit PositionCommand(Optional const& fen, Vector const& moves) : Command(Command::Type::Position) , m_fen(fen) , m_moves(moves) @@ -128,13 +128,13 @@ public: static PositionCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; - Optional const& fen() const { return m_fen; } + Optional const& fen() const { return m_fen; } Vector const& moves() const { return m_moves; } private: - Optional m_fen; + Optional m_fen; Vector m_moves; }; @@ -147,7 +147,7 @@ public: static GoCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; Optional> searchmoves; bool ponder { false }; @@ -172,7 +172,7 @@ public: static StopCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; }; class IdCommand : public Command { @@ -191,14 +191,14 @@ public: static IdCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; Type field_type() const { return m_field_type; } - String const& value() const { return m_value; } + DeprecatedString const& value() const { return m_value; } private: Type m_field_type; - String m_value; + DeprecatedString m_value; }; class UCIOkCommand : public Command { @@ -210,7 +210,7 @@ public: static UCIOkCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; }; class ReadyOkCommand : public Command { @@ -222,7 +222,7 @@ public: static ReadyOkCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; }; class BestMoveCommand : public Command { @@ -235,7 +235,7 @@ public: static BestMoveCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; Chess::Move move() const { return m_move; } @@ -252,7 +252,7 @@ public: static InfoCommand from_string(StringView command); - virtual String to_string() const override; + virtual DeprecatedString to_string() const override; Optional depth; Optional seldepth; diff --git a/Userland/Libraries/LibChess/UCIEndpoint.cpp b/Userland/Libraries/LibChess/UCIEndpoint.cpp index be23d6bc7c5..832290403ac 100644 --- a/Userland/Libraries/LibChess/UCIEndpoint.cpp +++ b/Userland/Libraries/LibChess/UCIEndpoint.cpp @@ -7,7 +7,7 @@ #include "UCIEndpoint.h" #include #include -#include +#include #include #include @@ -23,7 +23,7 @@ Endpoint::Endpoint(NonnullRefPtr in, NonnullRefPtrwrite(command.to_string()); } @@ -70,7 +70,7 @@ void Endpoint::set_in_notifier() NonnullOwnPtr Endpoint::read_command() { - String line(ReadonlyBytes(m_in->read_line(4096).bytes()), Chomp); + DeprecatedString line(ReadonlyBytes(m_in->read_line(4096).bytes()), Chomp); dbgln_if(UCI_DEBUG, "{} Received UCI Command: {}", class_name(), line); diff --git a/Userland/Libraries/LibCodeComprehension/CodeComprehensionEngine.cpp b/Userland/Libraries/LibCodeComprehension/CodeComprehensionEngine.cpp index d1b77e0976a..432c91f0df9 100644 --- a/Userland/Libraries/LibCodeComprehension/CodeComprehensionEngine.cpp +++ b/Userland/Libraries/LibCodeComprehension/CodeComprehensionEngine.cpp @@ -15,7 +15,7 @@ CodeComprehensionEngine::CodeComprehensionEngine(FileDB const& filedb, bool shou { } -void CodeComprehensionEngine::set_declarations_of_document(String const& filename, Vector&& declarations) +void CodeComprehensionEngine::set_declarations_of_document(DeprecatedString const& filename, Vector&& declarations) { // Callback may not be configured if we're running tests if (!set_declarations_of_document_callback) @@ -31,7 +31,7 @@ void CodeComprehensionEngine::set_declarations_of_document(String const& filenam set_declarations_of_document_callback(filename, move(declarations)); } -void CodeComprehensionEngine::set_todo_entries_of_document(String const& filename, Vector&& todo_entries) +void CodeComprehensionEngine::set_todo_entries_of_document(DeprecatedString const& filename, Vector&& todo_entries) { // Callback may not be configured if we're running tests if (!set_todo_entries_of_document_callback) diff --git a/Userland/Libraries/LibCodeComprehension/CodeComprehensionEngine.h b/Userland/Libraries/LibCodeComprehension/CodeComprehensionEngine.h index 04d7909a421..e228b906823 100644 --- a/Userland/Libraries/LibCodeComprehension/CodeComprehensionEngine.h +++ b/Userland/Libraries/LibCodeComprehension/CodeComprehensionEngine.h @@ -24,33 +24,33 @@ public: CodeComprehensionEngine(FileDB const& filedb, bool store_all_declarations = false); virtual ~CodeComprehensionEngine() = default; - virtual Vector get_suggestions(String const& file, GUI::TextPosition const& autocomplete_position) = 0; + virtual Vector get_suggestions(DeprecatedString const& file, GUI::TextPosition const& autocomplete_position) = 0; // TODO: In the future we can pass the range that was edited and only re-parse what we have to. - virtual void on_edit([[maybe_unused]] String const& file) {}; - virtual void file_opened([[maybe_unused]] String const& file) {}; + virtual void on_edit([[maybe_unused]] DeprecatedString const& file) {}; + virtual void file_opened([[maybe_unused]] DeprecatedString const& file) {}; - virtual Optional find_declaration_of(String const&, GUI::TextPosition const&) { return {}; } + virtual Optional find_declaration_of(DeprecatedString const&, GUI::TextPosition const&) { return {}; } struct FunctionParamsHint { - Vector params; + Vector params; size_t current_index { 0 }; }; - virtual Optional get_function_params_hint(String const&, GUI::TextPosition const&) { return {}; } + virtual Optional get_function_params_hint(DeprecatedString const&, GUI::TextPosition const&) { return {}; } - virtual Vector get_tokens_info(String const&) { return {}; } + virtual Vector get_tokens_info(DeprecatedString const&) { return {}; } - Function&&)> set_declarations_of_document_callback; - Function&&)> set_todo_entries_of_document_callback; + Function&&)> set_declarations_of_document_callback; + Function&&)> set_todo_entries_of_document_callback; protected: FileDB const& filedb() const { return m_filedb; } - void set_declarations_of_document(String const&, Vector&&); - void set_todo_entries_of_document(String const&, Vector&&); - HashMap> const& all_declarations() const { return m_all_declarations; } + void set_declarations_of_document(DeprecatedString const&, Vector&&); + void set_todo_entries_of_document(DeprecatedString const&, Vector&&); + HashMap> const& all_declarations() const { return m_all_declarations; } private: - HashMap> m_all_declarations; + HashMap> m_all_declarations; FileDB const& m_filedb; bool m_store_all_declarations { false }; }; diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/ConnectionFromClient.h b/Userland/Libraries/LibCodeComprehension/Cpp/ConnectionFromClient.h index f61208a0063..f609a7f2707 100644 --- a/Userland/Libraries/LibCodeComprehension/Cpp/ConnectionFromClient.h +++ b/Userland/Libraries/LibCodeComprehension/Cpp/ConnectionFromClient.h @@ -19,10 +19,10 @@ private: : LanguageServers::ConnectionFromClient(move(socket)) { m_autocomplete_engine = make(m_filedb); - m_autocomplete_engine->set_declarations_of_document_callback = [this](String const& filename, Vector&& declarations) { + m_autocomplete_engine->set_declarations_of_document_callback = [this](DeprecatedString const& filename, Vector&& declarations) { async_declarations_in_document(filename, move(declarations)); }; - m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector&& todo_entries) { + m_autocomplete_engine->set_todo_entries_of_document_callback = [this](DeprecatedString const& filename, Vector&& todo_entries) { async_todo_entries_in_document(filename, move(todo_entries)); }; } diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp index 49c82632273..df04444f352 100644 --- a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp +++ b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.cpp @@ -25,7 +25,7 @@ CppComprehensionEngine::CppComprehensionEngine(FileDB const& filedb) { } -CppComprehensionEngine::DocumentData const* CppComprehensionEngine::get_or_create_document_data(String const& file) +CppComprehensionEngine::DocumentData const* CppComprehensionEngine::get_or_create_document_data(DeprecatedString const& file) { auto absolute_path = filedb().to_absolute_path(file); if (!m_documents.contains(absolute_path)) { @@ -34,7 +34,7 @@ CppComprehensionEngine::DocumentData const* CppComprehensionEngine::get_or_creat return get_document_data(absolute_path); } -CppComprehensionEngine::DocumentData const* CppComprehensionEngine::get_document_data(String const& file) const +CppComprehensionEngine::DocumentData const* CppComprehensionEngine::get_document_data(DeprecatedString const& file) const { auto absolute_path = filedb().to_absolute_path(file); auto document_data = m_documents.get(absolute_path); @@ -43,7 +43,7 @@ CppComprehensionEngine::DocumentData const* CppComprehensionEngine::get_document return document_data.value(); } -OwnPtr CppComprehensionEngine::create_document_data_for(String const& file) +OwnPtr CppComprehensionEngine::create_document_data_for(DeprecatedString const& file) { if (m_unfinished_documents.contains(file)) { return {}; @@ -56,12 +56,12 @@ OwnPtr CppComprehensionEngine::create_docu return create_document_data(move(document.value()), file); } -void CppComprehensionEngine::set_document_data(String const& file, OwnPtr&& data) +void CppComprehensionEngine::set_document_data(DeprecatedString const& file, OwnPtr&& data) { m_documents.set(filedb().to_absolute_path(file), move(data)); } -Vector CppComprehensionEngine::get_suggestions(String const& file, const GUI::TextPosition& autocomplete_position) +Vector CppComprehensionEngine::get_suggestions(DeprecatedString const& file, const GUI::TextPosition& autocomplete_position) { Cpp::Position position { autocomplete_position.line(), autocomplete_position.column() > 0 ? autocomplete_position.column() - 1 : 0 }; @@ -104,7 +104,7 @@ Vector CppComprehensionEngine::get_s Optional> CppComprehensionEngine::try_autocomplete_name(DocumentData const& document, ASTNode const& node, Optional containing_token) const { - auto partial_text = String::empty(); + auto partial_text = DeprecatedString::empty(); if (containing_token.has_value() && containing_token.value().type() != Token::Type::ColonColon) { partial_text = containing_token.value().text(); } @@ -121,7 +121,7 @@ Optional> CppComprehensionEng auto const& parent = static_cast(*node.parent()); - auto partial_text = String::empty(); + auto partial_text = DeprecatedString::empty(); if (containing_token.value().type() != Token::Type::Dot) { if (&node != parent.property()) return {}; @@ -131,7 +131,7 @@ Optional> CppComprehensionEng return autocomplete_property(document, parent, partial_text); } -Vector CppComprehensionEngine::autocomplete_name(DocumentData const& document, ASTNode const& node, String const& partial_text) const +Vector CppComprehensionEngine::autocomplete_name(DocumentData const& document, ASTNode const& node, DeprecatedString const& partial_text) const { auto reference_scope = scope_of_reference_to_symbol(node); auto current_scope = scope_of_node(node); @@ -206,7 +206,7 @@ Vector CppComprehensionEngine::scope_of_reference_to_symbol(ASTNode return scope_parts; } -Vector CppComprehensionEngine::autocomplete_property(DocumentData const& document, MemberExpression const& parent, const String partial_text) const +Vector CppComprehensionEngine::autocomplete_property(DocumentData const& document, MemberExpression const& parent, const DeprecatedString partial_text) const { VERIFY(parent.object()); auto type = type_of(document, *parent.object()); @@ -233,7 +233,7 @@ bool CppComprehensionEngine::is_property(ASTNode const& node) const return parent.property() == &node; } -String CppComprehensionEngine::type_of_property(DocumentData const& document, Identifier const& identifier) const +DeprecatedString CppComprehensionEngine::type_of_property(DocumentData const& document, Identifier const& identifier) const { auto& parent = verify_cast(*identifier.parent()); VERIFY(parent.object()); @@ -253,12 +253,12 @@ String CppComprehensionEngine::type_of_property(DocumentData const& document, Id VERIFY(verify_cast(*type).name()); if (verify_cast(*type).name()) return verify_cast(*type).name()->full_name(); - return String::empty(); + return DeprecatedString::empty(); } return {}; } -String CppComprehensionEngine::type_of_variable(Identifier const& identifier) const +DeprecatedString CppComprehensionEngine::type_of_variable(Identifier const& identifier) const { ASTNode const* current = &identifier; while (current) { @@ -269,7 +269,7 @@ String CppComprehensionEngine::type_of_variable(Identifier const& identifier) co VERIFY(verify_cast(*var_or_param.type()).name()); if (verify_cast(*var_or_param.type()).name()) return verify_cast(*var_or_param.type()).name()->full_name(); - return String::empty(); + return DeprecatedString::empty(); } } } @@ -278,7 +278,7 @@ String CppComprehensionEngine::type_of_variable(Identifier const& identifier) co return {}; } -String CppComprehensionEngine::type_of(DocumentData const& document, Expression const& expression) const +DeprecatedString CppComprehensionEngine::type_of(DocumentData const& document, Expression const& expression) const { if (expression.is_member_expression()) { auto& member_expression = verify_cast(expression); @@ -304,7 +304,7 @@ String CppComprehensionEngine::type_of(DocumentData const& document, Expression return type_of_variable(*identifier); } -Vector CppComprehensionEngine::properties_of_type(DocumentData const& document, String const& type) const +Vector CppComprehensionEngine::properties_of_type(DocumentData const& document, DeprecatedString const& type) const { auto type_symbol = SymbolName::create(type); auto decl = find_declaration_of(document, type_symbol); @@ -362,21 +362,21 @@ Vector CppComprehensionEngine::get_child_symbols return symbols; } -String CppComprehensionEngine::document_path_from_include_path(StringView include_path) const +DeprecatedString CppComprehensionEngine::document_path_from_include_path(StringView include_path) const { static Regex library_include("<(.+)>"); static Regex user_defined_include("\"(.+)\""); - auto document_path_for_library_include = [&](StringView include_path) -> String { + auto document_path_for_library_include = [&](StringView include_path) -> DeprecatedString { RegexResult result; if (!library_include.search(include_path, result)) return {}; auto path = result.capture_group_matches.at(0).at(0).view.string_view(); - return String::formatted("/usr/include/{}", path); + return DeprecatedString::formatted("/usr/include/{}", path); }; - auto document_path_for_user_defined_include = [&](StringView include_path) -> String { + auto document_path_for_user_defined_include = [&](StringView include_path) -> DeprecatedString { RegexResult result; if (!user_defined_include.search(include_path, result)) return {}; @@ -391,17 +391,17 @@ String CppComprehensionEngine::document_path_from_include_path(StringView includ return result; } -void CppComprehensionEngine::on_edit(String const& file) +void CppComprehensionEngine::on_edit(DeprecatedString const& file) { set_document_data(file, create_document_data_for(file)); } -void CppComprehensionEngine::file_opened([[maybe_unused]] String const& file) +void CppComprehensionEngine::file_opened([[maybe_unused]] DeprecatedString const& file) { get_or_create_document_data(file); } -Optional CppComprehensionEngine::find_declaration_of(String const& filename, const GUI::TextPosition& identifier_position) +Optional CppComprehensionEngine::find_declaration_of(DeprecatedString const& filename, const GUI::TextPosition& identifier_position) { auto const* document_ptr = get_or_create_document_data(filename); if (!document_ptr) @@ -456,10 +456,10 @@ struct TargetDeclaration { Property, Scope } type; - String name; + DeprecatedString name; }; -static Optional get_target_declaration(ASTNode const& node, String name); +static Optional get_target_declaration(ASTNode const& node, DeprecatedString name); static Optional get_target_declaration(ASTNode const& node) { if (node.is_identifier()) { @@ -478,7 +478,7 @@ static Optional get_target_declaration(ASTNode const& node) return {}; } -static Optional get_target_declaration(ASTNode const& node, String name) +static Optional get_target_declaration(ASTNode const& node, DeprecatedString name) { if (node.parent() && node.parent()->is_name()) { auto& name_node = *verify_cast(node.parent()); @@ -612,7 +612,7 @@ CodeComprehension::DeclarationType CppComprehensionEngine::type_of_declaration(C return CodeComprehension::DeclarationType::Variable; } -OwnPtr CppComprehensionEngine::create_document_data(String text, String const& filename) +OwnPtr CppComprehensionEngine::create_document_data(DeprecatedString text, DeprecatedString const& filename) { auto document_data = make(); document_data->m_filename = filename; @@ -693,7 +693,7 @@ Optional> CppComprehensionEng System, } include_type { Project }; - String include_root; + DeprecatedString include_root; bool already_has_suffix = false; if (partial_include.starts_with('<')) { include_root = "/usr/include/"; @@ -716,7 +716,7 @@ Optional> CppComprehensionEng return {}; auto last_slash = partial_include.find_last('/'); - auto include_dir = String::empty(); + auto include_dir = DeprecatedString::empty(); auto partial_basename = partial_include.substring_view((last_slash.has_value() ? last_slash.value() : 0) + 1); if (last_slash.has_value()) { include_dir = partial_include.substring_view(1, last_slash.value()); @@ -738,12 +738,12 @@ Optional> CppComprehensionEng if (Core::File::is_directory(LexicalPath::join(full_dir, path).string())) { // FIXME: Don't dismiss the autocomplete when filling these suggestions. - auto completion = String::formatted("{}{}{}/", prefix, include_dir, path); + auto completion = DeprecatedString::formatted("{}{}{}/", prefix, include_dir, path); options.empend(completion, include_dir.length() + partial_basename.length() + 1, CodeComprehension::Language::Cpp, path, CodeComprehension::AutocompleteResultEntry::HideAutocompleteAfterApplying::No); } else if (path.ends_with(".h"sv)) { // FIXME: Place the cursor after the trailing > or ", even if it was // already typed. - auto completion = String::formatted("{}{}{}{}", prefix, include_dir, path, already_has_suffix ? "" : suffix); + auto completion = DeprecatedString::formatted("{}{}{}{}", prefix, include_dir, path, already_has_suffix ? "" : suffix); options.empend(completion, include_dir.length() + partial_basename.length() + 1, CodeComprehension::Language::Cpp, path); } } @@ -764,10 +764,10 @@ RefPtr CppComprehensionEngine::find_declaration_of(CppComprehe return target_declaration; } -String CppComprehensionEngine::SymbolName::scope_as_string() const +DeprecatedString CppComprehensionEngine::SymbolName::scope_as_string() const { if (scope.is_empty()) - return String::empty(); + return DeprecatedString::empty(); StringBuilder builder; for (size_t i = 0; i < scope.size() - 1; ++i) { @@ -790,11 +790,11 @@ CppComprehensionEngine::SymbolName CppComprehensionEngine::SymbolName::create(St return SymbolName::create(name, move(parts)); } -String CppComprehensionEngine::SymbolName::to_string() const +DeprecatedString CppComprehensionEngine::SymbolName::to_string() const { if (scope.is_empty()) return name; - return String::formatted("{}::{}", scope_as_string(), name); + return DeprecatedString::formatted("{}::{}", scope_as_string(), name); } bool CppComprehensionEngine::is_symbol_available(Symbol const& symbol, Vector const& current_scope, Vector const& reference_scope) @@ -818,7 +818,7 @@ bool CppComprehensionEngine::is_symbol_available(Symbol const& symbol, Vector CppComprehensionEngine::get_function_params_hint(String const& filename, const GUI::TextPosition& identifier_position) +Optional CppComprehensionEngine::get_function_params_hint(DeprecatedString const& filename, const GUI::TextPosition& identifier_position) { auto const* document_ptr = get_or_create_document_data(filename); if (!document_ptr) @@ -923,13 +923,13 @@ Optional CppComprehensionEngine::get for (auto token : document_of_declaration->parser().tokens_in_range(arg.start(), arg.end())) { tokens_text.append(token.text()); } - hint.params.append(String::join(' ', tokens_text)); + hint.params.append(DeprecatedString::join(' ', tokens_text)); } return hint; } -Vector CppComprehensionEngine::get_tokens_info(String const& filename) +Vector CppComprehensionEngine::get_tokens_info(DeprecatedString const& filename) { dbgln_if(CPP_LANGUAGE_SERVER_DEBUG, "CppComprehensionEngine::get_tokens_info: {}", filename); diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.h b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.h index 271bdd3b5bd..042bb19c27e 100644 --- a/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.h +++ b/Userland/Libraries/LibCodeComprehension/Cpp/CppComprehensionEngine.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include #include #include #include @@ -25,12 +25,12 @@ class CppComprehensionEngine : public CodeComprehensionEngine { public: CppComprehensionEngine(FileDB const& filedb); - virtual Vector get_suggestions(String const& file, GUI::TextPosition const& autocomplete_position) override; - virtual void on_edit(String const& file) override; - virtual void file_opened([[maybe_unused]] String const& file) override; - virtual Optional find_declaration_of(String const& filename, GUI::TextPosition const& identifier_position) override; - virtual Optional get_function_params_hint(String const&, GUI::TextPosition const&) override; - virtual Vector get_tokens_info(String const& filename) override; + virtual Vector get_suggestions(DeprecatedString const& file, GUI::TextPosition const& autocomplete_position) override; + virtual void on_edit(DeprecatedString const& file) override; + virtual void file_opened([[maybe_unused]] DeprecatedString const& file) override; + virtual Optional find_declaration_of(DeprecatedString const& filename, GUI::TextPosition const& identifier_position) override; + virtual Optional get_function_params_hint(DeprecatedString const&, GUI::TextPosition const&) override; + virtual Vector get_tokens_info(DeprecatedString const& filename) override; private: struct SymbolName { @@ -39,8 +39,8 @@ private: static SymbolName create(StringView, Vector&&); static SymbolName create(StringView); - String scope_as_string() const; - String to_string() const; + DeprecatedString scope_as_string() const; + DeprecatedString to_string() const; bool operator==(SymbolName const&) const = default; }; @@ -63,8 +63,8 @@ private: friend Traits; struct DocumentData { - String const& filename() const { return m_filename; } - String const& text() const { return m_text; } + DeprecatedString const& filename() const { return m_filename; } + DeprecatedString const& text() const { return m_text; } Preprocessor const& preprocessor() const { VERIFY(m_preprocessor); @@ -86,20 +86,20 @@ private: return *m_parser; } - String m_filename; - String m_text; + DeprecatedString m_filename; + DeprecatedString m_text; OwnPtr m_preprocessor; OwnPtr m_parser; HashMap m_symbols; - HashTable m_available_headers; + HashTable m_available_headers; }; - Vector autocomplete_property(DocumentData const&, MemberExpression const&, const String partial_text) const; - Vector autocomplete_name(DocumentData const&, ASTNode const&, String const& partial_text) const; - String type_of(DocumentData const&, Expression const&) const; - String type_of_property(DocumentData const&, Identifier const&) const; - String type_of_variable(Identifier const&) const; + Vector autocomplete_property(DocumentData const&, MemberExpression const&, const DeprecatedString partial_text) const; + Vector autocomplete_name(DocumentData const&, ASTNode const&, DeprecatedString const& partial_text) const; + DeprecatedString type_of(DocumentData const&, Expression const&) const; + DeprecatedString type_of_property(DocumentData const&, Identifier const&) const; + DeprecatedString type_of_variable(Identifier const&) const; bool is_property(ASTNode const&) const; RefPtr find_declaration_of(DocumentData const&, ASTNode const&) const; RefPtr find_declaration_of(DocumentData const&, SymbolName const&) const; @@ -110,16 +110,16 @@ private: Yes }; - Vector properties_of_type(DocumentData const& document, String const& type) const; + Vector properties_of_type(DocumentData const& document, DeprecatedString const& type) const; Vector get_child_symbols(ASTNode const&) const; Vector get_child_symbols(ASTNode const&, Vector const& scope, Symbol::IsLocal) const; - DocumentData const* get_document_data(String const& file) const; - DocumentData const* get_or_create_document_data(String const& file); - void set_document_data(String const& file, OwnPtr&& data); + DocumentData const* get_document_data(DeprecatedString const& file) const; + DocumentData const* get_or_create_document_data(DeprecatedString const& file); + void set_document_data(DeprecatedString const& file, OwnPtr&& data); - OwnPtr create_document_data_for(String const& file); - String document_path_from_include_path(StringView include_path) const; + OwnPtr create_document_data_for(DeprecatedString const& file); + DeprecatedString document_path_from_include_path(StringView include_path) const; void update_declared_symbols(DocumentData&); void update_todo_entries(DocumentData&); CodeComprehension::DeclarationType type_of_declaration(Cpp::Declaration const&); @@ -129,7 +129,7 @@ private: Optional find_preprocessor_definition(DocumentData const&, const GUI::TextPosition&); Optional find_preprocessor_substitution(DocumentData const&, Cpp::Position const&); - OwnPtr create_document_data(String text, String const& filename); + OwnPtr create_document_data(DeprecatedString text, DeprecatedString const& filename); Optional> try_autocomplete_property(DocumentData const&, ASTNode const&, Optional containing_token) const; Optional> try_autocomplete_name(DocumentData const&, ASTNode const&, Optional containing_token) const; Optional> try_autocomplete_include(DocumentData const&, Token include_path_token, Cpp::Position const& cursor_position) const; @@ -145,12 +145,12 @@ private: CodeComprehension::TokenInfo::SemanticType get_token_semantic_type(DocumentData const&, Token const&); CodeComprehension::TokenInfo::SemanticType get_semantic_type_for_identifier(DocumentData const&, Position); - HashMap> m_documents; + HashMap> m_documents; // A document's path will be in this set if we're currently processing it. // A document is added to this set when we start processing it (e.g because it was #included) and removed when we're done. // We use this to prevent circular #includes from looping indefinitely. - HashTable m_unfinished_documents; + HashTable m_unfinished_documents; }; template diff --git a/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp b/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp index ad0fe9809d0..3cd1e8dc38d 100644 --- a/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp +++ b/Userland/Libraries/LibCodeComprehension/Cpp/Tests.cpp @@ -39,14 +39,14 @@ class FileDB : public CodeComprehension::FileDB { public: FileDB() = default; - void add(String filename, String content) + void add(DeprecatedString filename, DeprecatedString content) { m_map.set(filename, content); } - virtual Optional get_or_read_from_filesystem(StringView filename) const override + virtual Optional get_or_read_from_filesystem(StringView filename) const override { - String target_filename = filename; + DeprecatedString target_filename = filename; if (!project_root().is_null() && filename.starts_with(project_root())) { target_filename = LexicalPath::relative_path(filename, project_root()); } @@ -54,7 +54,7 @@ public: } private: - HashMap m_map; + HashMap m_map; }; static void test_complete_local_args(); @@ -75,11 +75,11 @@ int run_tests() return s_some_test_failed ? 1 : 0; } -static void add_file(FileDB& filedb, String const& name) +static void add_file(FileDB& filedb, DeprecatedString const& name) { auto file = Core::File::open(LexicalPath::join(TESTS_ROOT_DIR, name).string(), Core::OpenMode::ReadOnly); VERIFY(!file.is_error()); - filedb.add(name, String::copy(file.value()->read_all())); + filedb.add(name, DeprecatedString::copy(file.value()->read_all())); } void test_complete_local_args() @@ -182,19 +182,19 @@ void test_parameters_hint() auto result = engine.get_function_params_hint("parameters_hint1.cpp", { 4, 9 }); if (!result.has_value()) FAIL("failed to get parameters hint (1)"); - if (result->params != Vector { "int x", "char y" } || result->current_index != 0) + if (result->params != Vector { "int x", "char y" } || result->current_index != 0) FAIL("bad result (1)"); result = engine.get_function_params_hint("parameters_hint1.cpp", { 5, 15 }); if (!result.has_value()) FAIL("failed to get parameters hint (2)"); - if (result->params != Vector { "int x", "char y" } || result->current_index != 1) + if (result->params != Vector { "int x", "char y" } || result->current_index != 1) FAIL("bad result (2)"); result = engine.get_function_params_hint("parameters_hint1.cpp", { 6, 8 }); if (!result.has_value()) FAIL("failed to get parameters hint (3)"); - if (result->params != Vector { "int x", "char y" } || result->current_index != 0) + if (result->params != Vector { "int x", "char y" } || result->current_index != 0) FAIL("bad result (3)"); PASS; diff --git a/Userland/Libraries/LibCodeComprehension/FileDB.cpp b/Userland/Libraries/LibCodeComprehension/FileDB.cpp index 9ba14625741..64edd56918f 100644 --- a/Userland/Libraries/LibCodeComprehension/FileDB.cpp +++ b/Userland/Libraries/LibCodeComprehension/FileDB.cpp @@ -9,14 +9,14 @@ namespace CodeComprehension { -String FileDB::to_absolute_path(StringView filename) const +DeprecatedString FileDB::to_absolute_path(StringView filename) const { if (LexicalPath { filename }.is_absolute()) { return filename; } if (m_project_root.is_null()) return filename; - return LexicalPath { String::formatted("{}/{}", m_project_root, filename) }.string(); + return LexicalPath { DeprecatedString::formatted("{}/{}", m_project_root, filename) }.string(); } } diff --git a/Userland/Libraries/LibCodeComprehension/FileDB.h b/Userland/Libraries/LibCodeComprehension/FileDB.h index 36e1a6efcf4..19495ae86ad 100644 --- a/Userland/Libraries/LibCodeComprehension/FileDB.h +++ b/Userland/Libraries/LibCodeComprehension/FileDB.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace CodeComprehension { @@ -18,16 +18,16 @@ class FileDB { public: virtual ~FileDB() = default; - virtual Optional get_or_read_from_filesystem(StringView filename) const = 0; + virtual Optional get_or_read_from_filesystem(StringView filename) const = 0; void set_project_root(StringView project_root) { m_project_root = project_root; } - String const& project_root() const { return m_project_root; } - String to_absolute_path(StringView filename) const; + DeprecatedString const& project_root() const { return m_project_root; } + DeprecatedString to_absolute_path(StringView filename) const; protected: FileDB() = default; private: - String m_project_root; + DeprecatedString m_project_root; }; } diff --git a/Userland/Libraries/LibCodeComprehension/Shell/ConnectionFromClient.h b/Userland/Libraries/LibCodeComprehension/Shell/ConnectionFromClient.h index e427b1175ae..960f088b446 100644 --- a/Userland/Libraries/LibCodeComprehension/Shell/ConnectionFromClient.h +++ b/Userland/Libraries/LibCodeComprehension/Shell/ConnectionFromClient.h @@ -20,10 +20,10 @@ private: : LanguageServers::ConnectionFromClient(move(socket)) { m_autocomplete_engine = make(m_filedb); - m_autocomplete_engine->set_declarations_of_document_callback = [this](String const& filename, Vector&& declarations) { + m_autocomplete_engine->set_declarations_of_document_callback = [this](DeprecatedString const& filename, Vector&& declarations) { async_declarations_in_document(filename, move(declarations)); }; - m_autocomplete_engine->set_todo_entries_of_document_callback = [this](String const& filename, Vector&& todo_entries) { + m_autocomplete_engine->set_todo_entries_of_document_callback = [this](DeprecatedString const& filename, Vector&& todo_entries) { async_todo_entries_in_document(filename, move(todo_entries)); }; } diff --git a/Userland/Libraries/LibCodeComprehension/Shell/ShellComprehensionEngine.cpp b/Userland/Libraries/LibCodeComprehension/Shell/ShellComprehensionEngine.cpp index f90f2ef227d..51cc01b29e4 100644 --- a/Userland/Libraries/LibCodeComprehension/Shell/ShellComprehensionEngine.cpp +++ b/Userland/Libraries/LibCodeComprehension/Shell/ShellComprehensionEngine.cpp @@ -18,7 +18,7 @@ ShellComprehensionEngine::ShellComprehensionEngine(FileDB const& filedb) { } -ShellComprehensionEngine::DocumentData const& ShellComprehensionEngine::get_or_create_document_data(String const& file) +ShellComprehensionEngine::DocumentData const& ShellComprehensionEngine::get_or_create_document_data(DeprecatedString const& file) { auto absolute_path = filedb().to_absolute_path(file); if (!m_documents.contains(absolute_path)) { @@ -27,7 +27,7 @@ ShellComprehensionEngine::DocumentData const& ShellComprehensionEngine::get_or_c return get_document_data(absolute_path); } -ShellComprehensionEngine::DocumentData const& ShellComprehensionEngine::get_document_data(String const& file) const +ShellComprehensionEngine::DocumentData const& ShellComprehensionEngine::get_document_data(DeprecatedString const& file) const { auto absolute_path = filedb().to_absolute_path(file); auto document_data = m_documents.get(absolute_path); @@ -35,7 +35,7 @@ ShellComprehensionEngine::DocumentData const& ShellComprehensionEngine::get_docu return *document_data.value(); } -OwnPtr ShellComprehensionEngine::create_document_data_for(String const& file) +OwnPtr ShellComprehensionEngine::create_document_data_for(DeprecatedString const& file) { auto document = filedb().get_or_read_from_filesystem(file); if (!document.has_value()) @@ -50,19 +50,19 @@ OwnPtr ShellComprehensionEngine::create_ return document_data; } -void ShellComprehensionEngine::set_document_data(String const& file, OwnPtr&& data) +void ShellComprehensionEngine::set_document_data(DeprecatedString const& file, OwnPtr&& data) { m_documents.set(filedb().to_absolute_path(file), move(data)); } -ShellComprehensionEngine::DocumentData::DocumentData(String&& _text, String _filename) +ShellComprehensionEngine::DocumentData::DocumentData(DeprecatedString&& _text, DeprecatedString _filename) : filename(move(_filename)) , text(move(_text)) , node(parse()) { } -Vector const& ShellComprehensionEngine::DocumentData::sourced_paths() const +Vector const& ShellComprehensionEngine::DocumentData::sourced_paths() const { if (all_sourced_paths.has_value()) return all_sourced_paths.value(); @@ -88,12 +88,12 @@ Vector const& ShellComprehensionEngine::DocumentData::sourced_paths() co ::Shell::AST::NodeVisitor::visit(node); } - HashTable sourced_files; + HashTable sourced_files; } visitor; node->visit(visitor); - Vector sourced_paths; + Vector sourced_paths; for (auto& entry : visitor.sourced_files) sourced_paths.append(move(entry)); @@ -133,7 +133,7 @@ size_t ShellComprehensionEngine::resolve(ShellComprehensionEngine::DocumentData return offset; } -Vector ShellComprehensionEngine::get_suggestions(String const& file, const GUI::TextPosition& position) +Vector ShellComprehensionEngine::get_suggestions(DeprecatedString const& file, const GUI::TextPosition& position) { dbgln_if(SH_LANGUAGE_SERVER_DEBUG, "ShellComprehensionEngine position {}:{}", position.line(), position.column()); @@ -154,17 +154,17 @@ Vector ShellComprehensionEngine::get return entries; } -void ShellComprehensionEngine::on_edit(String const& file) +void ShellComprehensionEngine::on_edit(DeprecatedString const& file) { set_document_data(file, create_document_data_for(file)); } -void ShellComprehensionEngine::file_opened([[maybe_unused]] String const& file) +void ShellComprehensionEngine::file_opened([[maybe_unused]] DeprecatedString const& file) { set_document_data(file, create_document_data_for(file)); } -Optional ShellComprehensionEngine::find_declaration_of(String const& filename, const GUI::TextPosition& identifier_position) +Optional ShellComprehensionEngine::find_declaration_of(DeprecatedString const& filename, const GUI::TextPosition& identifier_position) { dbgln_if(SH_LANGUAGE_SERVER_DEBUG, "find_declaration_of({}, {}:{})", filename, identifier_position.line(), identifier_position.column()); auto const& document = get_or_create_document_data(filename); @@ -195,7 +195,7 @@ Optional ShellComprehensionEngine::find_decl void ShellComprehensionEngine::update_declared_symbols(DocumentData const& document) { struct Visitor : public ::Shell::AST::NodeVisitor { - explicit Visitor(String const& filename) + explicit Visitor(DeprecatedString const& filename) : filename(filename) { } @@ -207,7 +207,7 @@ void ShellComprehensionEngine::update_declared_symbols(DocumentData const& docum if (!literal) continue; - String name; + DeprecatedString name; if (literal->is_bareword()) name = static_ptr_cast<::Shell::AST::BarewordLiteral>(literal)->text(); @@ -225,7 +225,7 @@ void ShellComprehensionEngine::update_declared_symbols(DocumentData const& docum declarations.append({ node->name().name, { filename, node->position().start_line.line_number, node->position().start_line.line_column }, CodeComprehension::DeclarationType::Function, {} }); } - String const& filename; + DeprecatedString const& filename; Vector declarations; } visitor { document.filename }; diff --git a/Userland/Libraries/LibCodeComprehension/Shell/ShellComprehensionEngine.h b/Userland/Libraries/LibCodeComprehension/Shell/ShellComprehensionEngine.h index 887e16d5cf3..bf888d388f3 100644 --- a/Userland/Libraries/LibCodeComprehension/Shell/ShellComprehensionEngine.h +++ b/Userland/Libraries/LibCodeComprehension/Shell/ShellComprehensionEngine.h @@ -14,32 +14,32 @@ namespace CodeComprehension::Shell { class ShellComprehensionEngine : public CodeComprehensionEngine { public: ShellComprehensionEngine(FileDB const& filedb); - virtual Vector get_suggestions(String const& file, const GUI::TextPosition& position) override; - virtual void on_edit(String const& file) override; - virtual void file_opened([[maybe_unused]] String const& file) override; - virtual Optional find_declaration_of(String const& filename, const GUI::TextPosition& identifier_position) override; + virtual Vector get_suggestions(DeprecatedString const& file, const GUI::TextPosition& position) override; + virtual void on_edit(DeprecatedString const& file) override; + virtual void file_opened([[maybe_unused]] DeprecatedString const& file) override; + virtual Optional find_declaration_of(DeprecatedString const& filename, const GUI::TextPosition& identifier_position) override; private: struct DocumentData { - DocumentData(String&& text, String filename); - String filename; - String text; + DocumentData(DeprecatedString&& text, DeprecatedString filename); + DeprecatedString filename; + DeprecatedString text; NonnullRefPtr<::Shell::AST::Node> node; - Vector const& sourced_paths() const; + Vector const& sourced_paths() const; private: NonnullRefPtr<::Shell::AST::Node> parse() const; - mutable Optional> all_sourced_paths {}; + mutable Optional> all_sourced_paths {}; }; - DocumentData const& get_document_data(String const& file) const; - DocumentData const& get_or_create_document_data(String const& file); - void set_document_data(String const& file, OwnPtr&& data); + DocumentData const& get_document_data(DeprecatedString const& file) const; + DocumentData const& get_or_create_document_data(DeprecatedString const& file); + void set_document_data(DeprecatedString const& file, OwnPtr&& data); - OwnPtr create_document_data_for(String const& file); - String document_path_from_include_path(StringView include_path) const; + OwnPtr create_document_data_for(DeprecatedString const& file); + DeprecatedString document_path_from_include_path(StringView include_path) const; void update_declared_symbols(DocumentData const&); static size_t resolve(ShellComprehensionEngine::DocumentData const& document, const GUI::TextPosition& position); @@ -52,7 +52,7 @@ private: return *s_shell; } - HashMap> m_documents; + HashMap> m_documents; static RefPtr<::Shell::Shell> s_shell; }; } diff --git a/Userland/Libraries/LibCodeComprehension/Types.h b/Userland/Libraries/LibCodeComprehension/Types.h index a8589ca35e1..67f0bc2a4a4 100644 --- a/Userland/Libraries/LibCodeComprehension/Types.h +++ b/Userland/Libraries/LibCodeComprehension/Types.h @@ -6,7 +6,7 @@ #pragma once -#include +#include namespace CodeComprehension { @@ -16,11 +16,11 @@ enum class Language { }; struct AutocompleteResultEntry { - String completion; + DeprecatedString completion; size_t partial_input_length { 0 }; // TODO: Actually assign the value of this field in more places (when applicable). Language language { Language::Unspecified }; - String display_text {}; + DeprecatedString display_text {}; enum class HideAutocompleteAfterApplying { No, @@ -30,7 +30,7 @@ struct AutocompleteResultEntry { }; struct ProjectLocation { - String file; + DeprecatedString file; size_t line { 0 }; size_t column { 0 }; @@ -51,10 +51,10 @@ enum class DeclarationType { }; struct Declaration { - String name; + DeprecatedString name; ProjectLocation position; DeclarationType type; - String scope; + DeprecatedString scope; bool operator==(Declaration const& other) const { @@ -109,8 +109,8 @@ struct TokenInfo { }; struct TodoEntry { - String content; - String filename; + DeprecatedString content; + DeprecatedString filename; size_t line { 0 }; size_t column { 0 }; }; diff --git a/Userland/Libraries/LibCompress/Gzip.cpp b/Userland/Libraries/LibCompress/Gzip.cpp index 924bb7bc9bd..0e0e5893766 100644 --- a/Userland/Libraries/LibCompress/Gzip.cpp +++ b/Userland/Libraries/LibCompress/Gzip.cpp @@ -7,8 +7,8 @@ #include +#include #include -#include #include namespace Compress { @@ -154,7 +154,7 @@ size_t GzipDecompressor::read(Bytes bytes) return total_read; } -Optional GzipDecompressor::describe_header(ReadonlyBytes bytes) +Optional GzipDecompressor::describe_header(ReadonlyBytes bytes) { if (bytes.size() < sizeof(BlockHeader)) return {}; @@ -164,7 +164,7 @@ Optional GzipDecompressor::describe_header(ReadonlyBytes bytes) return {}; LittleEndian original_size = *reinterpret_cast(bytes.offset(bytes.size() - sizeof(u32))); - return String::formatted("last modified: {}, original size {}", Core::DateTime::from_timestamp(header.modification_time).to_string(), (u32)original_size); + return DeprecatedString::formatted("last modified: {}, original size {}", Core::DateTime::from_timestamp(header.modification_time).to_string(), (u32)original_size); } bool GzipDecompressor::read_or_error(Bytes bytes) diff --git a/Userland/Libraries/LibCompress/Gzip.h b/Userland/Libraries/LibCompress/Gzip.h index c043bcadc45..080683f52f4 100644 --- a/Userland/Libraries/LibCompress/Gzip.h +++ b/Userland/Libraries/LibCompress/Gzip.h @@ -50,7 +50,7 @@ public: bool handle_any_error() override; static Optional decompress_all(ReadonlyBytes); - static Optional describe_header(ReadonlyBytes); + static Optional describe_header(ReadonlyBytes); static bool is_likely_compressed(ReadonlyBytes bytes); private: diff --git a/Userland/Libraries/LibConfig/Client.cpp b/Userland/Libraries/LibConfig/Client.cpp index 9d026630b2c..b0d7b531266 100644 --- a/Userland/Libraries/LibConfig/Client.cpp +++ b/Userland/Libraries/LibConfig/Client.cpp @@ -20,27 +20,27 @@ Client& Client::the() return *s_the; } -void Client::pledge_domains(Vector const& domains) +void Client::pledge_domains(Vector const& domains) { async_pledge_domains(domains); } -void Client::monitor_domain(String const& domain) +void Client::monitor_domain(DeprecatedString const& domain) { async_monitor_domain(domain); } -Vector Client::list_keys(StringView domain, StringView group) +Vector Client::list_keys(StringView domain, StringView group) { return list_config_keys(domain, group); } -Vector Client::list_groups(StringView domain) +Vector Client::list_groups(StringView domain) { return list_config_groups(domain); } -String Client::read_string(StringView domain, StringView group, StringView key, StringView fallback) +DeprecatedString Client::read_string(StringView domain, StringView group, StringView key, StringView fallback) { return read_string_value(domain, group, key).value_or(fallback); } @@ -85,42 +85,42 @@ void Client::add_group(StringView domain, StringView group) add_group_entry(domain, group); } -void Client::notify_changed_string_value(String const& domain, String const& group, String const& key, String const& value) +void Client::notify_changed_string_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) { Listener::for_each([&](auto& listener) { listener.config_string_did_change(domain, group, key, value); }); } -void Client::notify_changed_i32_value(String const& domain, String const& group, String const& key, i32 value) +void Client::notify_changed_i32_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, i32 value) { Listener::for_each([&](auto& listener) { listener.config_i32_did_change(domain, group, key, value); }); } -void Client::notify_changed_bool_value(String const& domain, String const& group, String const& key, bool value) +void Client::notify_changed_bool_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) { Listener::for_each([&](auto& listener) { listener.config_bool_did_change(domain, group, key, value); }); } -void Client::notify_removed_key(String const& domain, String const& group, String const& key) +void Client::notify_removed_key(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key) { Listener::for_each([&](auto& listener) { listener.config_key_was_removed(domain, group, key); }); } -void Client::notify_removed_group(String const& domain, String const& group) +void Client::notify_removed_group(DeprecatedString const& domain, DeprecatedString const& group) { Listener::for_each([&](auto& listener) { listener.config_group_was_removed(domain, group); }); } -void Client::notify_added_group(String const& domain, String const& group) +void Client::notify_added_group(DeprecatedString const& domain, DeprecatedString const& group) { Listener::for_each([&](auto& listener) { listener.config_group_was_added(domain, group); diff --git a/Userland/Libraries/LibConfig/Client.h b/Userland/Libraries/LibConfig/Client.h index 1ab9e52ad1b..e7c89396aa9 100644 --- a/Userland/Libraries/LibConfig/Client.h +++ b/Userland/Libraries/LibConfig/Client.h @@ -21,13 +21,13 @@ class Client final IPC_CLIENT_CONNECTION(Client, "/tmp/session/%sid/portal/config"sv) public: - void pledge_domains(Vector const&); - void monitor_domain(String const&); + void pledge_domains(Vector const&); + void monitor_domain(DeprecatedString const&); - Vector list_groups(StringView domain); - Vector list_keys(StringView domain, StringView group); + Vector list_groups(StringView domain); + Vector list_keys(StringView domain, StringView group); - String read_string(StringView domain, StringView group, StringView key, StringView fallback); + DeprecatedString read_string(StringView domain, StringView group, StringView key, StringView fallback); i32 read_i32(StringView domain, StringView group, StringView key, i32 fallback); bool read_bool(StringView domain, StringView group, StringView key, bool fallback); @@ -46,25 +46,25 @@ private: { } - void notify_changed_string_value(String const& domain, String const& group, String const& key, String const& value) override; - void notify_changed_i32_value(String const& domain, String const& group, String const& key, i32 value) override; - void notify_changed_bool_value(String const& domain, String const& group, String const& key, bool value) override; - void notify_removed_key(String const& domain, String const& group, String const& key) override; - void notify_removed_group(String const& domain, String const& group) override; - void notify_added_group(String const& domain, String const& group) override; + void notify_changed_string_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) override; + void notify_changed_i32_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, i32 value) override; + void notify_changed_bool_value(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value) override; + void notify_removed_key(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key) override; + void notify_removed_group(DeprecatedString const& domain, DeprecatedString const& group) override; + void notify_added_group(DeprecatedString const& domain, DeprecatedString const& group) override; }; -inline Vector list_groups(StringView domain) +inline Vector list_groups(StringView domain) { return Client::the().list_groups(domain); } -inline Vector list_keys(StringView domain, StringView group) +inline Vector list_keys(StringView domain, StringView group) { return Client::the().list_keys(domain, group); } -inline String read_string(StringView domain, StringView group, StringView key, StringView fallback = {}) +inline DeprecatedString read_string(StringView domain, StringView group, StringView key, StringView fallback = {}) { return Client::the().read_string(domain, group, key, fallback); } @@ -109,17 +109,17 @@ inline void add_group(StringView domain, StringView group) Client::the().add_group(domain, group); } -inline void pledge_domains(Vector const& domains) +inline void pledge_domains(Vector const& domains) { Client::the().pledge_domains(domains); } -inline void pledge_domain(String const& domain) +inline void pledge_domain(DeprecatedString const& domain) { Client::the().pledge_domains({ domain }); } -inline void monitor_domain(String const& domain) +inline void monitor_domain(DeprecatedString const& domain) { Client::the().monitor_domain(domain); } diff --git a/Userland/Libraries/LibConfig/Listener.cpp b/Userland/Libraries/LibConfig/Listener.cpp index 08fafeadc1b..0916619d09c 100644 --- a/Userland/Libraries/LibConfig/Listener.cpp +++ b/Userland/Libraries/LibConfig/Listener.cpp @@ -4,9 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include -#include #include namespace Config { @@ -29,27 +29,27 @@ void Listener::for_each(Function callback) callback(*listener); } -void Listener::config_string_did_change(String const&, String const&, String const&, String const&) +void Listener::config_string_did_change(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) { } -void Listener::config_i32_did_change(String const&, String const&, String const&, i32) +void Listener::config_i32_did_change(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, i32) { } -void Listener::config_bool_did_change(String const&, String const&, String const&, bool) +void Listener::config_bool_did_change(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&, bool) { } -void Listener::config_key_was_removed(String const&, String const&, String const&) +void Listener::config_key_was_removed(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) { } -void Listener::config_group_was_removed(String const&, String const&) +void Listener::config_group_was_removed(DeprecatedString const&, DeprecatedString const&) { } -void Listener::config_group_was_added(String const&, String const&) +void Listener::config_group_was_added(DeprecatedString const&, DeprecatedString const&) { } diff --git a/Userland/Libraries/LibConfig/Listener.h b/Userland/Libraries/LibConfig/Listener.h index 67820d1be29..467b10f2679 100644 --- a/Userland/Libraries/LibConfig/Listener.h +++ b/Userland/Libraries/LibConfig/Listener.h @@ -16,12 +16,12 @@ public: static void for_each(Function); - virtual void config_string_did_change(String const& domain, String const& group, String const& key, String const& value); - virtual void config_i32_did_change(String const& domain, String const& group, String const& key, i32 value); - virtual void config_bool_did_change(String const& domain, String const& group, String const& key, bool value); - virtual void config_key_was_removed(String const& domain, String const& group, String const& key); - virtual void config_group_was_removed(String const& domain, String const& group); - virtual void config_group_was_added(String const& domain, String const& group); + virtual void config_string_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value); + virtual void config_i32_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, i32 value); + virtual void config_bool_did_change(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key, bool value); + virtual void config_key_was_removed(DeprecatedString const& domain, DeprecatedString const& group, DeprecatedString const& key); + virtual void config_group_was_removed(DeprecatedString const& domain, DeprecatedString const& group); + virtual void config_group_was_added(DeprecatedString const& domain, DeprecatedString const& group); protected: Listener(); diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp index c9d27ce53f3..8115bd8dcc5 100644 --- a/Userland/Libraries/LibCore/Account.cpp +++ b/Userland/Libraries/LibCore/Account.cpp @@ -27,7 +27,7 @@ namespace Core { -static String get_salt() +static DeprecatedString get_salt() { char random_data[12]; fill_with_random(random_data, sizeof(random_data)); @@ -223,7 +223,7 @@ Account::Account(passwd const& pwd, spwd const& spwd, Vector extra_gids) { } -ErrorOr Account::generate_passwd_file() const +ErrorOr Account::generate_passwd_file() const { StringBuilder builder; @@ -256,7 +256,7 @@ ErrorOr Account::generate_passwd_file() const } #ifndef AK_OS_BSD_GENERIC -ErrorOr Account::generate_shadow_file() const +ErrorOr Account::generate_shadow_file() const { StringBuilder builder; @@ -268,24 +268,24 @@ ErrorOr Account::generate_shadow_file() const if (p->sp_namp == m_username) { builder.appendff("{}:{}:{}:{}:{}:{}:{}:{}:{}\n", m_username, m_password_hash, - (p->sp_lstchg == -1) ? "" : String::formatted("{}", p->sp_lstchg), - (p->sp_min == -1) ? "" : String::formatted("{}", p->sp_min), - (p->sp_max == -1) ? "" : String::formatted("{}", p->sp_max), - (p->sp_warn == -1) ? "" : String::formatted("{}", p->sp_warn), - (p->sp_inact == -1) ? "" : String::formatted("{}", p->sp_inact), - (p->sp_expire == -1) ? "" : String::formatted("{}", p->sp_expire), - (p->sp_flag == 0) ? "" : String::formatted("{}", p->sp_flag)); + (p->sp_lstchg == -1) ? "" : DeprecatedString::formatted("{}", p->sp_lstchg), + (p->sp_min == -1) ? "" : DeprecatedString::formatted("{}", p->sp_min), + (p->sp_max == -1) ? "" : DeprecatedString::formatted("{}", p->sp_max), + (p->sp_warn == -1) ? "" : DeprecatedString::formatted("{}", p->sp_warn), + (p->sp_inact == -1) ? "" : DeprecatedString::formatted("{}", p->sp_inact), + (p->sp_expire == -1) ? "" : DeprecatedString::formatted("{}", p->sp_expire), + (p->sp_flag == 0) ? "" : DeprecatedString::formatted("{}", p->sp_flag)); } else { builder.appendff("{}:{}:{}:{}:{}:{}:{}:{}:{}\n", p->sp_namp, p->sp_pwdp, - (p->sp_lstchg == -1) ? "" : String::formatted("{}", p->sp_lstchg), - (p->sp_min == -1) ? "" : String::formatted("{}", p->sp_min), - (p->sp_max == -1) ? "" : String::formatted("{}", p->sp_max), - (p->sp_warn == -1) ? "" : String::formatted("{}", p->sp_warn), - (p->sp_inact == -1) ? "" : String::formatted("{}", p->sp_inact), - (p->sp_expire == -1) ? "" : String::formatted("{}", p->sp_expire), - (p->sp_flag == 0) ? "" : String::formatted("{}", p->sp_flag)); + (p->sp_lstchg == -1) ? "" : DeprecatedString::formatted("{}", p->sp_lstchg), + (p->sp_min == -1) ? "" : DeprecatedString::formatted("{}", p->sp_min), + (p->sp_max == -1) ? "" : DeprecatedString::formatted("{}", p->sp_max), + (p->sp_warn == -1) ? "" : DeprecatedString::formatted("{}", p->sp_warn), + (p->sp_inact == -1) ? "" : DeprecatedString::formatted("{}", p->sp_inact), + (p->sp_expire == -1) ? "" : DeprecatedString::formatted("{}", p->sp_expire), + (p->sp_flag == 0) ? "" : DeprecatedString::formatted("{}", p->sp_flag)); } } endspent(); diff --git a/Userland/Libraries/LibCore/Account.h b/Userland/Libraries/LibCore/Account.h index 397fad28e81..c57a11ded77 100644 --- a/Userland/Libraries/LibCore/Account.h +++ b/Userland/Libraries/LibCore/Account.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include @@ -40,8 +40,8 @@ public: bool authenticate(SecretString const& password) const; ErrorOr login() const; - String username() const { return m_username; } - String password_hash() const { return m_password_hash; } + DeprecatedString username() const { return m_username; } + DeprecatedString password_hash() const { return m_password_hash; } // Setters only affect in-memory copy of password. // You must call sync to apply changes. @@ -60,9 +60,9 @@ public: uid_t uid() const { return m_uid; } gid_t gid() const { return m_gid; } - String const& gecos() const { return m_gecos; } - String const& home_directory() const { return m_home_directory; } - String const& shell() const { return m_shell; } + DeprecatedString const& gecos() const { return m_gecos; } + DeprecatedString const& home_directory() const { return m_home_directory; } + DeprecatedString const& shell() const { return m_shell; } Vector const& extra_gids() const { return m_extra_gids; } ErrorOr sync(); @@ -72,19 +72,19 @@ private: Account(passwd const& pwd, spwd const& spwd, Vector extra_gids); - ErrorOr generate_passwd_file() const; + ErrorOr generate_passwd_file() const; #ifndef AK_OS_BSD_GENERIC - ErrorOr generate_shadow_file() const; + ErrorOr generate_shadow_file() const; #endif - String m_username; + DeprecatedString m_username; - String m_password_hash; + DeprecatedString m_password_hash; uid_t m_uid { 0 }; gid_t m_gid { 0 }; - String m_gecos; - String m_home_directory; - String m_shell; + DeprecatedString m_gecos; + DeprecatedString m_home_directory; + DeprecatedString m_shell; Vector m_extra_gids; }; diff --git a/Userland/Libraries/LibCore/ArgsParser.cpp b/Userland/Libraries/LibCore/ArgsParser.cpp index fc6008d6fc3..59d3a17cf0e 100644 --- a/Userland/Libraries/LibCore/ArgsParser.cpp +++ b/Userland/Libraries/LibCore/ArgsParser.cpp @@ -77,7 +77,7 @@ bool ArgsParser::parse(int argc, char* const* argv, FailureBehavior failure_beha } long_options.append({ 0, 0, 0, 0 }); - String short_options = short_options_builder.build(); + DeprecatedString short_options = short_options_builder.build(); while (true) { int c = getopt_long(argc, argv, short_options.characters(), long_options.data(), nullptr); @@ -426,7 +426,7 @@ void ArgsParser::add_option(char const*& value, char const* help_string, char co add_option(move(option)); } -void ArgsParser::add_option(String& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) +void ArgsParser::add_option(DeprecatedString& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { OptionArgumentMode::Required, @@ -570,7 +570,7 @@ void ArgsParser::add_option(Vector& values, char const* help_string, cha add_option(move(option)); } -void ArgsParser::add_option(Vector& values, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) +void ArgsParser::add_option(Vector& values, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode) { Option option { OptionArgumentMode::Optional, @@ -579,7 +579,7 @@ void ArgsParser::add_option(Vector& values, char const* help_string, cha short_name, value_name, [&values](char const* s) { - String value = s; + DeprecatedString value = s; values.append(value); return true; }, @@ -609,7 +609,7 @@ void ArgsParser::add_positional_argument(char const*& value, char const* help_st add_positional_argument(move(arg)); } -void ArgsParser::add_positional_argument(String& value, char const* help_string, char const* name, Required required) +void ArgsParser::add_positional_argument(DeprecatedString& value, char const* help_string, char const* name, Required required) { Arg arg { help_string, @@ -702,7 +702,7 @@ void ArgsParser::add_positional_argument(Vector& values, char const add_positional_argument(move(arg)); } -void ArgsParser::add_positional_argument(Vector& values, char const* help_string, char const* name, Required required) +void ArgsParser::add_positional_argument(Vector& values, char const* help_string, char const* name, Required required) { Arg arg { help_string, @@ -813,7 +813,7 @@ void ArgsParser::autocomplete(FILE* file, StringView program_name, Span #include -#include #include #include #include @@ -53,11 +53,11 @@ public: Function accept_value; OptionHideMode hide_mode { OptionHideMode::None }; - String name_for_display() const + DeprecatedString name_for_display() const { if (long_name) - return String::formatted("--{}", long_name); - return String::formatted("-{:c}", short_name); + return DeprecatedString::formatted("--{}", long_name); + return DeprecatedString::formatted("-{:c}", short_name); } }; @@ -87,7 +87,7 @@ public: void add_ignored(char const* long_name, char short_name, OptionHideMode hide_mode = OptionHideMode::None); void add_option(bool& value, char const* help_string, char const* long_name, char short_name, OptionHideMode hide_mode = OptionHideMode::None); void add_option(char const*& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode = OptionHideMode::None); - void add_option(String& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode = OptionHideMode::None); + void add_option(DeprecatedString& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode = OptionHideMode::None); void add_option(StringView& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode = OptionHideMode::None); template void add_option(Integral& value, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode = OptionHideMode::None) @@ -98,17 +98,17 @@ public: void add_option(Vector& values, char const* help_string, char const* long_name, char short_name, char const* value_name, char separator = ',', OptionHideMode hide_mode = OptionHideMode::None); // Note: This option is being used when we expect the user to use the same option // multiple times (e.g. "program --option=example --option=anotherexample ..."). - void add_option(Vector& values, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode = OptionHideMode::None); + void add_option(Vector& values, char const* help_string, char const* long_name, char short_name, char const* value_name, OptionHideMode hide_mode = OptionHideMode::None); void add_positional_argument(Arg&&); void add_positional_argument(char const*& value, char const* help_string, char const* name, Required required = Required::Yes); - void add_positional_argument(String& value, char const* help_string, char const* name, Required required = Required::Yes); + void add_positional_argument(DeprecatedString& value, char const* help_string, char const* name, Required required = Required::Yes); void add_positional_argument(StringView& value, char const* help_string, char const* name, Required required = Required::Yes); void add_positional_argument(int& value, char const* help_string, char const* name, Required required = Required::Yes); void add_positional_argument(unsigned& value, char const* help_string, char const* name, Required required = Required::Yes); void add_positional_argument(double& value, char const* help_string, char const* name, Required required = Required::Yes); void add_positional_argument(Vector& value, char const* help_string, char const* name, Required required = Required::Yes); - void add_positional_argument(Vector& value, char const* help_string, char const* name, Required required = Required::Yes); + void add_positional_argument(Vector& value, char const* help_string, char const* name, Required required = Required::Yes); void add_positional_argument(Vector& value, char const* help_string, char const* name, Required required = Required::Yes); private: diff --git a/Userland/Libraries/LibCore/Command.cpp b/Userland/Libraries/LibCore/Command.cpp index bc2f73378d1..e3a318c680e 100644 --- a/Userland/Libraries/LibCore/Command.cpp +++ b/Userland/Libraries/LibCore/Command.cpp @@ -18,7 +18,7 @@ namespace Core { // Only supported in serenity mode because we use `posix_spawn_file_actions_addchdir` #ifdef AK_OS_SERENITY -ErrorOr command(String const& command_string, Optional chdir) +ErrorOr command(DeprecatedString const& command_string, Optional chdir) { auto parts = command_string.split(' '); if (parts.is_empty()) @@ -28,7 +28,7 @@ ErrorOr command(String const& command_string, Optional command(String const& program, Vector const& arguments, Optional chdir) +ErrorOr command(DeprecatedString const& program, Vector const& arguments, Optional chdir) { int stdout_pipe[2] = {}; int stderr_pipe[2] = {}; @@ -78,7 +78,7 @@ ErrorOr command(String const& program, Vector const& argu perror("open"); VERIFY_NOT_REACHED(); } - return String::copy(result_file->read_all()); + return DeprecatedString::copy(result_file->read_all()); }; auto output = read_all_from_pipe(stdout_pipe); auto error = read_all_from_pipe(stderr_pipe); diff --git a/Userland/Libraries/LibCore/Command.h b/Userland/Libraries/LibCore/Command.h index a3680a59625..6fa7cf7a991 100644 --- a/Userland/Libraries/LibCore/Command.h +++ b/Userland/Libraries/LibCore/Command.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include namespace Core { @@ -17,11 +17,11 @@ namespace Core { struct CommandResult { int exit_code { 0 }; - String output; - String error; + DeprecatedString output; + DeprecatedString error; }; -ErrorOr command(String const& program, Vector const& arguments, Optional chdir); -ErrorOr command(String const& command_string, Optional chdir); +ErrorOr command(DeprecatedString const& program, Vector const& arguments, Optional chdir); +ErrorOr command(DeprecatedString const& command_string, Optional chdir); } diff --git a/Userland/Libraries/LibCore/ConfigFile.cpp b/Userland/Libraries/LibCore/ConfigFile.cpp index e56b1a23cbb..aa66eb58258 100644 --- a/Userland/Libraries/LibCore/ConfigFile.cpp +++ b/Userland/Libraries/LibCore/ConfigFile.cpp @@ -17,28 +17,28 @@ namespace Core { -ErrorOr> ConfigFile::open_for_lib(String const& lib_name, AllowWriting allow_altering) +ErrorOr> ConfigFile::open_for_lib(DeprecatedString const& lib_name, AllowWriting allow_altering) { - String directory_name = String::formatted("{}/lib", StandardPaths::config_directory()); + DeprecatedString directory_name = DeprecatedString::formatted("{}/lib", StandardPaths::config_directory()); auto directory = TRY(Directory::create(directory_name, Directory::CreateDirectories::Yes)); - auto path = String::formatted("{}/{}.ini", directory, lib_name); + auto path = DeprecatedString::formatted("{}/{}.ini", directory, lib_name); return ConfigFile::open(path, allow_altering); } -ErrorOr> ConfigFile::open_for_app(String const& app_name, AllowWriting allow_altering) +ErrorOr> ConfigFile::open_for_app(DeprecatedString const& app_name, AllowWriting allow_altering) { auto directory = TRY(Directory::create(StandardPaths::config_directory(), Directory::CreateDirectories::Yes)); - auto path = String::formatted("{}/{}.ini", directory, app_name); + auto path = DeprecatedString::formatted("{}/{}.ini", directory, app_name); return ConfigFile::open(path, allow_altering); } -ErrorOr> ConfigFile::open_for_system(String const& app_name, AllowWriting allow_altering) +ErrorOr> ConfigFile::open_for_system(DeprecatedString const& app_name, AllowWriting allow_altering) { - auto path = String::formatted("/etc/{}.ini", app_name); + auto path = DeprecatedString::formatted("/etc/{}.ini", app_name); return ConfigFile::open(path, allow_altering); } -ErrorOr> ConfigFile::open(String const& filename, AllowWriting allow_altering) +ErrorOr> ConfigFile::open(DeprecatedString const& filename, AllowWriting allow_altering) { auto maybe_file = Stream::File::open(filename, allow_altering == AllowWriting::Yes ? Stream::OpenMode::ReadWrite : Stream::OpenMode::Read); OwnPtr buffered_file; @@ -57,13 +57,13 @@ ErrorOr> ConfigFile::open(String const& filename, Allo return config_file; } -ErrorOr> ConfigFile::open(String const& filename, int fd) +ErrorOr> ConfigFile::open(DeprecatedString const& filename, int fd) { auto file = TRY(Stream::File::adopt_fd(fd, Stream::OpenMode::ReadWrite)); return open(filename, move(file)); } -ErrorOr> ConfigFile::open(String const& filename, NonnullOwnPtr file) +ErrorOr> ConfigFile::open(DeprecatedString const& filename, NonnullOwnPtr file) { auto buffered_file = TRY(Stream::BufferedFile::create(move(file))); @@ -72,7 +72,7 @@ ErrorOr> ConfigFile::open(String const& filename, Nonn return config_file; } -ConfigFile::ConfigFile(String const& filename, OwnPtr open_file) +ConfigFile::ConfigFile(DeprecatedString const& filename, OwnPtr open_file) : m_filename(filename) , m_file(move(open_file)) { @@ -89,7 +89,7 @@ ErrorOr ConfigFile::reparse() if (!m_file) return {}; - HashMap* current_group = nullptr; + HashMap* current_group = nullptr; auto buffer = TRY(ByteBuffer::create_uninitialized(4096)); while (TRY(m_file->can_read_line())) { @@ -140,7 +140,7 @@ ErrorOr ConfigFile::reparse() return {}; } -String ConfigFile::read_entry(String const& group, String const& key, String const& default_value) const +DeprecatedString ConfigFile::read_entry(DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& default_value) const { if (!has_key(group, key)) { return default_value; @@ -150,7 +150,7 @@ String ConfigFile::read_entry(String const& group, String const& key, String con return jt->value; } -int ConfigFile::read_num_entry(String const& group, String const& key, int default_value) const +int ConfigFile::read_num_entry(DeprecatedString const& group, DeprecatedString const& key, int default_value) const { if (!has_key(group, key)) { return default_value; @@ -159,24 +159,24 @@ int ConfigFile::read_num_entry(String const& group, String const& key, int defau return read_entry(group, key).to_int().value_or(default_value); } -bool ConfigFile::read_bool_entry(String const& group, String const& key, bool default_value) const +bool ConfigFile::read_bool_entry(DeprecatedString const& group, DeprecatedString const& key, bool default_value) const { auto value = read_entry(group, key, default_value ? "true" : "false"); return value == "1" || value.equals_ignoring_case("true"sv); } -void ConfigFile::write_entry(String const& group, String const& key, String const& value) +void ConfigFile::write_entry(DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) { m_groups.ensure(group).ensure(key) = value; m_dirty = true; } -void ConfigFile::write_num_entry(String const& group, String const& key, int value) +void ConfigFile::write_num_entry(DeprecatedString const& group, DeprecatedString const& key, int value) { - write_entry(group, key, String::number(value)); + write_entry(group, key, DeprecatedString::number(value)); } -void ConfigFile::write_bool_entry(String const& group, String const& key, bool value) +void ConfigFile::write_bool_entry(DeprecatedString const& group, DeprecatedString const& key, bool value) { write_entry(group, key, value ? "true" : "false"); } @@ -193,9 +193,9 @@ ErrorOr ConfigFile::sync() TRY(m_file->seek(0, Stream::SeekMode::SetPosition)); for (auto& it : m_groups) { - TRY(m_file->write(String::formatted("[{}]\n", it.key).bytes())); + TRY(m_file->write(DeprecatedString::formatted("[{}]\n", it.key).bytes())); for (auto& jt : it.value) - TRY(m_file->write(String::formatted("{}={}\n", jt.key, jt.value).bytes())); + TRY(m_file->write(DeprecatedString::formatted("{}={}\n", jt.key, jt.value).bytes())); TRY(m_file->write("\n"sv.bytes())); } @@ -213,12 +213,12 @@ void ConfigFile::dump() const } } -Vector ConfigFile::groups() const +Vector ConfigFile::groups() const { return m_groups.keys(); } -Vector ConfigFile::keys(String const& group) const +Vector ConfigFile::keys(DeprecatedString const& group) const { auto it = m_groups.find(group); if (it == m_groups.end()) @@ -226,7 +226,7 @@ Vector ConfigFile::keys(String const& group) const return it->value.keys(); } -bool ConfigFile::has_key(String const& group, String const& key) const +bool ConfigFile::has_key(DeprecatedString const& group, DeprecatedString const& key) const { auto it = m_groups.find(group); if (it == m_groups.end()) @@ -234,24 +234,24 @@ bool ConfigFile::has_key(String const& group, String const& key) const return it->value.contains(key); } -bool ConfigFile::has_group(String const& group) const +bool ConfigFile::has_group(DeprecatedString const& group) const { return m_groups.contains(group); } -void ConfigFile::add_group(String const& group) +void ConfigFile::add_group(DeprecatedString const& group) { m_groups.ensure(group); m_dirty = true; } -void ConfigFile::remove_group(String const& group) +void ConfigFile::remove_group(DeprecatedString const& group) { m_groups.remove(group); m_dirty = true; } -void ConfigFile::remove_entry(String const& group, String const& key) +void ConfigFile::remove_entry(DeprecatedString const& group, DeprecatedString const& key) { auto it = m_groups.find(group); if (it == m_groups.end()) diff --git a/Userland/Libraries/LibCore/ConfigFile.h b/Userland/Libraries/LibCore/ConfigFile.h index 842fd4724f3..8c7beb25a5d 100644 --- a/Userland/Libraries/LibCore/ConfigFile.h +++ b/Userland/Libraries/LibCore/ConfigFile.h @@ -8,11 +8,11 @@ #pragma once +#include #include #include #include #include -#include #include #include @@ -25,29 +25,29 @@ public: No, }; - static ErrorOr> open_for_lib(String const& lib_name, AllowWriting = AllowWriting::No); - static ErrorOr> open_for_app(String const& app_name, AllowWriting = AllowWriting::No); - static ErrorOr> open_for_system(String const& app_name, AllowWriting = AllowWriting::No); - static ErrorOr> open(String const& filename, AllowWriting = AllowWriting::No); - static ErrorOr> open(String const& filename, int fd); - static ErrorOr> open(String const& filename, NonnullOwnPtr); + static ErrorOr> open_for_lib(DeprecatedString const& lib_name, AllowWriting = AllowWriting::No); + static ErrorOr> open_for_app(DeprecatedString const& app_name, AllowWriting = AllowWriting::No); + static ErrorOr> open_for_system(DeprecatedString const& app_name, AllowWriting = AllowWriting::No); + static ErrorOr> open(DeprecatedString const& filename, AllowWriting = AllowWriting::No); + static ErrorOr> open(DeprecatedString const& filename, int fd); + static ErrorOr> open(DeprecatedString const& filename, NonnullOwnPtr); ~ConfigFile(); - bool has_group(String const&) const; - bool has_key(String const& group, String const& key) const; + bool has_group(DeprecatedString const&) const; + bool has_key(DeprecatedString const& group, DeprecatedString const& key) const; - Vector groups() const; - Vector keys(String const& group) const; + Vector groups() const; + Vector keys(DeprecatedString const& group) const; size_t num_groups() const { return m_groups.size(); } - String read_entry(String const& group, String const& key, String const& default_value = String()) const; - int read_num_entry(String const& group, String const& key, int default_value = 0) const; - bool read_bool_entry(String const& group, String const& key, bool default_value = false) const; + DeprecatedString read_entry(DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& default_value = DeprecatedString()) const; + int read_num_entry(DeprecatedString const& group, DeprecatedString const& key, int default_value = 0) const; + bool read_bool_entry(DeprecatedString const& group, DeprecatedString const& key, bool default_value = false) const; - void write_entry(String const& group, String const& key, String const& value); - void write_num_entry(String const& group, String const& key, int value); - void write_bool_entry(String const& group, String const& key, bool value); + void write_entry(DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value); + void write_num_entry(DeprecatedString const& group, DeprecatedString const& key, int value); + void write_bool_entry(DeprecatedString const& group, DeprecatedString const& key, bool value); void dump() const; @@ -55,20 +55,20 @@ public: ErrorOr sync(); - void add_group(String const& group); - void remove_group(String const& group); - void remove_entry(String const& group, String const& key); + void add_group(DeprecatedString const& group); + void remove_group(DeprecatedString const& group); + void remove_entry(DeprecatedString const& group, DeprecatedString const& key); - String const& filename() const { return m_filename; } + DeprecatedString const& filename() const { return m_filename; } private: - ConfigFile(String const& filename, OwnPtr open_file); + ConfigFile(DeprecatedString const& filename, OwnPtr open_file); ErrorOr reparse(); - String m_filename; + DeprecatedString m_filename; OwnPtr m_file; - HashMap> m_groups; + HashMap> m_groups; bool m_dirty { false }; }; diff --git a/Userland/Libraries/LibCore/DateTime.cpp b/Userland/Libraries/LibCore/DateTime.cpp index 4e55a34a5bb..bbc9056555b 100644 --- a/Userland/Libraries/LibCore/DateTime.cpp +++ b/Userland/Libraries/LibCore/DateTime.cpp @@ -84,7 +84,7 @@ void DateTime::set_time(int year, int month, int day, int hour, int minute, int m_second = tm.tm_sec; } -String DateTime::to_string(StringView format) const +DeprecatedString DateTime::to_string(StringView format) const { struct tm tm; localtime_r(&m_timestamp, &tm); @@ -120,7 +120,7 @@ String DateTime::to_string(StringView format) const builder.append(format[i]); } else { if (++i == format_len) - return String(); + return DeprecatedString(); switch (format[i]) { case 'a': @@ -276,7 +276,7 @@ String DateTime::to_string(StringView format) const return builder.build(); } -Optional DateTime::parse(StringView format, String const& string) +Optional DateTime::parse(StringView format, DeprecatedString const& string) { unsigned format_pos = 0; unsigned string_pos = 0; diff --git a/Userland/Libraries/LibCore/DateTime.h b/Userland/Libraries/LibCore/DateTime.h index 1e38b94ba64..76fe34a68d3 100644 --- a/Userland/Libraries/LibCore/DateTime.h +++ b/Userland/Libraries/LibCore/DateTime.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include #include @@ -31,12 +31,12 @@ public: bool is_leap_year() const; void set_time(int year, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0); - String to_string(StringView format = "%Y-%m-%d %H:%M:%S"sv) const; + DeprecatedString to_string(StringView format = "%Y-%m-%d %H:%M:%S"sv) const; static DateTime create(int year, int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0); static DateTime now(); static DateTime from_timestamp(time_t); - static Optional parse(StringView format, String const& string); + static Optional parse(StringView format, DeprecatedString const& string); bool operator<(DateTime const& other) const { return m_timestamp < other.m_timestamp; } diff --git a/Userland/Libraries/LibCore/DirIterator.cpp b/Userland/Libraries/LibCore/DirIterator.cpp index 36c9c8ea2ca..f4871a80514 100644 --- a/Userland/Libraries/LibCore/DirIterator.cpp +++ b/Userland/Libraries/LibCore/DirIterator.cpp @@ -11,7 +11,7 @@ namespace Core { -DirIterator::DirIterator(String path, Flags flags) +DirIterator::DirIterator(DeprecatedString path, Flags flags) : m_path(move(path)) , m_flags(flags) { @@ -49,7 +49,7 @@ bool DirIterator::advance_next() auto* de = readdir(m_dir); if (!de) { m_error = errno; - m_next = String(); + m_next = DeprecatedString(); return false; } @@ -75,17 +75,17 @@ bool DirIterator::has_next() return advance_next(); } -String DirIterator::next_path() +DeprecatedString DirIterator::next_path() { if (m_next.is_null()) advance_next(); auto tmp = m_next; - m_next = String(); + m_next = DeprecatedString(); return tmp; } -String DirIterator::next_full_path() +DeprecatedString DirIterator::next_full_path() { StringBuilder builder; builder.append(m_path); diff --git a/Userland/Libraries/LibCore/DirIterator.h b/Userland/Libraries/LibCore/DirIterator.h index e3a47847714..dd6c88141ab 100644 --- a/Userland/Libraries/LibCore/DirIterator.h +++ b/Userland/Libraries/LibCore/DirIterator.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -20,7 +20,7 @@ public: SkipParentAndBaseDir = 0x2, }; - explicit DirIterator(String path, Flags = Flags::NoFlags); + explicit DirIterator(DeprecatedString path, Flags = Flags::NoFlags); ~DirIterator(); DirIterator(DirIterator&&); @@ -30,15 +30,15 @@ public: int error() const { return m_error; } char const* error_string() const { return strerror(m_error); } bool has_next(); - String next_path(); - String next_full_path(); + DeprecatedString next_path(); + DeprecatedString next_full_path(); int fd() const; private: DIR* m_dir = nullptr; int m_error = 0; - String m_next; - String m_path; + DeprecatedString m_next; + DeprecatedString m_path; int m_flags; bool advance_next(); diff --git a/Userland/Libraries/LibCore/Directory.cpp b/Userland/Libraries/LibCore/Directory.cpp index f406399b947..6881bb60b40 100644 --- a/Userland/Libraries/LibCore/Directory.cpp +++ b/Userland/Libraries/LibCore/Directory.cpp @@ -53,7 +53,7 @@ ErrorOr Directory::adopt_fd(int fd, Optional path) return Directory { fd, move(path) }; } -ErrorOr Directory::create(String path, CreateDirectories create_directories, mode_t creation_mode) +ErrorOr Directory::create(DeprecatedString path, CreateDirectories create_directories, mode_t creation_mode) { return create(LexicalPath { move(path) }, create_directories, creation_mode); } diff --git a/Userland/Libraries/LibCore/Directory.h b/Userland/Libraries/LibCore/Directory.h index a2e567b376f..8518c991e31 100644 --- a/Userland/Libraries/LibCore/Directory.h +++ b/Userland/Libraries/LibCore/Directory.h @@ -34,7 +34,7 @@ public: }; static ErrorOr create(LexicalPath path, CreateDirectories, mode_t creation_mode = 0755); - static ErrorOr create(String path, CreateDirectories, mode_t creation_mode = 0755); + static ErrorOr create(DeprecatedString path, CreateDirectories, mode_t creation_mode = 0755); static ErrorOr adopt_fd(int fd, Optional path = {}); ErrorOr> open(StringView filename, Stream::OpenMode mode) const; diff --git a/Userland/Libraries/LibCore/Event.h b/Userland/Libraries/LibCore/Event.h index fab8095cd99..44bd1360677 100644 --- a/Userland/Libraries/LibCore/Event.h +++ b/Userland/Libraries/LibCore/Event.h @@ -7,8 +7,8 @@ #pragma once +#include #include -#include #include #include #include diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp index 37842651685..1af47ec5ee3 100644 --- a/Userland/Libraries/LibCore/File.cpp +++ b/Userland/Libraries/LibCore/File.cpp @@ -29,7 +29,7 @@ namespace Core { -ErrorOr> File::open(String filename, OpenMode mode, mode_t permissions) +ErrorOr> File::open(DeprecatedString filename, OpenMode mode, mode_t permissions) { auto file = File::construct(move(filename)); if (!file->open_impl(mode, permissions)) @@ -37,7 +37,7 @@ ErrorOr> File::open(String filename, OpenMode mode, mode_t p return file; } -File::File(String filename, Object* parent) +File::File(DeprecatedString filename, Object* parent) : IODevice(parent) , m_filename(move(filename)) { @@ -109,7 +109,7 @@ bool File::is_device() const return S_ISBLK(stat.st_mode) || S_ISCHR(stat.st_mode); } -bool File::is_device(String const& filename) +bool File::is_device(DeprecatedString const& filename) { struct stat st; if (stat(filename.characters(), &st) < 0) @@ -125,7 +125,7 @@ bool File::is_block_device() const return S_ISBLK(stat.st_mode); } -bool File::is_block_device(String const& filename) +bool File::is_block_device(DeprecatedString const& filename) { struct stat st; if (stat(filename.characters(), &st) < 0) @@ -141,7 +141,7 @@ bool File::is_char_device() const return S_ISCHR(stat.st_mode); } -bool File::is_char_device(String const& filename) +bool File::is_char_device(DeprecatedString const& filename) { struct stat st; if (stat(filename.characters(), &st) < 0) @@ -157,7 +157,7 @@ bool File::is_directory() const return S_ISDIR(stat.st_mode); } -bool File::is_directory(String const& filename) +bool File::is_directory(DeprecatedString const& filename) { struct stat st; if (stat(filename.characters(), &st) < 0) @@ -173,7 +173,7 @@ bool File::is_link() const return S_ISLNK(stat.st_mode); } -bool File::is_link(String const& filename) +bool File::is_link(DeprecatedString const& filename) { struct stat st; if (lstat(filename.characters(), &st) < 0) @@ -186,18 +186,18 @@ bool File::looks_like_shared_library() const return File::looks_like_shared_library(m_filename); } -bool File::looks_like_shared_library(String const& filename) +bool File::looks_like_shared_library(DeprecatedString const& filename) { return filename.ends_with(".so"sv) || filename.contains(".so."sv); } -bool File::exists(String const& filename) +bool File::exists(DeprecatedString const& filename) { struct stat st; return stat(filename.characters(), &st) == 0; } -ErrorOr File::size(String const& filename) +ErrorOr File::size(DeprecatedString const& filename) { struct stat st; if (stat(filename.characters(), &st) < 0) @@ -205,17 +205,17 @@ ErrorOr File::size(String const& filename) return st.st_size; } -String File::real_path_for(String const& filename) +DeprecatedString File::real_path_for(DeprecatedString const& filename) { if (filename.is_null()) return {}; auto* path = realpath(filename.characters(), nullptr); - String real_path(path); + DeprecatedString real_path(path); free(path); return real_path; } -String File::current_working_directory() +DeprecatedString File::current_working_directory() { char* cwd = getcwd(nullptr, 0); if (!cwd) { @@ -223,13 +223,13 @@ String File::current_working_directory() return {}; } - auto cwd_as_string = String(cwd); + auto cwd_as_string = DeprecatedString(cwd); free(cwd); return cwd_as_string; } -String File::absolute_path(String const& path) +DeprecatedString File::absolute_path(DeprecatedString const& path) { if (File::exists(path)) return File::real_path_for(path); @@ -245,7 +245,7 @@ String File::absolute_path(String const& path) #ifdef AK_OS_SERENITY -ErrorOr File::read_link(String const& link_path) +ErrorOr File::read_link(DeprecatedString const& link_path) { // First, try using a 64-byte buffer, that ought to be enough for anybody. char small_buffer[64]; @@ -259,7 +259,7 @@ ErrorOr File::read_link(String const& link_path) // returns the full size of the link. Let's see if our small buffer // was enough to read the whole link. if (size <= sizeof(small_buffer)) - return String { small_buffer, size }; + return DeprecatedString { small_buffer, size }; // Nope, but at least now we know the right size. char* large_buffer_ptr; auto large_buffer = StringImpl::create_uninitialized(size, large_buffer_ptr); @@ -275,7 +275,7 @@ ErrorOr File::read_link(String const& link_path) // If we're here, the symlink has changed while we were looking at it. // If it became shorter, our buffer is valid, we just have to trim it a bit. if (new_size < size) - return String { large_buffer_ptr, new_size }; + return DeprecatedString { large_buffer_ptr, new_size }; // Otherwise, here's not much we can do, unless we want to loop endlessly // in this case. Let's leave it up to the caller whether to loop. errno = EAGAIN; @@ -286,7 +286,7 @@ ErrorOr File::read_link(String const& link_path) // This is a sad version for other systems. It has to always make a copy of the // link path, and to always make two syscalls to get the right size first. -ErrorOr File::read_link(String const& link_path) +ErrorOr File::read_link(DeprecatedString const& link_path) { struct stat statbuf = {}; int rc = lstat(link_path.characters(), &statbuf); @@ -299,7 +299,7 @@ ErrorOr File::read_link(String const& link_path) // (See above.) if (rc == statbuf.st_size) return { *buffer }; - return String { buffer_ptr, (size_t)rc }; + return DeprecatedString { buffer_ptr, (size_t)rc }; } #endif @@ -335,7 +335,7 @@ NonnullRefPtr File::standard_error() return *stderr_file; } -static String get_duplicate_name(String const& path, int duplicate_count) +static DeprecatedString get_duplicate_name(DeprecatedString const& path, int duplicate_count) { if (duplicate_count == 0) { return path; @@ -347,7 +347,7 @@ static String get_duplicate_name(String const& path, int duplicate_count) for (size_t i = 0; i < parts.size() - 1; ++i) { duplicated_name.appendff("{}/", parts[i]); } - auto prev_duplicate_tag = String::formatted("({})", duplicate_count); + auto prev_duplicate_tag = DeprecatedString::formatted("({})", duplicate_count); auto title = lexical_path.title(); if (title.ends_with(prev_duplicate_tag)) { // remove the previous duplicate tag "(n)" so we can add a new tag. @@ -360,7 +360,7 @@ static String get_duplicate_name(String const& path, int duplicate_count) return duplicated_name.build(); } -ErrorOr File::copy_file_or_directory(String const& dst_path, String const& src_path, RecursionMode recursion_mode, LinkMode link_mode, AddDuplicateFileMarker add_duplicate_file_marker, PreserveMode preserve_mode) +ErrorOr File::copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode recursion_mode, LinkMode link_mode, AddDuplicateFileMarker add_duplicate_file_marker, PreserveMode preserve_mode) { if (add_duplicate_file_marker == AddDuplicateFileMarker::Yes) { int duplicate_count = 0; @@ -398,14 +398,14 @@ ErrorOr File::copy_file_or_directory(String const& dst_pa return copy_file(dst_path, src_stat, source, preserve_mode); } -ErrorOr File::copy_file(String const& dst_path, struct stat const& src_stat, File& source, PreserveMode preserve_mode) +ErrorOr File::copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, File& source, PreserveMode preserve_mode) { int dst_fd = creat(dst_path.characters(), 0666); if (dst_fd < 0) { if (errno != EISDIR) return CopyError { errno, false }; - auto dst_dir_path = String::formatted("{}/{}", dst_path, LexicalPath::basename(source.filename())); + auto dst_dir_path = DeprecatedString::formatted("{}/{}", dst_path, LexicalPath::basename(source.filename())); dst_fd = creat(dst_dir_path.characters(), 0666); if (dst_fd < 0) return CopyError { errno, false }; @@ -470,15 +470,15 @@ ErrorOr File::copy_file(String const& dst_path, struct st return {}; } -ErrorOr File::copy_directory(String const& dst_path, String const& src_path, struct stat const& src_stat, LinkMode link, PreserveMode preserve_mode) +ErrorOr File::copy_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, struct stat const& src_stat, LinkMode link, PreserveMode preserve_mode) { if (mkdir(dst_path.characters(), 0755) < 0) return CopyError { errno, false }; - String src_rp = File::real_path_for(src_path); - src_rp = String::formatted("{}/", src_rp); - String dst_rp = File::real_path_for(dst_path); - dst_rp = String::formatted("{}/", dst_rp); + DeprecatedString src_rp = File::real_path_for(src_path); + src_rp = DeprecatedString::formatted("{}/", src_rp); + DeprecatedString dst_rp = File::real_path_for(dst_path); + dst_rp = DeprecatedString::formatted("{}/", dst_rp); if (!dst_rp.is_empty() && dst_rp.starts_with(src_rp)) return CopyError { errno, false }; @@ -488,10 +488,10 @@ ErrorOr File::copy_directory(String const& dst_path, Stri return CopyError { errno, false }; while (di.has_next()) { - String filename = di.next_path(); + DeprecatedString filename = di.next_path(); auto result = copy_file_or_directory( - String::formatted("{}/{}", dst_path, filename), - String::formatted("{}/{}", src_path, filename), + DeprecatedString::formatted("{}/{}", dst_path, filename), + DeprecatedString::formatted("{}/{}", src_path, filename), RecursionMode::Allowed, link, AddDuplicateFileMarker::Yes, preserve_mode); if (result.is_error()) return result.error(); @@ -525,7 +525,7 @@ ErrorOr File::copy_directory(String const& dst_path, Stri return {}; } -ErrorOr File::link_file(String const& dst_path, String const& src_path) +ErrorOr File::link_file(DeprecatedString const& dst_path, DeprecatedString const& src_path) { int duplicate_count = 0; while (access(get_duplicate_name(dst_path, duplicate_count).characters(), F_OK) == 0) { @@ -539,7 +539,7 @@ ErrorOr File::link_file(String const& dst_path, String const& src_path) return {}; } -ErrorOr File::remove(String const& path, RecursionMode mode, bool force) +ErrorOr File::remove(DeprecatedString const& path, RecursionMode mode, bool force) { struct stat path_stat; if (lstat(path.characters(), &path_stat) < 0) { @@ -569,14 +569,14 @@ ErrorOr File::remove(String const& path, RecursionMode return {}; } -Optional File::resolve_executable_from_environment(StringView filename) +Optional File::resolve_executable_from_environment(StringView filename) { if (filename.is_empty()) return {}; // Paths that aren't just a file name generally count as already resolved. if (filename.contains('/')) { - if (access(String { filename }.characters(), X_OK) != 0) + if (access(DeprecatedString { filename }.characters(), X_OK) != 0) return {}; return filename; @@ -592,7 +592,7 @@ Optional File::resolve_executable_from_environment(StringView filename) auto directories = path.split_view(':'); for (auto directory : directories) { - auto file = String::formatted("{}/{}", directory, filename); + auto file = DeprecatedString::formatted("{}/{}", directory, filename); if (access(file.characters(), X_OK) == 0) return file; diff --git a/Userland/Libraries/LibCore/File.h b/Userland/Libraries/LibCore/File.h index f46c23607f6..233e9c2364b 100644 --- a/Userland/Libraries/LibCore/File.h +++ b/Userland/Libraries/LibCore/File.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include #include #include @@ -26,31 +26,31 @@ class File final : public IODevice { public: virtual ~File() override; - static ErrorOr> open(String filename, OpenMode, mode_t = 0644); + static ErrorOr> open(DeprecatedString filename, OpenMode, mode_t = 0644); - String filename() const { return m_filename; } - void set_filename(const String filename) { m_filename = move(filename); } + DeprecatedString filename() const { return m_filename; } + void set_filename(const DeprecatedString filename) { m_filename = move(filename); } bool is_directory() const; - static bool is_directory(String const& filename); + static bool is_directory(DeprecatedString const& filename); bool is_device() const; - static bool is_device(String const& filename); + static bool is_device(DeprecatedString const& filename); bool is_block_device() const; - static bool is_block_device(String const& filename); + static bool is_block_device(DeprecatedString const& filename); bool is_char_device() const; - static bool is_char_device(String const& filename); + static bool is_char_device(DeprecatedString const& filename); bool is_link() const; - static bool is_link(String const& filename); + static bool is_link(DeprecatedString const& filename); bool looks_like_shared_library() const; - static bool looks_like_shared_library(String const& filename); + static bool looks_like_shared_library(DeprecatedString const& filename); - static bool exists(String const& filename); - static ErrorOr size(String const& filename); - static String current_working_directory(); - static String absolute_path(String const& path); + static bool exists(DeprecatedString const& filename); + static ErrorOr size(DeprecatedString const& filename); + static DeprecatedString current_working_directory(); + static DeprecatedString absolute_path(DeprecatedString const& path); enum class RecursionMode { Allowed, @@ -83,23 +83,23 @@ public: bool tried_recursing; }; - static ErrorOr copy_file(String const& dst_path, struct stat const& src_stat, File& source, PreserveMode = PreserveMode::Nothing); - static ErrorOr copy_directory(String const& dst_path, String const& src_path, struct stat const& src_stat, LinkMode = LinkMode::Disallowed, PreserveMode = PreserveMode::Nothing); - static ErrorOr copy_file_or_directory(String const& dst_path, String const& src_path, RecursionMode = RecursionMode::Allowed, LinkMode = LinkMode::Disallowed, AddDuplicateFileMarker = AddDuplicateFileMarker::Yes, PreserveMode = PreserveMode::Nothing); + static ErrorOr copy_file(DeprecatedString const& dst_path, struct stat const& src_stat, File& source, PreserveMode = PreserveMode::Nothing); + static ErrorOr copy_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, struct stat const& src_stat, LinkMode = LinkMode::Disallowed, PreserveMode = PreserveMode::Nothing); + static ErrorOr copy_file_or_directory(DeprecatedString const& dst_path, DeprecatedString const& src_path, RecursionMode = RecursionMode::Allowed, LinkMode = LinkMode::Disallowed, AddDuplicateFileMarker = AddDuplicateFileMarker::Yes, PreserveMode = PreserveMode::Nothing); - static String real_path_for(String const& filename); - static ErrorOr read_link(String const& link_path); - static ErrorOr link_file(String const& dst_path, String const& src_path); + static DeprecatedString real_path_for(DeprecatedString const& filename); + static ErrorOr read_link(DeprecatedString const& link_path); + static ErrorOr link_file(DeprecatedString const& dst_path, DeprecatedString const& src_path); struct RemoveError : public Error { - RemoveError(String f, int error_code) + RemoveError(DeprecatedString f, int error_code) : Error(error_code) , file(move(f)) { } - String file; + DeprecatedString file; }; - static ErrorOr remove(String const& path, RecursionMode, bool force); + static ErrorOr remove(DeprecatedString const& path, RecursionMode, bool force); virtual bool open(OpenMode) override; @@ -114,18 +114,18 @@ public: static NonnullRefPtr standard_output(); static NonnullRefPtr standard_error(); - static Optional resolve_executable_from_environment(StringView filename); + static Optional resolve_executable_from_environment(StringView filename); private: File(Object* parent = nullptr) : IODevice(parent) { } - explicit File(String filename, Object* parent = nullptr); + explicit File(DeprecatedString filename, Object* parent = nullptr); bool open_impl(OpenMode, mode_t); - String m_filename; + DeprecatedString m_filename; ShouldCloseFileDescriptor m_should_close_file_descriptor { ShouldCloseFileDescriptor::Yes }; }; diff --git a/Userland/Libraries/LibCore/FilePermissionsMask.h b/Userland/Libraries/LibCore/FilePermissionsMask.h index 3a664387e4c..011a426cc94 100644 --- a/Userland/Libraries/LibCore/FilePermissionsMask.h +++ b/Userland/Libraries/LibCore/FilePermissionsMask.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include namespace Core { diff --git a/Userland/Libraries/LibCore/FileWatcher.cpp b/Userland/Libraries/LibCore/FileWatcher.cpp index 57ebfb33840..ff7e9cad05c 100644 --- a/Userland/Libraries/LibCore/FileWatcher.cpp +++ b/Userland/Libraries/LibCore/FileWatcher.cpp @@ -7,9 +7,9 @@ #include "FileWatcher.h" #include +#include #include #include -#include #include #include #include @@ -23,7 +23,7 @@ namespace Core { // Only supported in serenity mode because we use InodeWatcher syscalls #ifdef AK_OS_SERENITY -static Optional get_event_from_fd(int fd, HashMap const& wd_to_path) +static Optional get_event_from_fd(int fd, HashMap const& wd_to_path) { u8 buffer[MAXIMUM_EVENT_SIZE]; int rc = read(fd, &buffer, MAXIMUM_EVENT_SIZE); @@ -42,7 +42,7 @@ static Optional get_event_from_fd(int fd, HashMapwatch_descriptor); return {}; } - String const& path = it->value; + DeprecatedString const& path = it->value; switch (event->type) { case InodeWatcherEvent::Type::ChildCreated: @@ -67,7 +67,7 @@ static Optional get_event_from_fd(int fd, HashMapname_length > 0) { - String child_name { event->name, event->name_length - 1 }; + DeprecatedString child_name { event->name, event->name_length - 1 }; result.event_path = LexicalPath::join(path, child_name).string(); } else { result.event_path = path; @@ -77,7 +77,7 @@ static Optional get_event_from_fd(int fd, HashMap FileWatcherBase::add_watch(String path, FileWatcherEvent::Type event_mask) +ErrorOr FileWatcherBase::add_watch(DeprecatedString path, FileWatcherEvent::Type event_mask) { - String canonical_path = canonicalize_path(move(path)); + DeprecatedString canonical_path = canonicalize_path(move(path)); if (m_path_to_wd.find(canonical_path) != m_path_to_wd.end()) { dbgln_if(FILE_WATCHER_DEBUG, "add_watch: path '{}' is already being watched", canonical_path); @@ -118,9 +118,9 @@ ErrorOr FileWatcherBase::add_watch(String path, FileWatcherEvent::Type eve return true; } -ErrorOr FileWatcherBase::remove_watch(String path) +ErrorOr FileWatcherBase::remove_watch(DeprecatedString path) { - String canonical_path = canonicalize_path(move(path)); + DeprecatedString canonical_path = canonicalize_path(move(path)); auto it = m_path_to_wd.find(canonical_path); if (it == m_path_to_wd.end()) { @@ -220,12 +220,12 @@ ErrorOr> FileWatcher::create(InodeWatcherFlags) return Error::from_errno(ENOTSUP); } -ErrorOr FileWatcherBase::add_watch(String, FileWatcherEvent::Type) +ErrorOr FileWatcherBase::add_watch(DeprecatedString, FileWatcherEvent::Type) { return Error::from_errno(ENOTSUP); } -ErrorOr FileWatcherBase::remove_watch(String) +ErrorOr FileWatcherBase::remove_watch(DeprecatedString) { return Error::from_errno(ENOTSUP); } diff --git a/Userland/Libraries/LibCore/FileWatcher.h b/Userland/Libraries/LibCore/FileWatcher.h index b19f844fcab..48f82de3986 100644 --- a/Userland/Libraries/LibCore/FileWatcher.h +++ b/Userland/Libraries/LibCore/FileWatcher.h @@ -7,12 +7,12 @@ #pragma once +#include #include #include #include #include #include -#include #include #include #include @@ -29,7 +29,7 @@ struct FileWatcherEvent { ChildDeleted = 1 << 4, }; Type type; - String event_path; + DeprecatedString event_path; }; AK_ENUM_BITWISE_OPERATORS(FileWatcherEvent::Type); @@ -38,9 +38,9 @@ class FileWatcherBase { public: virtual ~FileWatcherBase() = default; - ErrorOr add_watch(String path, FileWatcherEvent::Type event_mask); - ErrorOr remove_watch(String path); - bool is_watching(String const& path) const { return m_path_to_wd.find(path) != m_path_to_wd.end(); } + ErrorOr add_watch(DeprecatedString path, FileWatcherEvent::Type event_mask); + ErrorOr remove_watch(DeprecatedString path); + bool is_watching(DeprecatedString const& path) const { return m_path_to_wd.find(path) != m_path_to_wd.end(); } protected: FileWatcherBase(int watcher_fd) @@ -49,8 +49,8 @@ protected: } int m_watcher_fd { -1 }; - HashMap m_path_to_wd; - HashMap m_wd_to_path; + HashMap m_path_to_wd; + HashMap m_wd_to_path; }; class BlockingFileWatcher final : public FileWatcherBase { diff --git a/Userland/Libraries/LibCore/Group.cpp b/Userland/Libraries/LibCore/Group.cpp index 46493241888..8eff79cabd1 100644 --- a/Userland/Libraries/LibCore/Group.cpp +++ b/Userland/Libraries/LibCore/Group.cpp @@ -16,7 +16,7 @@ namespace Core { -ErrorOr Group::generate_group_file() const +ErrorOr Group::generate_group_file() const { StringBuilder builder; @@ -32,13 +32,13 @@ ErrorOr Group::generate_group_file() const for (auto const* gr = getgrent(); gr; gr = getgrent()) { #endif if (gr->gr_name == m_name) - builder.appendff("{}:x:{}:{}\n", m_name, m_id, String::join(',', m_members)); + builder.appendff("{}:x:{}:{}\n", m_name, m_id, DeprecatedString::join(',', m_members)); else { - Vector members; + Vector members; for (size_t i = 0; gr->gr_mem[i]; ++i) members.append(gr->gr_mem[i]); - builder.appendff("{}:x:{}:{}\n", gr->gr_name, gr->gr_gid, String::join(',', members)); + builder.appendff("{}:x:{}:{}\n", gr->gr_name, gr->gr_gid, DeprecatedString::join(',', members)); } } @@ -135,7 +135,7 @@ ErrorOr> Group::all() #else for (auto const* gr = getgrent(); gr; gr = getgrent()) { #endif - Vector members; + Vector members; for (size_t i = 0; gr->gr_mem[i]; ++i) members.append(gr->gr_mem[i]); @@ -148,7 +148,7 @@ ErrorOr> Group::all() return groups; } -Group::Group(String name, gid_t id, Vector members) +Group::Group(DeprecatedString name, gid_t id, Vector members) : m_name(move(name)) , m_id(id) , m_members(move(members)) diff --git a/Userland/Libraries/LibCore/Group.h b/Userland/Libraries/LibCore/Group.h index 05effe678b5..1ef4e58ee23 100644 --- a/Userland/Libraries/LibCore/Group.h +++ b/Userland/Libraries/LibCore/Group.h @@ -6,8 +6,8 @@ #pragma once +#include #include -#include #include #include @@ -22,17 +22,17 @@ public: static ErrorOr> all(); Group() = default; - Group(String name, gid_t id = 0, Vector members = {}); + Group(DeprecatedString name, gid_t id = 0, Vector members = {}); ~Group() = default; - String const& name() const { return m_name; } - void set_name(String const& name) { m_name = name; } + DeprecatedString const& name() const { return m_name; } + void set_name(DeprecatedString const& name) { m_name = name; } gid_t id() const { return m_id; } void set_group_id(gid_t const id) { m_id = id; } - Vector& members() { return m_members; } + Vector& members() { return m_members; } ErrorOr sync(); @@ -41,11 +41,11 @@ private: static ErrorOr id_exists(gid_t id); ErrorOr to_libc_group(); - ErrorOr generate_group_file() const; + ErrorOr generate_group_file() const; - String m_name; + DeprecatedString m_name; gid_t m_id { 0 }; - Vector m_members; + Vector m_members; }; } diff --git a/Userland/Libraries/LibCore/IODevice.cpp b/Userland/Libraries/LibCore/IODevice.cpp index 809a6aab586..542dd98bcba 100644 --- a/Userland/Libraries/LibCore/IODevice.cpp +++ b/Userland/Libraries/LibCore/IODevice.cpp @@ -153,7 +153,7 @@ ByteBuffer IODevice::read_all() return {}; } -String IODevice::read_line(size_t max_size) +DeprecatedString IODevice::read_line(size_t max_size) { if (m_fd < 0) return {}; @@ -166,7 +166,7 @@ String IODevice::read_line(size_t max_size) dbgln("IODevice::read_line: At EOF but there's more than max_size({}) buffered", max_size); return {}; } - auto line = String((char const*)m_buffered_data.data(), m_buffered_data.size(), Chomp); + auto line = DeprecatedString((char const*)m_buffered_data.data(), m_buffered_data.size(), Chomp); m_buffered_data.clear(); return line; } @@ -185,7 +185,7 @@ String IODevice::read_line(size_t max_size) new_buffered_data.append(m_buffered_data.data() + line_index, m_buffered_data.size() - line_index); m_buffered_data = move(new_buffered_data); line.resize(line_index); - return String::copy(line, Chomp); + return DeprecatedString::copy(line, Chomp); } } return {}; diff --git a/Userland/Libraries/LibCore/IODevice.h b/Userland/Libraries/LibCore/IODevice.h index d98f4ecc42f..e3cda9d68a8 100644 --- a/Userland/Libraries/LibCore/IODevice.h +++ b/Userland/Libraries/LibCore/IODevice.h @@ -34,7 +34,7 @@ public: private: NonnullRefPtr m_device; bool m_is_end { false }; - String m_buffer; + DeprecatedString m_buffer; }; class LineRange { @@ -89,7 +89,7 @@ public: ByteBuffer read(size_t max_size); ByteBuffer read_all(); - String read_line(size_t max_size = 16384); + DeprecatedString read_line(size_t max_size = 16384); bool write(u8 const*, int size); bool write(StringView); diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index c558ffdff58..05aab229518 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -33,7 +33,7 @@ LocalServer::~LocalServer() ::close(m_fd); } -ErrorOr LocalServer::take_over_from_system_server(String const& socket_path) +ErrorOr LocalServer::take_over_from_system_server(DeprecatedString const& socket_path) { if (m_listening) return Error::from_string_literal("Core::LocalServer: Can't perform socket takeover when already listening"); @@ -65,7 +65,7 @@ void LocalServer::setup_notifier() }; } -bool LocalServer::listen(String const& address) +bool LocalServer::listen(DeprecatedString const& address) { if (m_listening) return false; diff --git a/Userland/Libraries/LibCore/LocalServer.h b/Userland/Libraries/LibCore/LocalServer.h index c4854a70694..c93a049f905 100644 --- a/Userland/Libraries/LibCore/LocalServer.h +++ b/Userland/Libraries/LibCore/LocalServer.h @@ -17,9 +17,9 @@ class LocalServer : public Object { public: virtual ~LocalServer() override; - ErrorOr take_over_from_system_server(String const& path = String()); + ErrorOr take_over_from_system_server(DeprecatedString const& path = DeprecatedString()); bool is_listening() const { return m_listening; } - bool listen(String const& address); + bool listen(DeprecatedString const& address); ErrorOr> accept(); diff --git a/Userland/Libraries/LibCore/MappedFile.cpp b/Userland/Libraries/LibCore/MappedFile.cpp index eca51683cb1..2f5b41b4554 100644 --- a/Userland/Libraries/LibCore/MappedFile.cpp +++ b/Userland/Libraries/LibCore/MappedFile.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include -#include #include #include #include diff --git a/Userland/Libraries/LibCore/MimeData.cpp b/Userland/Libraries/LibCore/MimeData.cpp index 6d802974fbd..54595a1ea57 100644 --- a/Userland/Libraries/LibCore/MimeData.cpp +++ b/Userland/Libraries/LibCore/MimeData.cpp @@ -10,9 +10,9 @@ namespace Core { -Vector MimeData::formats() const +Vector MimeData::formats() const { - Vector mime_types; + Vector mime_types; mime_types.ensure_capacity(m_data.size()); for (auto& it : m_data) mime_types.unchecked_append(it.key); @@ -41,17 +41,17 @@ void MimeData::set_urls(Vector const& urls) set_data("text/uri-list", builder.to_byte_buffer()); } -String MimeData::text() const +DeprecatedString MimeData::text() const { - return String::copy(m_data.get("text/plain").value_or({})); + return DeprecatedString::copy(m_data.get("text/plain").value_or({})); } -void MimeData::set_text(String const& text) +void MimeData::set_text(DeprecatedString const& text) { set_data("text/plain", text.to_byte_buffer()); } -String guess_mime_type_based_on_filename(StringView path) +DeprecatedString guess_mime_type_based_on_filename(StringView path) { if (path.ends_with(".pbm"sv, CaseSensitivity::CaseInsensitive)) return "image/x‑portable‑bitmap"; @@ -164,7 +164,7 @@ String guess_mime_type_based_on_filename(StringView path) ENUMERATE_HEADER_CONTENTS #undef __ENUMERATE_MIME_TYPE_HEADER -Optional guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes bytes) +Optional guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes bytes) { #define __ENUMERATE_MIME_TYPE_HEADER(var_name, mime_type, pattern_offset, pattern_size, ...) \ if (static_cast(bytes.size()) >= pattern_offset && bytes.slice(pattern_offset).starts_with(var_name)) \ diff --git a/Userland/Libraries/LibCore/MimeData.h b/Userland/Libraries/LibCore/MimeData.h index f94d6b61c92..250086574c8 100644 --- a/Userland/Libraries/LibCore/MimeData.h +++ b/Userland/Libraries/LibCore/MimeData.h @@ -20,36 +20,36 @@ class MimeData : public Object { public: virtual ~MimeData() = default; - ByteBuffer data(String const& mime_type) const { return m_data.get(mime_type).value_or({}); } - void set_data(String const& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); } + ByteBuffer data(DeprecatedString const& mime_type) const { return m_data.get(mime_type).value_or({}); } + void set_data(DeprecatedString const& mime_type, ByteBuffer&& data) { m_data.set(mime_type, move(data)); } - bool has_format(String const& mime_type) const { return m_data.contains(mime_type); } - Vector formats() const; + bool has_format(DeprecatedString const& mime_type) const { return m_data.contains(mime_type); } + Vector formats() const; // Convenience helpers for "text/plain" bool has_text() const { return has_format("text/plain"); } - String text() const; - void set_text(String const&); + DeprecatedString text() const; + void set_text(DeprecatedString const&); // Convenience helpers for "text/uri-list" bool has_urls() const { return has_format("text/uri-list"); } Vector urls() const; void set_urls(Vector const&); - HashMap const& all_data() const { return m_data; } + HashMap const& all_data() const { return m_data; } private: MimeData() = default; - explicit MimeData(HashMap const& data) + explicit MimeData(HashMap const& data) : m_data(data) { } - HashMap m_data; + HashMap m_data; }; -String guess_mime_type_based_on_filename(StringView); +DeprecatedString guess_mime_type_based_on_filename(StringView); -Optional guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes); +Optional guess_mime_type_based_on_sniffed_bytes(ReadonlyBytes); } diff --git a/Userland/Libraries/LibCore/NetworkJob.h b/Userland/Libraries/LibCore/NetworkJob.h index 878dc33db88..17babf4d8b3 100644 --- a/Userland/Libraries/LibCore/NetworkJob.h +++ b/Userland/Libraries/LibCore/NetworkJob.h @@ -28,7 +28,7 @@ public: virtual ~NetworkJob() override = default; // Could fire twice, after Headers and after Trailers! - Function const& response_headers, Optional response_code)> on_headers_received; + Function const& response_headers, Optional response_code)> on_headers_received; Function on_finish; Function, u32)> on_progress; diff --git a/Userland/Libraries/LibCore/Object.cpp b/Userland/Libraries/LibCore/Object.cpp index f0c5dcf1beb..d09ec7fe391 100644 --- a/Userland/Libraries/LibCore/Object.cpp +++ b/Userland/Libraries/LibCore/Object.cpp @@ -182,7 +182,7 @@ void Object::save_to(JsonObject& json) } } -JsonValue Object::property(String const& name) const +JsonValue Object::property(DeprecatedString const& name) const { auto it = m_properties.find(name); if (it == m_properties.end()) @@ -190,7 +190,7 @@ JsonValue Object::property(String const& name) const return it->value->get(); } -bool Object::set_property(String const& name, JsonValue const& value) +bool Object::set_property(DeprecatedString const& name, JsonValue const& value) { auto it = m_properties.find(name); if (it == m_properties.end()) @@ -247,7 +247,7 @@ void Object::decrement_inspector_count(Badge) did_end_inspection(); } -void Object::register_property(String const& name, Function getter, Function setter) +void Object::register_property(DeprecatedString const& name, Function getter, Function setter) { m_properties.set(name, make(name, move(getter), move(setter))); } diff --git a/Userland/Libraries/LibCore/Object.h b/Userland/Libraries/LibCore/Object.h index 99fc416c341..9ce1cb548bf 100644 --- a/Userland/Libraries/LibCore/Object.h +++ b/Userland/Libraries/LibCore/Object.h @@ -7,13 +7,13 @@ #pragma once +#include #include #include #include #include #include #include -#include #include #include #include @@ -109,8 +109,8 @@ public: virtual bool is_widget() const { return false; } - String const& name() const { return m_name; } - void set_name(String name) { m_name = move(name); } + DeprecatedString const& name() const { return m_name; } + void set_name(DeprecatedString name) { m_name = move(name); } NonnullRefPtrVector& children() { return m_children; } NonnullRefPtrVector const& children() const { return m_children; } @@ -129,11 +129,11 @@ public: requires IsBaseOf; template - T* find_child_of_type_named(String const&) + T* find_child_of_type_named(DeprecatedString const&) requires IsBaseOf; template - T* find_descendant_of_type_named(String const&) + T* find_descendant_of_type_named(DeprecatedString const&) requires IsBaseOf; bool is_ancestor_of(Object const&) const; @@ -160,9 +160,9 @@ public: void save_to(JsonObject&); - bool set_property(String const& name, JsonValue const& value); - JsonValue property(String const& name) const; - HashMap> const& properties() const { return m_properties; } + bool set_property(DeprecatedString const& name, JsonValue const& value); + JsonValue property(DeprecatedString const& name) const; + HashMap> const& properties() const { return m_properties; } static IntrusiveList<&Object::m_all_objects_list_node>& all_objects(); @@ -200,7 +200,7 @@ public: protected: explicit Object(Object* parent = nullptr); - void register_property(String const& name, Function getter, Function setter = nullptr); + void register_property(DeprecatedString const& name, Function getter, Function setter = nullptr); virtual void event(Core::Event&); @@ -215,10 +215,10 @@ protected: private: Object* m_parent { nullptr }; - String m_name; + DeprecatedString m_name; int m_timer_id { 0 }; unsigned m_inspector_count { 0 }; - HashMap> m_properties; + HashMap> m_properties; NonnullRefPtrVector m_children; Function m_event_filter; }; @@ -246,7 +246,7 @@ requires IsBaseOf } template -T* Object::find_child_of_type_named(String const& name) +T* Object::find_child_of_type_named(DeprecatedString const& name) requires IsBaseOf { T* found_child = nullptr; @@ -262,7 +262,7 @@ requires IsBaseOf } template -T* Object::find_descendant_of_type_named(String const& name) +T* Object::find_descendant_of_type_named(DeprecatedString const& name) requires IsBaseOf { if (is(*this) && this->name() == name) { @@ -381,7 +381,7 @@ requires IsBaseOf [this]() -> JsonValue { \ struct { \ EnumType enum_value; \ - String string_value; \ + DeprecatedString string_value; \ } options[] = { __VA_ARGS__ }; \ auto enum_value = getter(); \ for (size_t i = 0; i < array_size(options); ++i) { \ @@ -394,7 +394,7 @@ requires IsBaseOf [this](auto& value) { \ struct { \ EnumType enum_value; \ - String string_value; \ + DeprecatedString string_value; \ } options[] = { __VA_ARGS__ }; \ if (!value.is_string()) \ return false; \ diff --git a/Userland/Libraries/LibCore/Process.cpp b/Userland/Libraries/LibCore/Process.cpp index 5c94482d8fc..8ec332a465b 100644 --- a/Userland/Libraries/LibCore/Process.cpp +++ b/Userland/Libraries/LibCore/Process.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -21,11 +21,11 @@ extern char** environ; namespace Core { struct ArgvList { - String m_path; - String m_working_directory; + DeprecatedString m_path; + DeprecatedString m_working_directory; Vector m_argv; - ArgvList(String path, size_t size) + ArgvList(DeprecatedString path, size_t size) : m_path { path } { m_argv.ensure_capacity(size + 2); @@ -44,7 +44,7 @@ struct ArgvList { return m_argv; } - void set_working_directory(String const& working_directory) + void set_working_directory(DeprecatedString const& working_directory) { m_working_directory = working_directory; } @@ -66,7 +66,7 @@ struct ArgvList { } }; -ErrorOr Process::spawn(StringView path, Span arguments, String working_directory) +ErrorOr Process::spawn(StringView path, Span arguments, DeprecatedString working_directory) { ArgvList argv { path, arguments.size() }; for (auto const& arg : arguments) @@ -75,9 +75,9 @@ ErrorOr Process::spawn(StringView path, Span arguments, Str return argv.spawn(); } -ErrorOr Process::spawn(StringView path, Span arguments, String working_directory) +ErrorOr Process::spawn(StringView path, Span arguments, DeprecatedString working_directory) { - Vector backing_strings; + Vector backing_strings; backing_strings.ensure_capacity(arguments.size()); ArgvList argv { path, arguments.size() }; for (auto const& arg : arguments) { @@ -88,7 +88,7 @@ ErrorOr Process::spawn(StringView path, Span arguments, return argv.spawn(); } -ErrorOr Process::spawn(StringView path, Span arguments, String working_directory) +ErrorOr Process::spawn(StringView path, Span arguments, DeprecatedString working_directory) { ArgvList argv { path, arguments.size() }; for (auto arg : arguments) diff --git a/Userland/Libraries/LibCore/Process.h b/Userland/Libraries/LibCore/Process.h index 2930ff1e5c4..54cd6a52e82 100644 --- a/Userland/Libraries/LibCore/Process.h +++ b/Userland/Libraries/LibCore/Process.h @@ -14,9 +14,9 @@ namespace Core { class Process { public: - static ErrorOr spawn(StringView path, Span arguments, String working_directory = {}); - static ErrorOr spawn(StringView path, Span arguments, String working_directory = {}); - static ErrorOr spawn(StringView path, Span arguments = {}, String working_directory = {}); + static ErrorOr spawn(StringView path, Span arguments, DeprecatedString working_directory = {}); + static ErrorOr spawn(StringView path, Span arguments, DeprecatedString working_directory = {}); + static ErrorOr spawn(StringView path, Span arguments = {}, DeprecatedString working_directory = {}); }; } diff --git a/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp b/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp index 3ee8999be38..4cb19be547e 100644 --- a/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp +++ b/Userland/Libraries/LibCore/ProcessStatisticsReader.cpp @@ -14,7 +14,7 @@ namespace Core { -HashMap ProcessStatisticsReader::s_usernames; +HashMap ProcessStatisticsReader::s_usernames; Optional ProcessStatisticsReader::get_all(RefPtr& proc_all_file, bool include_usernames) { @@ -110,7 +110,7 @@ Optional ProcessStatisticsReader::get_all(bool include_u return get_all(proc_all_file, include_usernames); } -String ProcessStatisticsReader::username_from_uid(uid_t uid) +DeprecatedString ProcessStatisticsReader::username_from_uid(uid_t uid) { if (s_usernames.is_empty()) { setpwent(); @@ -122,6 +122,6 @@ String ProcessStatisticsReader::username_from_uid(uid_t uid) auto it = s_usernames.find(uid); if (it != s_usernames.end()) return (*it).value; - return String::number(uid); + return DeprecatedString::number(uid); } } diff --git a/Userland/Libraries/LibCore/ProcessStatisticsReader.h b/Userland/Libraries/LibCore/ProcessStatisticsReader.h index 1499bedb2c3..1de6a7c03b9 100644 --- a/Userland/Libraries/LibCore/ProcessStatisticsReader.h +++ b/Userland/Libraries/LibCore/ProcessStatisticsReader.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -27,10 +27,10 @@ struct ThreadStatistics { unsigned ipv4_socket_write_bytes; unsigned file_read_bytes; unsigned file_write_bytes; - String state; + DeprecatedString state; u32 cpu; u32 priority; - String name; + DeprecatedString name; }; struct ProcessStatistics { @@ -45,11 +45,11 @@ struct ProcessStatistics { pid_t ppid; unsigned nfds; bool kernel; - String name; - String executable; - String tty; - String pledge; - String veil; + DeprecatedString name; + DeprecatedString executable; + DeprecatedString tty; + DeprecatedString pledge; + DeprecatedString veil; size_t amount_virtual; size_t amount_resident; size_t amount_shared; @@ -61,7 +61,7 @@ struct ProcessStatistics { Vector threads; // synthetic - String username; + DeprecatedString username; }; struct AllProcessesStatistics { @@ -76,8 +76,8 @@ public: static Optional get_all(bool include_usernames = true); private: - static String username_from_uid(uid_t); - static HashMap s_usernames; + static DeprecatedString username_from_uid(uid_t); + static HashMap s_usernames; }; } diff --git a/Userland/Libraries/LibCore/Property.cpp b/Userland/Libraries/LibCore/Property.cpp index 0d9f66dbab1..deaafe03dd9 100644 --- a/Userland/Libraries/LibCore/Property.cpp +++ b/Userland/Libraries/LibCore/Property.cpp @@ -9,7 +9,7 @@ namespace Core { -Property::Property(String name, Function getter, Function setter) +Property::Property(DeprecatedString name, Function getter, Function setter) : m_name(move(name)) , m_getter(move(getter)) , m_setter(move(setter)) diff --git a/Userland/Libraries/LibCore/Property.h b/Userland/Libraries/LibCore/Property.h index 1588379b2c4..6d1d0bdcf64 100644 --- a/Userland/Libraries/LibCore/Property.h +++ b/Userland/Libraries/LibCore/Property.h @@ -16,7 +16,7 @@ class Property { AK_MAKE_NONCOPYABLE(Property); public: - Property(String name, Function getter, Function setter = nullptr); + Property(DeprecatedString name, Function getter, Function setter = nullptr); ~Property() = default; bool set(JsonValue const& value) @@ -28,11 +28,11 @@ public: JsonValue get() const { return m_getter(); } - String const& name() const { return m_name; } + DeprecatedString const& name() const { return m_name; } bool is_readonly() const { return !m_setter; } private: - String m_name; + DeprecatedString m_name; Function m_getter; Function m_setter; }; diff --git a/Userland/Libraries/LibCore/SOCKSProxyClient.cpp b/Userland/Libraries/LibCore/SOCKSProxyClient.cpp index 1acd206fb31..b8601f5abf6 100644 --- a/Userland/Libraries/LibCore/SOCKSProxyClient.cpp +++ b/Userland/Libraries/LibCore/SOCKSProxyClient.cpp @@ -138,7 +138,7 @@ ErrorOr send_connect_request_message(Core::Stream::Socket& socket, Core:: return Error::from_string_literal("SOCKS negotiation failed: Failed to send connect request header"); TRY(target.visit( - [&](String const& hostname) -> ErrorOr { + [&](DeprecatedString const& hostname) -> ErrorOr { u8 address_data[2]; address_data[0] = to_underlying(AddressType::DomainName); address_data[1] = hostname.length(); @@ -312,7 +312,7 @@ ErrorOr> SOCKSProxyClient::connect(HostOrIPV4 co [&](u32 ipv4) { return Core::Stream::TCPSocket::connect({ IPv4Address(ipv4), static_cast(server_port) }); }, - [&](String const& hostname) { + [&](DeprecatedString const& hostname) { return Core::Stream::TCPSocket::connect(hostname, static_cast(server_port)); })); diff --git a/Userland/Libraries/LibCore/SOCKSProxyClient.h b/Userland/Libraries/LibCore/SOCKSProxyClient.h index f73488f230d..e2efe524482 100644 --- a/Userland/Libraries/LibCore/SOCKSProxyClient.h +++ b/Userland/Libraries/LibCore/SOCKSProxyClient.h @@ -19,8 +19,8 @@ public: }; struct UsernamePasswordAuthenticationData { - String username; - String password; + DeprecatedString username; + DeprecatedString password; }; enum class Command : u8 { @@ -29,7 +29,7 @@ public: UDPAssociate = 0x03, }; - using HostOrIPV4 = Variant; + using HostOrIPV4 = Variant; static ErrorOr> connect(Socket& underlying, Version, HostOrIPV4 const& target, int target_port, Variant const& auth_data = {}, Command = Command::Connect); static ErrorOr> connect(HostOrIPV4 const& server, int server_port, Version, HostOrIPV4 const& target, int target_port, Variant const& auth_data = {}, Command = Command::Connect); diff --git a/Userland/Libraries/LibCore/SessionManagement.cpp b/Userland/Libraries/LibCore/SessionManagement.cpp index f6bdac93d7c..acbe29e828f 100644 --- a/Userland/Libraries/LibCore/SessionManagement.cpp +++ b/Userland/Libraries/LibCore/SessionManagement.cpp @@ -47,19 +47,19 @@ ErrorOr logout(Optional force_sid) return {}; } -ErrorOr parse_path_with_sid(StringView general_path, Optional force_sid) +ErrorOr parse_path_with_sid(StringView general_path, Optional force_sid) { if (general_path.contains("%sid"sv)) { pid_t sid = TRY(root_session_id(force_sid)); - return general_path.replace("%sid"sv, String::number(sid), ReplaceMode::All); + return general_path.replace("%sid"sv, DeprecatedString::number(sid), ReplaceMode::All); } - return String(general_path); + return DeprecatedString(general_path); } ErrorOr create_session_temporary_directory_if_needed(uid_t uid, gid_t gid, Optional force_sid) { pid_t sid = TRY(root_session_id(force_sid)); - auto const temporary_directory = String::formatted("/tmp/session/{}", sid); + auto const temporary_directory = DeprecatedString::formatted("/tmp/session/{}", sid); auto directory = TRY(Core::Directory::create(temporary_directory, Core::Directory::CreateDirectories::Yes)); TRY(directory.chown(uid, gid)); return {}; diff --git a/Userland/Libraries/LibCore/SessionManagement.h b/Userland/Libraries/LibCore/SessionManagement.h index eb744a058ae..29eda5588b3 100644 --- a/Userland/Libraries/LibCore/SessionManagement.h +++ b/Userland/Libraries/LibCore/SessionManagement.h @@ -14,7 +14,7 @@ namespace Core::SessionManagement { ErrorOr root_session_id(Optional force_sid = {}); ErrorOr logout(Optional force_sid = {}); -ErrorOr parse_path_with_sid(StringView general_path, Optional force_sid = {}); +ErrorOr parse_path_with_sid(StringView general_path, Optional force_sid = {}); ErrorOr create_session_temporary_directory_if_needed(uid_t uid, gid_t gid, Optional force_sid = {}); } diff --git a/Userland/Libraries/LibCore/SharedCircularQueue.h b/Userland/Libraries/LibCore/SharedCircularQueue.h index 23a529bd91a..b6be60b1650 100644 --- a/Userland/Libraries/LibCore/SharedCircularQueue.h +++ b/Userland/Libraries/LibCore/SharedCircularQueue.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -18,7 +19,6 @@ #include #include #include -#include #include #include #include @@ -200,7 +200,7 @@ private: static ErrorOr> try_create_internal(int fd, bool is_new) { - auto name = String::formatted("SharedSingleProducerCircularQueue@{:x}", fd); + auto name = DeprecatedString::formatted("SharedSingleProducerCircularQueue@{:x}", fd); auto* raw_mapping = TRY(System::mmap(nullptr, sizeof(SharedMemorySPCQ), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0, 0, name)); dbgln_if(SHARED_QUEUE_DEBUG, "successfully mmapped {} at {:p}", name, raw_mapping); @@ -212,7 +212,7 @@ private: return SharedSingleProducerCircularQueue { move(name), adopt_ref(*new (nothrow) RefCountedSharedMemorySPCQ(shared_queue, fd)) }; } - SharedSingleProducerCircularQueue(String name, RefPtr queue) + SharedSingleProducerCircularQueue(DeprecatedString name, RefPtr queue) : m_queue(queue) , m_name(move(name)) { @@ -220,7 +220,7 @@ private: RefPtr m_queue; - String m_name {}; + DeprecatedString m_name {}; }; } diff --git a/Userland/Libraries/LibCore/SocketAddress.h b/Userland/Libraries/LibCore/SocketAddress.h index faf17c36f04..d4166605bff 100644 --- a/Userland/Libraries/LibCore/SocketAddress.h +++ b/Userland/Libraries/LibCore/SocketAddress.h @@ -38,7 +38,7 @@ public: { } - static SocketAddress local(String const& address) + static SocketAddress local(DeprecatedString const& address) { SocketAddress addr; addr.m_type = Type::Local; @@ -51,11 +51,11 @@ public: IPv4Address ipv4_address() const { return m_ipv4_address; } u16 port() const { return m_port; } - String to_string() const + DeprecatedString to_string() const { switch (m_type) { case Type::IPv4: - return String::formatted("{}:{}", m_ipv4_address, m_port); + return DeprecatedString::formatted("{}:{}", m_ipv4_address, m_port); case Type::Local: return m_local_address; default: @@ -88,15 +88,15 @@ private: Type m_type { Type::Invalid }; IPv4Address m_ipv4_address; u16 m_port { 0 }; - String m_local_address; + DeprecatedString m_local_address; }; } template<> -struct AK::Formatter : Formatter { +struct AK::Formatter : Formatter { ErrorOr format(FormatBuilder& builder, Core::SocketAddress const& value) { - return Formatter::format(builder, value.to_string()); + return Formatter::format(builder, value.to_string()); } }; diff --git a/Userland/Libraries/LibCore/StandardPaths.cpp b/Userland/Libraries/LibCore/StandardPaths.cpp index 9adc689794a..51e1e4c1086 100644 --- a/Userland/Libraries/LibCore/StandardPaths.cpp +++ b/Userland/Libraries/LibCore/StandardPaths.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include -#include #include #include #include @@ -14,18 +14,18 @@ namespace Core { -String StandardPaths::home_directory() +DeprecatedString StandardPaths::home_directory() { if (auto* home_env = getenv("HOME")) return LexicalPath::canonicalized_path(home_env); auto* pwd = getpwuid(getuid()); - String path = pwd ? pwd->pw_dir : "/"; + DeprecatedString path = pwd ? pwd->pw_dir : "/"; endpwent(); return LexicalPath::canonicalized_path(path); } -String StandardPaths::desktop_directory() +DeprecatedString StandardPaths::desktop_directory() { StringBuilder builder; builder.append(home_directory()); @@ -33,7 +33,7 @@ String StandardPaths::desktop_directory() return LexicalPath::canonicalized_path(builder.to_string()); } -String StandardPaths::documents_directory() +DeprecatedString StandardPaths::documents_directory() { StringBuilder builder; builder.append(home_directory()); @@ -41,7 +41,7 @@ String StandardPaths::documents_directory() return LexicalPath::canonicalized_path(builder.to_string()); } -String StandardPaths::downloads_directory() +DeprecatedString StandardPaths::downloads_directory() { StringBuilder builder; builder.append(home_directory()); @@ -49,7 +49,7 @@ String StandardPaths::downloads_directory() return LexicalPath::canonicalized_path(builder.to_string()); } -String StandardPaths::config_directory() +DeprecatedString StandardPaths::config_directory() { StringBuilder builder; builder.append(home_directory()); @@ -57,7 +57,7 @@ String StandardPaths::config_directory() return LexicalPath::canonicalized_path(builder.to_string()); } -String StandardPaths::tempfile_directory() +DeprecatedString StandardPaths::tempfile_directory() { return "/tmp"; } diff --git a/Userland/Libraries/LibCore/StandardPaths.h b/Userland/Libraries/LibCore/StandardPaths.h index 34a637adcbf..234eab42dc5 100644 --- a/Userland/Libraries/LibCore/StandardPaths.h +++ b/Userland/Libraries/LibCore/StandardPaths.h @@ -12,12 +12,12 @@ namespace Core { class StandardPaths { public: - static String home_directory(); - static String desktop_directory(); - static String documents_directory(); - static String downloads_directory(); - static String tempfile_directory(); - static String config_directory(); + static DeprecatedString home_directory(); + static DeprecatedString desktop_directory(); + static DeprecatedString documents_directory(); + static DeprecatedString downloads_directory(); + static DeprecatedString tempfile_directory(); + static DeprecatedString config_directory(); }; } diff --git a/Userland/Libraries/LibCore/Stream.cpp b/Userland/Libraries/LibCore/Stream.cpp index e023af05315..3ff6ba837fb 100644 --- a/Userland/Libraries/LibCore/Stream.cpp +++ b/Userland/Libraries/LibCore/Stream.cpp @@ -353,7 +353,7 @@ ErrorOr Socket::create_fd(SocketDomain domain, SocketType type) #endif } -ErrorOr Socket::resolve_host(String const& host, SocketType type) +ErrorOr Socket::resolve_host(DeprecatedString const& host, SocketType type) { int socket_type; switch (type) { @@ -398,7 +398,7 @@ ErrorOr Socket::resolve_host(String const& host, SocketType type) return Error::from_string_literal("Could not resolve to IPv4 address"); } -ErrorOr Socket::connect_local(int fd, String const& path) +ErrorOr Socket::connect_local(int fd, DeprecatedString const& path) { auto address = SocketAddress::local(path); auto maybe_sockaddr = address.to_sockaddr_un(); @@ -510,7 +510,7 @@ void PosixSocketHelper::setup_notifier() m_notifier = Core::Notifier::construct(m_fd, Core::Notifier::Read); } -ErrorOr> TCPSocket::connect(String const& host, u16 port) +ErrorOr> TCPSocket::connect(DeprecatedString const& host, u16 port) { auto ip_address = TRY(resolve_host(host, SocketType::Stream)); return connect(SocketAddress { ip_address, port }); @@ -552,7 +552,7 @@ ErrorOr PosixSocketHelper::pending_bytes() const return static_cast(value); } -ErrorOr> UDPSocket::connect(String const& host, u16 port, Optional