16 #ifdef CC_BUILDTREE_MEASURING    33 #define CBBT_SANITY_CHECK ((!::wxIsMainThread() && m_TerminationRequested) || Manager::IsAppShuttingDown())    35 #define CC_BUILDERTHREAD_DEBUG_OUTPUT 0    37 #if defined(CC_GLOBAL_DEBUG_OUTPUT)    38     #if CC_GLOBAL_DEBUG_OUTPUT == 1    39         #undef CC_BUILDERTHREAD_DEBUG_OUTPUT    40         #define CC_BUILDERTHREAD_DEBUG_OUTPUT 1    41     #elif CC_GLOBAL_DEBUG_OUTPUT == 2    42         #undef CC_BUILDERTHREAD_DEBUG_OUTPUT    43         #define CC_BUILDERTHREAD_DEBUG_OUTPUT 2    47 #if CC_BUILDERTHREAD_DEBUG_OUTPUT == 1    48     #define TRACE(format, args...) \    49         CCLogger::Get()->DebugLog(F(format, ##args))    50     #define TRACE2(format, args...)    51 #elif CC_BUILDERTHREAD_DEBUG_OUTPUT == 2    52     #define TRACE(format, args...)                                              \    55             if (g_EnableDebugTrace)                                             \    56                 CCLogger::Get()->DebugLog(F(format, ##args));                   \    59     #define TRACE2(format, args...) \    60         CCLogger::Get()->DebugLog(F(format, ##args))    62     #define TRACE(format, args...)    63     #define TRACE2(format, args...)    69     m_ClassBrowserSemaphore(sem),
    70     m_ClassBrowserBuilderThreadMutex(),
    73     m_CCTreeCtrlBottom(0),
    78     m_TerminationRequested(false),
    97     TRACE(
_T(
"ClassBrowserBuilderThread::Init"));
   127         for (
size_t i = 0; i < paths.
GetCount(); ++i)
   130             for (TokenFileSet::const_iterator tfs_it = result.begin(); tfs_it != result.end(); ++tfs_it)
   142         for (FilesList::const_iterator fl_it = prj->
GetFilesList().begin();
   174             for (TokenIdxSet::const_iterator its = tokens->begin(); its != tokens->end(); ++its)
   176                 Token* curToken = tree->
at(*its);
   209         if (platform::gtk || platform::macosx)
   222         if (platform::gtk || platform::macosx)
   245     TRACE(
_T(
"ClassBrowserBuilderThread::ExpandItem"));
   257 #ifdef CC_BUILDTREE_MEASURING   343 #ifdef CC_BUILDTREE_MEASURING   351 #ifndef CC_NO_COLLAPSE_ITEM   354     TRACE(
_T(
"ClassBrowserBuilderThread::CollapseItem"));
   366 #if !defined(__WXGTK__) && !defined(__WXMAC__)   376 #endif // CC_NO_COLLAPSE_ITEM   380     TRACE(
_T(
"ClassBrowserBuilderThread::SelectItem"));
   387 #ifdef CC_BUILDTREE_MEASURING   396 #ifdef CC_BUILDTREE_MEASURING   426 #ifdef CC_BUILDTREE_MEASURING   449 #ifdef CC_BUILDTREE_MEASURING   456 #ifdef CC_BUILDTREE_MEASURING   469 #ifdef CC_BUILDTREE_MEASURING   476 #ifdef CC_BUILDTREE_MEASURING   484 #ifdef CC_BUILDTREE_MEASURING   493 #ifdef CC_BUILDTREE_MEASURING   498 #ifndef CC_NO_COLLAPSE_ITEM   508 #ifdef CC_BUILDTREE_MEASURING   515 #ifdef CC_BUILDTREE_MEASURING   519 #endif // CC_NO_COLLAPSE_ITEM   522     if (platform::gtk || platform::macosx)
   524 #ifdef CC_BUILDTREE_MEASURING   531 #ifdef CC_BUILDTREE_MEASURING   538 #ifdef CC_BUILDTREE_MEASURING   547 #ifdef CC_BUILDTREE_MEASURING   553 #ifdef CC_BUILDTREE_MEASURING   563 #ifdef CC_BUILDTREE_MEASURING   569 #ifdef CC_BUILDTREE_MEASURING   576 #ifdef CC_BUILDTREE_MEASURING   594     TRACE(
