2012-07-08 14:54:57 -04:00
|
|
|
// Copyright (C) 2011, 2012 Strahinja Val Markovic <val@markovic.io>
|
|
|
|
//
|
|
|
|
// This file is part of YouCompleteMe.
|
|
|
|
//
|
|
|
|
// YouCompleteMe is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// YouCompleteMe is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#ifndef CLANGCOMPLETE_H_WLKDU0ZV
|
|
|
|
#define CLANGCOMPLETE_H_WLKDU0ZV
|
|
|
|
|
2012-07-21 12:09:29 -04:00
|
|
|
#include "UnsavedFile.h"
|
2012-07-28 18:27:30 -04:00
|
|
|
#include "Diagnostic.h"
|
2013-08-12 18:44:12 -04:00
|
|
|
#include "TranslationUnitStore.h"
|
2012-07-15 23:49:56 -04:00
|
|
|
|
2012-07-08 14:54:57 -04:00
|
|
|
#include <boost/utility.hpp>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
typedef struct CXTranslationUnitImpl *CXTranslationUnit;
|
|
|
|
|
2013-01-19 23:03:32 -05:00
|
|
|
namespace YouCompleteMe {
|
2012-07-08 14:54:57 -04:00
|
|
|
|
2012-08-11 22:27:15 -04:00
|
|
|
class TranslationUnit;
|
2012-07-20 00:17:39 -04:00
|
|
|
struct CompletionData;
|
2013-03-31 23:38:29 -04:00
|
|
|
struct Location;
|
2012-07-12 01:41:32 -04:00
|
|
|
|
2012-08-12 22:01:39 -04:00
|
|
|
typedef std::vector< CompletionData > CompletionDatas;
|
|
|
|
|
2012-07-08 14:54:57 -04:00
|
|
|
|
2013-10-01 13:12:50 -04:00
|
|
|
// All filename parameters must be absolute paths.
|
2013-01-19 23:03:32 -05:00
|
|
|
class ClangCompleter : boost::noncopyable {
|
2012-07-08 14:54:57 -04:00
|
|
|
public:
|
2012-07-11 02:28:58 -04:00
|
|
|
ClangCompleter();
|
|
|
|
~ClangCompleter();
|
2012-07-08 14:54:57 -04:00
|
|
|
|
2012-08-11 22:27:15 -04:00
|
|
|
bool UpdatingTranslationUnit( const std::string &filename );
|
2012-07-26 23:50:56 -04:00
|
|
|
|
2013-10-03 16:15:43 -04:00
|
|
|
std::vector< Diagnostic > UpdateTranslationUnit(
|
2013-10-01 13:12:50 -04:00
|
|
|
const std::string &filename,
|
|
|
|
const std::vector< UnsavedFile > &unsaved_files,
|
|
|
|
const std::vector< std::string > &flags );
|
2012-07-08 14:54:57 -04:00
|
|
|
|
2012-07-20 00:17:39 -04:00
|
|
|
std::vector< CompletionData > CandidatesForLocationInFile(
|
2013-10-01 13:12:50 -04:00
|
|
|
const std::string &filename,
|
2013-01-19 23:03:32 -05:00
|
|
|
int line,
|
|
|
|
int column,
|
2013-10-01 13:12:50 -04:00
|
|
|
const std::vector< UnsavedFile > &unsaved_files,
|
|
|
|
const std::vector< std::string > &flags );
|
2012-07-15 23:49:56 -04:00
|
|
|
|
2013-03-31 23:38:29 -04:00
|
|
|
Location GetDeclarationLocation(
|
2013-10-01 13:12:50 -04:00
|
|
|
const std::string &filename,
|
2013-03-31 23:38:29 -04:00
|
|
|
int line,
|
|
|
|
int column,
|
2013-10-01 13:12:50 -04:00
|
|
|
const std::vector< UnsavedFile > &unsaved_files,
|
|
|
|
const std::vector< std::string > &flags );
|
2013-03-31 23:38:29 -04:00
|
|
|
|
|
|
|
Location GetDefinitionLocation(
|
2013-10-01 13:12:50 -04:00
|
|
|
const std::string &filename,
|
2013-03-31 23:38:29 -04:00
|
|
|
int line,
|
|
|
|
int column,
|
2013-10-01 13:12:50 -04:00
|
|
|
const std::vector< UnsavedFile > &unsaved_files,
|
|
|
|
const std::vector< std::string > &flags );
|
2013-03-31 23:38:29 -04:00
|
|
|
|
2013-10-01 13:12:50 -04:00
|
|
|
void DeleteCachesForFile( const std::string &filename );
|
2013-03-14 23:39:44 -04:00
|
|
|
|
2012-07-08 14:54:57 -04:00
|
|
|
private:
|
2012-08-11 22:27:15 -04:00
|
|
|
|
2012-07-12 01:41:32 -04:00
|
|
|
/////////////////////////////
|
|
|
|
// PRIVATE MEMBER VARIABLES
|
|
|
|
/////////////////////////////
|
|
|
|
|
2012-07-08 14:54:57 -04:00
|
|
|
CXIndex clang_index_;
|
2012-07-15 23:49:56 -04:00
|
|
|
|
2013-08-12 18:44:12 -04:00
|
|
|
TranslationUnitStore translation_unit_store_;
|
2012-07-08 14:54:57 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace YouCompleteMe
|
|
|
|
|
|
|
|
#endif /* end of include guard: CLANGCOMPLETE_H_WLKDU0ZV */
|