00001 #ifndef FILENAME_TREE_IMPLEMENTATION_FILE 00002 #define FILENAME_TREE_IMPLEMENTATION_FILE 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : filename_tree * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 2004-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00018 #include "filename_tree.h" 00019 00020 using namespace basis; 00021 using namespace nodes; 00022 00023 nodes::packable_tree *fname_tree_creator::create() { return new filename_tree; } 00024 00026 00027 filename_tree::filename_tree() : _depth(0) {} 00028 00029 filename_tree::~filename_tree() { _dirname = ""; _files.reset(); } 00030 00031 void filename_tree::pack(byte_array &packed_form) const { 00032 basis::attach(packed_form, _depth); 00033 _dirname.pack(packed_form); 00034 _files.pack(packed_form); 00035 } 00036 00037 bool filename_tree::unpack(byte_array &packed_form) { 00038 if (!basis::detach(packed_form, _depth)) return false; 00039 if (!_dirname.unpack(packed_form)) return false; 00040 if (!_files.unpack(packed_form)) return false; 00041 return true; 00042 } 00043 00044 00045 #endif //FILENAME_TREE_IMPLEMENTATION_FILE 00046
1.5.1