File: clCxxFileCacheSymbols.h

package info (click to toggle)
codelite 14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 112,816 kB
  • sloc: cpp: 483,662; ansic: 150,144; php: 9,569; lex: 4,186; python: 3,417; yacc: 2,820; sh: 1,147; makefile: 52; xml: 13
file content (60 lines) | stat: -rw-r--r-- 1,867 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef CLCXXFILECACHESYMBOLS_H
#define CLCXXFILECACHESYMBOLS_H

#include "cl_command_event.h"
#include "codelite_exports.h"
#include "entry.h"
#include "wxStringHash.h"
#include <vector>
#include <wx/event.h>
#include <wx/filename.h>
#include <wx/sharedptr.h>
#include <wx/thread.h>

class SourceToTagsThread;
class WXDLLIMPEXP_CL clCxxFileCacheSymbols : public wxEvtHandler
{
    std::unordered_map<wxString, std::vector<TagEntryPtr> > m_cache;
    std::unordered_set<wxString> m_pendingFiles;
    wxCriticalSection m_cs;
    SourceToTagsThread* m_helperThread;

protected:
    void OnFileSave(clCommandEvent& e);
    void OnWorkspaceAction(wxCommandEvent& e);

public:
    void OnPraseCompleted(const wxString& filename, const wxString& strTags);

public:
    enum eFilter {
        kAllSymbols = 0,
        kFunctions = (1 << 0),
    };

public:
    typedef wxSharedPtr<clCxxFileCacheSymbols> Ptr_t;
    clCxxFileCacheSymbols();
    virtual ~clCxxFileCacheSymbols();

    bool Contains(const wxFileName& filename) const;
    bool Contains(const wxString& filename) const;
    void Clear();
    void Update(const wxFileName& filename, const TagEntryPtrVector_t& tags);
    void Delete(const wxFileName& filename);

    /**
     * @brief fetch from the cache, apply "flags" on the result. See eFilter
     */
    bool Find(const wxFileName& filename, TagEntryPtrVector_t& tags, size_t flags = 0);

    /**
     * @brief Request parsing of a file from the parser thread. The results will be cached
     * and an event 'clCommandEvent' is fired to notify that the cache was updated
     */
    void RequestSymbols(const wxFileName& filename);
};

wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CL, wxEVT_CXX_SYMBOLS_CACHE_UPDATED, clCommandEvent);
wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_CL, wxEVT_CXX_SYMBOLS_CACHE_INVALIDATED, clCommandEvent);
#endif // CLCXXFILECACHESYMBOLS_H