file_parser_error.hpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // Copyright (C) 2002-2006 Marcin Kalicinski
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // For more information, see www.boost.org
9 // ----------------------------------------------------------------------------
10 #ifndef BOOST_PROPERTY_TREE_DETAIL_FILE_PARSER_ERROR_HPP_INCLUDED
11 #define BOOST_PROPERTY_TREE_DETAIL_FILE_PARSER_ERROR_HPP_INCLUDED
12 
14 #include <string>
15 
16 namespace boost { namespace property_tree
17 {
18 
21  {
22 
23  public:
24 
26  // Construction & destruction
27 
28  // Construct error
29  file_parser_error(const std::string &msg,
30  const std::string &file,
31  unsigned long l) :
32  ptree_error(format_what(msg, file, l)),
33  m_message(msg), m_filename(file), m_line(l)
34  {
35  }
36 
38  // gcc 3.4.2 complains about lack of throw specifier on compiler
39  // generated dtor
40  {
41  }
42 
44  // Data access
45 
46  // Get error message (without line and file - use what() to get
47  // full message)
48  std::string message() const
49  {
50  return m_message;
51  }
52 
53  // Get error filename
54  std::string filename() const
55  {
56  return m_filename;
57  }
58 
59  // Get error line number
60  unsigned long line() const
61  {
62  return m_line;
63  }
64 
65  private:
66 
67  std::string m_message;
68  std::string m_filename;
69  unsigned long m_line;
70 
71  // Format error message to be returned by std::runtime_error::what()
72  static std::string format_what(const std::string &msg,
73  const std::string &file,
74  unsigned long l)
75  {
76  std::stringstream stream;
77  stream << (file.empty() ? "<unspecified file>" : file.c_str());
78  if (l > 0)
79  stream << '(' << l << ')';
80  stream << ": " << msg;
81  return stream.str();
82  }
83 
84  };
85 
86 } }
87 
88 #endif
msg
msg
boost::property_tree::file_parser_error::message
std::string message() const
Definition: file_parser_error.hpp:48
boost::property_tree::file_parser_error::format_what
static std::string format_what(const std::string &msg, const std::string &file, unsigned long l)
Definition: file_parser_error.hpp:72
boost::property_tree::ptree_error
Definition: exceptions.hpp:27
boost
BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE.
boost::property_tree::file_parser_error::file_parser_error
file_parser_error(const std::string &msg, const std::string &file, unsigned long l)
Definition: file_parser_error.hpp:29
boost::property_tree::file_parser_error::filename
std::string filename() const
Definition: file_parser_error.hpp:54
boost::property_tree::file_parser_error
File parse error.
Definition: file_parser_error.hpp:20
ptree.hpp
boost::property_tree::file_parser_error::m_filename
std::string m_filename
Definition: file_parser_error.hpp:68
boost::property_tree::file_parser_error::m_line
unsigned long m_line
Definition: file_parser_error.hpp:69
boost::property_tree::file_parser_error::line
unsigned long line() const
Definition: file_parser_error.hpp:60
boost::property_tree::file_parser_error::~file_parser_error
~file_parser_error()
Definition: file_parser_error.hpp:37
boost::property_tree::file_parser_error::m_message
std::string m_message
Definition: file_parser_error.hpp:67


sick_visionary_ros
Author(s): SICK AG TechSupport 3D Snapshot
autogenerated on Thu Feb 8 2024 03:39:00