diff options
Diffstat (limited to 'unicode/unicodecpp.C')
| -rw-r--r-- | unicode/unicodecpp.C | 31 | 
1 files changed, 31 insertions, 0 deletions
| diff --git a/unicode/unicodecpp.C b/unicode/unicodecpp.C index 8c43b31..5677b86 100644 --- a/unicode/unicodecpp.C +++ b/unicode/unicodecpp.C @@ -636,6 +636,8 @@ struct cb_wrapper {  	template<typename ...Args> void operator()(Args && ...args)  	{ +		if (caught) +			return;  		try {  			cb(std::forward<Args>(args)...);  		} catch (...) @@ -771,6 +773,35 @@ int unicode::bidi_cleanup(std::u32string &string,  	return 0;  } +int unicode::bidi_cleanup(std::u32string &string, +			  std::vector<unicode_bidi_level_t> &levels, +			  const std::function<void (size_t)> &lambda, +			  int cleanup_options, +			  size_t starting_pos, +			  size_t n) +{ +	size_t s=string.size(); + +	if (levels.size() != s) +		return -1; + +	if (starting_pos >= s) +		return 0; + +	if (n > s-starting_pos) +		n=s-starting_pos; + +	cb_wrapper<void (size_t)> cb{lambda}; +	unicode_bidi_cleanup(&string[starting_pos], +			     &levels[starting_pos], +			     n, +			     cleanup_options, +			     removed_callback, +			     reinterpret_cast<void *>(&cb)); +	cb.rethrow(); +	return 0; +} +  int unicode::bidi_logical_order(std::u32string &string,  				std::vector<unicode_bidi_level_t> &levels,  				unicode_bidi_level_t paragraph_embedding, | 
