1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 07:38:10 +00:00

LibCore: Put all classes in the Core namespace and remove the leading C

I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.

The new convention is:

- "LibFoo" is a userspace library that provides the "Foo" namespace.

That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
This commit is contained in:
Andreas Kling 2020-02-02 12:34:39 +01:00
parent b7e3810b5c
commit 2d39da5405
265 changed files with 1380 additions and 1167 deletions

View file

@ -35,7 +35,7 @@
#define DEFAULT_LINE_COUNT 10
int tail_from_pos(CFile& file, off_t startline, bool want_follow)
int tail_from_pos(Core::File& file, off_t startline, bool want_follow)
{
if (!file.seek(startline + 1))
return 1;
@ -61,12 +61,12 @@ int tail_from_pos(CFile& file, off_t startline, bool want_follow)
return 0;
}
off_t find_seek_pos(CFile& file, int wanted_lines)
off_t find_seek_pos(Core::File& file, int wanted_lines)
{
// Rather than reading the whole file, start at the end and work backwards,
// stopping when we've found the number of lines we want.
off_t pos = 0;
if (!file.seek(0, CIODevice::SeekMode::FromEndPosition, &pos)) {
if (!file.seek(0, Core::IODevice::SeekMode::FromEndPosition, &pos)) {
fprintf(stderr, "Failed to find end of file: %s\n", file.error_string());
return 1;
}
@ -105,14 +105,14 @@ int main(int argc, char* argv[])
int line_count = DEFAULT_LINE_COUNT;
const char* file = nullptr;
CArgsParser args_parser;
Core::ArgsParser args_parser;
args_parser.add_option(follow, "Output data as it is written to the file", "follow", 'f');
args_parser.add_option(line_count, "Fetch the specified number of lines", "lines", 'n', "number");
args_parser.add_positional_argument(file, "File path", "file");
args_parser.parse(argc, argv);
auto f = CFile::construct(file);
if (!f->open(CIODevice::ReadOnly)) {
auto f = Core::File::construct(file);
if (!f->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error opening file %s: %s\n", file, strerror(errno));
exit(1);
}