Removing some commented out code
This commit is contained in:
parent
903452e855
commit
d9299175aa
@ -23,13 +23,14 @@ namespace YouCompleteMe
|
|||||||
const int kNumLetters = NUM_LETTERS;
|
const int kNumLetters = NUM_LETTERS;
|
||||||
static const int kLettersIndexStart = 0;
|
static const int kLettersIndexStart = 0;
|
||||||
static const int kNumbersIndexStart = 26;
|
static const int kNumbersIndexStart = 26;
|
||||||
// static const int kNumbersIndexStart = 0;
|
|
||||||
|
|
||||||
bool IsUppercase( char letter )
|
bool IsUppercase( char letter )
|
||||||
{
|
{
|
||||||
return 'A' <= letter && letter <= 'Z';
|
return 'A' <= letter && letter <= 'Z';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int IndexForChar( char letter )
|
int IndexForChar( char letter )
|
||||||
{
|
{
|
||||||
if ( IsUppercase( letter ) )
|
if ( IsUppercase( letter ) )
|
||||||
@ -39,6 +40,7 @@ int IndexForChar( char letter )
|
|||||||
return letter;
|
return letter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LetterHash::LetterHash()
|
LetterHash::LetterHash()
|
||||||
{
|
{
|
||||||
letters_.resize( kNumLetters );
|
letters_.resize( kNumLetters );
|
||||||
@ -49,6 +51,7 @@ LetterHash::LetterHash()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LetterHash::~LetterHash()
|
LetterHash::~LetterHash()
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < letters_.size(); ++i )
|
for ( int i = 0; i < letters_.size(); ++i )
|
||||||
@ -57,6 +60,7 @@ LetterHash::~LetterHash()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LetterHash::HasLetter( char letter )
|
bool LetterHash::HasLetter( char letter )
|
||||||
{
|
{
|
||||||
int letter_index = IndexForChar( letter );
|
int letter_index = IndexForChar( letter );
|
||||||
@ -64,16 +68,6 @@ bool LetterHash::HasLetter( char letter )
|
|||||||
return list;
|
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 )
|
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* >();
|
letters_[ letter_index ] = new std::list< LetterNode* >();
|
||||||
return *letters_[ letter_index ];
|
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 )
|
std::list< LetterNode* >* LetterHash::ListPointerAt( char letter )
|
||||||
{
|
{
|
||||||
return letters_[ IndexForChar( letter ) ];
|
return letters_[ IndexForChar( letter ) ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LetterHash::HasLetter( char letter ) const
|
bool LetterHash::HasLetter( char letter ) const
|
||||||
{
|
{
|
||||||
return letters_[ IndexForChar( letter ) ] != NULL;
|
return letters_[ IndexForChar( letter ) ] != NULL;
|
||||||
|
@ -40,8 +40,6 @@ public:
|
|||||||
LetterHash();
|
LetterHash();
|
||||||
~LetterHash();
|
~LetterHash();
|
||||||
|
|
||||||
// const std::list< LetterNode* > operator[] ( char letter ) const;
|
|
||||||
|
|
||||||
bool HasLetter( char letter );
|
bool HasLetter( char letter );
|
||||||
|
|
||||||
std::list< LetterNode* >& operator[] ( char letter );
|
std::list< LetterNode* >& operator[] ( char letter );
|
||||||
@ -53,9 +51,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
std::vector< std::list< LetterNode* >* > letters_;
|
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
|
} // namespace YouCompleteMe
|
||||||
|
@ -28,6 +28,7 @@ LetterNode::LetterNode( char letter )
|
|||||||
is_root_node = false;
|
is_root_node = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LetterNode::LetterNode( const std::string &text )
|
LetterNode::LetterNode( const std::string &text )
|
||||||
{
|
{
|
||||||
is_uppercase = false;
|
is_uppercase = false;
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
// #include <boost/unordered_map.hpp>
|
|
||||||
|
|
||||||
namespace YouCompleteMe
|
namespace YouCompleteMe
|
||||||
{
|
{
|
||||||
@ -45,21 +44,13 @@ public:
|
|||||||
return is_uppercase;
|
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 )
|
inline const std::list< LetterNode* >* NodeListForLetter( char letter )
|
||||||
{
|
{
|
||||||
return letters_.ListPointerAt( letter );
|
return letters_.ListPointerAt( letter );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void PrependNodeForLetter( char letter, LetterNode* node )
|
inline void PrependNodeForLetter( char letter, LetterNode* node )
|
||||||
{
|
{
|
||||||
letters_[ letter ].push_front( node );
|
letters_[ letter ].push_front( node );
|
||||||
@ -70,9 +61,6 @@ private:
|
|||||||
// TODO: rename LetterHash to LetterNodeListHash or LetterNodeListDict/Map?
|
// TODO: rename LetterHash to LetterNodeListHash or LetterNodeListDict/Map?
|
||||||
LetterHash letters_;
|
LetterHash letters_;
|
||||||
std::vector< boost::shared_ptr< LetterNode > > letternode_per_text_index_;
|
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_uppercase;
|
||||||
bool is_root_node;
|
bool is_root_node;
|
||||||
};
|
};
|
||||||
|
@ -217,5 +217,7 @@ TEST_F( CompleterTest, SameLowercaseCandidateWins )
|
|||||||
"Foobar" ) );
|
"Foobar" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: tests for filepath and filetype candidate storing
|
||||||
|
|
||||||
} // namespace YouCompleteMe
|
} // namespace YouCompleteMe
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user