Boost logo

Boost :

From: Shunsuke Sogame (mb2act_at_[hidden])
Date: 2006-07-20 06:24:59


Alexander A Potocki wrote:
> No comments during about 2 weeks.
> what's wrong?
>
>> Hi boost community!
>>
>> I would like to propose my iterator based conversion library.
>> It allows declaring and using transformations by following way:
>>
>> std::wstring utf16string(L”some sequence to convert”);
>>
>> typedef cvt::encoder<wchar_t, char> coder_t;
>> coder_t coder = cvt::utf16() >> cvt::utf8();
>>
>> That piece of code declares converter from wchar_t to char sequences and
>> then instantiate such converter by utf16 to utf8 transformation.
>>
>> Then that converter instance can be used by following way:
>> typedef cvt::convert_input_iterator<coder_t, std::wstring::const_iterator
>> > it_t;
>> - declaration of input iterator
>>
>> std::string result;
>> std::copy(
>> it_t(coder, utf16string.begin(), utf16string.end()),
>> it_t(coder, utf16string.end(), utf16string.end()),
>> std::back_inserter(result)
>> );
>> Now we have utf8 encoded string in result container. That’s all.
>>
>> Library contains implementation for following transformations/algorithms:
>> utf7, utf8, utf16(be/le), utf32(be, le), Unicode simple folding, base64,
>> rc5(cipher/decipher).
>> Library allows creating pipeline converters, e.g.:
>>
>> typedef cvt::encoder<char, char> coder_t; // char to char sequence
>> transformation
>> coder_t coder = cvt::utf7() >> cvt::utf16() >> cvt::utf8() / cvt::int8()
>> >> cvt::rc5<32,12,8>(key) / cvt::int8() >> cvt::base64();
>>
>> That expression defines pipeline transformation. Utf7 encoded sequence
>> transforms to utf16 encoded sequence, then to utf8 encoded, then performs
>> rc5 cipher with specified key, then performs base64 encoding.
>>
>> Library can be found at http://sourceforge.net/projects/trotter-cvt/

That definitely seems great.
Your code looks similar to Boost.Serialization Data Flow.
   http://www.boost.org/libs/serialization/doc/dataflow.html
But, we have now Boost.Range.
Assume 'range_copy(rng,it)' just calls
'std::copy(boost::begin(rng),boost::end(rng),it)'.

     range_copy(make_u32_to_u8_iterator_range(src), it);

There is no typedef's.
You can look into <boost/regex/pending/unicode_iterator.hpp>, which
shows such implementations.

-- 
Shunsuke Sogame

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk