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
00047 static L literal_to_letter(const std::string&);
00048
00050 static std::string letter_to_literal(const L&);
00051
00052 # define DECLARE_DEFAULT(name) \
00053 static const std::string default_##name ();
00054
00056 DECLARE_DEFAULT(open_par)
00057
00058
00059 DECLARE_DEFAULT(close_par)
00060
00062 DECLARE_DEFAULT(plus)
00063
00065 DECLARE_DEFAULT(times)
00066
00068 DECLARE_DEFAULT(star)
00069
00071 DECLARE_DEFAULT(epsilon)
00072
00074 DECLARE_DEFAULT(zero)
00075
00077 DECLARE_DEFAULT(open_weight)
00078
00080 DECLARE_DEFAULT(close_weight)
00081
00083 DECLARE_DEFAULT(space)
00084
00085 # undef DECLARE_DEFAULT
00086
00087 };
00088
00089 template <typename L>
00090 struct token_representation
00091 {
00092 std::string open_par;
00093 std::string close_par;
00094 std::string plus;
00095 std::string times;
00096 std::string star;
00097 std::string one;
00098 std::string zero;
00099 std::string open_weight;
00100 std::string close_weight;
00101 std::vector<std::string> spaces;
00102
00103
00104 token_representation();
00105
00106
00107 template <typename U>
00108 token_representation(const token_representation<U>& arg);
00109
00110 };
00111
00112
00113 typedef token_representation<misc::true_t> token_representation_t;
00114
00115 # define LETTER_DEFAULT(name, value) \
00116 static const std::string default_##name () { return value; }
00117
00118 }
00119
00120 }
00121
00122 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00123 # include <vaucanson/algebra/concept/letter.hxx>
00124 # endif // ! VCSN_USE_INTERFACE_ONLY
00125
00126 #endif // ! VCSN_ALGEBRA_CONCEPT_LETTER_HH