| 1 |
#ifndef CTAGSGENERATOR_HPP |
| 2 |
#define CTAGSGENERATOR_HPP |
| 3 |
|
| 4 |
#include "codelite_exports.h" |
| 5 |
#include "entry.h" |
| 6 |
#include "readtags.h" |
| 7 |
#include "tag_tree.h" |
| 8 |
|
| 9 |
#include <vector> |
| 10 |
#include <wx/filename.h> |
| 11 |
#include <wx/textfile.h> |
| 12 |
|
| 13 |
class WXDLLIMPEXP_CL CTags |
| 14 |
{ |
| 15 |
protected: |
| 16 |
static wxString WrapSpaces(const wxString& file); |
| 17 |
/** |
| 18 |
* @brief parse list of files |
| 19 |
* @param filesContent contains a list of files to be parsed. Each file is placed on its own line |
| 20 |
* @param path location for the output ctags file. The output is written into `wxFileName(path, "ctags")`; |
| 21 |
* @param codelite_indexer path to `codelite_indexer` |
| 22 |
* @param ctags_args arguments to pass to ctags executable. Leave empty for the defaults |
| 23 |
* @param output if provided, holds the ctags content |
| 24 |
* @return true on success, false otherwise |
| 25 |
*/ |
| 26 |
static bool DoGenerate(const wxString& filesContent, const wxString& codelite_indexer, |
| 27 |
const wxStringMap_t& macro_table, const wxString& ctags_kinds = wxEmptyString, |
| 28 |
wxString* output = nullptr); |
| 29 |
|
| 30 |
static void Initialise(const wxString& codelite_indexer); |
| 31 |
|
| 32 |
public: |
| 33 |
/** |
| 34 |
* @brief given a list of files, generate an output tags file and place it under 'path' |
| 35 |
*/ |
| 36 |
static size_t ParseFiles(const std::vector<wxString>& files, const wxString& codelite_indexer, |
| 37 |
const wxStringMap_t& macro_table, std::vector<TagEntryPtr>& tags); |
| 38 |
|
| 39 |
/** |
| 40 |
* @brief given a list of files, generate an output tags file and place it under 'path' |
| 41 |
*/ |
| 42 |
static size_t ParseFile(const wxString& file, const wxString& codelite_indexer, const wxStringMap_t& macro_table, |
| 43 |
std::vector<TagEntryPtr>& tags); |
| 44 |
|
| 45 |
/** |
| 46 |
* @brief run codelite-indexer on a buffer and return list of tags |
| 47 |
*/ |
| 48 |
static size_t ParseBuffer(const wxFileName& filename, const wxString& buffer, const wxString& codelite_indexer, |
| 49 |
const wxStringMap_t& macro_table, std::vector<TagEntryPtr>& tags); |
| 50 |
/** |
| 51 |
* @brief parse list of local variables from a given source file |
| 52 |
*/ |
| 53 |
static size_t ParseLocals(const wxFileName& filename, const wxString& buffer, const wxString& codelite_indexer, |
| 54 |
const wxStringMap_t& macro_table, std::vector<TagEntryPtr>& tags); |
| 55 |
}; |
| 56 |
|
| 57 |
#endif // CTAGSGENERATOR_HPP |