Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
XMLHandler.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Chris Bielow $
32 // $Authors: Marc Sturm, Chris Bielow $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_FORMAT_HANDLERS_XMLHANDLER_H
36 #define OPENMS_FORMAT_HANDLERS_XMLHANDLER_H
37 
38 #include <iosfwd>
39 
40 #include <OpenMS/CONCEPT/Types.h>
41 #include <OpenMS/CONCEPT/Macros.h>
42 
43 #include <OpenMS/DATASTRUCTURES/ListUtils.h> // StringList
47 
48 #include <xercesc/sax2/DefaultHandler.hpp>
49 #include <xercesc/sax/Locator.hpp>
50 #include <xercesc/sax2/Attributes.hpp>
51 
52 #include <algorithm>
53 
54 namespace OpenMS
55 {
56  namespace Internal
57  {
58 
59  /*
60  * @brief Helper class for XML parsing that handles the memory management for conversions of Xerces strings
61  *
62  * It provides the convert() function which internally calls
63  * XMLString::transcode and ensures that the memory is released properly
64  * through XMLString::release in a transparent and object oriented manner.
65  *
66  * Releasing the memory can be done manually through clear() or will be done
67  * automatically in the destructor.
68  *
69  */
70  class OPENMS_DLLAPI StringManager
71  {
72 public:
74  StringManager();
75 
77  ~StringManager();
78 
80  void clear();
81 
83  XMLCh * convert(const char * str) const;
84 
86  XMLCh * convert(const std::string & str) const;
87 
89  XMLCh * convert(const String & str) const;
90 
92  char * convert(const XMLCh * str) const;
93 
100  static void appendASCII(const XMLCh * str, const XMLSize_t length, String & result);
101 
102 private:
103  mutable std::vector<XMLCh *> xml_strings_;
104  mutable std::vector<char *> c_strings_;
105  };
106 
110  class OPENMS_DLLAPI XMLHandler :
111  public xercesc::DefaultHandler
112  {
113 public:
114 
116  class OPENMS_DLLAPI EndParsingSoftly :
118  {
119  public:
120  EndParsingSoftly(const char * file, int line, const char * function) :
121  Exception::BaseException(file, line, function)
122  {
123  }
124 
125  };
126 
129  {
131  STORE
132  };
133 
135  XMLHandler(const String & filename, const String & version);
137  virtual ~XMLHandler();
138 
140  void reset();
141 
142 
149  void fatalError(const xercesc::SAXParseException & exception);
150  void error(const xercesc::SAXParseException & exception);
151  void warning(const xercesc::SAXParseException & exception);
153 
155  void fatalError(ActionMode mode, const String & msg, UInt line = 0, UInt column = 0) const;
157  void error(ActionMode mode, const String & msg, UInt line = 0, UInt column = 0) const;
159  void warning(ActionMode mode, const String & msg, UInt line = 0, UInt column = 0) const;
160 
162  virtual void characters(const XMLCh * const chars, const XMLSize_t length);
164  virtual void startElement(const XMLCh * const uri, const XMLCh * const localname, const XMLCh * const qname, const xercesc::Attributes & attrs);
166  virtual void endElement(const XMLCh * const uri, const XMLCh * const localname, const XMLCh * const qname);
167 
169  virtual void writeTo(std::ostream & /*os*/);
170 
172  String errorString();
173 
181  static String writeXMLEscape(const String& to_escape)
182  {
183  String _copy = to_escape;
184  // has() is cheap, so check before calling substitute(), since substitute() will usually happen rarely
185  if (_copy.has('&')) _copy.substitute("&","&amp;");
186  if (_copy.has('>')) _copy.substitute(">","&gt;");
187  if (_copy.has('"')) _copy.substitute("\"","&quot;");
188  if (_copy.has('<')) _copy.substitute("<","&lt;");
189  if (_copy.has('\'')) _copy.substitute("'","&apos;");
190 
191  return _copy;
192  }
193 
194 protected:
197 
200 
203 
206 
212  std::vector<String> open_tags_;
213 
215  inline bool equal_(const XMLCh * a, const XMLCh * b) const
216  {
217  return xercesc::XMLString::compareString(a, b) == 0;
218  }
219 
221 
222 
224  void writeUserParam_(const String & tag_name, std::ostream & os, const MetaInfoInterface & meta, UInt indent) const;
225 
227 
229 
230 
232  std::vector<std::vector<String> > cv_terms_;
233 
236  inline SignedSize cvStringToEnum_(const Size section, const String & term, const char * message, const SignedSize result_on_error = 0)
237  {
238  OPENMS_PRECONDITION(section < cv_terms_.size(), "cvStringToEnum_: Index overflow (section number too large)");
239 
240  std::vector<String>::const_iterator it = std::find(cv_terms_[section].begin(), cv_terms_[section].end(), term);
241  if (it != cv_terms_[section].end())
242  {
243  return it - cv_terms_[section].begin();
244  }
245  else
246  {
247  warning(LOAD, String("Unexpected CV entry '") + message + "'='" + term + "'");
248  return result_on_error;
249  }
250  }
251 
253 
255 
256 
258  inline Int asInt_(const String & in)
259  {
260  Int res = 0;
261  try
262  {
263  res = in.toInt();
264  }
266  {
267  error(LOAD, String("Int conversion error of \"") + in + "\"");
268  }
269  return res;
270  }
271 
273  inline Int asInt_(const XMLCh * in)
274  {
275  return xercesc::XMLString::parseInt(in);
276  }
277 
279  inline UInt asUInt_(const String & in)
280  {
281  UInt res = 0;
282  try
283  {
284  Int tmp = in.toInt();
285  if (tmp < 0)
286  {
287  throw Exception::ConversionError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "");
288  }
289  res = UInt(tmp);
290  }
292  {
293  error(LOAD, String("UInt conversion error of \"") + in + "\"");
294  }
295  return res;
296  }
297 
299  inline double asDouble_(const String & in)
300  {
301  double res = 0.0;
302  try
303  {
304  res = in.toDouble();
305  }
307  {
308  error(LOAD, String("Double conversion error of \"") + in + "\"");
309  }
310  return res;
311  }
312 
314  inline float asFloat_(const String & in)
315  {
316  float res = 0.0;
317  try
318  {
319  res = in.toFloat();
320  }
322  {
323  error(LOAD, String("Float conversion error of \"") + in + "\"");
324  }
325  return res;
326  }
327 
335  inline bool asBool_(const String & in)
336  {
337  if (in == "true" || in == "TRUE" || in == "True" || in == "1")
338  {
339  return true;
340  }
341  else if (in == "false" || in == "FALSE" || in == "False" || in == "0")
342  {
343  return false;
344  }
345  else
346  {
347  error(LOAD, String("Boolean conversion error of \"") + in + "\"");
348  }
349  return false;
350  }
351 
353  inline DateTime asDateTime_(String date_string)
354  {
355  DateTime date_time;
356  if (date_string != "")
357  {
358  try
359  {
360  //strip away milliseconds
361  date_string.trim();
362  date_string = date_string.substr(0, 19);
363  date_time.set(date_string);
364  }
365  catch (Exception::ParseError& /*err*/ )
366  {
367  error(LOAD, String("DateTime conversion error of \"") + date_string + "\"");
368  }
369  }
370  return date_time;
371  }
372 
374 
376 
377 
379  inline char * attributeAsString_(const xercesc::Attributes & a, const char * name) const
380  {
381  const XMLCh * val = a.getValue(sm_.convert(name));
382  if (val == 0) fatalError(LOAD, String("Required attribute '") + name + "' not present!");
383  return sm_.convert(val);
384  }
385 
387  inline Int attributeAsInt_(const xercesc::Attributes & a, const char * name) const
388  {
389  const XMLCh * val = a.getValue(sm_.convert(name));
390  if (val == 0) fatalError(LOAD, String("Required attribute '") + name + "' not present!");
391  return xercesc::XMLString::parseInt(val);
392  }
393 
395  inline double attributeAsDouble_(const xercesc::Attributes & a, const char * name) const
396  {
397  const XMLCh * val = a.getValue(sm_.convert(name));
398  if (val == 0) fatalError(LOAD, String("Required attribute '") + name + "' not present!");
399  return String(sm_.convert(val)).toDouble();
400  }
401 
403  inline DoubleList attributeAsDoubleList_(const xercesc::Attributes & a, const char * name) const
404  {
405  String tmp(expectList_(attributeAsString_(a, name)));
406  return ListUtils::create<double>(tmp.substr(1, tmp.size() - 2));
407  }
408 
410  inline IntList attributeAsIntList_(const xercesc::Attributes & a, const char * name) const
411  {
412  String tmp(expectList_(attributeAsString_(a, name)));
413  return ListUtils::create<Int>(tmp.substr(1, tmp.size() - 2));
414  }
415 
417  inline StringList attributeAsStringList_(const xercesc::Attributes & a, const char * name) const
418  {
419  String tmp(expectList_(attributeAsString_(a, name)));
420  return ListUtils::create<String>(tmp.substr(1, tmp.size() - 2));
421  }
422 
428  inline bool optionalAttributeAsString_(String & value, const xercesc::Attributes & a, const char * name) const
429  {
430  const XMLCh * val = a.getValue(sm_.convert(name));
431  if (val != 0)
432  {
433  value = sm_.convert(val);
434  return true;
435  }
436  return false;
437  }
438 
444  inline bool optionalAttributeAsInt_(Int & value, const xercesc::Attributes & a, const char * name) const
445  {
446  const XMLCh * val = a.getValue(sm_.convert(name));
447  if (val != 0)
448  {
449  value = xercesc::XMLString::parseInt(val);
450  return true;
451  }
452  return false;
453  }
454 
460  inline bool optionalAttributeAsUInt_(UInt & value, const xercesc::Attributes & a, const char * name) const
461  {
462  const XMLCh * val = a.getValue(sm_.convert(name));
463  if (val != 0)
464  {
465  value = xercesc::XMLString::parseInt(val);
466  return true;
467  }
468  return false;
469  }
470 
476  inline bool optionalAttributeAsDouble_(double & value, const xercesc::Attributes & a, const char * name) const
477  {
478  const XMLCh * val = a.getValue(sm_.convert(name));
479  if (val != 0)
480  {
481  value = String(sm_.convert(val)).toDouble();
482  return true;
483  }
484  return false;
485  }
486 
492  inline bool optionalAttributeAsDoubleList_(DoubleList & value, const xercesc::Attributes & a, const char * name) const
493  {
494  const XMLCh * val = a.getValue(sm_.convert(name));
495  if (val != 0)
496  {
497  value = attributeAsDoubleList_(a, name);
498  return true;
499  }
500  return false;
501  }
502 
508  inline bool optionalAttributeAsStringList_(StringList & value, const xercesc::Attributes & a, const char * name) const
509  {
510  const XMLCh * val = a.getValue(sm_.convert(name));
511  if (val != 0)
512  {
513  value = attributeAsStringList_(a, name);
514  return true;
515  }
516  return false;
517  }
518 
524  inline bool optionalAttributeAsIntList_(IntList & value, const xercesc::Attributes & a, const char * name) const
525  {
526  const XMLCh * val = a.getValue(sm_.convert(name));
527  if (val != 0)
528  {
529  value = attributeAsIntList_(a, name);
530  return true;
531  }
532  return false;
533  }
534 
536  inline char * attributeAsString_(const xercesc::Attributes & a, const XMLCh * name) const
537  {
538  const XMLCh * val = a.getValue(name);
539  if (val == 0) fatalError(LOAD, String("Required attribute '") + sm_.convert(name) + "' not present!");
540  return sm_.convert(val);
541  }
542 
544  inline Int attributeAsInt_(const xercesc::Attributes & a, const XMLCh * name) const
545  {
546  const XMLCh * val = a.getValue(name);
547  if (val == 0) fatalError(LOAD, String("Required attribute '") + sm_.convert(name) + "' not present!");
548  return xercesc::XMLString::parseInt(val);
549  }
550 
552  inline double attributeAsDouble_(const xercesc::Attributes & a, const XMLCh * name) const
553  {
554  const XMLCh * val = a.getValue(name);
555  if (val == 0) fatalError(LOAD, String("Required attribute '") + sm_.convert(name) + "' not present!");
556  return String(sm_.convert(val)).toDouble();
557  }
558 
560  inline DoubleList attributeAsDoubleList_(const xercesc::Attributes & a, const XMLCh * name) const
561  {
562  String tmp(expectList_(attributeAsString_(a, name)));
563  return ListUtils::create<double>(tmp.substr(1, tmp.size() - 2));
564  }
565 
567  inline IntList attributeAsIntList_(const xercesc::Attributes & a, const XMLCh * name) const
568  {
569  String tmp(expectList_(attributeAsString_(a, name)));
570  return ListUtils::create<Int>(tmp.substr(1, tmp.size() - 2));
571  }
572 
574  inline StringList attributeAsStringList_(const xercesc::Attributes & a, const XMLCh * name) const
575  {
576  String tmp(expectList_(attributeAsString_(a, name)));
577  return ListUtils::create<String>(tmp.substr(1, tmp.size() - 2));
578  }
579 
581  inline bool optionalAttributeAsString_(String & value, const xercesc::Attributes & a, const XMLCh * name) const
582  {
583  const XMLCh * val = a.getValue(name);
584  if (val != 0)
585  {
586  char * tmp2 = sm_.convert(val);
587  if (String(tmp2) != "")
588  {
589  value = tmp2;
590  return true;
591  }
592  }
593  return false;
594  }
595 
597  inline bool optionalAttributeAsInt_(Int & value, const xercesc::Attributes & a, const XMLCh * name) const
598  {
599  const XMLCh * val = a.getValue(name);
600  if (val != 0)
601  {
602  value = xercesc::XMLString::parseInt(val);
603  return true;
604  }
605  return false;
606  }
607 
609  inline bool optionalAttributeAsUInt_(UInt & value, const xercesc::Attributes & a, const XMLCh * name) const
610  {
611  const XMLCh * val = a.getValue(name);
612  if (val != 0)
613  {
614  value = xercesc::XMLString::parseInt(val);
615  return true;
616  }
617  return false;
618  }
619 
621  inline bool optionalAttributeAsDouble_(double & value, const xercesc::Attributes & a, const XMLCh * name) const
622  {
623  const XMLCh * val = a.getValue(name);
624  if (val != 0)
625  {
626  value = String(sm_.convert(val)).toDouble();
627  return true;
628  }
629  return false;
630  }
631 
637  inline bool optionalAttributeAsDoubleList_(DoubleList & value, const xercesc::Attributes & a, const XMLCh * name) const
638  {
639  const XMLCh * val = a.getValue(name);
640  if (val != 0)
641  {
642  value = attributeAsDoubleList_(a, name);
643  return true;
644  }
645  return false;
646  }
647 
653  inline bool optionalAttributeAsIntList_(IntList & value, const xercesc::Attributes & a, const XMLCh * name) const
654  {
655  const XMLCh * val = a.getValue(name);
656  if (val != 0)
657  {
658  value = attributeAsIntList_(a, name);
659  return true;
660  }
661  return false;
662  }
663 
669  inline bool optionalAttributeAsStringList_(StringList & value, const xercesc::Attributes & a, const XMLCh * name) const
670  {
671  const XMLCh * val = a.getValue(name);
672  if (val != 0)
673  {
674  value = attributeAsStringList_(a, name);
675  return true;
676  }
677  return false;
678  }
679 
681 
682 private:
684  XMLHandler();
685 
686  inline String expectList_(const char * str) const
687  {
688  String tmp(str);
689  if (!(tmp.hasPrefix('[') && tmp.hasSuffix(']')))
690  {
691  fatalError(LOAD, String("List argument is not a string representation of a list!"));
692  }
693  return tmp;
694  }
695 
696  };
697 
698  } // namespace Internal
699 } // namespace OpenMS
700 
701 #endif // OPENMS_FORMAT_HANDLERS_XMLHANDLER_H
702 
bool equal_(const XMLCh *a, const XMLCh *b) const
Returns if two Xerces strings are equal.
Definition: XMLHandler.h:215
bool optionalAttributeAsDoubleList_(DoubleList &value, const xercesc::Attributes &a, const XMLCh *name) const
Assigns the attribute content to the DoubleList value if the attribute is present.
Definition: XMLHandler.h:637
std::vector< String > open_tags_
Stack of open XML tags.
Definition: XMLHandler.h:212
char * attributeAsString_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a String.
Definition: XMLHandler.h:536
bool optionalAttributeAsInt_(Int &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the Int value if the attribute is present.
Definition: XMLHandler.h:444
IntList attributeAsIntList_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to an IntList.
Definition: XMLHandler.h:410
bool has(Byte byte) const
true if String contains the byte, false otherwise
A more convenient string class.
Definition: String.h:57
Exception that is thrown if the parsing is ended by some event (e.g. if only a prefix of the XML file...
Definition: XMLHandler.h:116
Int asInt_(const XMLCh *in)
Conversion of a Xerces string to an integer value.
Definition: XMLHandler.h:273
String version_
Schema version.
Definition: XMLHandler.h:202
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:66
StringList attributeAsStringList_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to an StringList.
Definition: XMLHandler.h:417
void set(UInt month, UInt day, UInt year, UInt hour, UInt minute, UInt second)
sets data from six integers
SignedSize cvStringToEnum_(const Size section, const String &term, const char *message, const SignedSize result_on_error=0)
Definition: XMLHandler.h:236
bool optionalAttributeAsIntList_(IntList &value, const xercesc::Attributes &a, const XMLCh *name) const
Assigns the attribute content to the IntList value if the attribute is present.
Definition: XMLHandler.h:653
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:107
XMLCh * convert(const char *str) const
Transcode the supplied C string to XMLCh* and take ownership of the XMLCh*.
unsigned int UInt
Unsigned integer type.
Definition: Types.h:95
bool optionalAttributeAsDouble_(double &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the double value if the attribute is present.
Definition: XMLHandler.h:476
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:59
Base class for XML handlers.
Definition: XMLHandler.h:110
DateTime asDateTime_(String date_string)
Conversion of a xs:datetime string to a DateTime value.
Definition: XMLHandler.h:353
UInt asUInt_(const String &in)
Conversion of a String to an unsigned integer value.
Definition: XMLHandler.h:279
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:135
ActionMode
Action to set the current mode (for error messages)
Definition: XMLHandler.h:128
double attributeAsDouble_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a double.
Definition: XMLHandler.h:395
Definition: XMLHandler.h:70
Int attributeAsInt_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a Int.
Definition: XMLHandler.h:544
bool optionalAttributeAsDoubleList_(DoubleList &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the DoubleList value if the attribute is present.
Definition: XMLHandler.h:492
Int attributeAsInt_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a Int.
Definition: XMLHandler.h:387
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
static String writeXMLEscape(const String &to_escape)
Escapes a string and returns the escaped string.
Definition: XMLHandler.h:181
bool optionalAttributeAsIntList_(IntList &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the IntList value if the attribute is present.
Definition: XMLHandler.h:524
String substr(size_t pos=0, size_t n=npos) const
Wrapper for the STL substr() method. Returns a String object with its contents initialized to a subst...
bool optionalAttributeAsDouble_(double &value, const xercesc::Attributes &a, const XMLCh *name) const
Assigns the attribute content to the double value if the attribute is present.
Definition: XMLHandler.h:621
String error_message_
Error message of the last error.
Definition: XMLHandler.h:196
bool optionalAttributeAsString_(String &value, const xercesc::Attributes &a, const XMLCh *name) const
Assigns the attribute content to the String value if the attribute is present.
Definition: XMLHandler.h:581
EndParsingSoftly(const char *file, int line, const char *function)
Definition: XMLHandler.h:120
std::vector< XMLCh * > xml_strings_
Definition: XMLHandler.h:103
DoubleList attributeAsDoubleList_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a DoubleList.
Definition: XMLHandler.h:560
Int toInt() const
Conversion to int.
char * attributeAsString_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a String.
Definition: XMLHandler.h:379
double toDouble() const
Conversion to double.
int exception
(Used by various macros. Indicates a rough category of the exception being caught.)
float asFloat_(const String &in)
Conversion of a String to a float value.
Definition: XMLHandler.h:314
IntList attributeAsIntList_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a IntList.
Definition: XMLHandler.h:567
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
bool optionalAttributeAsStringList_(StringList &value, const xercesc::Attributes &a, const XMLCh *name) const
Assigns the attribute content to the StringList value if the attribute is present.
Definition: XMLHandler.h:669
bool asBool_(const String &in)
Conversion of a string to a boolean value.
Definition: XMLHandler.h:335
float toFloat() const
Conversion to float.
String file_
File name.
Definition: XMLHandler.h:199
Exception base class.
Definition: Exception.h:90
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:56
Invalid conversion exception.
Definition: Exception.h:363
Loading a file.
Definition: XMLHandler.h:130
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:74
double asDouble_(const String &in)
Conversion of a String to a double value.
Definition: XMLHandler.h:299
StringManager sm_
Helper class for string conversion.
Definition: XMLHandler.h:205
bool optionalAttributeAsUInt_(UInt &value, const xercesc::Attributes &a, const XMLCh *name) const
Assigns the attribute content to the UInt value if the attribute is present.
Definition: XMLHandler.h:609
Int asInt_(const String &in)
Conversion of a String to an integer value.
Definition: XMLHandler.h:258
bool hasPrefix(const String &string) const
true if String begins with string, false otherwise
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
DateTime Class.
Definition: DateTime.h:55
String & substitute(char from, char to)
Replaces all occurrences of the character from by the character to.
StringList attributeAsStringList_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a StringList.
Definition: XMLHandler.h:574
String expectList_(const char *str) const
Definition: XMLHandler.h:686
std::vector< std::vector< String > > cv_terms_
Array of CV term lists (one sublist denotes one term and it&#39;s children)
Definition: XMLHandler.h:232
bool optionalAttributeAsUInt_(UInt &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the UInt value if the attribute is present.
Definition: XMLHandler.h:460
std::vector< char * > c_strings_
Definition: XMLHandler.h:104
int Int
Signed integer type.
Definition: Types.h:103
bool optionalAttributeAsInt_(Int &value, const xercesc::Attributes &a, const XMLCh *name) const
Assigns the attribute content to the Int value if the attribute is present.
Definition: XMLHandler.h:597
double attributeAsDouble_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a double.
Definition: XMLHandler.h:552
DoubleList attributeAsDoubleList_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a DoubleList.
Definition: XMLHandler.h:403
bool hasSuffix(const String &string) const
true if String ends with string, false otherwise
bool optionalAttributeAsStringList_(StringList &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the StringList value if the attribute is present.
Definition: XMLHandler.h:508
Parse Error exception.
Definition: Exception.h:623
bool optionalAttributeAsString_(String &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the String value if the attribute is present.
Definition: XMLHandler.h:428

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:04 using doxygen 1.8.13