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-2015.
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 
46 
47 #include <xercesc/sax2/DefaultHandler.hpp>
48 #include <xercesc/sax/Locator.hpp>
49 #include <xercesc/sax2/Attributes.hpp>
50 
51 #include <algorithm>
52 
53 namespace OpenMS
54 {
55  namespace Internal
56  {
57 
59  class OPENMS_DLLAPI StringManager
60  {
61 public:
63  StringManager();
64 
66  ~StringManager();
67 
69  void clear();
70 
72  XMLCh * convert(const char * str) const;
73 
75  XMLCh * convert(const std::string & str) const;
76 
78  XMLCh * convert(const String & str) const;
79 
81  char * convert(const XMLCh * str) const;
82 
89  static void appendASCII(const XMLCh * str, const XMLSize_t length, String & result);
90 
91 private:
92  mutable std::vector<XMLCh *> xml_strings_;
93  mutable std::vector<char *> c_strings_;
94  };
95 
99  class OPENMS_DLLAPI XMLHandler :
100  public xercesc::DefaultHandler
101  {
102 public:
104  class OPENMS_DLLAPI EndParsingSoftly :
106  {
107 public:
108  EndParsingSoftly(const char * file, int line, const char * function) :
109  Exception::BaseException(file, line, function)
110  {
111  }
112 
113  };
114 
117  {
119  STORE
120  };
121 
123  XMLHandler(const String & filename, const String & version);
125  virtual ~XMLHandler();
126 
128  void reset();
129 
130 
137  void fatalError(const xercesc::SAXParseException & exception);
138  void error(const xercesc::SAXParseException & exception);
139  void warning(const xercesc::SAXParseException & exception);
141 
143  void fatalError(ActionMode mode, const String & msg, UInt line = 0, UInt column = 0) const;
145  void error(ActionMode mode, const String & msg, UInt line = 0, UInt column = 0) const;
147  void warning(ActionMode mode, const String & msg, UInt line = 0, UInt column = 0) const;
148 
150  virtual void characters(const XMLCh * const chars, const XMLSize_t length);
152  virtual void startElement(const XMLCh * const uri, const XMLCh * const localname, const XMLCh * const qname, const xercesc::Attributes & attrs);
154  virtual void endElement(const XMLCh * const uri, const XMLCh * const localname, const XMLCh * const qname);
155 
157  virtual void writeTo(std::ostream & /*os*/);
158 
160  String errorString();
161 
169  static String writeXMLEscape(const String& to_escape)
170  {
171  String _copy = to_escape;
172  // has() is cheap, so check before calling substitute(), since substitute() will usually happen rarely
173  if (_copy.has('&')) _copy.substitute("&","&amp;");
174  if (_copy.has('>')) _copy.substitute(">","&gt;");
175  if (_copy.has('"')) _copy.substitute("\"","&quot;");
176  if (_copy.has('<')) _copy.substitute("<","&lt;");
177  if (_copy.has('\'')) _copy.substitute("'","&apos;");
178 
179  return _copy;
180  }
181 
182 protected:
185 
188 
191 
194 
200  std::vector<String> open_tags_;
201 
203  inline bool equal_(const XMLCh * a, const XMLCh * b) const
204  {
205  return xercesc::XMLString::compareString(a, b) == 0;
206  }
207 
209 
210 
212  void writeUserParam_(const String & tag_name, std::ostream & os, const MetaInfoInterface & meta, UInt indent) const;
213 
215 
217 
218 
220  std::vector<std::vector<String> > cv_terms_;
221 
224  inline SignedSize cvStringToEnum_(const Size section, const String & term, const char * message, const SignedSize result_on_error = 0)
225  {
226  OPENMS_PRECONDITION(section < cv_terms_.size(), "cvStringToEnum_: Index overflow (section number too large)");
227 
228  std::vector<String>::const_iterator it = std::find(cv_terms_[section].begin(), cv_terms_[section].end(), term);
229  if (it != cv_terms_[section].end())
230  {
231  return it - cv_terms_[section].begin();
232  }
233  else
234  {
235  warning(LOAD, String("Unexpected CV entry '") + message + "'='" + term + "'");
236  return result_on_error;
237  }
238  }
239 
241 
243 
244 
246  inline Int asInt_(const String & in)
247  {
248  Int res = 0;
249  try
250  {
251  res = in.toInt();
252  }
254  {
255  error(LOAD, String("Int conversion error of \"") + in + "\"");
256  }
257  return res;
258  }
259 
261  inline Int asInt_(const XMLCh * in)
262  {
263  return xercesc::XMLString::parseInt(in);
264  }
265 
267  inline UInt asUInt_(const String & in)
268  {
269  UInt res = 0;
270  try
271  {
272  Int tmp = in.toInt();
273  if (tmp < 0)
274  {
275  throw Exception::ConversionError(__FILE__, __LINE__, __PRETTY_FUNCTION__, "");
276  }
277  res = UInt(tmp);
278  }
280  {
281  error(LOAD, String("UInt conversion error of \"") + in + "\"");
282  }
283  return res;
284  }
285 
287  inline double asDouble_(const String & in)
288  {
289  double res = 0.0;
290  try
291  {
292  res = in.toDouble();
293  }
295  {
296  error(LOAD, String("Double conversion error of \"") + in + "\"");
297  }
298  return res;
299  }
300 
302  inline float asFloat_(const String & in)
303  {
304  float res = 0.0;
305  try
306  {
307  res = in.toFloat();
308  }
310  {
311  error(LOAD, String("Float conversion error of \"") + in + "\"");
312  }
313  return res;
314  }
315 
322  inline bool asBool_(const String & in)
323  {
324  if (in == "true" || in == "TRUE" || in == "True" || in == "1")
325  {
326  return true;
327  }
328  else if (in == "false" || in == "FALSE" || in == "False" || in == "0")
329  {
330  return false;
331  }
332  else
333  {
334  error(LOAD, String("Boolean conversion error of \"") + in + "\"");
335  }
336  return false;
337  }
338 
340  inline DateTime asDateTime_(String date_string)
341  {
342  DateTime date_time;
343  if (date_string != "")
344  {
345  try
346  {
347  //strip away milliseconds
348  date_string.trim();
349  date_string = date_string.substr(0, 19);
350  date_time.set(date_string);
351  }
352  catch (Exception::ParseError& /*err*/ )
353  {
354  error(LOAD, String("DateTime conversion error of \"") + date_string + "\"");
355  }
356  }
357  return date_time;
358  }
359 
361 
363 
364 
366  inline char * attributeAsString_(const xercesc::Attributes & a, const char * name) const
367  {
368  const XMLCh * val = a.getValue(sm_.convert(name));
369  if (val == 0) fatalError(LOAD, String("Required attribute '") + name + "' not present!");
370  return sm_.convert(val);
371  }
372 
374  inline Int attributeAsInt_(const xercesc::Attributes & a, const char * name) const
375  {
376  const XMLCh * val = a.getValue(sm_.convert(name));
377  if (val == 0) fatalError(LOAD, String("Required attribute '") + name + "' not present!");
378  return xercesc::XMLString::parseInt(val);
379  }
380 
382  inline double attributeAsDouble_(const xercesc::Attributes & a, const char * name) const
383  {
384  const XMLCh * val = a.getValue(sm_.convert(name));
385  if (val == 0) fatalError(LOAD, String("Required attribute '") + name + "' not present!");
386  return String(sm_.convert(val)).toDouble();
387  }
388 
390  inline DoubleList attributeAsDoubleList_(const xercesc::Attributes & a, const char * name) const
391  {
392  String tmp(expectList_(attributeAsString_(a, name)));
393  return ListUtils::create<double>(tmp.substr(1, tmp.size() - 2));
394  }
395 
397  inline IntList attributeAsIntList_(const xercesc::Attributes & a, const char * name) const
398  {
399  String tmp(expectList_(attributeAsString_(a, name)));
400  return ListUtils::create<Int>(tmp.substr(1, tmp.size() - 2));
401  }
402 
404  inline StringList attributeAsStringList_(const xercesc::Attributes & a, const char * name) const
405  {
406  String tmp(expectList_(attributeAsString_(a, name)));
407  return ListUtils::create<String>(tmp.substr(1, tmp.size() - 2));
408  }
409 
415  inline bool optionalAttributeAsString_(String & value, const xercesc::Attributes & a, const char * name) const
416  {
417  const XMLCh * val = a.getValue(sm_.convert(name));
418  if (val != 0)
419  {
420  value = sm_.convert(val);
421  return true;
422  }
423  return false;
424  }
425 
431  inline bool optionalAttributeAsInt_(Int & value, const xercesc::Attributes & a, const char * name) const
432  {
433  const XMLCh * val = a.getValue(sm_.convert(name));
434  if (val != 0)
435  {
436  value = xercesc::XMLString::parseInt(val);
437  return true;
438  }
439  return false;
440  }
441 
447  inline bool optionalAttributeAsUInt_(UInt & value, const xercesc::Attributes & a, const char * name) const
448  {
449  const XMLCh * val = a.getValue(sm_.convert(name));
450  if (val != 0)
451  {
452  value = xercesc::XMLString::parseInt(val);
453  return true;
454  }
455  return false;
456  }
457 
463  inline bool optionalAttributeAsDouble_(double & value, const xercesc::Attributes & a, const char * name) const
464  {
465  const XMLCh * val = a.getValue(sm_.convert(name));
466  if (val != 0)
467  {
468  value = String(sm_.convert(val)).toDouble();
469  return true;
470  }
471  return false;
472  }
473 
479  inline bool optionalAttributeAsDoubleList_(DoubleList & value, const xercesc::Attributes & a, const char * name) const
480  {
481  const XMLCh * val = a.getValue(sm_.convert(name));
482  if (val != 0)
483  {
484  value = attributeAsDoubleList_(a, name);
485  return true;
486  }
487  return false;
488  }
489 
495  inline bool optionalAttributeAsStringList_(StringList & value, const xercesc::Attributes & a, const char * name) const
496  {
497  const XMLCh * val = a.getValue(sm_.convert(name));
498  if (val != 0)
499  {
500  value = attributeAsStringList_(a, name);
501  return true;
502  }
503  return false;
504  }
505 
511  inline bool optionalAttributeAsIntList_(IntList & value, const xercesc::Attributes & a, const char * name) const
512  {
513  const XMLCh * val = a.getValue(sm_.convert(name));
514  if (val != 0)
515  {
516  value = attributeAsIntList_(a, name);
517  return true;
518  }
519  return false;
520  }
521 
523  inline char * attributeAsString_(const xercesc::Attributes & a, const XMLCh * name) const
524  {
525  const XMLCh * val = a.getValue(name);
526  if (val == 0) fatalError(LOAD, String("Required attribute '") + sm_.convert(name) + "' not present!");
527  return sm_.convert(val);
528  }
529 
531  inline Int attributeAsInt_(const xercesc::Attributes & a, const XMLCh * name) const
532  {
533  const XMLCh * val = a.getValue(name);
534  if (val == 0) fatalError(LOAD, String("Required attribute '") + sm_.convert(name) + "' not present!");
535  return xercesc::XMLString::parseInt(val);
536  }
537 
539  inline double attributeAsDouble_(const xercesc::Attributes & a, const XMLCh * name) const
540  {
541  const XMLCh * val = a.getValue(name);
542  if (val == 0) fatalError(LOAD, String("Required attribute '") + sm_.convert(name) + "' not present!");
543  return String(sm_.convert(val)).toDouble();
544  }
545 
547  inline DoubleList attributeAsDoubleList_(const xercesc::Attributes & a, const XMLCh * name) const
548  {
549  String tmp(expectList_(attributeAsString_(a, name)));
550  return ListUtils::create<double>(tmp.substr(1, tmp.size() - 2));
551  }
552 
554  inline IntList attributeAsIntList_(const xercesc::Attributes & a, const XMLCh * name) const
555  {
556  String tmp(expectList_(attributeAsString_(a, name)));
557  return ListUtils::create<Int>(tmp.substr(1, tmp.size() - 2));
558  }
559 
561  inline StringList attributeAsStringList_(const xercesc::Attributes & a, const XMLCh * name) const
562  {
563  String tmp(expectList_(attributeAsString_(a, name)));
564  return ListUtils::create<String>(tmp.substr(1, tmp.size() - 2));
565  }
566 
568  inline bool optionalAttributeAsString_(String & value, const xercesc::Attributes & a, const XMLCh * name) const
569  {
570  const XMLCh * val = a.getValue(name);
571  if (val != 0)
572  {
573  char * tmp2 = sm_.convert(val);
574  if (String(tmp2) != "")
575  {
576  value = tmp2;
577  return true;
578  }
579  }
580  return false;
581  }
582 
584  inline bool optionalAttributeAsInt_(Int & value, const xercesc::Attributes & a, const XMLCh * name) const
585  {
586  const XMLCh * val = a.getValue(name);
587  if (val != 0)
588  {
589  value = xercesc::XMLString::parseInt(val);
590  return true;
591  }
592  return false;
593  }
594 
596  inline bool optionalAttributeAsUInt_(UInt & value, const xercesc::Attributes & a, const XMLCh * name) const
597  {
598  const XMLCh * val = a.getValue(name);
599  if (val != 0)
600  {
601  value = xercesc::XMLString::parseInt(val);
602  return true;
603  }
604  return false;
605  }
606 
608  inline bool optionalAttributeAsDouble_(double & value, const xercesc::Attributes & a, const XMLCh * name) const
609  {
610  const XMLCh * val = a.getValue(name);
611  if (val != 0)
612  {
613  value = String(sm_.convert(val)).toDouble();
614  return true;
615  }
616  return false;
617  }
618 
624  inline bool optionalAttributeAsDoubleList_(DoubleList & value, const xercesc::Attributes & a, const XMLCh * name) const
625  {
626  const XMLCh * val = a.getValue(name);
627  if (val != 0)
628  {
629  value = attributeAsDoubleList_(a, name);
630  return true;
631  }
632  return false;
633  }
634 
640  inline bool optionalAttributeAsIntList_(IntList & value, const xercesc::Attributes & a, const XMLCh * name) const
641  {
642  const XMLCh * val = a.getValue(name);
643  if (val != 0)
644  {
645  value = attributeAsIntList_(a, name);
646  return true;
647  }
648  return false;
649  }
650 
656  inline bool optionalAttributeAsStringList_(StringList & value, const xercesc::Attributes & a, const XMLCh * name) const
657  {
658  const XMLCh * val = a.getValue(name);
659  if (val != 0)
660  {
661  value = attributeAsStringList_(a, name);
662  return true;
663  }
664  return false;
665  }
666 
668 
669 private:
671  XMLHandler();
672 
673  inline String expectList_(const char * str) const
674  {
675  String tmp(str);
676  if (!(tmp.hasPrefix('[') && tmp.hasSuffix(']')))
677  {
678  fatalError(LOAD, String("List argument is not a string representation of a list!"));
679  }
680  return tmp;
681  }
682 
683  };
684 
685  } // namespace Internal
686 } // namespace OpenMS
687 
688 #endif // OPENMS_FORMAT_HANDLERS_XMLHANDLER_H
std::vector< String > open_tags_
Stack of open XML tags.
Definition: XMLHandler.h:200
IntList attributeAsIntList_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to an IntList.
Definition: XMLHandler.h:397
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:415
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:624
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:104
Int asInt_(const XMLCh *in)
Conversion of a Xerces string to an integer value.
Definition: XMLHandler.h:261
String version_
Schema version.
Definition: XMLHandler.h:190
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:66
IntList attributeAsIntList_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a IntList.
Definition: XMLHandler.h:554
void set(UInt month, UInt day, UInt year, UInt hour, UInt minute, UInt second)
sets data from six integers
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:640
SignedSize cvStringToEnum_(const Size section, const String &term, const char *message, const SignedSize result_on_error=0)
Definition: XMLHandler.h:224
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:584
bool hasSuffix(const String &string) const
true if String ends with string, false otherwise
#define OPENMS_PRECONDITION(condition, message)
Precondition macro.
Definition: openms/include/OpenMS/CONCEPT/Macros.h:107
unsigned int UInt
Unsigned integer type.
Definition: Types.h:88
char * attributeAsString_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a String.
Definition: XMLHandler.h:523
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:431
std::vector< Int > IntList
Vector of signed integers.
Definition: ListUtils.h:59
Base class for XML handlers.
Definition: XMLHandler.h:99
DateTime asDateTime_(String date_string)
Conversion of a xs:datetime string to a DataTime value.
Definition: XMLHandler.h:340
UInt asUInt_(const String &in)
Conversion of a String to an unsigned integer value.
Definition: XMLHandler.h:267
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:128
ActionMode
Action to set the current mode (for error messages)
Definition: XMLHandler.h:116
Helper class for XML parsing that handles the memory management for conversions of Xerces strings...
Definition: XMLHandler.h:59
Int attributeAsInt_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a Int.
Definition: XMLHandler.h:374
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:596
bool has(Byte byte) const
true if String contains the byte, false otherwise
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
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:495
static String writeXMLEscape(const String &to_escape)
Escapes a string and returns the escaped string.
Definition: XMLHandler.h:169
double toDouble() const
Conversion to double.
bool equal_(const XMLCh *a, const XMLCh *b) const
Returns if two xerces strings are equal.
Definition: XMLHandler.h:203
String error_message_
Error message of the last error.
Definition: XMLHandler.h:184
Int toInt() const
Conversion to int.
EndParsingSoftly(const char *file, int line, const char *function)
Definition: XMLHandler.h:108
String expectList_(const char *str) const
Definition: XMLHandler.h:673
std::vector< XMLCh * > xml_strings_
Definition: XMLHandler.h:92
DoubleList attributeAsDoubleList_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a DoubleList.
Definition: XMLHandler.h:390
int exception
(Used by various macros. Indicates a rough category of the exception being caught.)
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:608
StringList attributeAsStringList_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to an StringList.
Definition: XMLHandler.h:404
float asFloat_(const String &in)
Conversion of a String to a float value.
Definition: XMLHandler.h:302
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:447
double attributeAsDouble_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a double.
Definition: XMLHandler.h:382
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
XMLCh * convert(const char *str) const
Transcode the supplied C string to XMLCh* and take ownership of the XMLCh*.
bool asBool_(const String &in)
Conversion of a string to a boolean value.
Definition: XMLHandler.h:322
String file_
File name.
Definition: XMLHandler.h:187
DoubleList attributeAsDoubleList_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a DoubleList.
Definition: XMLHandler.h:547
char * attributeAsString_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a String.
Definition: XMLHandler.h:366
Exception base class.
Definition: Exception.h:90
double attributeAsDouble_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a double.
Definition: XMLHandler.h:539
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:118
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:287
StringManager sm_
Helper class for string conversion.
Definition: XMLHandler.h:193
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:463
Int asInt_(const String &in)
Conversion of a String to an integer value.
Definition: XMLHandler.h:246
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:568
DateTime Class.
Definition: DateTime.h:55
String & substitute(char from, char to)
Replaces all occurrences of the character from by the character to.
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...
float toFloat() const
Conversion to float.
Int attributeAsInt_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a Int.
Definition: XMLHandler.h:531
std::vector< std::vector< String > > cv_terms_
Array of CV term lists (one sublist denotes one term and it's children)
Definition: XMLHandler.h:220
std::vector< char * > c_strings_
Definition: XMLHandler.h:93
int Int
Signed integer type.
Definition: Types.h:96
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:511
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:479
StringList attributeAsStringList_(const xercesc::Attributes &a, const XMLCh *name) const
Converts an attribute to a StringList.
Definition: XMLHandler.h:561
bool hasPrefix(const String &string) const
true if String begins with string, false otherwise
Parse Error exception.
Definition: Exception.h:608
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:656

OpenMS / TOPP release 2.0.0 Documentation generated on Tue Aug 25 2015 05:53:55 using doxygen 1.8.9.1