Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

sapling

English document is under construction. Now, Japanese and English are written together.

This library is a STL like tree container.

概要 Summary

This library is a STL like tree container.

STL ライクな木のコンテナライブラリです。小さな木のライブラリなので苗木(sapling)と名づけてみました。

特徴 Features

  1. 強力なイテレーター
    1. 全てのイテレーターで親子兄弟に自由に移動可能
    2. 全てのイテレーターがポインタ一つだけをメンバとしているため、コピーが軽い
    3. 走査の方法によっていくつかのイテレーターが用意されている
      1. 直接の子のみを走査する sibling_iterator
      2. pre-order で走査する pre_order_iterator
      3. post-order で走査する post_order_iterator
  2. std::list の延長線上にある
    1. 挿入は挿入予定地の直後のノードを指定
    2. 全てのイテレーターが周回する
  3. アロケーターをきちんと取り扱っている

使い方 Usage

gslib::sapling::tree

This library's main part. このライブラリの本体です。

#include <gslib/sapling/tree.h> using namespace gslib; using namespace sapling; tree< int > t; // create root as 100 // 100 のルートを作成 tree< int >::iterator rt = t.insert( t.end(), 100 ); // create 10, 11 as root's children // 10, 11 をルートの子として作成 t.insert( rt.end(), 10 ); t.insert( rt.end(), 11 ); // erase all notdes under rt. ( this case is same with clear ) // rt 以下を削除 ( クリアと同じ ) t.erase( rt );

gslib::sapling::dump

Output tree to std::stream. 木をストリームに出力します。

#include <gslib/sapling/tree.h> #include <gslib/sapling/dump.h> using namespace gslib; using namespace sapling; tree< int > t; // insert nodes in t. // t にノードを挿入 ... dump( t, std::cout );

gslib::sapling::scribble

This is a tricky. If you don't like it, you can avoid to use it easily. 木を作るのはなかなか面倒です。そこで、トリッキーな方法で木を作ります。嫌悪感を感じる方が多数いると思われますので、tree ライブラリと簡単に切り離して使えるようになっています。

#include <gslib/sapling/tree.h> #include <gslib/sapling/scribble.h> // 以下の木を作る。 // make following tree. // // 0 // 1 // 2 // 3 // 4 // 5 // 6 // 7 // 8 // 9 // 10 tree< int > t; scribble( t ) .b( 0 ) // 子を持つノードは .b()。xml での <tag> ( 1 ) ( 2 ) // 子を持たないノードは ( ? )。xml での <tag/> .b( 3 ).e() // .b( ? ).e() と () は同じ .e() ( 4 ) ( 5 ) .b( 6 ) ( 7 ) ( 8 ) .e() ( 9 ) .e() ( 10 ) .e(); // 終了タグ .e()。xml での </tag>

ディレクトリ構成 : Directories

動作確認環境 : Compile Check Environment

このライブラリは、boost に依存しています。

作者に関して : Author

ライセンス : License

zlib/libpng license

Copyright (C) 2004 &o

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

-----------------------------------------------------------------------------------------

商用利用していただいても、改変していただいても、結構です。謝辞は必要ありませんが、レスポンスがあるとうれしいのは言うまでもありません(^^)。一応 zlib/libpng ライセンスとしておきますが、&o に被害が及ばない範囲でのパブリックドメインであると考えていただいて、差し支えありません。そのため、ライセンスは随時よりゆるいものへ変えていっています。おそらく、ある日突然厳しいライセンスを求めるものになったりはしないと思います。安心してお使いください。

法的には、上記の原文のほうが有効なので、より厳密には日本語訳よりも原文を参考にしてください。日本語訳は、http://opensource.jp/licenses/zlib-license.html から頂いてきました。

zlib/libpngライセンス ( 日本語訳 )

Copyright (c) 2004 &o

本ソフトウェアは「現状のまま」で、明示であるか暗黙であるかを問わず、何らの保証もなく提供されます。本ソフトウェアの使用によって生じるいかなる損害についても、作者は一切の責任を負わないものとします。 以下の制限に従う限り、商用アプリケーションを含めて、本ソフトウェアを任意の目的に使用し、自由に改変して再頒布することをすべての人に許可します。

  1. 本ソフトウェアの出自について虚偽の表示をしてはなりません。あなたがオリジナルのソフトウェアを作成したと主張してはなりません。あなたが本ソフトウェアを製品内で使用する場合、製品の文書に謝辞をれていただければ幸いですが、必須ではありません。
  2. ソースを変更した場合は、そのことを明示しなければなりません。オリジナルのソフトウェアであるという虚偽の表示をしてはなりません。
  3. ソースの頒布物から、この表示を削除したり、表示の内容を変更したりしてはなりません。

Generated on Sat Nov 27 15:02:48 2004 for sapling by doxygen 1.3.6