1 | /** |
---|
2 | * This source file is part of OgreColladaPlugin |
---|
3 | * an addon for OGRE (Object-oriented Graphics Rendering Engine) |
---|
4 | * For the latest info, see http://www.ogre3d.org/ |
---|
5 | * |
---|
6 | * This program is free software; you can redistribute it and/or modify it under |
---|
7 | * the terms of the GNU Lesser General Public License as published by the Free Software |
---|
8 | * Foundation; either version 2 of the License, or (at your option) any later |
---|
9 | * version. |
---|
10 | |
---|
11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
---|
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
13 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
14 | |
---|
15 | * You should have received a copy of the GNU Lesser General Public License along with |
---|
16 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
17 | * Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
18 | * http://www.gnu.org/copyleft/lesser.txt. |
---|
19 | * |
---|
20 | * @author Philipp Hartl |
---|
21 | * @see README |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef __COLLADA_UTILS_H__ |
---|
25 | #define __COLLADA_UTILS_H__ |
---|
26 | |
---|
27 | #include "OgreColladaPrerequisites.h" |
---|
28 | |
---|
29 | namespace Ogre |
---|
30 | { |
---|
31 | /** |
---|
32 | * some functions to get information out of xml data nodes |
---|
33 | */ |
---|
34 | class ColladaUtils |
---|
35 | { |
---|
36 | public: |
---|
37 | |
---|
38 | /** |
---|
39 | * search for the id in the childs of start node |
---|
40 | * and return the node corresponding to the id string |
---|
41 | * in first child line, no more! |
---|
42 | * <tagname id="id" ...> |
---|
43 | * |
---|
44 | * @param start the xml node where we start to search |
---|
45 | * @param id the string identifier we are looking for |
---|
46 | * @return the xmlNode if found, else NULL |
---|
47 | */ |
---|
48 | static xmlNode *getChildById(xmlNode *start, const char *id); |
---|
49 | |
---|
50 | /** |
---|
51 | * search for the tagname in the childs of start node |
---|
52 | * and return the node corresponding to the string |
---|
53 | * in first child line, no more! |
---|
54 | * <tagname ...> |
---|
55 | * |
---|
56 | * @param start the xml node where to start |
---|
57 | * @param tagname the string element we are looking for |
---|
58 | * @return the xmlNode if found, else NULL |
---|
59 | */ |
---|
60 | static xmlNode *getChildByTagName(xmlNode *start, const String &tagname); |
---|
61 | |
---|
62 | /** |
---|
63 | * similar to getChildByTagName, but returns a node list |
---|
64 | * |
---|
65 | * @see getChildByTagName |
---|
66 | * @return a list with xmlNode * |
---|
67 | */ |
---|
68 | static xmlNodePtrVector getChildsByTagName(xmlNode *start, const String &tagname); |
---|
69 | |
---|
70 | /** |
---|
71 | * get content of node, between <node>...</node> |
---|
72 | * interior entities will be substituted !! |
---|
73 | * |
---|
74 | * @param node the xml node that holds the content |
---|
75 | * @return the string content which is hold by the xml node |
---|
76 | */ |
---|
77 | static String getContent(xmlNode *node); |
---|
78 | static String getContentDirect(xmlNode *node); |
---|
79 | |
---|
80 | /** |
---|
81 | * look for the attribute property name we want |
---|
82 | * and return its value |
---|
83 | * <tagname attribute="value" ...> |
---|
84 | * |
---|
85 | * @param node the actual xml node |
---|
86 | * @param property the property we want to get out |
---|
87 | * @return the string value of the property |
---|
88 | */ |
---|
89 | static String getProperty(xmlNode *node, const char *property); |
---|
90 | static String getProperty(xmlNode *node, const String &property); |
---|
91 | |
---|
92 | /** |
---|
93 | * print all child elements of this node |
---|
94 | * |
---|
95 | * @param node a node in tree hierachy |
---|
96 | * @return void |
---|
97 | */ |
---|
98 | static void printChildElements(xmlNode *node); |
---|
99 | |
---|
100 | /** |
---|
101 | * print all elements of this node |
---|
102 | * children of their children and so on |
---|
103 | * |
---|
104 | * @param node a node in tree hierachy |
---|
105 | * @return void |
---|
106 | */ |
---|
107 | static void printAllElements(xmlNode *node); |
---|
108 | }; |
---|
109 | } |
---|
110 | |
---|
111 | #endif // __COLLADA_UTILS_H__ |
---|