⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adapter

📁 C语言库函数的原型,有用的拿去
💻
📖 第 1 页 / 共 3 页
字号:
			_Right._Mycont = _Tcont;
			}
		}

_STLCLR_FIELD_ACCESS:
	// data members
	_Mycont_t^ _Mycont;	// the wrapped ICollection interface
	};

//
// TEMPLATE CLASS collection_adapter<IDictionary>
//
template<>
	ref class collection_adapter<
		System::Collections::IDictionary>
	{	// wrapper for IDictionary
public:
	// types
	typedef System::Collections::IDictionary _Mycont_t;
	typedef System::Collections::IEnumerator _Myenum_t;
	typedef System::Object^ _Value_t;
	typedef collection_adapter<_Mycont_t> _Mytype_t;

	typedef Enum_iterator<_Mycont_t, _Myenum_t, _Value_t> iterator;

	typedef int size_type;
	typedef int difference_type;
	typedef _Value_t value_type;
	typedef _Value_t% reference;

	// basics
	collection_adapter()
		:	_Mycont(nullptr)
		{	// construct empty wrapper
		}

	collection_adapter(collection_adapter% _Right)
		:	_Mycont(_Right._Mycont)
		{	// construct by copying _Right
		}

	collection_adapter% operator=(collection_adapter% _Right)
		{	// assign
		_Mycont = _Right._Mycont;
		return (*this);
		}

	collection_adapter% operator=(collection_adapter^ _Right)
		{	// assign
		_Mycont = _Right->_Mycont;
		return (*this);
		}

	// constructors
	collection_adapter(_Mycont_t^ _Right)
		:	_Mycont(_Right)
		{	// construct by wrapping
		}

	// destructor
	~collection_adapter()
		{	// destroy the object
		}

	// accessors
	operator _Mycont_t^()
		{	// convert to base
		return (_Mycont);
		}

	_Mycont_t^ base()
		{	// return base
		return (_Mycont);
		}

	// iterator generators
	iterator begin()
		{	// return iterator for beginning of input sequence
		return (iterator(_Mycont, _Mycont->GetEnumerator()));
		}

	iterator end()
		{	// return iterator for end of input sequence
		return (iterator(_Mycont));
		}

	// size controllers
	size_type size()
		{	// return length of sequence
		return (_Mycont->Count);
		}

	// mutators
	void swap(collection_adapter% _Right)
		{	// exchange contents with _Right
		if ((Object^)this != %_Right)
			{	// worth doing, swap
			_Mycont_t^ _Tcont = _Mycont;

			_Mycont = _Right._Mycont;
			_Right._Mycont = _Tcont;
			}
		}

_STLCLR_FIELD_ACCESS:
	// data members
	_Mycont_t^ _Mycont;	// the wrapped IDictionary interface
	};

//
// TEMPLATE CLASS collection_adapter<IDictionary<T> >
//
template<typename _Key_t,
	typename _Mapped_t>
	ref class collection_adapter<
		System::Collections::Generic::IDictionary<_Key_t, _Mapped_t> >
	{	// wrapper for IDictionary<T>
public:
	// types
	typedef System::Collections::Generic::IDictionary<
		_Key_t, _Mapped_t> _Mycont_t;
	typedef System::Collections::Generic::KeyValuePair<
		_Key_t, _Mapped_t> _Value_t;
	typedef System::Collections::Generic::IEnumerator<
		_Value_t> _Myenum_t;
	typedef collection_adapter<_Mycont_t> _Mytype_t;

	typedef Enum_iterator<_Mycont_t, _Myenum_t, _Value_t> iterator;

	typedef _Key_t key_type;
	typedef _Mapped_t mapped_type;

	typedef int size_type;
	typedef int difference_type;
	typedef _Value_t value_type;
	typedef _Value_t% reference;

	// basics
	collection_adapter()
		:	_Mycont(nullptr)
		{	// construct empty wrapper
		}

	collection_adapter(collection_adapter% _Right)
		:	_Mycont(_Right._Mycont)
		{	// construct by copying _Right
		}

	collection_adapter% operator=(collection_adapter% _Right)
		{	// assign
		_Mycont = _Right._Mycont;
		return (*this);
		}

	collection_adapter% operator=(collection_adapter^ _Right)
		{	// assign
		_Mycont = _Right->_Mycont;
		return (*this);
		}

	// constructors
	collection_adapter(_Mycont_t^ _Right)
		:	_Mycont(_Right)
		{	// construct by wrapping
		}

	// destructor
	~collection_adapter()
		{	// destroy the object
		}

	// accessors
	operator _Mycont_t^()
		{	// convert to base
		return (_Mycont);
		}

	_Mycont_t^ base()
		{	// return base
		return (_Mycont);
		}

	// iterator generators
	iterator begin()
		{	// return iterator for beginning of input sequence
		return (iterator(_Mycont, _Mycont->GetEnumerator()));
		}

	iterator end()
		{	// return iterator for end of input sequence
		return (iterator(_Mycont));
		}

	// size controllers
	size_type size()
		{	// return length of sequence
		return (_Mycont->Count);
		}

	// mutators
	void swap(collection_adapter% _Right)
		{	// exchange contents with _Right
		if ((Object^)this != %_Right)
			{	// worth doing, swap
			_Mycont_t^ _Tcont = _Mycont;

			_Mycont = _Right._Mycont;
			_Right._Mycont = _Tcont;
			}
		}

_STLCLR_FIELD_ACCESS:
	// data members
	_Mycont_t^ _Mycont;	// the wrapped IDictionary interface
	};

//
// TEMPLATE CLASS collection_adapter<IList>
//
template<>
	ref class collection_adapter<
		System::Collections::IList>
	{	// wrapper for IList
public:
	// types
	typedef System::Collections::IList _Mycont_t;
	typedef System::Object^ _Value_t;
	typedef collection_adapter<_Mycont_t> _Mytype_t;

	typedef BCL_iterator<_Mytype_t, false> iterator;

	typedef int size_type;
	typedef int difference_type;
	typedef _Value_t value_type;
	typedef BCL_reference<_Mytype_t, false> reference;

	// basics
	collection_adapter()
		:	_Mycont(nullptr)
		{	// construct empty wrapper
		}

	collection_adapter(collection_adapter% _Right)
		:	_Mycont(_Right._Mycont)
		{	// construct by copying _Right
		}

	collection_adapter% operator=(collection_adapter% _Right)
		{	// assign
		_Mycont = _Right._Mycont;
		return (*this);
		}

	collection_adapter% operator=(collection_adapter^ _Right)
		{	// assign
		_Mycont = _Right->_Mycont;
		return (*this);
		}

	// constructors
	collection_adapter(_Mycont_t^ _Right)
		:	_Mycont(_Right)
		{	// construct by wrapping
		}

	// destructor
	~collection_adapter()
		{	// destroy the object
		}

	// accessors
	bool valid_bias(size_type _Bias)
		{	// test if _Bias is currently a valid bias
		return (0 <= _Bias && _Bias <= size());
		}

	reference at(size_type _Bias)
		{	// subscript mutable sequence with checking, biased
		return (reference(this, _Bias));
		}

	value_type at_val(size_type _Pos)
		{	// subscript mutable sequence with checking
		return (_Mycont[_Pos]);
		}

	void at_set(size_type _Pos, value_type _Val)
		{	// assign to subscripted mutable sequence with checking
		_Mycont[_Pos] = _Val;
		}

	property value_type default[difference_type]
		{	// get or set subscripted element
		value_type get(difference_type _Pos)
			{	// get _Pos element
			return (_Mycont[_Pos]);
			}

		void set(difference_type _Pos, value_type _Val)
			{	// set _Pos element
			_Mycont[_Pos] = _Val;
			}
		};

	// accessors
	operator _Mycont_t^()
		{	// convert to base
		return (_Mycont);
		}

	_Mycont_t^ base()
		{	// return base
		return (_Mycont);
		}

	// iterator generators
	iterator make_iterator(size_type _Bias)
		{	// return iterator for offset
		return (iterator(this, _Bias));
		}

	iterator begin()
		{	// return iterator for beginning of mutable sequence
		return (make_iterator(0));
		}
	iterator end()
		{	// return iterator for end of mutable sequence
		return (make_iterator(size()));
		}

	// size controllers
	size_type size()
		{	// return length of sequence
		return (_Mycont->Count);
		}

	// mutators
	void swap(collection_adapter% _Right)
		{	// exchange contents with _Right
		if ((Object^)this != %_Right)
			{	// worth doing, swap
			_Mycont_t^ _Tcont = _Mycont;

			_Mycont = _Right._Mycont;
			_Right._Mycont = _Tcont;
			}
		}

_STLCLR_FIELD_ACCESS:
	// data members
	_Mycont_t^ _Mycont;	// the wrapped IList interface
	};

