OLD | NEW |
1 // Copyright 2013 Google Inc. | 1 // Copyright 2013 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not | 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not |
4 // use this file except in compliance with the License. You may obtain a copy of | 4 // use this file except in compliance with the License. You may obtain a copy of |
5 // the License at | 5 // the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
12 // License for the specific language governing permissions and limitations under | 12 // License for the specific language governing permissions and limitations under |
13 // the License. | 13 // the License. |
14 | 14 |
15 #include "liblouis_wrapper.h" | 15 #include "third_party/liblouis/nacl_wrapper/liblouis_wrapper.h" |
16 | 16 |
17 #include <cstddef> | 17 #include <cstddef> |
18 | 18 |
19 #include "liblouis/liblouis.h" | 19 #include "third_party/liblouis/overrides/liblouis/liblouis.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // Decodes UTF-8 into 16-bit wide characters. | 23 // Decodes UTF-8 into 16-bit wide characters. |
24 // This implementation is very permissive and may miss encoding errors. | 24 // This implementation is very permissive and may miss encoding errors. |
25 // It ignores charaters which are not in the Unicode Basic Multilingual Plane. | 25 // It ignores charaters which are not in the Unicode Basic Multilingual Plane. |
26 // TODO(jbroman): Handle more than BMP if liblouis changes to accept UTF-16. | 26 // TODO(jbroman): Handle more than BMP if liblouis changes to accept UTF-16. |
27 static bool DecodeUtf8(const std::string& in, std::vector<widechar>* out) { | 27 static bool DecodeUtf8(const std::string& in, std::vector<widechar>* out) { |
28 int len = in.length(); | 28 int len = in.length(); |
29 std::vector<widechar> result; | 29 std::vector<widechar> result; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 // TODO(jbroman): log this | 239 // TODO(jbroman): log this |
240 return false; | 240 return false; |
241 } | 241 } |
242 | 242 |
243 // Return the back translation result. | 243 // Return the back translation result. |
244 out->swap(text); | 244 out->swap(text); |
245 return true; | 245 return true; |
246 } | 246 } |
247 | 247 |
248 } // namespace liblouis_nacl | 248 } // namespace liblouis_nacl |
OLD | NEW |