_T(
"ClassBrowserBuilderThread::RemoveInvalidNodes"));
   604     while (parent.
IsOk() && existing.
IsOk())
   606         bool removeCurrent = 
false;
   611             removeCurrent = 
true;
   612         else if (data && data->
m_Token)
   614             const Token* token = 
nullptr;
   626                 removeCurrent = 
true;
   638 #ifndef CC_NO_COLLAPSE_ITEM   645 #endif // CC_NO_COLLAPSE_ITEM   665     TRACE(
_T(
"ClassBrowserBuilderThread::ExpandNamespaces"));
   670     wxTreeItemIdValue enumerationCookie;
   672     while (existing.
IsOk())
   691     TRACE(
_T(
"ClassBrowserBuilderThread::CreateSpecialFolders"));
   706     for (TokenIdxSet::const_iterator tis_it = tis->begin(); tis_it != tis->end(); ++tis_it)
   708         const Token* token = tt->
at(*tis_it);
   723         if (hasGF && hasGV && hasGP && hasTD && hasGM)
   765     return hasGF || hasGV || hasGP || hasTD || hasGM;
   770     TRACE(
_T(
"ClassBrowserBuilderThread::AddNodeIfNotThere"));
   772     wxTreeItemIdValue cookie = 0;
   778         if (itemText == name)
   792     return tree->
AppendItem(parent, name, imgIndex, imgIndex, data);
   798                                               short int tokenKindMask,
   801     TRACE(
_T(
"ClassBrowserBuilderThread::AddChildrenOf"));
   806     const Token* parentToken = 0;
   807     bool parentTokenError = 
false;
   812     if (parentTokenIdx == -1)
   825             TRACE(
_T(
"Token not found?!?"));
   826             parentTokenError = 
true;
   828         if (!parentTokenError)
   834     if (parentTokenError) 
return false;
   836     return AddNodes(tree, parent, tokens, tokenKindMask, tokenScopeMask,
   842     TRACE(
_T(
"ClassBrowserBuilderThread::AddAncestorsOf"));
   863     TRACE(
_T(
"ClassBrowserBuilderThread::AddDescendantsOf"));
   890     TRACE(
_T(
"ClassBrowserBuilderThread::AddMembersOf"));
   900 #ifdef CC_BUILDTREE_MEASURING   904 #ifdef CC_BUILDTREE_MEASURING   909 #ifdef CC_BUILDTREE_MEASURING   914 #ifdef CC_BUILDTREE_MEASURING   920     bool haveFirstItem = 
false;
   949                         firstItem = rootCtorDtor;
   962                         firstItem = rootPublic;
   971                     while (existing.
IsOk())
   980                             firstItem = existing;
   983                             haveFirstItem = 
true;
  1012         if (haveFirstItem && firstItem.
IsOk())
  1022                                          short int tokenKindMask, 
int tokenScopeMask, 
bool allowGlobals)
  1024     TRACE(
_T(
"ClassBrowserBuilderThread::AddNodes"));
  1027     std::set<unsigned long, std::less<unsigned long> > tickets;
  1033         wxTreeItemIdValue cookie;
  1035         while (curchild.
IsOk())
  1044     TokenIdxSet::const_iterator end = tokens->end();
  1045     for (TokenIdxSet::const_iterator start = tokens->begin(); start != end; ++start)
  1055             && (tokenScopeMask == 0 || token->
m_Scope == tokenScopeMask)
  1059                 && tickets.find(token->
GetTicket()) != tickets.end() )
  1098 #ifdef CC_BUILDTREE_MEASURING  1106     TRACE(
