Source-highlight Library
/home/bettini/work/source-highlight/src-highlite/lib/srchilite/ctagscollector.h
00001 //
00002 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2009
00003 //
00004 // Copyright: See COPYING file that comes with this distribution
00005 //
00006 
00007 #ifndef CTAGSCOLLECTOR_H_
00008 #define CTAGSCOLLECTOR_H_
00009 
00010 #include <string>
00011 #include <list>
00012 
00013 #include "refposition.h"
00014 #include "readtags.h"
00015 
00016 namespace srchilite {
00017 
00018 struct FormatterParams;
00019 
00024 struct CTagsInfo {
00026     std::string fileName;
00027 
00029     std::string lineNumber;
00030 
00032     RefPosition refposition;
00033 
00035     bool isAnchor;
00036 
00045     CTagsInfo(const std::string &_fileName, const std::string &_lineNumber,
00046             RefPosition _refposition, bool _isAnchor) :
00047         fileName(_fileName), lineNumber(_lineNumber),
00048                 refposition(_refposition), isAnchor(_isAnchor) {
00049 
00050     }
00051 };
00052 
00056 typedef std::list<CTagsInfo> CTagsInfos;
00057 
00062 class CTagsCollector {
00064     RefPosition refposition;
00065 
00067     tagFile *ctags_file;
00068 
00070     tagFileInfo info;
00071 
00072 public:
00078     CTagsCollector(const std::string &ctags_file_name, RefPosition pos);
00079     ~CTagsCollector();
00080 
00089     bool collectTags(const std::string &word, CTagsInfos &infos,
00090             const FormatterParams *fileInfo);
00091 
00095     void setRefPosition(RefPosition r) {
00096         refposition = r;
00097     }
00098 };
00099 
00100 }
00101 
00102 #endif /*CTAGSCOLLECTOR_H_*/