Removing some commented out code

This commit is contained in:
Strahinja Val Markovic 2012-04-29 19:56:16 -07:00
parent 903452e855
commit d9299175aa
5 changed files with 11 additions and 32 deletions

View File

@ -23,13 +23,14 @@ namespace YouCompleteMe
const int kNumLetters = NUM_LETTERS;
static const int kLettersIndexStart = 0;
static const int kNumbersIndexStart = 26;
// static const int kNumbersIndexStart = 0;
bool IsUppercase( char letter )
{
return 'A' <= letter && letter <= 'Z';
}
int IndexForChar( char letter )
{
if ( IsUppercase( letter ) )
@ -39,6 +40,7 @@ int IndexForChar( char letter )
return letter;
}
LetterHash::LetterHash()
{
letters_.resize( kNumLetters );
@ -49,6 +51,7 @@ LetterHash::LetterHash()
}
}
LetterHash::~LetterHash()
{
for ( int i = 0; i < letters_.size(); ++i )
@ -57,6 +60,7 @@ LetterHash::~LetterHash()
}
}
bool LetterHash::HasLetter( char letter )
{
int letter_index = IndexForChar( letter );
@ -64,16 +68,6 @@ bool LetterHash::HasLetter( char letter )
return list;
}
// const std::list< LetterNode* > LetterHash::operator[] ( char letter ) const
// {
// int letter_index = IndexForChar( letter );
// std::list< LetterNode* > *list = letters_[ letter_index ];
// if ( list )
//
// return *list;
//
// return std::list< LetterNode* >();
// }
std::list< LetterNode* >& LetterHash::operator[] ( char letter )
{
@ -85,16 +79,15 @@ std::list< LetterNode* >& LetterHash::operator[] ( char letter )
letters_[ letter_index ] = new std::list< LetterNode* >();
return *letters_[ letter_index ];
// letter_node_lists_.push_back( std::list< LetterNode* >() );
// letters_[ letter_index ] = &letter_node_lists_.back();
// return letter_node_lists_.back();
}
std::list< LetterNode* >* LetterHash::ListPointerAt( char letter )
{
return letters_[ IndexForChar( letter ) ];
}
bool LetterHash::HasLetter( char letter ) const
{
return letters_[ IndexForChar( letter ) ] != NULL;

View File

@ -40,8 +40,6 @@ public:
LetterHash();
~LetterHash();
// const std::list< LetterNode* > operator[] ( char letter ) const;
bool HasLetter( char letter );
std::list< LetterNode* >& operator[] ( char letter );
@ -53,9 +51,6 @@ public:
private:
std::vector< std::list< LetterNode* >* > letters_;
// TODO: remove this list, we can just create lists on the heap when we need
// them
// std::vector< std::list< LetterNode* > > letter_node_lists_;
};
} // namespace YouCompleteMe

View File

@ -28,6 +28,7 @@ LetterNode::LetterNode( char letter )
is_root_node = false;
}
LetterNode::LetterNode( const std::string &text )
{
is_uppercase = false;

View File

@ -27,7 +27,6 @@
#include <list>
#include <string>
// #include <boost/unordered_map.hpp>
namespace YouCompleteMe
{
@ -45,21 +44,13 @@ public:
return is_uppercase;
}
// inline const std::list< LetterNode* > NodesForLetter( char letter ) const
// {
// return letters_[ letter ];
// }
//
// inline const std::list< LetterNode* >& NodesForLetter( char letter )
// {
// return letters_[ letter ];
// }
inline const std::list< LetterNode* >* NodeListForLetter( char letter )
{
return letters_.ListPointerAt( letter );
}
inline void PrependNodeForLetter( char letter, LetterNode* node )
{
letters_[ letter ].push_front( node );
@ -70,9 +61,6 @@ private:
// TODO: rename LetterHash to LetterNodeListHash or LetterNodeListDict/Map?
LetterHash letters_;
std::vector< boost::shared_ptr< LetterNode > > letternode_per_text_index_;
// std::vector< std::list< LetterNode* >* > letters_;
// std::vector< std::list< LetterNode* > > letter_node_lists_;
// boost::unordered_map< std::list< LetterNode* > letters_;
bool is_uppercase;
bool is_root_node;
};

View File

@ -217,5 +217,7 @@ TEST_F( CompleterTest, SameLowercaseCandidateWins )
"Foobar" ) );
}
// TODO: tests for filepath and filetype candidate storing
} // namespace YouCompleteMe