52 _T(
"return"),
_T(
"result"),
53 _T(
"brief"),
_T(
"short"),
57 _T(
"class"),
_T(
"struct"),
105 int nestedArgsCount = 0;
124 return nestedArgsCount;
135 if (start < (
size_t)
m_Pos)
137 doc.
replace(start, count, str);
138 m_Pos += str.
size() - count;
141 doc.
replace(start, count, str);
155 bool foundOne =
false;
160 while (
m_Pos < (
int)doc.
size() && !foundOne)
162 for (
int k = 0; k <
KwCount; ++k)
164 if ( isKw[k] && (kwLen >= (
int)
Keywords[k].size() ||
169 if (machingKwCount == 1)
186 for (
int l = 0; l <
KwCount; ++l)
201 isKw[foundKw] = doc[
m_Pos + kwLen] ==
Keywords[foundKw][kwLen];
223 int nestedArgsCount = 0;
236 return nestedArgsCount;
241 bool gotWord =
false;
256 output += doc[
m_Pos];
272 int nestedArgsCount = 0;
280 return nestedArgsCount;
292 return nestedArgsCount;
295 output += doc[
m_Pos];
303 output += doc[
m_Pos];
308 return nestedArgsCount;
321 bool isPrevWhitespace = doc[
m_Pos - 1] ==
_T(
' ') ||
324 return isPrevWhitespace;
353 endLine = doc.
size();
375 output += replaceWith;
413 wxString &plainText = arguments[0], &brief = arguments[1], ¶ms = arguments[2],
414 &seeAlso = arguments[3], &returns = arguments[4];
455 for (
size_t i = 0; i < (size_t)(
sizeof(arguments)/
sizeof(arguments[0])); ++i)
457 arguments[i].
Trim(
true).
Trim(
false);
484 if (brief.size() > 0)
485 html += b1 + brief + b0 + br;
487 if (params.size() > 0)
488 html += b1 +
_T(
"Parameters:") + b0 + br + params;
490 if (returns.size() > 0)
491 html += b1 +
_T(
"Returns:") + b0 + br +
tab + returns +
br;
493 if (plainText.
size()>0)
495 plainText.
Trim(
false);
496 plainText.
Trim(
true);
497 html += b1 +
_T(
"Description:") + b0 + br +
tab;
499 html += plainText +
br;
502 if (seeAlso.size() > 0)
504 html += b1 +
_T(
"See also: ") +
b0;
510 html += CommandToAnchor(cmdSearchAll, tok, &tok) +
_T(
" ");
519 static Token ancestorChecker(
_T(
""), 0, 0, 0);
520 const wxString& argType = ExtractTypeAndName(fullType);
524 size_t found = fullType.
find(argType);
525 fullType.
replace(found, argType.
size(), CommandToAnchor(cmdSearch, argType, &argType) );
531 if (args.
size() == 0)
537 while ( tokenizer.HasMoreTokens() )
539 wxString tok = tokenizer.GetNextToken();
540 args += ConvertTypeToAnchor(tok);
541 if (tokenizer.HasMoreTokens())
544 return _T(
'(') + args +
_T(
')');
551 size_t eqPos = tok.
Find(
_T(
'='));
570 static const wxString whitespace =
_T(
" \n\t");
606 separatorTag + *args +
_T(
"\">") + name +
_T(
"</a>");
610 _T(
"\">") + name +
_T(
"</a>");
616 return CommandToAnchor(cmd, name, &tmp);
624 size_t separator = args.
rfind(separatorTag);
626 separator = args.
size() + 1;
633 if (separator + 1 < args.
size())
641 const wxChar DocumentationHelper::separatorTag =
_T(
'+');
642 const wxString DocumentationHelper::commandTag =
_T(
"cmd=");
646 m_CurrentTokenIdx(-1),
688 html +=
_T(
"<a name=\"top\"></a>");
692 Token* token = tree->
at(tokenIdx);
706 if (tokenNs.
size() > 0)
720 html +=
_T(
" const");
722 html +=
_T(
" noexcept");
768 html += i1 +
_T(
"<font color=\"green\" size=3>") +
_T(
"(") +
786 html += br + b1 +
_T(
"Members:") +
b0;
789 const Token* t2 = tree->
at(*it);
799 html += br + b1 +
_T(
"Values:") +
b0;
802 const Token* t2 = tree->
at(*it);
834 html +=
_T(
" <a href=\"#top\">Top</a> ");
836 html +=
_T(
"</body></html>");
845 if (tokensIdx.empty())
848 if (tokensIdx.size() == 1)
856 html +=
_T(
"<a name=\"top\"></a>");
858 html +=
_T(
"Multiple matches, please select one:<br>");
859 TokenIdxSet::const_iterator it = tokensIdx.begin();
863 while (it != tokensIdx.end())
865 const Token* token = tree->
at(*it);
885 html +=
_T(
" <a href=\"#top\">Top</a> ");
887 html +=
_T(
"</body></html>");
924 const wxString& href =
event.GetLinkInfo().GetHref();
932 if(args.
ToLong(&tokenIdx))
952 size_t scpOp = args.
rfind(
_T(
"::"));
964 if (result.size() > 0)
973 if (args.
ToLong(&tokenIdx))
976 const Token* token = tree->
at(tokenIdx);
987 if (args.
ToLong(&tokenIdx))
990 const Token* token = tree->
at(tokenIdx);
1001 dismissPopup =
true;
1006 if (href.
size()>1 && href[0] ==
_T(
'#'))
void ReplaceInDoc(wxString &doc, size_t start, size_t count, const wxString &str)
destructor class member function
int m_ParentIndex
Parent Token index.
constructor class member function
static Command HrefToCommand(const wxString &href, wxString &args)
wxString GenerateHTML(int tokenIdx, TokenTree *tree)
ConfigManager * GetConfigManager(const wxString &name_space) const
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
wxString m_Name
Token's name, it can be searched in the TokenTree.
size_t rfind(const wxString &str, size_t nStart=npos) const
static wxString ExtractTypeAndName(wxString type, wxString *outName=0)
unsigned int m_ImplLine
function implementation line index
void resize(size_t nSize, wxUniChar ch='\0')
int GetEndLine(const wxString &doc) const
bool IsValidAncestor(const wxString &ancestor)
build in types are not valid ancestors for a type define token
typedef, note typedefs are stored as classes inheriting from the typedef'd type, this takes advantage...
static wxString CommandToAnchor(Command cmd, const wxString &name, const wxString *args=0)
wxString & replace(size_t nStart, size_t nLen, const wxString &str)
void RegisterColour(const wxString &category, const wxString &name, const wxString &id, const wxColour &defaultColour)
container like tokens, those tokens can have children tokens
wxString GetFilename() const
get a full path of the file which contains the current Token
bool GotoTokenPosition(int line, const wxString &tokenName)
Move the caret at the specified line.
bool ReadBool(const wxString &name, bool defaultVal=false)
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
int GetLineArgument(const wxString &doc, wxString &output)
unsigned int m_Line
Line index where the token was met, which is 1 based.
int m_Index
current Token index in the tree, it is index of the std::vector<Token*>, so use the index...
bool IsKeywordBegin(const wxString &doc) const
wxString GetNamespace() const
get a literal string presentation of the namespace.
bool m_IsNoExcept
the member method is noexcept (yes/no)
static const wxString NewLineReplacment
TokenScope m_Scope
public? private? protected?
static const wxString Keywords[]
void GetWordArgument(const wxString &doc, wxString &output)
size_t find(const wxString &str, size_t nStart=0) const
Code completion plugin has those features: show tool-tip when the mouse hover over the variables/func...
wxString OnDocumentationLink(wxHtmlLinkEvent &event, bool &dismissPopup)
EditorManager * GetEditorManager() const
wxUSE_UNICODE_dependent wxChar
wxString GetStrippedArgs() const
remove all default value of the function argument string, e.g.
CodeCompletion * m_CC
Pointer to CodeComplete object.
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
void RereadOptions(ConfigManager *cfg)
bool IsEnd(const wxString &doc) const
a symbol found in the parsed files, it can be many kinds, such as a variable, a class and so on...
wxString & RemoveLast(size_t n=1)
std::set< int, std::less< int > > TokenIdxSet
wxColour GetColour(const wxString &id) const
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
DocumentationHelper(CodeCompletion *cc)
wxString & Truncate(size_t len)
bool m_IsConst
the member method is const (yes/no)
#define CC_LOCKER_TRACK_TT_MTX_UNLOCK(M)
size_t find_last_of(const wxString &str, size_t nStart=npos) const
cbEditor * Open(const wxString &filename, int pos=0, ProjectFile *data=nullptr)
const wxString & _(const wxString &string)
wxString & Trim(bool fromRight=true)
wxString m_Args
If it is a function Token, then this value is function arguments, e.g.
wxString GetTokenScopeString() const
the access kind string, e.g.
bool IsOneOf(wxChar c, const wxChar *chars) const
#define CC_LOCKER_TRACK_TT_MTX_LOCK(M)
ParserBase & GetParser()
return a reference to the currently active Parser object
bool ToLong(long *val, int base=10) const
bool HasMoreTokens() const
ColourManager * GetColourManager() const
int FindNextKeyword(const wxString &doc)
int m_CurrentTokenIdx
Documentation of which token was previously displayed.
wxString GetDocumentation(int tokenIdx)
get the document string associated with the token
void GetBlockArgument(const wxString &doc, wxString &output)
void ReplaceCurrentKeyword(wxString &doc, const wxString &str)
TokenKind m_TokenKind
See TokenKind class.
wxString & insert(size_t nPos, const wxString &str)
static wxString DoxygenToHTML(const wxString &doc)
static wxString ConvertArgsToAnchors(wxString args)
general function, not constructor nor destructor
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
bool HandleNewLine(const wxString &doc, wxString &output, const wxString &replaceWith=NewLineReplacment)
size_t FindMatches(const wxString &query, TokenIdxSet &result, bool caseSensitive, bool is_prefix, TokenKind kindMask=tkUndefined)
find a collection of matched tokens
static wxString ConvertTypeToAnchor(wxString fullType)
int Find(wxUniChar ch, bool fromEnd=false) const
virtual TokenTree * GetTokenTree() const
wxUniChar GetChar(size_t n) const
bool wxLaunchDefaultBrowser(const wxString &url, int flags=0)
macro definition, such as: #define AAA(x,y) f(x,y), where AAA is a token of tkMacroDef ...
wxString GetImplFilename() const
get a full path of the file which contains the function implementation.
wxString SubString(size_t from, size_t to) const
virtual wxString GetAsString(long flags=wxC2S_NAME|wxC2S_CSS_SYNTAX) const
void WriteOptions(ConfigManager *cfg)
wxString m_FullType
this is the full return value (if any): e.g.
int CheckKeyword(const wxString &doc)
int GetArgument(const wxString &doc, int range, wxString &output)
wxString GetTokenKindString() const
the token kind string, e.g.
bool SkipDecorations(const wxString &doc)
int GetParagraphArgument(const wxString &doc, wxString &output)
static wxString CommandToAnchorInt(Command cmd, const wxString &name, int arg0)
static wxString Format(const wxString &format,...)
the usage of the macro, for example: AAA(1,2)
NativeParser m_NativeParser
this member will actually manage all the Parser instances