Debian Codegraph @

CodeLite/code_completion_api.h

raw
1 //////////////////////////////////////////////////////////////////////////////
2 //////////////////////////////////////////////////////////////////////////////
3 //
4 // Copyright : (C) 2015 Eran Ifrah
5 // File name : code_completion_api.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
26 #ifndef CODE_COMPLETION_API_H
27 #define CODE_COMPLETION_API_H
28
29 #include "cl_typedef.h"
30 #include "variable.h"
31 #include "function.h"
32 #include "expression_result.h"
33
34 extern WXDLLIMPEXP_CL std::string get_scope_name(const std::string &in, std::vector<std::string > &additionlNS, const std::map<std::string, std::string> &ignoreTokens);
35 extern WXDLLIMPEXP_CL void get_variables(const std::string &in, VariableList &li, const std::map<std::string, std::string> &ignoreMap, bool isUsedWithinFunc);
36 extern WXDLLIMPEXP_CL bool is_primitive_type(const std::string &in);
37 extern WXDLLIMPEXP_CL void get_functions(const std::string &in, FunctionList &li, const std::map<std::string, std::string> &ignoreTokens);
38 extern WXDLLIMPEXP_CL void get_typedefs(const std::string &in, clTypedefList &li);
39 extern WXDLLIMPEXP_CL ExpressionResult &parse_expression(const std::string &in);
40 extern WXDLLIMPEXP_CL bool setLexerInput(const std::string &in, const std::map<std::string, std::string> &ignoreTokens);
41 extern WXDLLIMPEXP_CL void cl_scope_lex_clean();
42
43 // We dont use WXDLLIMPEXP_CL intentionally to avoid people using these members/functions
44 // directly
45 extern int cl_scope_lex();
46 extern int cl_scope_lineno;
47 extern std::string cl_scope_text;
48
49 class WXDLLIMPEXP_CL CppLexer
50 {
51 public:
52 typedef std::map<std::string, std::string> StringMap_t;
53
54 public:
55 CppLexer(const std::string& str) {
56 StringMap_t dummy;
57 ::setLexerInput(str, dummy);
58 }
59 ~CppLexer() {
60 ::cl_scope_lex_clean();
61 }
62 int lex() const {
63 return cl_scope_lex();
64 }
65 int line_number() const {
66 return cl_scope_lineno;
67 }
68 std::string text() const {
69 return cl_scope_text;
70 }
71 };
72 #endif // CODECOMPLETION_API_H