<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[basic_streambuf versuche]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>Ich hab mir folgenden Beitrag als Ausgangsgrundlage genommen <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-25962-and-postdays-is-0-and-postorder-is-asc-and-start-is-70-and-sid-is-4f484aa6e4370badae0cac27200c8aae.html" rel="nofollow">mir reicht's! Kryptostream muß her!</a></p>
<p>Jetzt wollte ich das ganze als Steambuffer implementieren, so das ich den Crypt-Stream so aufrufen kann:</p>
<pre><code class="language-cpp">crypt&lt;RC4&gt; rc4();
crypt.setKey(128, &quot;passphrase&quot;);
crypt &lt;&lt; &quot;zu verschlüsseln&quot;;
crypt.clear();
</code></pre>
<p>Die eingabe zum Stream können/sollen sein ein string, filestream oder was auch immer. Folgendes hab ich bisher schon gebastelt:<br />
(Nur zum Testen für den basic_streambuf)</p>
<pre><code class="language-cpp">template&lt;class _char, class _traits = std::char_traits&lt;_char&gt;&gt;
class myClassBuf: public std::basic_streambuf&lt;_char, _traits&gt;
{
	public:
		myClassBuf(): _buffer(new std::basic_iostream&lt;_char, _traits&gt;)
		{

		};

		virtual ~myClassBuf() {};

		typedef _char						char_type;
		typedef _traits						traits_type;
		typedef typename _traits::int_type	int_type;
		typedef typename _traits::pos_type	pos_type;
		//typedef std::basic_streambuf&lt;_char, _traits&gt;::pos_type pos_type;

		virtual myClassBuf *setbuf(char_type* buf, std::streamsize)
		{

		};

		virtual int_type overflow(int_type c = _traits::eof())
		{

		};

		virtual int_type underflow()
		{

		};

	protected:
		char_type *_buffer;
		std::streamsize _size;
};

template&lt;class _char, class _traits = std::char_traits&lt;_char&gt;&gt;
class myClassStream: std::basic_iostream&lt;_char, _traits&gt;
{
	public:
		myClassStream();
		~myClassStream() {};
};

template&lt;class charT, class traits&gt;
myClassStream&lt;charT, traits&gt;::myClassStream(): myClassBuffer&lt;charT, traits&gt;(), std::basic_iostream&lt;_char. _traits&gt;()
{

}
</code></pre>
<p>Ich hab aber leider keine Ahnung wie ich weitermachen soll/muss. Google ist in solcher beziehung nicht grad sehr ergiebig.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/222322/basic_streambuf-versuche</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 05:08:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/222322.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Sep 2008 18:02:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to basic_streambuf versuche on Wed, 10 Sep 2008 18:02:40 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>Ich hab mir folgenden Beitrag als Ausgangsgrundlage genommen <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-25962-and-postdays-is-0-and-postorder-is-asc-and-start-is-70-and-sid-is-4f484aa6e4370badae0cac27200c8aae.html" rel="nofollow">mir reicht's! Kryptostream muß her!</a></p>
<p>Jetzt wollte ich das ganze als Steambuffer implementieren, so das ich den Crypt-Stream so aufrufen kann:</p>
<pre><code class="language-cpp">crypt&lt;RC4&gt; rc4();
crypt.setKey(128, &quot;passphrase&quot;);
crypt &lt;&lt; &quot;zu verschlüsseln&quot;;
crypt.clear();
</code></pre>
<p>Die eingabe zum Stream können/sollen sein ein string, filestream oder was auch immer. Folgendes hab ich bisher schon gebastelt:<br />
(Nur zum Testen für den basic_streambuf)</p>
<pre><code class="language-cpp">template&lt;class _char, class _traits = std::char_traits&lt;_char&gt;&gt;
class myClassBuf: public std::basic_streambuf&lt;_char, _traits&gt;
{
	public:
		myClassBuf(): _buffer(new std::basic_iostream&lt;_char, _traits&gt;)
		{

		};

		virtual ~myClassBuf() {};

		typedef _char						char_type;
		typedef _traits						traits_type;
		typedef typename _traits::int_type	int_type;
		typedef typename _traits::pos_type	pos_type;
		//typedef std::basic_streambuf&lt;_char, _traits&gt;::pos_type pos_type;

		virtual myClassBuf *setbuf(char_type* buf, std::streamsize)
		{

		};

		virtual int_type overflow(int_type c = _traits::eof())
		{

		};

		virtual int_type underflow()
		{

		};

	protected:
		char_type *_buffer;
		std::streamsize _size;
};

template&lt;class _char, class _traits = std::char_traits&lt;_char&gt;&gt;
class myClassStream: std::basic_iostream&lt;_char, _traits&gt;
{
	public:
		myClassStream();
		~myClassStream() {};
};

template&lt;class charT, class traits&gt;
myClassStream&lt;charT, traits&gt;::myClassStream(): myClassBuffer&lt;charT, traits&gt;(), std::basic_iostream&lt;_char. _traits&gt;()
{

}
</code></pre>
<p>Ich hab aber leider keine Ahnung wie ich weitermachen soll/muss. Google ist in solcher beziehung nicht grad sehr ergiebig.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1579904</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1579904</guid><dc:creator><![CDATA[VirtualDreams]]></dc:creator><pubDate>Wed, 10 Sep 2008 18:02:40 GMT</pubDate></item></channel></rss>