first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / library / filesystem / filename_tree.h
1 #ifndef FILENAME_TREE_CLASS
2 #define FILENAME_TREE_CLASS
3
4 /*****************************************************************************\
5 *                                                                             *
6 *  Name   : filename_tree                                                     *
7 *  Author : Chris Koeritz                                                     *
8 *                                                                             *
9 *******************************************************************************
10 * Copyright (c) 2004-$now By Author.  This program is free software; you can  *
11 * redistribute it and/or modify it under the terms of the GNU General Public  *
12 * License as published by the Free Software Foundation; either version 2 of   *
13 * the License or (at your option) any later version.  This is online at:      *
14 *     http://www.fsf.org/copyleft/gpl.html                                    *
15 * Please send any updates to: fred@gruntose.com                               *
16 \*****************************************************************************/
17
18 //! This is a support class for the directory_tree.
19 /*!
20   This class has been exported from directory_tree's implementation to
21   avoid redundant code for iteration and such.
22   Note: this is a heavy-weight header that should not be included in other
23   headers.
24 */
25
26 #include "filename_list.h"
27
28 #include <nodes/packable_tree.h>
29
30 namespace filesystem {
31
32 class filename_tree : public nodes::packable_tree
33 {
34 public:
35   filename _dirname;  //!< the full directory name at this position.
36   filename_list _files;  //!< the filenames that are at this node in the tree.
37   int _depth;  //!< how far below root node are we.
38
39   filename_tree();
40
41   virtual ~filename_tree();
42
43   virtual int packed_size() const;
44
45   virtual void pack(basis::byte_array &packed_form) const;
46
47   virtual bool unpack(basis::byte_array &packed_form);
48 };
49
50 //! this is the tree factory used in the recursive_unpack.
51 /*! it meets our needs for regenerating these objects from a streamed form. */
52 class fname_tree_creator : public nodes::packable_tree_factory
53 {
54 public:
55 ////  virtual ~fname_tree_creator() {}
56   virtual nodes::packable_tree *create();
57     //!< implements the create() method for filename_trees to support packing.
58 };
59
60 } //namespace.
61
62 #endif
63