#pragma once #include "File.h" #include #include class MarkdownContentParser { public: using FileMetadataItem = std::pair; using FileMetadata = std::vector; using FileContentBody = std::vector; void run(const std::string& path) { FileMetadata metadata; unsigned metadata_end_loc = 0; const auto lines = File(path).readLines(); for (const auto& line : lines) { } } std::string getContentBody() const { return mContentBody; } FileMetadata getFileMetadata() const { return mMetadata; } private: std::optional checkForMetadataItem(const std::string& line) const { unsigned char_count = 0; std::string prefix; std::string suffix; bool building_prefix = true; for (const auto c : line) { if (c == ':' && char_count > 0 && building_prefix) { building_prefix = false; } else if (building_prefix) { prefix += c; } else { suffix += c; } char_count ++; } if (!prefix.empty() && !suffix.empty()) { return FileMetadataItem{prefix, suffix}; } else { return std::nullopt; } } FileMetadata mMetadata; FileContentBody mContentBody; };