00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_LETTER_COUPLE_LETTER_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_LETTER_COUPLE_LETTER_HH
00019
00020 # include <climits>
00021 # include <string>
00022 # include <iostream>
00023
00024 # include <vaucanson/algebra/concept/letter.hh>
00025 # include <vaucanson/algebra/concept/freemonoid_base.hh>
00026
00027
00028
00029 namespace vcsn
00030 {
00031
00032 namespace algebra
00033 {
00034
00035 template <typename U, typename V>
00036 struct letter_traits< std::pair<U, V> >
00037 {
00038
00039 typedef misc::true_t is_char_letter;
00040
00041 enum
00042 {
00043
00044
00045
00046
00047
00048
00049
00050
00051 cardinal = INT_MAX
00052 };
00053
00054 LETTER_DEFAULT(open_par, "(")
00055 LETTER_DEFAULT(close_par, ")")
00056 LETTER_DEFAULT(plus, "+")
00057 LETTER_DEFAULT(times, ".")
00058 LETTER_DEFAULT(star, "*")
00059 LETTER_DEFAULT(epsilon, "1")
00060 LETTER_DEFAULT(zero, "0")
00061 LETTER_DEFAULT(open_weight, "{")
00062 LETTER_DEFAULT(close_weight, "}")
00063 LETTER_DEFAULT(space, " ")
00064
00065 static
00066 std::string
00067 letter_to_literal(const std::pair<U, V>& c)
00068 {
00069 std::stringstream sstr;
00070 sstr << c;
00071 return sstr.str();
00072 }
00073
00074 };
00075
00076 } // ! algebra
00077
00078 } // ! vcsn
00079
00080 namespace vcsn {
00081
00082 namespace algebra {
00083
00084 // Specialization for pairs.
00085 template <typename S, typename U, typename V, typename CharContainer>
00086 bool op_parse (const algebra::FreeMonoidBase<S>& set,
00087 std::basic_string< std::pair<U, V> >& v,
00088 const std::string& s,
00089 typename std::string::const_iterator& i,
00090 const CharContainer& escaped);
00091 }
00092 } // ! vcsn
00093
00094 namespace std {
00095
00100 template <typename U, typename V>
00101 std::ostream& operator<< (std::ostream& o, std::pair<U, V> p);
00102
00104 template <typename U, typename V, class Traits, class Allocator>
00105 std::ostream&
00106 operator<< (std::ostream& o,
00107 std::basic_string<std::pair<U, V>, Traits, Allocator> s);
00108
00110 template <typename U, typename V>
00111 std::istream& operator>> (std::istream& i, std::pair<U, V>& p);
00112
00113 } // ! std
00114
00115 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00116 # include <vaucanson/algebra/implementation/letter/couple_letter.hxx>
00117 # endif // ! VCSN_USE_INTERFACE_ONLY
00118
00119 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_LETTER_COUPLE_LETTER_HH