Code::Blocks
SVN r11506
|
a container class to hold all the Tokens getting from parsing stage More...
#include <tokentree.h>
Public Member Functions | |
TokenTree () | |
virtual | ~TokenTree () |
void | clear () |
Token * | operator[] (int idx) |
Token * | at (int idx) |
const Token * | at (int idx) const |
size_t | size () |
total size of std::vector<Token*> More... | |
size_t | realsize () |
some position of the std::vector<Token*> are not used, so the real size maybe a bit smaller than the total size More... | |
bool | empty () |
check to see whether the TokenTree is empty More... | |
int | insert (Token *newToken) |
add a new Token instance to the TokenTree More... | |
int | insert (int loc, Token *newToken) |
add a new Token instance to the TokenTree More... | |
int | erase (int loc) |
remove the Token specified by the index More... | |
void | erase (Token *oldToken) |
remove the Token from the TokenTree More... | |
void | Clear () |
void | RecalcFreeList () |
collect the unused slots in the std::vector<Token*> More... | |
void | RenameToken (Token *token, const wxString &newName) |
only the token's name need to be changed, thus update the index map of the TokenTree More... | |
void | RecalcInheritanceChain (Token *token) |
convert the Token's ancestor string to it's IDs this contains recursive calls, for example in such code More... | |
int | TokenExists (const wxString &name, int parent, short int kindMask) |
query tokens by names More... | |
int | TokenExists (const wxString &name, const wxString &baseArgs, int parent, TokenKind kind) |
query tokens by names More... | |
int | TokenExists (const wxString &name, const TokenIdxSet &parents, short int kindMask) |
query tokens by names More... | |
int | TokenExists (const wxString &name, const wxString &baseArgs, const TokenIdxSet &parents, TokenKind kind) |
query tokens by names More... | |
size_t | FindMatches (const wxString &query, TokenIdxSet &result, bool caseSensitive, bool is_prefix, TokenKind kindMask=tkUndefined) |
find a collection of matched tokens More... | |
size_t | FindTokensInFile (const wxString &filename, TokenIdxSet &result, short int kindMask) |
find tokens belong to a specified file More... | |
void | RemoveFile (const wxString &filename) |
remove tokens belong to the file More... | |
void | RemoveFile (int fileIndex) |
remove tokens belong to the file More... | |
const TokenList * | GetTokens () const |
Protected access to internal lists / maps. More... | |
const TokenIdxSet * | GetGlobalNameSpaces () const |
all kinds of tokens under global name spaces More... | |
const TokenFileMap * | GetFilesMap () const |
const TokenIdxSet * | GetTokensBelongToFile (size_t fileIdx) const |
const TokenFileSet * | GetFilesToBeReparsed () const |
size_t | GetFileMapSize () const |
void | InsertTokenBelongToFile (size_t fileIdx, int tokenIdx) |
void | EraseFileMapInFileMap (size_t fileIdx) |
size_t | GetFileStatusCountForIndex (size_t fileIdx) const |
void | EraseFileStatusByIndex (size_t fileIdx) |
void | EraseFilesToBeReparsedByIndex (size_t fileIdx) |
size_t | InsertFileOrGetIndex (const wxString &filename) |
put the filename in the m_FilenameMap, and return the file index, if this file is already in the m_FilenameMap, it just return the file index. More... | |
size_t | GetFileMatches (const wxString &filename, std::set< size_t > &result, bool caseSensitive, bool is_prefix) |
size_t | GetFileIndex (const wxString &filename) |
const wxString | GetFilename (size_t fileIdx) const |
size_t | ReserveFileForParsing (const wxString &filename, bool preliminary=false) |
mark a file to be parsed. More... | |
void | FlagFileForReparsing (const wxString &filename) |
mark the file as "need to be reparsed" status, usually happens that this file is saved(updated) so a reparse need to be done. More... | |
void | FlagFileAsParsed (const wxString &filename) |
mark the file status as fpsDone, since parsing this file is done More... | |
bool | IsFileParsed (const wxString &filename) |
is the file name is in the tokentree, and it's status is either assigned or beingparsed or done also, should make sure that this file is not marked as "need to be reparsed". More... | |
void | MarkFileTokensAsLocal (const wxString &filename, bool local=true, void *userData=0) |
mark the tokens so that they are associated with a C::B project More... | |
void | MarkFileTokensAsLocal (size_t fileIdx, bool local=true, void *userData=0) |
mark the tokens so that they are associated with a C::B project More... | |
void | AppendDocumentation (int tokenIdx, unsigned int fileIdx, const wxString &doc) |
associate a document string with the token More... | |
wxString | GetDocumentation (int tokenIdx) |
get the document string associated with the token More... | |
Public Attributes | |
size_t | m_TokenTicketCount |
Protected Member Functions | |
Token * | GetTokenAt (int idx) |
Token const * | GetTokenAt (int idx) const |
int | AddToken (Token *newToken, int forceidx=-1) |
void | RemoveToken (int idx) |
void | RemoveToken (Token *oldToken) |
int | AddTokenToList (Token *newToken, int forceidx=-1) |
add the Token pointer to the vector<Token*>, mostly the default value forceidx = -1 is used which add a new slot in the vector or reused an empty slot. More... | |
void | RemoveTokenFromList (int idx) |
Remove the Token specified by the idx in the vector<Token*>, note the Token instance is destroyed, and the slot becomes empty. More... | |
void | RecalcFullInheritance (int parentIdx, TokenIdxSet &result) |
bool | CheckChildRemove (const Token *token, int fileIdx) |
Check all the children belong this token should be removed. More... | |
Protected Attributes | |
TokenSearchTree | m_Tree |
This is a string->TokenIndexSet map. More... | |
TokenList | m_Tokens |
Contains the pointers to all the Token instances, it is just a std::vector<Token*>, the suggest way to access a Token instance is by first get its index in the m_Tokens, then get its address by m_Tokens[index], the reason we have such indirect access is that there are many Tokens which can reference each other, it is much safe using index instead of raw pointers. More... | |
TokenIdxList | m_FreeTokens |
List of all the deleted (and available) tokens. More... | |
TokenIdxSet | m_TopNameSpaces |
namespace tokens belongs to the global namespace More... | |
TokenIdxSet | m_GlobalNameSpaces |
any tokens belong to the global namespace More... | |
TokenFilenameMap | m_FilenameMap |
Map: file names -> file indices. More... | |
TokenFileMap | m_FileMap |
Map: file indices -> sets of TokenIndexes. More... | |
TokenFileStatusMap | m_FileStatusMap |
Map: file indices -> status. More... | |
TokenFileSet | m_FilesToBeReparsed |
Set: file indices. More... | |
Friends | |
class | CCDebugInfo |
class | CCTest |
class | CCTestFrame |
class | NativeParserTest |
a container class to hold all the Tokens getting from parsing stage
To query a Token, a unique index is needed, the index is actually position in the std::vector<Token*> (namely TokenList).
Definition at line 37 of file tokentree.h.
TokenTree::TokenTree | ( | ) |
Definition at line 51 of file tokentree.cpp.
References BasicSearchTree::clear(), SearchTree< T >::clear(), m_FileMap, m_FilenameMap, m_FileStatusMap, m_FilesToBeReparsed, m_FreeTokens, m_GlobalNameSpaces, m_Tokens, m_TopNameSpaces, and m_Tree.
|
virtual |
Definition at line 69 of file tokentree.cpp.
References clear().
|
protected |
Definition at line 364 of file tokentree.cpp.
References SearchTree< T >::AddItem(), AddTokenToList(), SearchTree< T >::GetItemAtPos(), Token::m_FileIdx, m_FileMap, m_GlobalNameSpaces, Token::m_Name, Token::m_ParentIndex, Token::m_TokenKind, m_TopNameSpaces, m_Tree, and tkNamespace.
Referenced by insert().
|
protected |
add the Token pointer to the vector<Token*>, mostly the default value forceidx = -1 is used which add a new slot in the vector or reused an empty slot.
if forceidx >= 0, this means we need to replace the value in the specified slot index, the later case only happens we are re-construct the Tokentree from the cache. always return the used slot index in the vector.
Definition at line 485 of file tokentree.cpp.
References Token::m_AncestorsString, Token::m_Args, Token::m_BaseArgs, Token::m_BaseType, m_FreeTokens, Token::m_FullType, Token::m_Index, Token::m_Name, Token::m_TemplateArgument, m_Tokens, Token::m_TokenTree, and wxString::Shrink().
Referenced by AddToken().
void TokenTree::AppendDocumentation | ( | int | tokenIdx, |
unsigned int | fileIdx, | ||
const wxString & | doc | ||
) |
associate a document string with the token
tokenIdx | token index |
fileIdx | the file index where the doc locates |
doc | document string |
Definition at line 936 of file tokentree.cpp.
References GetTokenAt(), Token::m_Doc, Token::m_FileIdx, Token::m_ImplDoc, Token::m_ImplFileIdx, and wxString::Shrink().
Referenced by EraseFilesToBeReparsedByIndex(), Tokenizer::SetLastTokenIdx(), and Tokenizer::SkipComment().
|
inline |
Definition at line 51 of file tokentree.h.
References GetTokenAt().
Referenced by ClassBrowserBuilderThread::AddAncestorsOf(), ClassBrowserBuilderThread::AddChildrenOf(), NativeParserBase::AddChildrenOfEnum(), NativeParserBase::AddChildrenOfUnnamed(), NativeParserBase::AddConstructors(), ClassBrowserBuilderThread::AddDescendantsOf(), Tokenizer::AddMacroDefinition(), ClassBrowserBuilderThread::AddNodes(), NativeParserBase::AddTemplateAlias(), ParserThread::CalcEnumExpression(), CheckChildRemove(), Tokenizer::CheckMacroUsageAndReplace(), NativeParserBase::CleanupSearchScope(), NativeParserBase::CollectSearchScopes(), NativeParserBase::ComputeCallTip(), ClassBrowserBuilderThread::CreateSpecialFolders(), NativeParserBase::DependsOnAllocator(), CCDebugInfo::DisplayTokenInfo(), ParserThread::DoAddToken(), CodeCompletion::DoAllMethodsImpl(), CodeCompletion::DoCodeComplete(), InsertClassMethodDlgHelper::DoFillMethodsFor(), CCDebugInfo::FillAncestors(), CCDebugInfo::FillChildren(), InsertClassMethodDlg::FillClasses(), CCDebugInfo::FillDescendants(), NativeParserBase::FindAIMatches(), NativeParserBase::FindCurrentFunctionScope(), NativeParser::FindCurrentFunctionStart(), FindMatches(), FindTokensInFile(), ParserBase::FindTokensInFile(), DocumentationHelper::GenerateHTML(), NativeParserBase::GenerateResultSet(), Token::GetNamespace(), CodeCompletion::GetTokenAt(), NativeParserBase::GetTokenFromCurrentLine(), Token::InheritsFrom(), ClassBrowserBuilderThread::Init(), NativeParserBase::IsAllocator(), NativeParserBase::IsChildOfUnnamedOrEnum(), DocumentationHelper::OnDocumentationLink(), CCDebugInfo::OnFindClick(), CodeCompletion::OnGotoDeclaration(), CodeCompletion::OnGotoFunction(), CCDebugInfo::OnSave(), ClassBrowser::OnSearch(), CodeRefactoring::Parse(), NativeParser::ParseBufferForUsingNamespace(), NativeParser::ParseFunctionArguments(), NativeParser::ParseLocalBlock(), NativeParserBase::PrettyPrintToken(), RecalcFullInheritance(), RecalcInheritanceChain(), RemoveFile(), ClassBrowserBuilderThread::RemoveInvalidNodes(), NativeParserBase::RemoveLastFunctionChildren(), NativeParserBase::ResolveExpression(), NativeParserBase::ResolveOperator(), ParserThread::ResolveTemplateMap(), ClassBrowserBuilderThread::TokenContainsChildrenOfKind(), ParserThread::TokenExists(), ClassBrowserBuilderThread::TokenMatchesFilter(), CodeCompletion::UpdateEditorSyntax(), and CodeRefactoring::VerifyResult().
|
inline |
Definition at line 52 of file tokentree.h.
References GetTokenAt(), realsize(), and size().
|
protected |
Check all the children belong this token should be removed.
token | the checked token pointer |
fileIdx | file index the token belongs to |
Definition at line 609 of file tokentree.cpp.
References at(), Token::m_Children, Token::m_FileIdx, Token::m_ImplFileIdx, and m_Tokens.
Referenced by RemoveFile().
void TokenTree::clear | ( | ) |
Definition at line 74 of file tokentree.cpp.
References BasicSearchTree::clear(), SearchTree< T >::clear(), m_FileMap, m_FilenameMap, m_FileStatusMap, m_FilesToBeReparsed, m_FreeTokens, m_GlobalNameSpaces, m_Tokens, m_TopNameSpaces, and m_Tree.
Referenced by Clear(), CodeCompletion::OnGotoFunction(), and ~TokenTree().
|
inline |
Definition at line 86 of file tokentree.h.
References clear(), FindMatches(), FindTokensInFile(), RecalcFreeList(), RecalcInheritanceChain(), RemoveFile(), RenameToken(), tkUndefined, and TokenExists().
Referenced by CCDebugInfo::FillAncestors(), CCDebugInfo::FillChildren(), CCDebugInfo::FillDescendants(), CCDebugInfo::FillFiles(), and NativeParser::MarkItemsByAI().
|
inline |
check to see whether the TokenTree is empty
Definition at line 63 of file tokentree.h.
References erase(), insert(), and size().
Referenced by NativeParserBase::AddTemplateAlias(), CodeCompletion::OnGotoFunction(), and NativeParserBase::ResolveOperator().
int TokenTree::erase | ( | int | loc | ) |
remove the Token specified by the index
Definition at line 127 of file tokentree.cpp.
References m_Tokens, and RemoveToken().
Referenced by Token::DeleteAllChildren(), empty(), and Tokenizer::HandleUndefs().
void TokenTree::erase | ( | Token * | oldToken | ) |
remove the Token from the TokenTree
oldToken | the token need to be removed, if success, the pointer is invalid after the function call |
Definition at line 136 of file tokentree.cpp.
References RemoveToken().
|
inline |
Definition at line 217 of file tokentree.h.
References m_FileMap.
Referenced by Parser::RemoveFile().
|
inline |
Definition at line 227 of file tokentree.h.
References m_FileStatusMap.
Referenced by Parser::RemoveFile().
|
inline |
Definition at line 232 of file tokentree.h.
References AppendDocumentation(), FlagFileAsParsed(), FlagFileForReparsing(), GetDocumentation(), GetFileIndex(), GetFileMatches(), GetFilename(), InsertFileOrGetIndex(), IsFileParsed(), m_FilesToBeReparsed, MarkFileTokensAsLocal(), and ReserveFileForParsing().
Referenced by Parser::RemoveFile().
size_t TokenTree::FindMatches | ( | const wxString & | query, |
TokenIdxSet & | result, | ||
bool | caseSensitive, | ||
bool | is_prefix, | ||
TokenKind | kindMask = tkUndefined |
||
) |
find a collection of matched tokens
query | search name |
result | the return collection token index |
caseSensitive | true if we need the case sensitive search for the query name |
is_prefix | true if the query is only a prefix of any matched token |
kindMask | token kind match mask |
Definition at line 266 of file tokentree.cpp.
References at(), BasicSearchTree::FindMatches(), SearchTree< T >::GetItemAtPos(), Token::m_TokenKind, m_Tree, and tkUndefined.
Referenced by Clear(), NativeParserBase::ComputeCallTip(), NativeParserBase::GenerateResultSet(), DocumentationHelper::OnDocumentationLink(), ClassBrowser::OnSearch(), RecalcInheritanceChain(), and ParserThread::ResolveTemplateMap().
size_t TokenTree::FindTokensInFile | ( | const wxString & | filename, |
TokenIdxSet & | result, | ||
short int | kindMask | ||
) |
find tokens belong to a specified file
filename | search key |
result | returned tokens |
kindMask | token filter mask |
Definition at line 298 of file tokentree.cpp.
References _T, at(), BasicSearchTree::GetItemNo(), BasicSearchTree::HasItem(), m_FileMap, m_FilenameMap, Token::m_TokenKind, wxString::Replace(), TRACE, and wxString::wx_str().
Referenced by Clear(), ParserBase::FindTokensInFile(), and CCDebugInfo::OnSave().
void TokenTree::FlagFileAsParsed | ( | const wxString & | filename | ) |
mark the file status as fpsDone, since parsing this file is done
Definition at line 931 of file tokentree.cpp.
References fpsDone, InsertFileOrGetIndex(), and m_FileStatusMap.
Referenced by EraseFilesToBeReparsedByIndex(), and ParserThread::Parse().
void TokenTree::FlagFileForReparsing | ( | const wxString & | filename | ) |
mark the file as "need to be reparsed" status, usually happens that this file is saved(updated) so a reparse need to be done.
Definition at line 926 of file tokentree.cpp.
References InsertFileOrGetIndex(), and m_FilesToBeReparsed.
Referenced by EraseFilesToBeReparsedByIndex(), and Parser::Reparse().
wxString TokenTree::GetDocumentation | ( | int | tokenIdx | ) |
get the document string associated with the token
tokenIdx | token index |
Definition at line 960 of file tokentree.cpp.
References GetTokenAt(), Token::m_Doc, Token::m_ImplDoc, and wxEmptyString.
Referenced by EraseFilesToBeReparsedByIndex(), and DocumentationHelper::GenerateHTML().
size_t TokenTree::GetFileIndex | ( | const wxString & | filename | ) |
Definition at line 851 of file tokentree.cpp.
References _T, BasicSearchTree::GetItemNo(), m_FilenameMap, and wxString::Replace().
Referenced by EraseFilesToBeReparsedByIndex(), ClassBrowserBuilderThread::Init(), Tokenizer::Init(), and Tokenizer::InitFromBuffer().
|
inline |
Definition at line 207 of file tokentree.h.
References m_FileMap.
Referenced by Parser::OnAllThreadsDone().
size_t TokenTree::GetFileMatches | ( | const wxString & | filename, |
std::set< size_t > & | result, | ||
bool | caseSensitive, | ||
bool | is_prefix | ||
) |
Definition at line 843 of file tokentree.cpp.
References _T, BasicSearchTree::FindMatches(), m_FilenameMap, and wxString::Replace().
Referenced by CodeCompletion::DoAllMethodsImpl(), EraseFilesToBeReparsedByIndex(), and ClassBrowserBuilderThread::Init().
const wxString TokenTree::GetFilename | ( | size_t | fileIdx | ) | const |
Definition at line 858 of file tokentree.cpp.
References BasicSearchTree::GetString(), and m_FilenameMap.
Referenced by EraseFilesToBeReparsedByIndex(), Token::GetFilename(), Token::GetImplFilename(), and Parser::ReparseModifiedFiles().
|
inline |
Definition at line 191 of file tokentree.h.
References m_FileMap.
|
inline |
Definition at line 222 of file tokentree.h.
References m_FileStatusMap.
Referenced by Parser::RemoveFile().
|
inline |
Definition at line 202 of file tokentree.h.
References m_FilesToBeReparsed.
Referenced by Parser::ReparseModifiedFiles().
|
inline |
all kinds of tokens under global name spaces
Definition at line 186 of file tokentree.h.
References m_GlobalNameSpaces.
Referenced by ClassBrowserBuilderThread::AddChildrenOf(), and ClassBrowserBuilderThread::CreateSpecialFolders().
|
protected |
Definition at line 819 of file tokentree.cpp.
References m_Tokens.
Referenced by AppendDocumentation(), at(), GetDocumentation(), and operator[]().
|
protected |
Definition at line 827 of file tokentree.cpp.
References m_Tokens.
|
inline |
Protected access to internal lists / maps.
Definition at line 180 of file tokentree.h.
References m_Tokens.
Referenced by NativeParserBase::GenerateResultSet().
|
inline |
Definition at line 196 of file tokentree.h.
References m_FileMap.
Referenced by CodeCompletion::DoAllMethodsImpl(), and ClassBrowserBuilderThread::Init().
int TokenTree::insert | ( | Token * | newToken | ) |
add a new Token instance to the TokenTree
newToken | the pointer to a Token instance |
Definition at line 111 of file tokentree.cpp.
References AddToken().
Referenced by Tokenizer::AddMacroDefinition(), ParserThread::DoAddToken(), empty(), and ParserThread::FindTokenFromQueue().
int TokenTree::insert | ( | int | loc, |
Token * | newToken | ||
) |
add a new Token instance to the TokenTree
loc | -1 means we add a new slot to the Token list (vector), otherwise, the new added Token will replace the old one in that location(index). |
Definition at line 119 of file tokentree.cpp.
References AddToken().
size_t TokenTree::InsertFileOrGetIndex | ( | const wxString & | filename | ) |
put the filename in the m_FilenameMap, and return the file index, if this file is already in the m_FilenameMap, it just return the file index.
Definition at line 835 of file tokentree.cpp.
References _T, BasicSearchTree::insert(), m_FilenameMap, and wxString::Replace().
Referenced by EraseFilesToBeReparsedByIndex(), FlagFileAsParsed(), FlagFileForReparsing(), NativeParserBase::GetTokenFromCurrentLine(), ParserThread::InitTokenizer(), IsFileParsed(), MarkFileTokensAsLocal(), RemoveFile(), Parser::RemoveFile(), and ReserveFileForParsing().
|
inline |
Definition at line 212 of file tokentree.h.
References m_FileMap.
Referenced by ParserThread::DoAddToken().
bool TokenTree::IsFileParsed | ( | const wxString & | filename | ) |
is the file name is in the tokentree, and it's status is either assigned or beingparsed or done also, should make sure that this file is not marked as "need to be reparsed".
Definition at line 863 of file tokentree.cpp.
References fpsNotParsed, InsertFileOrGetIndex(), m_FileMap, m_FileStatusMap, and m_FilesToBeReparsed.
Referenced by EraseFilesToBeReparsedByIndex(), ParserThread::HandleIncludes(), Parser::IsFileParsed(), and Parser::Parse().
void TokenTree::MarkFileTokensAsLocal | ( | const wxString & | filename, |
bool | local = true , |
||
void * | userData = 0 |
||
) |
mark the tokens so that they are associated with a C::B project
filename | specify the tokens which belong to the file |
local | true if the tokens belong to project files |
userData | a pointer to the c::b project |
Definition at line 874 of file tokentree.cpp.
References InsertFileOrGetIndex().
Referenced by EraseFilesToBeReparsedByIndex(), and MarkFileAsLocalThreadedTask::Execute().
void TokenTree::MarkFileTokensAsLocal | ( | size_t | fileIdx, |
bool | local = true , |
||
void * | userData = 0 |
||
) |
mark the tokens so that they are associated with a C::B project
fileIdx | specify the tokens which belong to the file |
local | true if the tokens belong to project files |
userData | a pointer to the c::b project |
Definition at line 879 of file tokentree.cpp.
References m_FileMap, Token::m_IsLocal, m_Tokens, and Token::m_UserData.
|
inline |
Definition at line 50 of file tokentree.h.
References GetTokenAt().
size_t TokenTree::realsize | ( | ) |
some position of the std::vector<Token*> are not used, so the real size maybe a bit smaller than the total size
Definition at line 103 of file tokentree.cpp.
References m_FreeTokens, and m_Tokens.
Referenced by at(), and Parser::OnAllThreadsDone().
void TokenTree::RecalcFreeList | ( | ) |
collect the unused slots in the std::vector<Token*>
Definition at line 633 of file tokentree.cpp.
References m_FreeTokens, and m_Tokens.
Referenced by Clear().
|
protected |
Definition at line 787 of file tokentree.cpp.
References _T, at(), Token::m_Ancestors, Token::m_Name, Token::m_TokenKind, tkClass, tkTypedef, TRACE, and wxString::wx_str().
Referenced by RecalcInheritanceChain().
void TokenTree::RecalcInheritanceChain | ( | Token * | token | ) |
convert the Token's ancestor string to it's IDs this contains recursive calls, for example in such code
the Token A's ancestor string is "B", and the token B's ancestor string is "C" the ancestors of Token A are Token B and Token C, B is the direct ancestor the Token C's descendants are Token A and Token B, B is the direct descendant
Definition at line 643 of file tokentree.cpp.
References _T, at(), wxString::Clear(), wxString::Find(), FindMatches(), wxStringTokenizer::GetNextToken(), wxStringTokenizer::HasMoreTokens(), wxString::IsEmpty(), Token::m_Ancestors, Token::m_AncestorsString, Token::m_Descendants, Token::m_DirectAncestors, Token::m_Index, Token::m_Name, Token::m_TokenKind, RecalcFullInheritance(), wxStopWatch::Start(), wxStopWatch::Time(), tkClass, tkEnum, tkNamespace, tkTypedef, TokenExists(), TRACE, wxString::wx_str(), and wxNOT_FOUND.
Referenced by ClassBrowserBuilderThread::AddAncestorsOf(), ClassBrowserBuilderThread::AddDescendantsOf(), Clear(), CCDebugInfo::DisplayTokenInfo(), InsertClassMethodDlgHelper::DoFillMethodsFor(), ClassBrowserBuilderThread::ExpandItem(), NativeParserBase::GenerateResultSet(), and CodeCompletion::UpdateEditorSyntax().
void TokenTree::RemoveFile | ( | const wxString & | filename | ) |
remove tokens belong to the file
Definition at line 549 of file tokentree.cpp.
References InsertFileOrGetIndex().
Referenced by Clear(), Parser::RemoveFile(), Parser::ReparseModifiedFiles(), and ReserveFileForParsing().
void TokenTree::RemoveFile | ( | int | fileIndex | ) |
remove tokens belong to the file
Definition at line 554 of file tokentree.cpp.
References at(), CheckChildRemove(), wxString::clear(), Token::m_Doc, Token::m_FileIdx, m_FileMap, Token::m_ImplDoc, Token::m_ImplFileIdx, Token::m_ImplLine, Token::m_Line, m_Tokens, and RemoveToken().
|
protected |
Definition at line 396 of file tokentree.cpp.
References m_Tokens.
Referenced by erase(), RemoveFile(), and RemoveToken().
|
protected |
Definition at line 404 of file tokentree.cpp.
References _T, CCLogger::DebugLog(), CCLogger::Get(), SearchTree< T >::GetItemAtPos(), BasicSearchTree::GetItemNo(), Token::m_Ancestors, Token::m_Children, Token::m_Descendants, Token::m_DirectAncestors, m_GlobalNameSpaces, Token::m_Index, Token::m_Name, Token::m_ParentIndex, m_Tokens, m_TopNameSpaces, m_Tree, RemoveToken(), and RemoveTokenFromList().
|
protected |
Remove the Token specified by the idx in the vector<Token*>, note the Token instance is destroyed, and the slot becomes empty.
The empty slot was recored and will be re-used later.
Definition at line 536 of file tokentree.cpp.
References m_FreeTokens, and m_Tokens.
Referenced by RemoveToken().
only the token's name need to be changed, thus update the index map of the TokenTree
Definition at line 338 of file tokentree.cpp.
References SearchTree< T >::AddItem(), SearchTree< T >::GetItemAtPos(), BasicSearchTree::GetItemNo(), Token::m_Index, Token::m_Name, and m_Tree.
Referenced by Clear(), and ParserThread::RefineAnonymousTypeToken().
size_t TokenTree::ReserveFileForParsing | ( | const wxString & | filename, |
bool | preliminary = false |
||
) |
mark a file to be parsed.
Or, assigned, return non-zero if success.
filename | the file need to be parsed |
preliminary | if true, this means we will put the file status as assigned (not parse it soon, just assigned a Parserthread task, and the actually parsing will be done later; if false, then set the file status to being parsed, so parsing must be happened immediately after this function call. |
Definition at line 896 of file tokentree.cpp.
References fpsAssigned, fpsBeingParsed, fpsDone, fpsNotParsed, InsertFileOrGetIndex(), m_FileStatusMap, m_FilesToBeReparsed, and RemoveFile().
Referenced by EraseFilesToBeReparsedByIndex(), ParserThread::Parse(), Parser::Parse(), and ParserBase::Reparse().
size_t TokenTree::size | ( | ) |
total size of std::vector<Token*>
Definition at line 98 of file tokentree.cpp.
References m_Tokens.
Referenced by at(), empty(), InsertClassMethodDlg::FillClasses(), NativeParser::MarkItemsByAI(), CCDebugInfo::OnFindClick(), CodeCompletion::OnGotoFunction(), and NativeParser::ParseLocalBlock().
int TokenTree::TokenExists | ( | const wxString & | name, |
int | parent, | ||
short int | kindMask | ||
) |
query tokens by names
name | the search key, token's name |
parent | search only the tokens under the token specified by parent |
kindMask | token kind mask |
Definition at line 141 of file tokentree.cpp.
References SearchTree< T >::GetItemAtPos(), BasicSearchTree::GetItemNo(), Token::m_ParentIndex, Token::m_TokenKind, m_Tokens, and m_Tree.
Referenced by Tokenizer::AddMacroDefinition(), ParserThread::CalcEnumExpression(), Tokenizer::CheckMacroUsageAndReplace(), Clear(), NativeParserBase::ComputeCallTip(), Tokenizer::HandleUndefs(), Tokenizer::IsMacroDefined(), CodeCompletion::OnGotoDeclaration(), NativeParser::ParseBufferForUsingNamespace(), NativeParserBase::PrettyPrintToken(), RecalcInheritanceChain(), and ParserThread::TokenExists().
int TokenTree::TokenExists | ( | const wxString & | name, |
const wxString & | baseArgs, | ||
int | parent, | ||
TokenKind | kind | ||
) |
query tokens by names
name | the search key, token's name |
baseArgs | specify the function parameter |
parent | search only the tokens under the token specified by parent |
kindMask | token kind mask |
Definition at line 167 of file tokentree.cpp.
References SearchTree< T >::GetItemAtPos(), BasicSearchTree::GetItemNo(), Token::m_BaseArgs, Token::m_ParentIndex, Token::m_TokenKind, m_Tokens, m_Tree, and tkAnyContainer.
int TokenTree::TokenExists | ( | const wxString & | name, |
const TokenIdxSet & | parents, | ||
short int | kindMask | ||
) |
query tokens by names
name | the search key, token's name |
parents | search only the tokens under the token specified by parent collection tokens |
kindMask | token kind mask |
Definition at line 198 of file tokentree.cpp.
References SearchTree< T >::GetItemAtPos(), BasicSearchTree::GetItemNo(), Token::m_ParentIndex, Token::m_TokenKind, m_Tokens, and m_Tree.
int TokenTree::TokenExists | ( | const wxString & | name, |
const wxString & | baseArgs, | ||
const TokenIdxSet & | parents, | ||
TokenKind | kind | ||
) |
query tokens by names
name | the search key, token's name |
baseArgs | specify the function parameter |
parents | search only the tokens under the token specified by parent collection tokens |
kindMask | token kind mask |
Definition at line 230 of file tokentree.cpp.
References SearchTree< T >::GetItemAtPos(), BasicSearchTree::GetItemNo(), Token::m_BaseArgs, Token::m_ParentIndex, Token::m_TokenKind, m_Tokens, m_Tree, and tkAnyContainer.
|
friend |
Definition at line 39 of file tokentree.h.
|
friend |
Definition at line 40 of file tokentree.h.
|
friend |
Definition at line 41 of file tokentree.h.
|
friend |
Definition at line 42 of file tokentree.h.
|
protected |
Map: file indices -> sets of TokenIndexes.
Definition at line 372 of file tokentree.h.
Referenced by AddToken(), clear(), EraseFileMapInFileMap(), FindTokensInFile(), GetFileMapSize(), GetFilesMap(), GetTokensBelongToFile(), InsertTokenBelongToFile(), IsFileParsed(), MarkFileTokensAsLocal(), RemoveFile(), and TokenTree().
|
protected |
Map: file names -> file indices.
Definition at line 369 of file tokentree.h.
Referenced by clear(), CCDebugInfo::FillFiles(), FindTokensInFile(), GetFileIndex(), GetFileMatches(), GetFilename(), InsertFileOrGetIndex(), CCDebugInfo::OnSave(), and TokenTree().
|
protected |
Map: file indices -> status.
Definition at line 375 of file tokentree.h.
Referenced by clear(), EraseFileStatusByIndex(), FlagFileAsParsed(), GetFileStatusCountForIndex(), IsFileParsed(), ReserveFileForParsing(), and TokenTree().
|
protected |
Set: file indices.
Definition at line 378 of file tokentree.h.
Referenced by clear(), EraseFilesToBeReparsedByIndex(), FlagFileForReparsing(), GetFilesToBeReparsed(), IsFileParsed(), ReserveFileForParsing(), and TokenTree().
|
protected |
List of all the deleted (and available) tokens.
When more and more Tokens were allocated, their address was recorded in the m_Tokens, m_Tokens grows larger, but if we delete some Tokens, the will have some empty slots in the std::vector<Token*>, we need to reuse those slots, here m_FreeTokens is to hold those empty slots for reuse, so we don't waste empty slots in the m_Tokens
Definition at line 360 of file tokentree.h.
Referenced by AddTokenToList(), clear(), realsize(), RecalcFreeList(), RemoveTokenFromList(), and TokenTree().
|
protected |
any tokens belong to the global namespace
Definition at line 366 of file tokentree.h.
Referenced by AddToken(), clear(), GetGlobalNameSpaces(), RemoveToken(), and TokenTree().
|
protected |
Contains the pointers to all the Token instances, it is just a std::vector<Token*>, the suggest way to access a Token instance is by first get its index in the m_Tokens, then get its address by m_Tokens[index], the reason we have such indirect access is that there are many Tokens which can reference each other, it is much safe using index instead of raw pointers.
Definition at line 353 of file tokentree.h.
Referenced by AddTokenToList(), CheckChildRemove(), clear(), erase(), GetTokenAt(), GetTokens(), MarkFileTokensAsLocal(), realsize(), RecalcFreeList(), RemoveFile(), RemoveToken(), RemoveTokenFromList(), size(), TokenExists(), and TokenTree().
size_t TokenTree::m_TokenTicketCount |
Definition at line 305 of file tokentree.h.
Referenced by Tokenizer::AddMacroDefinition(), ParserThread::DoAddToken(), and ParserThread::FindTokenFromQueue().
|
protected |
namespace tokens belongs to the global namespace
Definition at line 363 of file tokentree.h.
Referenced by AddToken(), clear(), RemoveToken(), and TokenTree().
|
protected |
This is a string->TokenIndexSet map.
E.g. we have a class Token named "AAA", also, we can have a function Token named "AAA", they are different Tokens, but they share the same name. So we may have an tree point "AAA" -> <30, 40> map in the TokenSearchTree. Note here 30 and 40 are the indexes (slots) in the m_Tokens vector, which holds the Tokens pointers. In-fact, "AAA" -> <30, 40> is not mapped directly, it has a indirect map like "AAA" -> 16 -> <30, 40>, the middle number 16 here is the tree point item index in the BasicSearchTree, as we have a std::vector< TokenIndexSet > in the SearchTree, the 16 is the index to fetch the value <30,40> in the vector
Definition at line 345 of file tokentree.h.
Referenced by AddToken(), clear(), FindMatches(), CCDebugInfo::OnSave(), RemoveToken(), RenameToken(), TokenExists(), and TokenTree().