Style fixes for C++ code

This commit is contained in:
Strahinja Val Markovic 2013-03-23 10:47:30 -07:00
parent b00287a6a2
commit a3a3250f76
4 changed files with 14 additions and 13 deletions

View File

@ -43,9 +43,9 @@ std::string GetWordBoundaryChars( const std::string &text ) {
return result; return result;
} }
LetterNode* FirstUppercaseNode( const std::list< LetterNode *> &list ) { LetterNode *FirstUppercaseNode( const std::list< LetterNode *> &list ) {
LetterNode *node = NULL; LetterNode *node = NULL;
foreach( LetterNode *current_node, list ) { foreach( LetterNode * current_node, list ) {
if ( current_node->LetterIsUppercase() ) { if ( current_node->LetterIsUppercase() ) {
node = current_node; node = current_node;
break; break;
@ -54,9 +54,9 @@ LetterNode* FirstUppercaseNode( const std::list< LetterNode *> &list ) {
return node; return node;
} }
LetterNode* FirstLowercaseNode( const std::list< LetterNode *> &list ) { LetterNode *FirstLowercaseNode( const std::list< LetterNode *> &list ) {
LetterNode *node = NULL; LetterNode *node = NULL;
foreach( LetterNode *current_node, list ) { foreach( LetterNode * current_node, list ) {
if ( !current_node->LetterIsUppercase() ) { if ( !current_node->LetterIsUppercase() ) {
node = current_node; node = current_node;
break; break;

View File

@ -269,12 +269,13 @@ void ClangCompleter::DeleteCachesForFileAsync( const std::string &filename ) {
void ClangCompleter::DeleteCaches() { void ClangCompleter::DeleteCaches() {
std::vector< std::string > filenames; std::vector< std::string > filenames;
if ( !file_cache_delete_stack_.PopAllNoWait( filenames ) ) if ( !file_cache_delete_stack_.PopAllNoWait( filenames ) )
return; return;
lock_guard< mutex > lock( filename_to_translation_unit_mutex_ ); lock_guard< mutex > lock( filename_to_translation_unit_mutex_ );
foreach( const std::string &filename, filenames ) { foreach( const std::string & filename, filenames ) {
filename_to_translation_unit_.erase( filename ); filename_to_translation_unit_.erase( filename );
} }
} }
@ -415,7 +416,7 @@ std::vector< CompletionData > ClangCompleter::SortCandidatesForQuery(
std::vector< const Candidate * > repository_candidates = std::vector< const Candidate * > repository_candidates =
candidate_repository_.GetCandidatesForStrings( completion_datas ); candidate_repository_.GetCandidatesForStrings( completion_datas );
std::vector< ResultAnd< CompletionData* > > data_and_results; std::vector< ResultAnd< CompletionData * > > data_and_results;
for ( uint i = 0; i < repository_candidates.size(); ++i ) { for ( uint i = 0; i < repository_candidates.size(); ++i ) {
const Candidate *candidate = repository_candidates[ i ]; const Candidate *candidate = repository_candidates[ i ];
@ -427,8 +428,8 @@ std::vector< CompletionData > ClangCompleter::SortCandidatesForQuery(
query_has_uppercase_letters ); query_has_uppercase_letters );
if ( result.IsSubsequence() ) { if ( result.IsSubsequence() ) {
ResultAnd< CompletionData* > data_and_result( &completion_datas[ i ], ResultAnd< CompletionData * > data_and_result( &completion_datas[ i ],
result ); result );
data_and_results.push_back( boost::move( data_and_result ) ); data_and_results.push_back( boost::move( data_and_result ) );
} }
} }
@ -438,7 +439,7 @@ std::vector< CompletionData > ClangCompleter::SortCandidatesForQuery(
std::vector< CompletionData > sorted_completion_datas; std::vector< CompletionData > sorted_completion_datas;
sorted_completion_datas.reserve( data_and_results.size() ); sorted_completion_datas.reserve( data_and_results.size() );
foreach ( const ResultAnd< CompletionData* > & data_and_result, foreach ( const ResultAnd< CompletionData * > &data_and_result,
data_and_results ) { data_and_results ) {
sorted_completion_datas.push_back( *data_and_result.extra_object_ ); sorted_completion_datas.push_back( *data_and_result.extra_object_ );
} }

View File

@ -250,7 +250,7 @@ void IdentifierCompleter::ResultsForQueryAndType(
continue; continue;
Result result = candidate->QueryMatchResult( Result result = candidate->QueryMatchResult(
query, query_has_uppercase_letters ); query, query_has_uppercase_letters );
if ( result.IsSubsequence() ) if ( result.IsSubsequence() )
results.push_back( result ); results.push_back( result );

View File

@ -100,15 +100,15 @@ struct ResultAnd {
}; };
template< class T > template< class T >
struct ResultAnd<T* > { struct ResultAnd<T * > {
ResultAnd( const T* extra_object, const Result &result ) ResultAnd( const T *extra_object, const Result &result )
: extra_object_( extra_object ), result_( result ) {} : extra_object_( extra_object ), result_( result ) {}
bool operator< ( const ResultAnd &other ) const { bool operator< ( const ResultAnd &other ) const {
return result_ < other.result_; return result_ < other.result_;
} }
const T* extra_object_; const T *extra_object_;
Result result_; Result result_;
}; };