LibreOffice Module basic (master) 1
codecompletecache.hxx
Go to the documentation of this file.
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
20#ifndef INCLUDED_BASIC_CODECOMPLETECACHE_HXX
21#define INCLUDED_BASIC_CODECOMPLETECACHE_HXX
22
23#include <config_options.h>
24#include <basic/basicdllapi.h>
25#include <rtl/ustring.hxx>
26#include <unordered_map>
27
28typedef std::unordered_map< OUString, OUString > CodeCompleteVarTypes;
29/* variable name, type */
30typedef std::unordered_map< OUString, CodeCompleteVarTypes > CodeCompleteVarScopes;
31/* procedure, CodeCompleteVarTypes */
32
34{
35/*
36 * class to store basic code completion
37 * options
38 * */
39private:
46
47public:
49
50 static bool IsCodeCompleteOn();
51 static void SetCodeCompleteOn( bool b );
52
53 static bool IsExtendedTypeDeclaration();
54 static void SetExtendedTypeDeclaration( bool b );
55
56 static bool IsProcedureAutoCompleteOn();
57 static void SetProcedureAutoCompleteOn( bool b );
58
59 static bool IsAutoCloseQuotesOn();
60 static void SetAutoCloseQuotesOn( bool b );
61
62 static bool IsAutoCloseParenthesisOn();
63 static void SetAutoCloseParenthesisOn( bool b );
64
65 static bool IsAutoCorrectOn();
66 static void SetAutoCorrectOn( bool b );
67};
68
69class UNLESS_MERGELIBS(BASIC_DLLPUBLIC) CodeCompleteDataCache final
70{
71/*
72 * cache to store data for
73 * code completion
74 * */
75private:
76 CodeCompleteVarScopes aVarScopes;
77 CodeCompleteVarTypes aGlobalVars;
78
79public:
80 CodeCompleteDataCache(){}
81
82 friend BASIC_DLLPUBLIC std::ostream& operator<< (std::ostream& aStream, const CodeCompleteDataCache& aCache);
83
84 void InsertGlobalVar( const OUString& sVarName, const OUString& sVarType );
85 void InsertLocalVar( const OUString& sProcName, const OUString& sVarName, const OUString& sVarType );
86 OUString GetVarType( std::u16string_view sVarName ) const;
87 OUString GetCorrectCaseVarName( std::u16string_view sVarName, std::u16string_view sActProcName ) const;
88 void Clear();
89};
90
91#endif // INCLUDED_BASIC_CODECOMPLETECACHE_HXX
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BASIC_DLLPUBLIC
Definition: basicdllapi.h:17
std::ostream & operator<<(std::ostream &aStream, const CodeCompleteDataCache &aCache)
std::unordered_map< OUString, CodeCompleteVarTypes > CodeCompleteVarScopes
std::unordered_map< OUString, OUString > CodeCompleteVarTypes
void Clear(EHistoryType eHistory)