diff --git a/cpp/ycm/ClangCompleter.h b/cpp/ycm/ClangCompleter.h index 5539ca2e..7d943be5 100644 --- a/cpp/ycm/ClangCompleter.h +++ b/cpp/ycm/ClangCompleter.h @@ -20,6 +20,7 @@ #include "ConcurrentLatestValue.h" #include "Future.h" +#include "UnsavedFile.h" #include #include @@ -35,28 +36,6 @@ namespace YouCompleteMe class CandidateRepository; struct CompletionData; -// TODO: put this in a separated header file -struct UnsavedFile -{ - UnsavedFile() : filename_( NULL ), contents_( NULL ), length_( 0 ) {} - - const char *filename_; - const char *contents_; - unsigned long length_; - - // We need this to be able to export this struct to Python via Boost.Python's - // methods. I have no clue why, but it won't compile without it. - // TODO: report this problem on the Boost bug tracker, the default equality - // operator should be more than adequate here - bool operator== ( const UnsavedFile &other ) const - { - return - filename_ == other.filename_ && - contents_ == other.contents_ && - length_ == other.length_; - } -}; - typedef boost::shared_ptr< std::vector< CompletionData > > AsyncCompletions; typedef boost::unordered_map< std::string, std::vector< std::string > > diff --git a/cpp/ycm/UnsavedFile.h b/cpp/ycm/UnsavedFile.h new file mode 100644 index 00000000..e0565d74 --- /dev/null +++ b/cpp/ycm/UnsavedFile.h @@ -0,0 +1,44 @@ +// Copyright (C) 2011, 2012 Strahinja Val Markovic +// +// 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 . + +#ifndef UNSAVEDFILE_H_0GIYZQL4 +#define UNSAVEDFILE_H_0GIYZQL4 + +struct UnsavedFile +{ + UnsavedFile() : filename_( NULL ), contents_( NULL ), length_( 0 ) {} + + const char *filename_; + const char *contents_; + unsigned long length_; + + // We need this to be able to export this struct to Python via Boost.Python's + // methods. I have no clue why, but it won't compile without it. + // TODO: report this problem on the Boost bug tracker, the default equality + // operator should be more than adequate here + bool operator== ( const UnsavedFile &other ) const + { + return + filename_ == other.filename_ && + contents_ == other.contents_ && + length_ == other.length_; + } +}; + + +#endif /* end of include guard: UNSAVEDFILE_H_0GIYZQL4 */ + diff --git a/cpp/ycm/indexer.cpp b/cpp/ycm/indexer.cpp index 00678d8c..6f800bb3 100644 --- a/cpp/ycm/indexer.cpp +++ b/cpp/ycm/indexer.cpp @@ -19,6 +19,7 @@ #include "ClangCompleter.h" #include "Future.h" #include "CompletionData.h" +#include "UnsavedFile.h" #include #include