1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

Take StringView in more places

We should work towards a pattern where we take StringView as function
arguments, and store String as member, to push the String construction
to the last possible moment.
This commit is contained in:
Robin Burchell 2019-06-02 12:26:28 +02:00 committed by Andreas Kling
parent b55b6cd7fc
commit 7bce096afd
14 changed files with 28 additions and 36 deletions

View file

@ -1,7 +1,7 @@
#include "CDirIterator.h"
#include <cerrno>
CDirIterator::CDirIterator(const String& path, Flags flags)
CDirIterator::CDirIterator(const StringView& path, Flags flags)
: m_flags(flags)
{
m_dir = opendir(path.characters());

View file

@ -11,7 +11,7 @@ public:
SkipDots = 0x1,
};
CDirIterator(const String& path, Flags = Flags::NoFlags);
CDirIterator(const StringView& path, Flags = Flags::NoFlags);
~CDirIterator();
bool has_error() const { return m_error != 0; }

View file

@ -3,7 +3,7 @@
#include <stdio.h>
#include <unistd.h>
CFile::CFile(const String& filename)
CFile::CFile(const StringView& filename)
: m_filename(filename)
{
}

View file

@ -6,11 +6,11 @@
class CFile final : public CIODevice {
public:
CFile() {}
explicit CFile(const String&);
explicit CFile(const StringView&);
virtual ~CFile() override;
String filename() const { return m_filename; }
void set_filename(const String& filename) { m_filename = filename; }
void set_filename(const StringView& filename) { m_filename = filename; }
virtual bool open(CIODevice::OpenMode) override;