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:
parent
297a2762cd
commit
434c190667
2 changed files with 10 additions and 5 deletions
|
@ -5,11 +5,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FileArgument.h"
|
#include "FileArgument.h"
|
||||||
#include <AK/Optional.h>
|
|
||||||
#include <AK/String.h>
|
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
#include <LibRegex/Regex.h>
|
#include <LibRegex/Regex.h>
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
|
||||||
FileArgument::FileArgument(String file_argument)
|
FileArgument::FileArgument(String file_argument)
|
||||||
{
|
{
|
||||||
m_line = {};
|
m_line = {};
|
||||||
|
@ -17,7 +17,7 @@ FileArgument::FileArgument(String file_argument)
|
||||||
|
|
||||||
if (Core::File::exists(file_argument)) {
|
if (Core::File::exists(file_argument)) {
|
||||||
// A file exists with the full specified name, don't attempt to parse it.
|
// A file exists with the full specified name, don't attempt to parse it.
|
||||||
m_filename = file_argument;
|
m_filename = move(file_argument);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,3 +58,5 @@ FileArgument::FileArgument(String file_argument)
|
||||||
FileArgument::~FileArgument()
|
FileArgument::~FileArgument()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -6,12 +6,13 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Optional.h>
|
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
|
||||||
class FileArgument final {
|
class FileArgument final {
|
||||||
public:
|
public:
|
||||||
FileArgument(String);
|
explicit FileArgument(String);
|
||||||
~FileArgument();
|
~FileArgument();
|
||||||
|
|
||||||
String filename() { return m_filename; }
|
String filename() { return m_filename; }
|
||||||
|
@ -23,3 +24,5 @@ private:
|
||||||
Optional<size_t> m_line;
|
Optional<size_t> m_line;
|
||||||
Optional<size_t> m_column;
|
Optional<size_t> m_column;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue