/src/libreoffice/include/basic/codecompletecache.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | #pragma once |
20 | | |
21 | | #include <config_options.h> |
22 | | #include <basic/basicdllapi.h> |
23 | | #include <rtl/ustring.hxx> |
24 | | #include <unordered_map> |
25 | | |
26 | | typedef std::unordered_map< OUString, OUString > CodeCompleteVarTypes; |
27 | | /* variable name, type */ |
28 | | typedef std::unordered_map< OUString, CodeCompleteVarTypes > CodeCompleteVarScopes; |
29 | | /* procedure, CodeCompleteVarTypes */ |
30 | | |
31 | | class BASIC_DLLPUBLIC CodeCompleteOptions |
32 | | { |
33 | | /* |
34 | | * class to store basic code completion |
35 | | * options |
36 | | * */ |
37 | | private: |
38 | | bool bIsCodeCompleteOn; |
39 | | bool bIsProcedureAutoCompleteOn; |
40 | | bool bIsAutoCloseQuotesOn; |
41 | | bool bIsAutoCloseParenthesisOn; |
42 | | bool bIsAutoCorrectOn; |
43 | | bool bExtendedTypeDeclarationOn; |
44 | | |
45 | | public: |
46 | | CodeCompleteOptions(); |
47 | | |
48 | | static bool IsCodeCompleteOn(); |
49 | | static void SetCodeCompleteOn( bool b ); |
50 | | |
51 | | static bool IsExtendedTypeDeclaration(); |
52 | | static void SetExtendedTypeDeclaration( bool b ); |
53 | | |
54 | | static bool IsProcedureAutoCompleteOn(); |
55 | | static void SetProcedureAutoCompleteOn( bool b ); |
56 | | |
57 | | static bool IsAutoCloseQuotesOn(); |
58 | | static void SetAutoCloseQuotesOn( bool b ); |
59 | | |
60 | | static bool IsAutoCloseParenthesisOn(); |
61 | | static void SetAutoCloseParenthesisOn( bool b ); |
62 | | |
63 | | static bool IsAutoCorrectOn(); |
64 | | static void SetAutoCorrectOn( bool b ); |
65 | | }; |
66 | | |
67 | | class UNLESS_MERGELIBS(BASIC_DLLPUBLIC) CodeCompleteDataCache final |
68 | | { |
69 | | /* |
70 | | * cache to store data for |
71 | | * code completion |
72 | | * */ |
73 | | private: |
74 | | CodeCompleteVarScopes aVarScopes; |
75 | | CodeCompleteVarTypes aGlobalVars; |
76 | | |
77 | | public: |
78 | 0 | CodeCompleteDataCache(){} |
79 | | |
80 | | friend BASIC_DLLPUBLIC std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache); |
81 | | |
82 | | void InsertGlobalVar( const OUString& sVarName, const OUString& sVarType ); |
83 | | void InsertLocalVar( const OUString& sProcName, const OUString& sVarName, const OUString& sVarType ); |
84 | | OUString GetVarType( std::u16string_view sVarName ) const; |
85 | | OUString GetCorrectCaseVarName( std::u16string_view sVarName, std::u16string_view sActProcName ) const; |
86 | | void Clear(); |
87 | | }; |
88 | | |
89 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |