htuu_string.hh

来自「liburl是一个小的C++库」· HH 代码 · 共 59 行

HH
59
字号
/*  $Id: htuu_string.hh,v 1.3 2002/04/04 17:30:29 t16 Exp $  HTUU encoded string class.  Copyright (C) 2002  Kasper Peeters <k.peeters@damtp.cam.ac.uk>  This program and its components are free software; you can  redistribute it and/or modify it under the terms of the GNU General  Public License as published by the Free Software Foundation; either  version 2, or (at your option) any later version.   This program and its components are distributed in the hope that it  will be useful, but WITHOUT ANY WARRANTY; without even the implied  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See  the GNU General Public License for more details.   You should have received a copy of the GNU General Public License in  the file COPYING accompanying this program; if not, write to the  Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  Reference: RFC 1113*/#ifndef htuu_string_hh__#define htuu_string_hh__#include <vector.h>template<class InputIterator, class OutputIterator>void htuu_encode(InputIterator begin, InputIterator end, OutputIterator out)	{	bool b2,b3;   begin.value_type i1,i2,i3,i4;	while(begin!=end) {		i1=i2=i3=i4=0;		b2=b3=false;		i1=*(begin++);		if(begin!=end) { i2=*(begin++); b2=true; }		if(begin!=end) { i3=*(begin++); b3=true; }		*(out++) = six2pr[ *(begin) >> 2 ];		*(out++) = six2pr[ ((*(begin++) << 4) & 060) | ((i2 >> 4) & 017)]; 		if(b2)			*(out++) = six2pr[ ((i2 << 2) & 074) | ((i3 >> 6) & 03)];		else 			*(out++) = '=';		if(b3)			*(out++) = six2pr[ i3 & 077];		else 			*(out++) = '=';		}	}//string htuu_decode(const string& in) const;#endif

⌨️ 快捷键说明

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