Click here to Skip to main content
15,886,547 members
Articles / Desktop Programming / WTL

Boost.Range support for ATL/WTL CString

Rate me:
Please Sign up or sign in to vote.
4.12/5 (9 votes)
2 Sep 20052 min read 36.1K   262   11  
Consistent interfaces to CString using Boost.Range.
#pragma once

#ifndef _WIN32_WCE

#include <atlmisc.h>
#include <boost/range/iterator_range.hpp>

namespace tomato {

	namespace detail {

		template< class FindFilePredT, class StringT >
		struct find_file_range_base
		{
			typedef boost::iterator_range<
				find_file_iterator<FindFilePredT, StringT>
			> type;
		};

	} // namespace detail

template< class FindFilePredT, class StringT >
struct find_file_range :
	detail::find_file_range_base<FindFilePredT, StringT>::type
{
private:
	typedef typename detail::find_file_range_base<FindFilePredT, StringT>::type super_t;

public:
	find_file_range(FindFilePredT pred, LPCTSTR pstrName) :
		super_t(
			find_file_iterator<FindFilePredT, StringT>(pred, pstrName),
			find_file_iterator<FindFilePredT, StringT>(pred)
		)
	{ }
};

// object generators
/*
template< class FindFilePredT >
find_file_range<FindFilePredT>
make_find_file_range(FindFilePredT pred, LPCTSTR pstrName)
{
	return find_file_range<FindFilePredT>(pred, pstrName);
}
*/
template< class FindFilePredT, class StringT >
inline
find_file_range<FindFilePredT, StringT>
make_find_file_range(FindFilePredT pred, StringT const& strName)
{
	return find_file_range<FindFilePredT, StringT>(pred, strName);
}

template< class StringT, class FindFilePredT >
inline
find_file_range<FindFilePredT, StringT>
make_find_file_range(FindFilePredT pred, LPCTSTR pstrName)
{
	return find_file_range<FindFilePredT, StringT>(pred, pstrName);
}

} // namespace tomato

#endif // _WIN32_WCE

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Japan Japan
I am worried about my poor English...

Comments and Discussions