1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-05 22:57:35 +00:00

TextEditor: Minor cleanups in the FileArgument class

* Remove unnecessary #include statements
* Move it into the TextEditor namespace
* Mark the single-argument constructor explicit
* Use move() to avoid some unnecessary copies
This commit is contained in:
Andreas Kling 2021-05-06 12:34:51 +02:00
parent 297a2762cd
commit 434c190667
2 changed files with 10 additions and 5 deletions

View file

@ -5,11 +5,11 @@
*/
#include "FileArgument.h"
#include <AK/Optional.h>
#include <AK/String.h>
#include <LibCore/File.h>
#include <LibRegex/Regex.h>
namespace TextEditor {
FileArgument::FileArgument(String file_argument)
{
m_line = {};
@ -17,7 +17,7 @@ FileArgument::FileArgument(String file_argument)
if (Core::File::exists(file_argument)) {
// A file exists with the full specified name, don't attempt to parse it.
m_filename = file_argument;
m_filename = move(file_argument);
return;
}
@ -58,3 +58,5 @@ FileArgument::FileArgument(String file_argument)
FileArgument::~FileArgument()
{
}
}

View file

@ -6,12 +6,13 @@
#pragma once
#include <AK/Optional.h>
#include <AK/String.h>
namespace TextEditor {
class FileArgument final {
public:
FileArgument(String);
explicit FileArgument(String);
~FileArgument();
String filename() { return m_filename; }
@ -23,3 +24,5 @@ private:
Optional<size_t> m_line;
Optional<size_t> m_column;
};
}