1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:07:36 +00:00

LibCore: Convert CFile to ObjectPtr

This commit is contained in:
Andreas Kling 2019-09-21 20:50:06 +02:00
parent 31b38ed88f
commit 8d550c174e
30 changed files with 135 additions and 134 deletions

View file

@ -13,13 +13,13 @@ int main(int argc, char** argv)
return 0;
}
CFile file(argv[1]);
if (!file.open(CIODevice::ReadOnly)) {
fprintf(stderr, "Error: Cannot open %s: %s\n", argv[1], file.error_string());
auto file = CFile::construct(argv[1]);
if (!file->open(CIODevice::ReadOnly)) {
fprintf(stderr, "Error: Cannot open %s: %s\n", argv[1], file->error_string());
return 1;
}
auto file_contents = file.read_all();
auto file_contents = file->read_all();
auto json = JsonValue::from_string(file_contents);
if (!json.is_object()) {

View file

@ -37,13 +37,13 @@ int main(int argc, char** argv)
return 0;
}
CFile file(argv[1]);
if (!file.open(CIODevice::ReadOnly)) {
fprintf(stderr, "Error: Cannot open %s: %s\n", argv[1], file.error_string());
auto file = CFile::construct(argv[1]);
if (!file->open(CIODevice::ReadOnly)) {
fprintf(stderr, "Error: Cannot open %s: %s\n", argv[1], file->error_string());
return 1;
}
auto file_contents = file.read_all();
auto file_contents = file->read_all();
Vector<Endpoint> endpoints;

View file

@ -356,13 +356,13 @@ void VBForm::mousemove_event(GMouseEvent& event)
void VBForm::load_from_file(const String& path)
{
CFile file(path);
if (!file.open(CIODevice::ReadOnly)) {
auto file = CFile::construct(path);
if (!file->open(CIODevice::ReadOnly)) {
GMessageBox::show(String::format("Could not open '%s' for reading", path.characters()), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}
auto file_contents = file.read_all();
auto file_contents = file->read_all();
auto form_json = JsonValue::from_string(file_contents);
if (!form_json.is_object()) {
@ -392,8 +392,8 @@ void VBForm::load_from_file(const String& path)
void VBForm::write_to_file(const String& path)
{
CFile file(path);
if (!file.open(CIODevice::WriteOnly)) {
auto file = CFile::construct(path);
if (!file->open(CIODevice::WriteOnly)) {
GMessageBox::show(String::format("Could not open '%s' for writing", path.characters()), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}
@ -414,7 +414,7 @@ void VBForm::write_to_file(const String& path)
widget_array.append(widget_object);
}
form_object.set("widgets", widget_array);
file.write(form_object.to_string());
file->write(form_object.to_string());
}
void VBForm::dump()