Code style fixes

This commit is contained in:
Strahinja Val Markovic 2013-02-23 15:54:44 -08:00
parent c819c9f31e
commit e1584a33b0
6 changed files with 23 additions and 22 deletions

View File

@ -202,7 +202,7 @@ Future< void > ClangCompleter::UpdateTranslationUnitAsync(
make_shared< ClangPackagedTask >(); make_shared< ClangPackagedTask >();
clang_packaged_task->parsing_task_ = packaged_task< void >( clang_packaged_task->parsing_task_ = packaged_task< void >(
boost::move( functor ) ); boost::move( functor ) );
unique_future< void > future = unique_future< void > future =
clang_packaged_task->parsing_task_.get_future(); clang_packaged_task->parsing_task_.get_future();
clang_task_.Set( clang_packaged_task ); clang_task_.Set( clang_packaged_task );

View File

@ -138,7 +138,7 @@ void IdentifierCompleter::AddCandidatesToDatabaseFromBuffer(
const std::string &buffer_contents, const std::string &buffer_contents,
const std::string &filetype, const std::string &filetype,
const std::string &filepath, const std::string &filepath,
bool collect_from_comments_and_strings) { bool collect_from_comments_and_strings ) {
ClearCandidatesStoredForFile( filetype, filepath ); ClearCandidatesStoredForFile( filetype, filepath );
std::string new_contents = std::string new_contents =
@ -293,8 +293,8 @@ void IdentifierCompleter::InitThreads() {
} }
buffer_identifiers_thread_.reset( buffer_identifiers_thread_.reset(
new boost::thread( BufferIdentifiersThreadMain, new boost::thread( BufferIdentifiersThreadMain,
boost::ref( buffer_identifiers_task_stack_ ) ) ); boost::ref( buffer_identifiers_task_stack_ ) ) );
} }

View File

@ -57,10 +57,10 @@ public:
const std::string &filepath ); const std::string &filepath );
void AddCandidatesToDatabaseFromBuffer( void AddCandidatesToDatabaseFromBuffer(
const std::string &buffer_contents, const std::string &buffer_contents,
const std::string &filetype, const std::string &filetype,
const std::string &filepath, const std::string &filepath,
bool collect_from_comments_and_strings ); bool collect_from_comments_and_strings );
// NOTE: params are taken by value on purpose! With a C++11 compiler we can // NOTE: params are taken by value on purpose! With a C++11 compiler we can
// avoid an expensive copy of buffer_contents if the param is taken by value // avoid an expensive copy of buffer_contents if the param is taken by value

View File

@ -30,11 +30,11 @@ const char *COMMENT_AND_STRING_REGEX =
"|" "|"
"/\\*.*?\\*/" // C-style comments, '/* ... */' "/\\*.*?\\*/" // C-style comments, '/* ... */'
"|" "|"
"'(?:\\\\'|.)*?'" // Anything inside single quotes, '...', but mind the // Anything inside single quotes, '...', but mind the escaped quote
// escaped quote "'(?:\\\\'|.)*?'"
"|" "|"
"\"(?:\\\\\"|.)*?\""; // Anything inside double quotes, "...", but mind // Anything inside double quotes, "...", but mind the escaped double quote
// the escaped double quote "\"(?:\\\\\"|.)*?\"";
const char *IDENTIFIER_REGEX = "[_a-zA-Z]\\w*"; const char *IDENTIFIER_REGEX = "[_a-zA-Z]\\w*";

View File

@ -32,8 +32,8 @@ namespace YouCompleteMe {
namespace { namespace {
std::vector< const Candidate * > CandidatesFromObjectList( std::vector< const Candidate * > CandidatesFromObjectList(
const pylist &candidates, const pylist &candidates,
const std::string &candidate_property ) { const std::string &candidate_property ) {
int num_candidates = len( candidates ); int num_candidates = len( candidates );
std::vector< std::string > candidate_strings; std::vector< std::string > candidate_strings;
candidate_strings.reserve( num_candidates ); candidate_strings.reserve( num_candidates );
@ -44,21 +44,22 @@ std::vector< const Candidate * > CandidatesFromObjectList(
} else { } else {
object holder = extract< object >( candidates[ i ] ); object holder = extract< object >( candidates[ i ] );
candidate_strings.push_back( extract< std::string >( candidate_strings.push_back( extract< std::string >(
holder[ candidate_property.c_str() ] ) ); holder[ candidate_property.c_str() ] ) );
} }
} }
return CandidateRepository::Instance().GetCandidatesForStrings( return CandidateRepository::Instance().GetCandidatesForStrings(
candidate_strings ); candidate_strings );
} }
} // unnamed namespace } // unnamed namespace
boost::python::list FilterAndSortCandidates( boost::python::list FilterAndSortCandidates(
const boost::python::list &candidates, const boost::python::list &candidates,
const std::string &candidate_property, const std::string &candidate_property,
const std::string &query ) { const std::string &query ) {
pylist filtered_candidates; pylist filtered_candidates;
if ( query.empty() ) if ( query.empty() )
return filtered_candidates; return filtered_candidates;

View File

@ -27,9 +27,9 @@ namespace YouCompleteMe {
// the candidates and a user query, returns a new sorted python list with the // the candidates and a user query, returns a new sorted python list with the
// original objects that survived the filtering. // original objects that survived the filtering.
boost::python::list FilterAndSortCandidates( boost::python::list FilterAndSortCandidates(
const boost::python::list &candidates, const boost::python::list &candidates,
const std::string &candidate_property, const std::string &candidate_property,
const std::string &query ); const std::string &query );
} // namespace YouCompleteMe } // namespace YouCompleteMe