/
thomas-king
/
SourceManager
Обзор
Документация
Войти
/
thomas-king
/
SourceManager
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
lib/Services/SourceManager.cpp
36 строк
844 B
Ace Rodstin
Task #39. Add write capability to SourceManager.
24 окт 2023, 15:32
24 окт 2023, 15:32
bfd3834
Код
Авторство
О чём код?
// // SourceManager.cpp // SourceManager // // Created by Ace Rodstin on 10/24/23. // Updated by Ace Rodstin on 10/24/23. // // Copyright © 2023 Ace Rodstin. All rights reserved. // #include "Services/SourceManager.h" string SourceManager::read(string filePath) { fileManager.openFile(filePath, FileManager::OpenOption::READ); auto result = fileManager.read(); fileManager.closeFile(); return result; } void SourceManager::write(string filePath, string sourceCode, WriteOption writeOption) { FileManager::OpenOption openOption; switch (writeOption) { case WriteOption::REPLACE: openOption = FileManager::OpenOption::WRITE; break; case WriteOption::APPEND: openOption = FileManager::OpenOption::APPEND; break; } fileManager.openFile(filePath, openOption); fileManager.write(sourceCode); fileManager.closeFile(); }