1
#ifndef INCLUDE_FINDER_H
2
#define INCLUDE_FINDER_H
7
class CommentParseResult {
9
std::map<size_t, std::string> m_comments;
10
std::string m_filename;
13
void addComment(const std::string& comment, size_t line, bool cppComment)
15
// try to group this comment with the one above it
16
std::string cmt = comment;
17
if(cppComment && line) {
18
size_t prevLine = line - 1;
19
std::map<size_t, std::string>::iterator iter = m_comments.find(prevLine);
20
if(iter != m_comments.end()) {
25
// remove the previous comment from the map
26
m_comments.erase(iter);
29
m_comments[line] = cmt;
32
std::string getCommentForLine(size_t line) const
34
std::map<size_t, std::string>::const_iterator iter = m_comments.find(line);
35
if(iter == m_comments.end())
42
std::map<size_t, std::string>::const_iterator iter = m_comments.begin();
43
for(; iter != m_comments.end(); iter++) {
44
printf("Line : %d\n", iter->first);
45
printf("Comment:\n%s\n", iter->second.c_str());
49
void setFilename(const std::string& filename)
51
m_filename = filename;
54
const std::string& getFilename() const
66
extern int ParseComments(const char* filePath, CommentParseResult &comments);