//
// TEMPLATE CLASS collection_adapter<IList<T> >
//
template<typename _Value_t>
	ref class collection_adapter<
		System::Collections::Generic::IList<_Value_t> >
	{	// wrapper for IList<T>
public:
	// types
	typedef System::Collections::Generic::IList<_Value_t> _Mycont_t;
	typedef collection_adapter<_Mycont_t> _Mytype_t;

	typedef BCL_iterator<_Mytype_t, false> iterator;

	typedef int size_type;
	typedef int difference_type;
	typedef _Value_t value_type;
	typedef BCL_reference<_Mytype_t, false> reference;

	// basics
	collection_adapter()
		:	_Mycont(nullptr)
		{	// construct empty wrapper
		}

	collection_adapter(collection_adapter% _Right)
		:	_Mycont(_Right._Mycont)
		{	// construct by copying _Right
		}

	collection_adapter% operator=(collection_adapter% _Right)
		{	// assign
		_Mycont = _Right._Mycont;
		return (*this);
		}

	collection_adapter% operator=(collection_adapter^ _Right)
		{	// assign
		_Mycont = _Right->_Mycont;
		return (*this);
		}

	// constructors
	collection_adapter(_Mycont_t^ _Right)
		:	_Mycont(_Right)
		{	// construct by wrapping
		}

	// destructor
	~collection_adapter()
		{	// destroy the object
		}

	// accessors
	bool valid_bias(size_type _Bias)
		{	// test if _Bias is currently a valid bias
		return (0 <= _Bias && _Bias <= size());
		}

	reference at(size_type _Bias)
		{	// subscript mutable sequence with checking, biased
		return (reference(this, _Bias));
		}

	value_type at_val(size_type _Pos)
		{	// subscript mutable sequence with checking
		return (_Mycont[_Pos]);
		}

	void at_set(size_type _Pos, value_type _Val)
		{	// assign to subscripted mutable sequence with checking
		_Mycont[_Pos] = _Val;
		}

	property value_type default[difference_type]
		{	// get or set subscripted element
		value_type get(difference_type _Pos)
			{	// get _Pos element
			return (_Mycont[_Pos]);
			}

		void set(difference_type _Pos, value_type _Val)
			{	// set _Pos element
			_Mycont[_Pos] = _Val;
			}
		};

	// accessors
	operator _Mycont_t^()
		{	// convert to base
		return (_Mycont);
		}

	_Mycont_t^ base()
		{	// return base
		return (_Mycont);
		}

	// iterator generators
	iterator make_iterator(size_type _Bias)
		{	// return iterator for offset
		return (iterator(this, _Bias));
		}

	iterator begin()
		{	// return iterator for beginning of mutable sequence
		return (make_iterator(0));
		}

	iterator end()
		{	// return iterator for end of mutable sequence
		return (make_iterator(size()));
		}

	// size controllers
	size_type size()
		{	// return length of sequence
		return (_Mycont->Count);
		}

	// mutators
	void swap(collection_adapter% _Right)
		{	// exchange contents with _Right
		if ((Object^)this != %_Right)
			{	// worth doing, swap
			_Mycont_t^ _Tcont = _Mycont;

			_Mycont = _Right._Mycont;
			_Right._Mycont = _Tcont;
			}
		}

_STLCLR_FIELD_ACCESS:
	// data members
	_Mycont_t^ _Mycont;	// the wrapped IList interface
	};

	namespace impl {
//
// TEMPLATE CLASS range_enumerator_base
//
template<typename _Iter_t,
	typename _Value_t>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -