comparison DEPENDENCIES/generic/include/boost/detail/utf8_codecvt_facet.ipp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
169 } 169 }
170 170
171 // How many char objects can I process to get <= max_limit 171 // How many char objects can I process to get <= max_limit
172 // wchar_t objects? 172 // wchar_t objects?
173 int utf8_codecvt_facet::do_length( 173 int utf8_codecvt_facet::do_length(
174 BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &, 174 const std::mbstate_t &,
175 const char * from, 175 const char * from,
176 const char * from_end, 176 const char * from_end,
177 std::size_t max_limit 177 std::size_t max_limit
178 ) const
178 #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) 179 #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
179 ) const throw() 180 throw()
180 #else
181 ) const
182 #endif 181 #endif
183 { 182 {
184 // RG - this code is confusing! I need a better way to express it. 183 // RG - this code is confusing! I need a better way to express it.
185 // and test cases. 184 // and test cases.
186 185
215 else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3; 214 else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3;
216 else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4; 215 else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4;
217 else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5; 216 else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5;
218 else return 6; 217 else return 6;
219 } 218 }
220 BOOST_UTF8_END_NAMESPACE 219
221 220 namespace detail {
222 namespace { 221
223 template<std::size_t s> 222 template<std::size_t s>
224 int get_cont_octet_out_count_impl(wchar_t word){ 223 int get_cont_octet_out_count_impl(wchar_t word){
225 if (word < 0x80) { 224 if (word < 0x80) {
226 return 0; 225 return 0;
227 } 226 }
268 #else 267 #else
269 return 2; 268 return 2;
270 #endif 269 #endif
271 } 270 }
272 271
273 } // namespace anonymous 272 } // namespace detail
274 273
275 BOOST_UTF8_BEGIN_NAMESPACE
276 // How many "continuing octets" will be needed for this word 274 // How many "continuing octets" will be needed for this word
277 // == total octets - 1. 275 // == total octets - 1.
278 int utf8_codecvt_facet::get_cont_octet_out_count( 276 int utf8_codecvt_facet::get_cont_octet_out_count(
279 wchar_t word 277 wchar_t word
280 ) const { 278 ) const {
281 return get_cont_octet_out_count_impl<sizeof(wchar_t)>(word); 279 return detail::get_cont_octet_out_count_impl<sizeof(wchar_t)>(word);
282 } 280 }
283 BOOST_UTF8_END_NAMESPACE 281 BOOST_UTF8_END_NAMESPACE
284 282
285 #endif 283 #endif