#pragma once #include "position.h" #include "optional.h" #include #include struct FileContents { FileContents(); FileContents(const std::string& path, const std::string& content); optional ToOffset(Position p) const; optional ContentsInRange(Range range) const; std::string path; std::string content; // {0, 1 + position of first newline, 1 + position of second newline, ...} std::vector line_offsets_; }; using FileContentsMap = std::unordered_map;