From 6c1854f9f3f7308dce0e326aa063d929f8da5881 Mon Sep 17 00:00:00 2001 From: Gergo Mocsi Date: Fri, 19 Jul 2013 22:00:29 +0200 Subject: GSOC work, code fixes + cache implementation WARNING: cache implementation gives a link error to it's methods. Created the cache called CodeCompleteDataCache in file include/basic/codecompletecache.hxx This class should replace the std::vector< CodeCompleteData > int file baside2b.cxx When issuing command "make basic", it compiles fine, but, when "make basctl", it gives a link error (ld returned status 1) to CodeCompleteDataCache's methods. Change-Id: If78c6533b7fb5653cc459d22b80c98d097b886eb --- include/basic/codecompletecache.hxx | 61 +++++++++++++++++++++++++++++++++++++ include/basic/sbmod.hxx | 7 +++-- 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 include/basic/codecompletecache.hxx (limited to 'include/basic') diff --git a/include/basic/codecompletecache.hxx b/include/basic/codecompletecache.hxx new file mode 100644 index 000000000000..f375f04d0484 --- /dev/null +++ b/include/basic/codecompletecache.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef CODECOMPLETECACHE_H +#define CODECOMPLETECACHE_H + +#include +#include +#include +#include +#include +#include + +typedef boost::unordered_map< OUString, OUString, OUStringHash > CodeCompleteVarTypes; +/* variable name, type */ +typedef boost::unordered_map< OUString, CodeCompleteVarTypes, OUStringHash > CodeCompleteVarScopes; +/* procedure, CodeCompleteVarTypes */ + +class CodeCompleteDataCache +{ +/* + * cache to store data for + * code completition + * */ +private: + CodeCompleteVarScopes aVarScopes; + +public: + const OUString GLOB_KEY = OUString("global key"); + const OUString NOT_FOUND = OUString("not found"); + CodeCompleteDataCache(){} + + virtual ~CodeCompleteDataCache(){} + + void SetVars( const CodeCompleteVarScopes& aScopes ); + const CodeCompleteVarScopes& GetVars() const; + + void InsertProcedure( const OUString& sProcName, const CodeCompleteVarTypes& aVarTypes ); + const OUString& GetVariableType( const OUString& sVarName, const OUString& sProcName ) const; + +}; + +#endif // CODECOMPLETECACHE_H + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx index 65dab93173c4..763beefe3c5d 100644 --- a/include/basic/sbmod.hxx +++ b/include/basic/sbmod.hxx @@ -29,6 +29,7 @@ #include #include #include "basicdllapi.h" +#include class SbMethod; class SbProperty; @@ -44,6 +45,7 @@ class ModuleInitDependencyMap; struct ClassModuleRunInitItem; struct SbClassData; +/* struct CodeCompleteData { OUString sVarName; @@ -59,7 +61,7 @@ struct CodeCompleteData { return ( sVarParent == OUString("") ); } -}; +};*/ class BASIC_DLLPUBLIC SbModule : public SbxObject, private ::boost::noncopyable { @@ -150,7 +152,8 @@ public: void RemoveVars(); ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule(); bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ); - std::vector< CodeCompleteData > GetCodeCompleteDataFromParse(); + //std::vector< CodeCompleteData > GetCodeCompleteDataFromParse(); + CodeCompleteDataCache GetCodeCompleteDataFromParse(); SbxArrayRef GetMethods(); }; -- cgit