Back to index

texmacs  1.0.7.15
path.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : path.hpp
00004 * DESCRIPTION: paths are integer lists,
00005 *              which are for instance useful to select subtrees in trees
00006 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00007 *******************************************************************************
00008 * This software falls under the GNU general public license version 3 or later.
00009 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00010 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00011 ******************************************************************************/
00012 
00013 #ifndef PATH_H
00014 #define PATH_H
00015 #include "list.hpp"
00016 typedef list<int> path;
00017 #include "tree_cursor.hpp"
00018 
00019 /******************************************************************************
00020 * General routines
00021 ******************************************************************************/
00022 
00023 bool   zero_path (path p);
00024 int    hash (path p);
00025 string as_string (path p);
00026 path   as_path (string s);
00027 bool   version_inf_eq (string v1, string v2);
00028 bool   version_inf (string v1, string v2);
00029 
00030 /******************************************************************************
00031 * Operations on paths
00032 ******************************************************************************/
00033 
00034 path path_up (path p);
00035 path path_up (path p, int times);
00036 bool path_inf (path p1, path p2);
00037 bool path_inf_eq (path p1, path p2);
00038 bool path_less (path p1, path p2);
00039 bool path_less_eq (path p1, path p2);
00040 path path_add (path p, int plus);
00041 path path_add (path p, int plus, int pos);
00042 #define path_inc(p) path_add(p,1)
00043 #define path_dec(p) path_add(p,-1)
00044 path operator / (path p, path q);
00045 path common (path start, path end);
00046 
00047 /******************************************************************************
00048 * Getting subtrees from paths
00049 ******************************************************************************/
00050 
00051 bool  has_subtree (tree t, path p);
00052 tree& subtree (tree& t, path p);
00053 tree& parent_subtree (tree& t, path p);
00054 
00055 #endif // defined PATH_H