Debian Codegraph @

CodeLite/cl_calltip.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // copyright : (C) 2008 by Eran Ifrah
5 // file name : cl_calltip.h
6 //
7 // -------------------------------------------------------------------------
8 // A
9 // _____ _ _ _ _
10 // / __ \ | | | | (_) |
11 // | / \/ ___ __| | ___| | _| |_ ___
12 // | | / _ \ / _ |/ _ \ | | | __/ _ )
13 // | \__/\ (_) | (_| | __/ |___| | || __/
14 // \____/\___/ \__,_|\___\_____/_|\__\___|
15 //
16 // F i l e
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 //////////////////////////////////////////////////////////////////////////////
24 //////////////////////////////////////////////////////////////////////////////
25 #ifndef CODELITE_CALLTIP_H
26 #define CODELITE_CALLTIP_H
27
28 #include "codelite_exports.h"
29 #include "entry.h"
30 #include "smart_ptr.h"
31 #include "tokenizer.h"
32
33 struct clTipInfo {
34 wxString str;
35 std::vector<std::pair<int, int>> paramLen;
36 };
37
38 /**
39 * A call tip function that wraps a tip strings for function prototypes.
40 *
41 * \ingroup CodeLite
42 * \version 1.0
43 * first version
44 *
45 * \date 09-18-2006
46 * \author Eran
47 */
48 class WXDLLIMPEXP_CL clCallTip
49 {
50 std::vector<clTipInfo> m_tips;
51 int m_curr;
52 void Initialize(const std::vector<TagEntryPtr>& tags);
53
54 public:
55 /**
56 * @brief format list of tags into calltips
57 */
58 static void FormatTagsToTips(const TagEntryPtrVector_t& tags, std::vector<clTipInfo>& tips);
59
60 /**
61 * Constructor
62 * \param tips input tips
63 */
64 clCallTip(const std::vector<TagEntryPtr>& tips);
65
66 /**
67 * default constructor
68 */
69 clCallTip();
70
71 /**
72 * Copy constructor
73 */
74 clCallTip(const clCallTip& rhs);
75
76 /**
77 * Assignment operator
78 * \param rhs right hand side
79 * \return this
80 */
81 clCallTip& operator=(const clCallTip& rhs);
82
83 /**
84 * Destructor
85 * \return
86 */
87 virtual ~clCallTip() {}
88
89 /**
90 * Show next tip, if we are at last tip, return the first tip or empty string if no tips exists
91 * \return next tip
92 */
93 wxString Next();
94
95 /**
96 * Show previous tip, if we are at first tip, return the last tip or empty string if no tips exists
97 * \return previous tip
98 */
99 wxString Prev();
100
101 /**
102 * return the first tip
103 */
104 wxString First();
105
106 /**
107 * @brief return the current tip
108 * @return return the current tip
109 */
110 wxString Current();
111
112 /**
113 * @brief select the first tip that has at least argcount
114 * @return true if we managed to find this tip, false otherwise
115 */
116 bool SelectTipToMatchArgCount(size_t argcount);
117
118 /**
119 * Return number of tips stored in this object
120 * \return number of tips
121 */
122 int Count() const;
123
124 /**
125 * \brief return all tips as a single string
126 */
127 wxString All();
128
129 /**
130 * @brief get the highlight offset & width for the current tip
131 * @param index paramter index
132 * @param start [output]
133 * @param len [output]
134 */
135 void GetHighlightPos(int index, int& start, int& len);
136
137 int GetCurr() const { return m_curr; }
138
139 /**
140 * @brief set the tip to a specific tag
141 */
142 void SelectSiganture(const wxString& signature);
143
144 wxString TipAt(int at);
145 };
146
147 typedef SmartPtr<clCallTip> clCallTipPtr;
148 #endif // CODELITE_CALLTIP_H