_T(
"ClassBrowserBuilderThread::TokenMatchesFilter"));
  1123         for (TokenIdxSet::const_iterator tis_it = token->
m_Children.begin();
  1150     TRACE(
_T(
"ClassBrowserBuilderThread::TokenContainsChildrenOfKind"));
  1155     bool isOfKind = 
false;
  1160     for (TokenIdxSet::const_iterator tis_it = token->
m_Children.begin(); tis_it != token->
m_Children.end(); ++tis_it)
  1162         const Token* child = tree->
at(*tis_it);
  1177     TRACE(
_T(
"ClassBrowserBuilderThread::SaveExpandedItems"));
  1182     wxTreeItemIdValue cookie;
  1184     while (existing.
IsOk())
  1200     TRACE(
_T(
"ClassBrowserBuilderThread::ExpandSavedItems"));
  1205     wxTreeItemIdValue cookie;
  1242     TRACE(
_T(
"ClassBrowserBuilderThread::SaveSelectedItem"));
  1261     TRACE(
_T(
"ClassBrowserBuilderThread::SelectSavedItem"));
  1271     wxTreeItemIdValue cookie;
  1284             wxTreeItemIdValue cookie2;
 const TokenIdxSet * GetTokensBelongToFile(size_t fileIdx) const
virtual wxTreeItemId GetNextChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
TokenTree * GetTree() const
get the TokenTree associated with the current Token 
wxString F(const wxChar *msg,...)
sprintf-like function 
wxSemaphore & m_ClassBrowserSemaphore
void SaveExpandedItems(CCTreeCtrl *tree, wxTreeItemId parent, int level)
destructor class member function 
CCTreeCtrl * m_CCTreeCtrlBottom
pointer to the bottom wxTreeCtrl 
#define CC_LOCKER_TRACK_CBBT_MTX_LOCK
int m_ParentIndex
Parent Token index. 
#define PARSER_IMG_TYPEDEF_FOLDER
virtual void SetItemBold(const wxTreeItemId &item, bool bold=true)
constructor class member function 
wxArrayString GetAllPathsByFilename(const wxString &filename)
Get the implementation file path if the input is a header file. 
#define PARSER_IMG_VARS_FOLDER
virtual wxTreeItemId GetItemParent(const wxTreeItemId &item) const
void Init(NativeParser *np, CCTreeCtrl *treeTop, CCTreeCtrl *treeBottom, const wxString &active_filename, void *user_data, const BrowserOptions &bo, TokenTree *tt, int idThreadEvent)
virtual void SetItemHasChildren(const wxTreeItemId &item, bool hasChildren=true)
wxString m_Name
Token's name, it can be searched in the TokenTree. 
std::set< size_t, std::less< size_t > > TokenFileSet
typedef, note typedefs are stored as classes inheriting from the typedef'd type, this takes advantage...
static bool IsAppShuttingDown()
#define PARSER_IMG_FUNCS_FOLDER
SelectedItemPath m_SelectedPath
virtual void DeleteAllItems()
container like tokens, those tokens can have children tokens 
virtual FilesList & GetFilesList()
Provides an easy way to iterate all the files belonging in this target. 
TokenKind m_TokenKind
a copy of Token::m_TokenKind 
#define TRACE(format, args...)
wxFileName file
The full filename of this file. 
const TokenIdxSet * GetGlobalNameSpaces() const
all kinds of tokens under global name spaces 
virtual size_t GetChildrenCount(const wxTreeItemId &item, bool recursively=true) const
#define PARSER_IMG_OTHERS_FOLDER
virtual wxTreeItemId GetSelection() const
SpecialFolder m_SpecialFolder
the node's kind, it could be "root", "normal token", 
virtual void EnsureVisible(const wxTreeItemId &item)
NativeParser * m_NativeParser
a container class to hold all the Tokens getting from parsing stage 
TokenIdxSet m_Children
if it is a class kind token, then it contains all the member tokens 
bool showInheritance
whether the base class or derive class information is shown as a child node default: false ...
void * m_UserData
custom user-data (the classbrowser expects it to be a pointer to a cbProject), this field is used whe...
void AddMembersOf(CCTreeCtrl *tree, wxTreeItemId node)
TokenIdxSet m_CurrentTokenSet
Tokens belong to the m_CurrentFileSet file set. 
the thread is starting to (re)build the tree 
int m_Index
current Token index in the tree, it is index of the std::vector<Token*>, so use the index...
wxString m_ActiveFilename
virtual ~ClassBrowserBuilderThread()
destructor 
virtual wxTreeItemData * GetItemData(const wxTreeItemId &item) const
void SetCompareFunction(const BrowserSortType type)
virtual wxString GetItemText(const wxTreeItemId &item) const
TokenFileSet m_CurrentFileSet
A file set which contains a header file and the associated implementation file. 
bool m_IsTemp
local (automatic) variable 
#define PARSER_IMG_SYMBOLS_FOLDER
TokenScope m_Scope
public? private? protected? 
Represents a file in a Code::Blocks project. 
void DebugLog(const wxString &msg)
virtual void SortChildren(const wxTreeItemId &item)
virtual void SetItemTextColour(const wxTreeItemId &item, const wxColour &col)
void RecalcInheritanceChain(Token *token)
convert the Token's ancestor string to it's IDs this contains recursive calls, for example in such co...
virtual void CollapseAndReset(const wxTreeItemId &item)
wxString m_TokenName
short name of the Token, it is a copy of Token::m_Name 
void ExpandNamespaces(wxTreeItemId node, TokenKind tokenKind, int level)
recursively construct the children of node's children, which matches tokenKind Called from BuildTree(...
bool expandNS
whether a namespaces node is auto-expand auto-expand means the child of the namespace is automaticall...
virtual wxTreeItemId GetFirstChild(const wxTreeItemId &item, wxTreeItemIdValue &cookie) const
virtual void DeleteChildren(const wxTreeItemId &item)
Represents a Code::Blocks project. 
display symbols of current project 
#define PARSER_IMG_CLASS_FOLDER
a symbol found in the parsed files, it can be many kinds, such as a variable, a class and so on...
std::set< int, std::less< int > > TokenIdxSet
display symbols of current file 
size_t GetFileIndex(const wxString &filename)
bool TokenMatchesFilter(const Token *token, bool locked=false)
if the token should be shown in the tree, it will return true 
Token * m_Token
a pointer to the associated Token instance in the TokenTree 
ClassBrowserBuilderThread(wxEvtHandler *evtHandler, wxSemaphore &sem)
constructor 
virtual void SelectItem(const wxTreeItemId &item, bool select=true)
Options for the symbol browser, this specify how the symbol browser will shown. 
ExpandedItemVect m_ExpandedVect
virtual void SetItemData(const wxTreeItemId &item, wxTreeItemData *data)
unsigned long m_Ticket
the Token's ticket in a TokenTree This is actually a copy of Token::m_Ticket, 
void ExpandSavedItems(CCTreeCtrl *tree, wxTreeItemId parent, int level)
bool AddNodes(CCTreeCtrl *tree, wxTreeItemId parent, const TokenIdxSet *tokens, short int tokenKindMask=0xffff, int tokenScopeMask=0, bool allowGlobals=false)
static wxColour GetColour(wxSystemColour index)
wxEventType wxEVT_COMMAND_ENTER
wxTreeItemId AddNodeIfNotThere(CCTreeCtrl *tree, wxTreeItemId parent, const wxString &name, int imgIndex=-1, CCTreeCtrlData *data=0)
#define CC_LOCKER_TRACK_TT_MTX_UNLOCK(M)
bool AddAncestorsOf(CCTreeCtrl *tree, wxTreeItemId parent, int tokenIdx)
virtual wxTreeItemId GetLastChild(const wxTreeItemId &item) const
int m_TokenIndex
a copy of Token::m_TokenIndex 
void CollapseItem(wxTreeItemId item)
remove the children of the tree item Called from external, BuildTree(), RemoveInvalidNodes(): ...
const wxString & _(const wxString &string)
#define CC_LOCKER_TRACK_TT_MTX_LOCK(M)
bool TokenContainsChildrenOfKind(const Token *token, int kind)
NativeParser class is just like a manager class to control Parser objects. 
wxMutex m_ClassBrowserBuilderThreadMutex
Some member functions of ClassBrowserBuilderThread such as ExpandItem() can either be called from the...
wxString m_TemplateArgument
template argument list, comma separated list string 
virtual void Expand(const wxTreeItemId &item)
ParserBase & GetParser()
return a reference to the currently active Parser object 
Actual data stored with each node in the symbol tree. 
BrowserDisplayFilter displayFilter
token filter option 
wxTreeItemId m_SelectItemRequired
BrowserOptions m_BrowserOptions
TokenIdxSet m_Descendants
all the descendants in the inheritance hierarchy 
bool treeMembers
show members in the bottom tree. 
size_t GetFileMatches(const wxString &filename, std::set< size_t > &result, bool caseSensitive, bool is_prefix)
void SelectItemRequired()
void Start(long milliseconds=0)
virtual wxTreeItemId GetNextSibling(const wxTreeItemId &item) const
const CCTreeCtrlData & GetData()
bool AddDescendantsOf(CCTreeCtrl *tree, wxTreeItemId parent, int tokenIdx, bool allowInheritance=true)
virtual void SetImageList(wxImageList *imageList)
void SelectItem(wxTreeItemId item)
TokenKind m_TokenKind
See TokenKind class. 
virtual void Delete(const wxTreeItemId &item)
#define CBBT_SANITY_CHECK
general function, not constructor nor destructor 
virtual wxTreeItemId AddRoot(const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
virtual wxTreeItemId GetPrevSibling(const wxTreeItemId &item) const
BrowserSortType sortType
token sort option in the tree default: bstKind 
void RemoveInvalidNodes(CCTreeCtrl *tree, wxTreeItemId parent)
Remove any nodes no longer valid (due to update) 
#define CC_LOCKER_TRACK_CBBT_MTX_UNLOCK
virtual wxTreeItemId GetRootItem() const
virtual TokenTree * GetTokenTree() const
int GetTokenKindImage(const Token *token)
Returns the image assigned to a specific token for a symbol browser. 
display symbols of current workspace 
int idThreadEvent
the event ID which will be sent from worker thread to ClassBrowser 
virtual void ScrollTo(const wxTreeItemId &item)
#define PARSER_IMG_MACRO_USE_FOLDER
virtual void SetItemImage(const wxTreeItemId &item, int image, wxTreeItemIcon which=wxTreeItemIcon_Normal)
macro definition, such as: #define AAA(x,y) f(x,y), where AAA is a token of tkMacroDef ...
bool CreateSpecialFolders(CCTreeCtrl *tree, wxTreeItemId parent)
void ExpandItem(wxTreeItemId item)
construct the children of the tree item Called from external, BuildTree(): 
#define PARSER_IMG_MACRO_DEF_FOLDER
wxString m_FullType
this is the full return value (if any): e.g. 
size_t GetTicket() const
get the ticket value of the current token 
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
wxImageList * GetImageList()
Used to support Symbol browser and codecompletion UI Image list is used to initialize the symbol brow...
bool m_IsLocal
if true, means the token belong to a C::B project, it exists in the project's source/header files...
TokenIdxSet m_DirectAncestors
the nearest ancestors 
bool m_TerminationRequested
if this variable is true, the Entry() function should return 
virtual unsigned int GetCount() const
CCTreeCtrl * m_CCTreeCtrlTop
pointer to the top wxTreeCtrl 
virtual bool ItemHasChildren(const wxTreeItemId &item) const
wxTreeItemId AppendItem(const wxTreeItemId &parent, const wxString &text, int image=-1, int selImage=-1, wxTreeItemData *data=NULL)
TokenIdxSet m_CurrentGlobalTokensSet
Special global scope tokens belong to the m_CurrentFileSet file set. 
the usage of the macro, for example: AAA(1,2) 
bool AddChildrenOf(CCTreeCtrl *tree, wxTreeItemId parent, int parentTokenIdx, short int tokenKindMask=0xffff, int tokenScopeMask=0)
Add the child nodes of the specified token.