GCC Middle and Back End API Reference
best_match< GOAL_TYPE, CANDIDATE_TYPE > Class Template Reference

#include <spellcheck.h>

Public Types

typedef GOAL_TYPE goal_t
 
typedef CANDIDATE_TYPE candidate_t
 
typedef edit_distance_traits< goal_tgoal_traits
 
typedef edit_distance_traits< candidate_tcandidate_traits
 

Public Member Functions

 best_match (GOAL_TYPE goal, edit_distance_t best_distance_so_far=MAX_EDIT_DISTANCE)
 
void consider (candidate_t candidate)
 
void set_best_so_far (CANDIDATE_TYPE best_candidate, edit_distance_t best_distance, size_t best_candidate_len)
 
edit_distance_t get_cutoff (size_t candidate_len) const
 
candidate_t get_best_meaningful_candidate () const
 
candidate_t blithely_get_best_candidate () const
 
edit_distance_t get_best_distance () const
 
size_t get_best_candidate_length () const
 

Private Attributes

const char * m_goal
 
size_t m_goal_len
 
candidate_t m_best_candidate
 
edit_distance_t m_best_distance
 
size_t m_best_candidate_len
 

Detailed Description

template<typename GOAL_TYPE, typename CANDIDATE_TYPE>
class best_match< GOAL_TYPE, CANDIDATE_TYPE >
A type for use when determining the best match against a string,
expressed as a template so that we can match against various
string-like types (const char *, frontend identifiers, and preprocessor
macros).

This type accumulates the best possible match against GOAL_TYPE for
a sequence of elements of CANDIDATE_TYPE, whilst minimizing the
number of calls to get_edit_distance and to
edit_distance_traits<T>::get_length.   

Member Typedef Documentation

◆ candidate_t

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
CANDIDATE_TYPE best_match< GOAL_TYPE, CANDIDATE_TYPE >::candidate_t

◆ candidate_traits

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
edit_distance_traits<candidate_t> best_match< GOAL_TYPE, CANDIDATE_TYPE >::candidate_traits

◆ goal_t

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
GOAL_TYPE best_match< GOAL_TYPE, CANDIDATE_TYPE >::goal_t

◆ goal_traits

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
edit_distance_traits<goal_t> best_match< GOAL_TYPE, CANDIDATE_TYPE >::goal_traits

Constructor & Destructor Documentation

◆ best_match()

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
best_match< GOAL_TYPE, CANDIDATE_TYPE >::best_match ( GOAL_TYPE goal,
edit_distance_t best_distance_so_far = MAX_EDIT_DISTANCE )
inline

Member Function Documentation

◆ blithely_get_best_candidate()

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
candidate_t best_match< GOAL_TYPE, CANDIDATE_TYPE >::blithely_get_best_candidate ( ) const
inline

◆ consider()

◆ get_best_candidate_length()

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
size_t best_match< GOAL_TYPE, CANDIDATE_TYPE >::get_best_candidate_length ( ) const
inline

◆ get_best_distance()

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
edit_distance_t best_match< GOAL_TYPE, CANDIDATE_TYPE >::get_best_distance ( ) const
inline

◆ get_best_meaningful_candidate()

◆ get_cutoff()

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
edit_distance_t best_match< GOAL_TYPE, CANDIDATE_TYPE >::get_cutoff ( size_t candidate_len) const
inline

◆ set_best_so_far()

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
void best_match< GOAL_TYPE, CANDIDATE_TYPE >::set_best_so_far ( CANDIDATE_TYPE best_candidate,
edit_distance_t best_distance,
size_t best_candidate_len )
inline

Field Documentation

◆ m_best_candidate

◆ m_best_candidate_len

◆ m_best_distance

◆ m_goal

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
const char* best_match< GOAL_TYPE, CANDIDATE_TYPE >::m_goal
private

◆ m_goal_len

template<typename GOAL_TYPE , typename CANDIDATE_TYPE >
size_t best_match< GOAL_TYPE, CANDIDATE_TYPE >::m_goal_len
private

The documentation for this class was generated from the following file: