00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef VCSN_ALGEBRA_CONCEPT_LETTER_HH
00019 # define VCSN_ALGEBRA_CONCEPT_LETTER_HH
00020 
00021 # include <string>
00022 # include <vector>
00023 
00024 # include <vaucanson/misc/static.hh>
00025 
00026 namespace vcsn {
00027 
00028   namespace algebra {
00029 
00030     template <class L>
00031     struct letter_traits
00032     {
00033       
00034       typedef misc::false_t is_char_letter;
00035 
00036       
00037       enum
00038         {
00039           cardinal = misc::static_pow<2, sizeof(L) * 8>::value
00040         };
00041 
00044 
00046       
00047       static std::string kind();
00048       static int dim();
00049 
00052       static L literal_to_letter(const std::string&);
00053 
00055       static std::string letter_to_literal(const L&);
00056 
00057 # define DECLARE_DEFAULT(name) \
00058       static const std::string default_##name ();
00059 
00061       DECLARE_DEFAULT(open_par)
00062 
00063       
00064       DECLARE_DEFAULT(close_par)
00065 
00067       DECLARE_DEFAULT(plus)
00068 
00070       DECLARE_DEFAULT(times)
00071 
00073       DECLARE_DEFAULT(star)
00074 
00076       DECLARE_DEFAULT(epsilon)
00077 
00079       DECLARE_DEFAULT(zero)
00080 
00082       DECLARE_DEFAULT(open_weight)
00083 
00085       DECLARE_DEFAULT(close_weight)
00086 
00088       DECLARE_DEFAULT(space)
00089 
00090 # undef DECLARE_DEFAULT
00091 
00092     };
00093 
00094     template <typename L>
00095     struct token_representation
00096     {
00097       std::string               open_par;
00098       std::string               close_par;
00099       std::string               plus;
00100       std::string               times;
00101       std::string               star;
00102       std::string               one;
00103       std::string               zero;
00104       std::string               open_weight;
00105       std::string               close_weight;
00106       std::vector<std::string>  spaces;
00107 
00108       
00109       token_representation();
00110 
00111       
00112       template <typename U>
00113       token_representation(const token_representation<U>& arg);
00114 
00115     };
00116 
00117     
00118     typedef token_representation<misc::true_t> token_representation_t;
00119 
00120 # define LETTER_DEFAULT(name, value) \
00121     static const std::string default_##name () { return value; }
00122 
00123   } 
00124 
00125 } 
00126 
00127 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00128 #  include <vaucanson/algebra/concept/letter.hxx>
00129 # endif // ! VCSN_USE_INTERFACE_ONLY
00130 
00131 #endif // ! VCSN_ALGEBRA_CONCEPT_LETTER_HH