LetterHash -> LetterNodeListMap

This commit is contained in:
Strahinja Val Markovic 2012-09-06 12:56:08 -07:00
parent ae57c9c39b
commit a6b4b7fd27
5 changed files with 17 additions and 18 deletions

View File

@ -18,7 +18,7 @@
#ifndef LETTERNODE_H_EIZ6JVWC #ifndef LETTERNODE_H_EIZ6JVWC
#define LETTERNODE_H_EIZ6JVWC #define LETTERNODE_H_EIZ6JVWC
#include "LetterHash.h" #include "LetterNodeListMap.h"
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
@ -63,8 +63,7 @@ public:
private: private:
// TODO: rename LetterHash to LetterNodeListHash or LetterNodeListDict/Map? LetterNodeListMap letters_;
LetterHash letters_;
std::vector< boost::shared_ptr< LetterNode > > letternode_per_text_index_; std::vector< boost::shared_ptr< LetterNode > > letternode_per_text_index_;
bool is_uppercase_; bool is_uppercase_;
bool is_root_node_; bool is_root_node_;

View File

@ -15,7 +15,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>. // along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
#include "LetterHash.h" #include "LetterNodeListMap.h"
#include "standard.h" #include "standard.h"
namespace YouCompleteMe namespace YouCompleteMe
@ -41,7 +41,7 @@ int IndexForChar( char letter )
} }
LetterHash::LetterHash() LetterNodeListMap::LetterNodeListMap()
{ {
letters_.resize( kNumLetters ); letters_.resize( kNumLetters );
@ -52,7 +52,7 @@ LetterHash::LetterHash()
} }
LetterHash::~LetterHash() LetterNodeListMap::~LetterNodeListMap()
{ {
for ( uint i = 0; i < letters_.size(); ++i ) for ( uint i = 0; i < letters_.size(); ++i )
{ {
@ -61,7 +61,7 @@ LetterHash::~LetterHash()
} }
bool LetterHash::HasLetter( char letter ) bool LetterNodeListMap::HasLetter( char letter )
{ {
int letter_index = IndexForChar( letter ); int letter_index = IndexForChar( letter );
std::list< LetterNode* > *list = letters_[ letter_index ]; std::list< LetterNode* > *list = letters_[ letter_index ];
@ -69,7 +69,7 @@ bool LetterHash::HasLetter( char letter )
} }
std::list< LetterNode* >& LetterHash::operator[] ( char letter ) std::list< LetterNode* >& LetterNodeListMap::operator[] ( char letter )
{ {
int letter_index = IndexForChar( letter ); int letter_index = IndexForChar( letter );
std::list< LetterNode* > *list = letters_[ letter_index ]; std::list< LetterNode* > *list = letters_[ letter_index ];
@ -82,13 +82,13 @@ std::list< LetterNode* >& LetterHash::operator[] ( char letter )
} }
std::list< LetterNode* >* LetterHash::ListPointerAt( char letter ) std::list< LetterNode* >* LetterNodeListMap::ListPointerAt( char letter )
{ {
return letters_[ IndexForChar( letter ) ]; return letters_[ IndexForChar( letter ) ];
} }
bool LetterHash::HasLetter( char letter ) const bool LetterNodeListMap::HasLetter( char letter ) const
{ {
return letters_[ IndexForChar( letter ) ] != NULL; return letters_[ IndexForChar( letter ) ] != NULL;
} }

View File

@ -15,8 +15,8 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>. // along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
#ifndef LETTERHASH_H_BRK2UMC1 #ifndef LETTERNODELISTMAP_H_BRK2UMC1
#define LETTERHASH_H_BRK2UMC1 #define LETTERNODELISTMAP_H_BRK2UMC1
#include <vector> #include <vector>
#include <list> #include <list>
@ -34,11 +34,11 @@ extern const int kNumLetters;
int IndexForChar( char letter ); int IndexForChar( char letter );
bool IsUppercase( char letter ); bool IsUppercase( char letter );
class LetterHash : boost::noncopyable class LetterNodeListMap : boost::noncopyable
{ {
public: public:
LetterHash(); LetterNodeListMap();
~LetterHash(); ~LetterNodeListMap();
bool HasLetter( char letter ); bool HasLetter( char letter );
@ -55,5 +55,5 @@ private:
} // namespace YouCompleteMe } // namespace YouCompleteMe
#endif /* end of include guard: LETTERHASH_H_BRK2UMC1 */ #endif /* end of include guard: LETTERNODELISTMAP_H_BRK2UMC1 */

View File

@ -16,7 +16,7 @@
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>. // along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "LetterHash.h" #include "LetterNodeListMap.h"
namespace YouCompleteMe namespace YouCompleteMe
{ {

View File

@ -16,7 +16,7 @@
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>. // along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "LetterHash.h" #include "LetterNodeListMap.h"
namespace YouCompleteMe namespace YouCompleteMe
{ {