CMS 3D CMS Logo

Functions
FWConfiguration.cc File Reference
#include <memory>
#include <stdexcept>
#include <algorithm>
#include <functional>
#include "Fireworks/Core/interface/FWConfiguration.h"

Go to the source code of this file.

Functions

std::string attrEscape (std::string value)
 

Function Documentation

◆ attrEscape()

std::string attrEscape ( std::string  value)

Helper function to make sure we escape correctly xml entities embedded in the string value.

Definition at line 144 of file FWConfiguration.cc.

References relativeConstraints::value.

Referenced by FWConfiguration::streamTo().

144  {
146  index = 0;
147  while (std::string::npos != (index = value.find('&', index))) {
148  value.replace(index, 1, "&amp;", 5);
149  // Do not check "&quot;" for quotes.
150  index += 5;
151  }
152 
153  while (std::string::npos != (index = value.find('"', index))) {
154  value.replace(index, 1, "&quot;", 6);
155  // Do not check "&quot;" for quotes.
156  index += 6;
157  }
158 
159  index = 0;
160  while (std::string::npos != (index = value.find('<', index))) {
161  value.replace(index, 1, "&lt;", 4);
162  // Do not check "&quot;" for quotes.
163  index += 4;
164  }
165 
166  index = 0;
167  while (std::string::npos != (index = value.find('>', index))) {
168  value.replace(index, 1, "&gt;", 4);
169  // Do not check "&quot;" for quotes.
170  index += 4;
171  }
172 
173  return value;
174 }
uint16_t size_type
Definition: value.py:1