This file is indexed.

/usr/include/tulip/GlXMLTools.h is in libtulip-dev 4.8.0dfsg-2+b7.

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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*
 *
 * This file is part of Tulip (www.tulip-software.org)
 *
 * Authors: David Auber and the Tulip development Team
 * from LaBRI, University of Bordeaux
 *
 * Tulip is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 *
 * Tulip is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 */
///@cond DOXYGEN_HIDDEN

#ifndef DOXYGEN_NOTFOR_DEVEL

#ifndef Tulip_GLXMLTOOLS_H
#define Tulip_GLXMLTOOLS_H

#include <sstream>
#include <vector>
#include <map>
#include <cassert>

#include <tulip/tulipconf.h>

namespace tlp {

/**
 * static tools class use to store/load xml data
 */
class GlSimpleEntity;

class TLP_GL_SCOPE GlXMLTools {

public :

  /**
   * Create and enter into a new data node
   */
  static void beginDataNode(std::string &outString);

  /**
   * End last data node
   */
  static void endDataNode(std::string &outString);

  /**
   * Enter into a data node and set the currentPosition integer to the position next the data tag
   */
  static void enterDataNode(const std::string &inString, unsigned int &currentPosition);

  /**
   * Leave a data node and set the currentPosition integer to the position next the data end tag
   */
  static void leaveDataNode(const std::string &inString, unsigned int &currentPosition);

  /**
   * Create and enter into a new children node with name : name
   */
  static void beginChildNode(std::string &outString, const std::string &name="children");

  /**
   * End last children node with name : name
   */
  static void endChildNode(std::string &outString, const std::string &name="children");

  /**
   * Enter into a child node and set the currentPosition integer to the position next the child tag
   * \return child name
   */
  static std::string enterChildNode(const std::string &inString, unsigned int &currentPosition);

  /**
   * Leave into a child node and set the currentPosition integer to the position next the child end tag
   * \return child name
   */
  static void leaveChildNode(const std::string &inString, unsigned int &currentPosition, const std::string &childName);

  /**
   * Create a property with name and value in rootNode
   */
  static void createProperty(std::string &outString, const std::string &name, const std::string &value, const std::string &parent="");

  /**
   * Get properties associated with the last opened child
   * These properties is returned into a map of string/string
   */
  static std::map<std::string,std::string> getProperties(const std::string &inString, unsigned int &currentPosition);

  /**
   * 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(std::string &outString,const std::string &name,const typename std::vector<Obj> &vect) {

    std::stringstream str;
    str << "(" ;
    typename std::vector<Obj>::const_iterator it=vect.begin();
    assert(it != vect.end());
    str << *it ;
    ++it;

    for(; it!=vect.end(); ++it) {
      str << "," << *it ;
    }

    str << ")" ;
    outString.append("<"+name+">"+str.str()+"</"+name+">\n");
  }

  /**
   * Set vector of Object with the given XML
   */
  template <typename Obj>
  static void setWithXML(const std::string &inString, unsigned int &currentPosition,const std::string &name,std::vector<Obj> &vect) {

    goToNextCaracter(inString,currentPosition);

    std::string nameTag=inString.substr(currentPosition,name.size()+2);
    assert(nameTag=="<"+name+">");
    currentPosition+=name.size()+2;

    size_t endValuePosition=inString.find("</"+name+">",currentPosition);
    assert(endValuePosition!=std::string::npos);

    std::istringstream is(inString.substr(currentPosition,endValuePosition-currentPosition));
    Obj data;
    char c=is.get();

    while(c!=')') {
      is >> data ;
      vect.push_back(data);
      c=is.get();
    }

    currentPosition=endValuePosition+name.size()+3;

  }

  /**
   * Get the XML output for an Object
   */
  template <typename Obj>
  static void getXML(std::string &outString, const std::string &name, const Obj &value) {
    std::stringstream str;
    str << value ;
    applyIndentation(outString);
    outString.append("<"+name+">"+str.str()+"</"+name+">\n");
  }


  static bool checkNextXMLtag(const std::string &inString, unsigned int &currentPosition, const std::string &name) {
    unsigned int tmp=currentPosition;
    goToNextCaracter(inString,tmp);
    std::string nameTag=inString.substr(tmp,name.size()+2);
    return (nameTag=="<"+name+">");
  }

  /**
   * Set an Object with the given XML
   */
  template <typename Obj>
  static void setWithXML(const std::string &inString, unsigned int &currentPosition, const std::string &name, Obj &value) {

    goToNextCaracter(inString,currentPosition);

    std::string nameTag=inString.substr(currentPosition,name.size()+2);
    assert(nameTag=="<"+name+">");
    currentPosition+=name.size()+2;

    size_t endValuePosition=inString.find("</"+name+">",currentPosition);
    assert(endValuePosition!=std::string::npos);

    std::stringstream str(inString.substr(currentPosition,endValuePosition-currentPosition));
    str >> value;
    currentPosition=endValuePosition+name.size()+3;
  }

  /**
   * Set an Object with the given XML and default value
   */
  template <typename Obj>
  static void setWithXML(const std::string &inString, unsigned int &currentPosition, const std::string &name, Obj &value,const Obj &defValue) {
    goToNextCaracter(inString,currentPosition);

    std::string nameTag=inString.substr(currentPosition,name.size()+2);

    if(nameTag=="<"+name+">") {
      currentPosition+=name.size()+2;

      size_t endValuePosition=inString.find("</"+name+">",currentPosition);
      assert(endValuePosition!=std::string::npos);

      std::stringstream str(inString.substr(currentPosition,endValuePosition-currentPosition));
      str >> value;
      currentPosition=endValuePosition+name.size()+3;
    }
    else {
      value=defValue;
    }
  }

private :

  static void applyIndentation(std::string &outString);
  static void goToNextCaracter(const std::string &inString, unsigned int &currentPosition);

  static unsigned int indentationNumber;

};

}
#endif

#endif //DOXYGEN_NOTFOR_DEVEL
///@endcond