00001 #ifndef IONFLUX_TOOLS_TREERESOLVER 00002 #define IONFLUX_TOOLS_TREERESOLVER 00003 /* ========================================================================== 00004 * Ionflux Tools 00005 * Copyright (c) 2004 Joern P. Meier 00006 * mail@ionflux.org 00007 * -------------------------------------------------------------------------- 00008 * TreeResolver.hpp Tree path resolution. 00009 * ========================================================================== 00010 * 00011 * This file is part of Ionflux Tools. 00012 * 00013 * Ionflux Tools is free software; you can redistribute it and/or modify it 00014 * under the terms of the GNU General Public License as published by the Free 00015 * Software Foundation; either version 2 of the License, or (at your option) 00016 * any later version. 00017 * 00018 * Ionflux Tools is distributed in the hope that it will be useful, but 00019 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00020 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00021 * for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with Ionflux Tools; if not, write to the Free Software Foundation, 00025 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 * 00027 * ========================================================================== */ 00028 00029 #include <string> 00030 #include <iostream> 00031 #include <vector> 00032 #include "ionflux/Tree.hpp" 00033 #include "ionflux/Tokenizer.hpp" 00034 #include "ionflux/NodeReference.hpp" 00035 00036 namespace Ionflux 00037 { 00038 00039 namespace Tools 00040 { 00041 00042 struct DataEntry; 00043 struct TreePath; 00044 class Tree; 00045 class NodeReference; 00046 00054 class TreeResolver 00055 { 00056 protected: 00057 00058 public: 00060 static const TokenType TT_RES_OPERATOR; 00062 static const TokenType TT_SUB_LEFT; 00064 static const TokenType TT_SUB_RIGHT; 00066 static const TokenType TT_RES_PAR_LEFT; 00068 static const TokenType TT_RES_PAR_RIGHT; 00069 00074 TreeResolver(); 00075 00080 virtual ~TreeResolver(); 00081 00091 static bool parseTreePath(const std::string &treePathExpr, 00092 std::vector<NodeReference> &nodeRefs); 00093 00110 static bool createTreePath(Tree *tree, 00111 std::vector<NodeReference> &nodeRefs, TreePath &treePath, 00112 bool createPath, bool nodesOnly = false); 00113 00114 }; 00115 00116 } 00117 00118 } 00119 00123 #endif