/usr/include/tulip/GlXMLTools.h is in libtulip-ogl-dev 3.1.2-2.3ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | //-*-c++-*-
/**
Authors: David Auber, Patrick Mary, Morgan Mathiaut
from the LaBRI Visualization Team
Email : auber@tulip-software.org
Last modification : 13/03/2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*/
#ifndef DOXYGEN_NOTFOR_DEVEL
#ifndef Tulip_GLXMLTOOLS_H
#define Tulip_GLXMLTOOLS_H
#include <tulip/tulipconf.h>
#include <sstream>
#include <vector>
#include <tulip/Array.h>
#include <tulip/Color.h>
#include <tulip/Coord.h>
typedef struct _xmlNode xmlNode;
typedef xmlNode * xmlNodePtr;
namespace tlp {
/**
* static tools class use to store/load xml data
*/
class GlSimpleEntity;
class TLP_GL_SCOPE GlXMLTools {
public :
/**
* Create a data and a child node in rootNode
*/
static void createDataAndChildrenNodes(xmlNodePtr rootNode,xmlNodePtr &dataNode, xmlNodePtr &childrenNode);
/**
* Create a data node in rootNode
*/
static void createDataNode(xmlNodePtr rootNode,xmlNodePtr &dataNode);
/**
* Create a child node with a given name in rootNode
*/
static void createChild(xmlNodePtr rootNode, const std::string &name, xmlNodePtr &childNode);
/**
* Create a property with name and value in rootNode
*/
static void createProperty(xmlNodePtr rootNode, const std::string &name, const std::string &value);
/**
* Add a text content in rootNode
*/
static void addContent(xmlNodePtr rootNode,const std::string &content);
/**
* Get the data and child node of rootNode
*/
static void getDataAndChildrenNodes(xmlNodePtr rootNode,xmlNodePtr &dataNode, xmlNodePtr &childrenNode);
/**
* Get the data node of rootNode
*/
static void getDataNode(xmlNodePtr rootNode,xmlNodePtr &dataNode);
/**
* Get the data node in the same level of rootNode
*/
static void getDataNodeDirectly(xmlNodePtr rootNode,xmlNodePtr &dataNode);
/**
* Get the data with name of dataNode
*/
static void getData(const std::string &name, xmlNodePtr dataNode, xmlNodePtr &outNode);
/**
* Get the property with name of node
*/
static std::string getProperty(const std::string &name, xmlNodePtr node);
/**
* Get the text content of the rootNode
*/
static void getContent(xmlNodePtr rootNode,std::string &content);
/**
* Create a GlEntity with the given name
*/
static GlSimpleEntity *createEntity(const std::string &name);
/**
* Get the XML output for a vector of Object
*/
template <typename Obj>
static void getXML(xmlNodePtr rootNode,const std::string &name,const typename std::vector<Obj> &vect)
{
xmlNodePtr node;
createChild(rootNode,name,node);
std::stringstream str;
str << "(" ;
typename std::vector<Obj>::const_iterator it=vect.begin();
str << *it ;
++it;
for(;it!=vect.end();++it) {
str << "," << *it ;
}
str << ")" ;
addContent(node,str.str());
}
/**
* Set vector of Object with the given XML
*/
template <typename Obj>
static void setWithXML(xmlNodePtr rootNode,const std::string &name,std::vector<Obj> &vect)
{
xmlNodePtr node;
GlXMLTools::getData(name, rootNode, node);
std::string tmp;
getContent(node,tmp);
std::istringstream is(tmp);
Obj data;
char c=is.get();
while(c!=')'){
is >> data ;
vect.push_back(data);
c=is.get();
}
}
/**
* Get the XML output for an Object
*/
template <typename Obj>
static void getXML(xmlNodePtr rootNode, const std::string &name, const Obj &value)
{
xmlNodePtr node;
createChild(rootNode,name,node);
std::stringstream str;
str << value ;
addContent(node,str.str());
}
/**
* Set an Object with the given XML
*/
template <typename Obj>
static void setWithXML(xmlNodePtr rootNode, const std::string &name, Obj &value) {
xmlNodePtr node;
GlXMLTools::getData(name, rootNode, node);
std::string tmp;
getContent(node,tmp);
std::stringstream str(tmp);
str >> value;
}
};
}
#endif
#endif //DOXYGEN_NOTFOR_DEVEL
|