<?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[CTreectrl Item-Baum speichern]]></title><description><![CDATA[<p>Hallöchen,</p>
<p>ich möchte einen Treebaum(bzw. die items) binär abspeichern<br />
So das man beim öffnen der Datei den Treebaum wieder herstellen kann.</p>
<p>Wie kann man die Item Daten (Text ,Position im Baum usw.) abspeichern ?<br />
Eigentlich steht das ja alles in der TVITEM-Strucktur. aber...</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/150972/ctreectrl-item-baum-speichern</link><generator>RSS for Node</generator><lastBuildDate>Wed, 22 Jul 2026 22:33:53 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/150972.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 21 Jun 2006 19:51:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CTreectrl Item-Baum speichern on Wed, 21 Jun 2006 19:51:16 GMT]]></title><description><![CDATA[<p>Hallöchen,</p>
<p>ich möchte einen Treebaum(bzw. die items) binär abspeichern<br />
So das man beim öffnen der Datei den Treebaum wieder herstellen kann.</p>
<p>Wie kann man die Item Daten (Text ,Position im Baum usw.) abspeichern ?<br />
Eigentlich steht das ja alles in der TVITEM-Strucktur. aber...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1082478</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1082478</guid><dc:creator><![CDATA[BILL]]></dc:creator><pubDate>Wed, 21 Jun 2006 19:51:16 GMT</pubDate></item><item><title><![CDATA[Reply to CTreectrl Item-Baum speichern on Wed, 21 Jun 2006 20:10:24 GMT]]></title><description><![CDATA[<p>Das ganze ist ein rekursver Algorithmus.<br />
Folgender Psudocode:</p>
<pre><code>void Save(Node)
{
  Write contents of Node;
  Write ChildNode Count to file;
  For Each ChildNode
     Save(ChildNode);
}

void Load(Parent)
{
  Load Node from file;
  Create Node;
  Load ChildNode Count from File.
  For Each ChildNode in File
     Load(Node);
}
</code></pre>
<p>Da gibt es zwar noch so ein paar Spzialitäten wie man mit der Root umgeht, aber im großen und ganzen war es das.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1082489</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1082489</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Wed, 21 Jun 2006 20:10:24 GMT</pubDate></item><item><title><![CDATA[Reply to CTreectrl Item-Baum speichern on Wed, 21 Jun 2006 21:53:25 GMT]]></title><description><![CDATA[<p>Hier ein konkretes Beispiel mit TinyXML und CTreeCtrl (allerdings nur laden. Traversieren ist aber gleich):</p>
<pre><code class="language-cpp">#include &quot;tinyxml.h&quot;

	class obj
	{
	  public:
		TiXmlNode * node;
		TiXmlElement * element;
		HTREEITEM ht;
	};

	/* XML Datei -&gt; Strukturansicht */

	TiXmlDocument doc( &quot;tree_Biologie.xml&quot; );
	if(!doc.LoadFile())
		MessageBox(&quot;File wird nicht geladen.&quot;,&quot;Info&quot;,MB_ICONEXCLAMATION);
	else
	{
		// Objektmodell in Strukturansicht übertragen
		obj root, curr, parent, child, brother;

		root.element = doc.RootElement(); 			
		root.ht      = m_TreeCtrl.InsertItem(root.element-&gt;Value()); 

		stack&lt;obj&gt; todo;

		// Traversier-Algorithmus

		todo.push(root);
		while(!todo.empty())
		{
			curr = todo.top(); 
            todo.pop();

			//for each child of current //testweise fürs erste Kind//
			if(child.node = curr.element-&gt;FirstChild())
			{
				child.element	= child.node-&gt;ToElement();
				child.ht		= m_TreeCtrl.InsertItem(child.element-&gt;Value(),0,0,curr.ht,TVI_LAST);
				todo.push(child);
			}

			if(brother.node	= curr.element-&gt;NextSibling())
			{	
				parent.ht		= m_TreeCtrl.GetParentItem(curr.ht);
				brother.element	= brother.node-&gt;ToElement();
				brother.ht		= m_TreeCtrl.InsertItem(brother.element-&gt;Value(),0,0,parent.ht,TVI_LAST); 

				todo.push(brother);
			}
		}
	}
</code></pre>
<p>Vielleicht hilft es weiter. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1082541</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1082541</guid><dc:creator><![CDATA[Erhard Henkes]]></dc:creator><pubDate>Wed, 21 Jun 2006 21:53:25 GMT</pubDate></item><item><title><![CDATA[Reply to CTreectrl Item-Baum speichern on Thu, 22 Jun 2006 09:15:50 GMT]]></title><description><![CDATA[<p>Jo besten Dank,<br />
ich probiere es mal aus</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1082765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1082765</guid><dc:creator><![CDATA[BILL]]></dc:creator><pubDate>Thu, 22 Jun 2006 09:15:50 GMT</pubDate></item></channel></rss>