1#cython: language_level=3
2# Copyright 2005-2020 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the 'License');
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an 'AS IS' BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16# See www.openfst.org for extensive documentation on this weighted
17# finite-state transducer library.
18
19
20from libcpp.string cimport string
21
22from cintegral_types cimport int8
23from cintegral_types cimport int16
24from cintegral_types cimport int32
25from cintegral_types cimport int64
26from cintegral_types cimport uint8
27from cintegral_types cimport uint16
28from cintegral_types cimport uint32
29from cintegral_types cimport uint64
30
31
32cdef extern from "<iostream>" namespace "std" nogil:
33
34  cdef cppclass iostream:
35
36    pass
37
38  cdef cppclass istream(iostream):
39
40    pass
41
42  cdef cppclass ostream(iostream):
43
44    pass
45
46
47# We are ignoring openmodes for the moment.
48
49
50cdef extern from "<fstream>" namespace "std" nogil:
51
52  cdef cppclass ifstream(istream):
53
54    ifstream(const string &)
55
56  cdef cppclass ofstream(ostream):
57
58    ofstream(const string &)
59
60
61cdef extern from "<sstream>" namespace "std" nogil:
62
63  cdef cppclass stringstream(istream, ostream):
64
65    stringstream()
66
67    string str()
68
69    stringstream &operator<<(const string &)
70
71    stringstream &operator<<(bool)
72
73    # We define these in terms of the Google cintegral_types.
74
75    stringstream &operator<<(int8)
76
77    stringstream &operator<<(uint8)
78
79    stringstream &operator<<(int16)
80
81    stringstream &operator<<(uint16)
82
83    stringstream &operator<<(int32)
84
85    stringstream &operator<<(uint32)
86
87    stringstream &operator<<(int64)
88
89    stringstream &operator<<(uint64)
90
91    stringstream &operator<<(double)
92
93    stringstream &operator<<(long double)
94