00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_LETTER_CHAR_LETTER_HXX
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_LETTER_CHAR_LETTER_HXX
00019 
00020 # include <string>
00021 # include <utility>
00022 
00023 # include <vaucanson/algebra/implementation/letter/char_letter.hh>
00024 
00025 namespace vcsn
00026 {
00027   namespace algebra
00028   {
00029     template <>
00030     struct letter_traits<char>
00031     {
00032       
00033       typedef misc::true_t is_char_letter;
00034 
00035       enum
00036       {
00037         
00038         
00039         
00040         
00041         cardinal = 255
00042       };
00043 
00044       
00045       typedef undefined_type first_projection_t;
00046       typedef undefined_type second_projection_t;
00047 
00048       
00049       static char default_joker()   { return '?'; }
00050       static char default_other()   { return '#'; }
00051 
00052       static
00053       std::pair<bool, char>
00054       literal_to_letter(const std::string& str)
00055       {
00056         
00057         if (str.size() != 1)
00058           return std::make_pair(false, 0);
00059 
00060         return std::make_pair(true, str[0]);
00061       }
00062 
00063       static
00064       std::string
00065       letter_to_literal(const char& c)
00066       {
00067         std::string str;
00068         str = str + c;
00069         return str;
00070       }
00071 
00072       
00073       static std::string kind() { return "simple"; }
00074       static int dim() { return 1; }
00075 
00076     };
00077 
00078   } 
00079 
00080 } 
00081 
00082 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_LETTER_CHAR_LETTER_HXX