17 #ifndef ZORBA_INTERNAL_DIAGNOSTIC_H
18 #define ZORBA_INTERNAL_DIAGNOSTIC_H
30 namespace diagnostic {
34 namespace serialization {
40 namespace diagnostic {
68 location() : line_( 0 ), column_( 0 ), line_end_( 0 ), column_end_( 0 ) {
87 file_( file ), line_( line ), column_( column ),
88 line_end_( line_end ), column_end_( column_end )
105 template<
class StringType>
108 file_( file.
c_str() ), line_( line ), column_( column ),
109 line_end_( line_end ), column_end_( column_end )
119 return file_.c_str();
164 return explicit_bool::value_of( line_ );
192 line_end_ = line_end;
193 column_end_ = column_end;
201 column_type column_end_;
218 bool operator==( location
const &i, location
const &j );
228 bool operator!=( location
const &i, location
const &j );
237 typedef std::vector<std::string> params_type;
273 return params_[ i - 1 ];
327 void substitute( value_type *s )
const;
332 void add_param( value_type
const& );
333 value_type lookup_param( size_type i )
const;
334 bool then_else(
bool, value_type
const&, value_type::size_type*,
336 size_type to_index( value_type::value_type )
const;
bool operator!() const
Checks whether this location has not been set.
char const * file() const
Gets the file name, if any.
A location holds the file location of an error.
line_type line_end() const
Gets the ending line number, if any.
std::enable_if<!ZORBA_TR1_NS::is_array< T >::value &&!ZORBA_TR1_NS::is_pointer< T >::value &&has_insertion_operator<T >::value, std::string >::type to_string(T const &t)
column_type column_end() const
Gets the ending column number, if any.
StringType::const_pointer c_str(StringType const &s)
location()
Constructs a default (empty) location.
unsigned short column_type
The column-number type.
bool operator!=(location const &i, location const &j)
Helper class for implementing a solution to the "explicit bool conversion" problem.
static location const empty
A empty instance for convenience.
parameters & operator,(T const &t)
Adds the string representation of the given object as the next parameter.
value_type const & operator[](size_type i) const
Gets the i'th parameter value.
column_type column() const
Gets the column number, if any.
unsigned line_type
The line-number type.
params_type::value_type value_type
params_type::size_type size_type
location(StringType const &file, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)
Constructs a location.
bool operator==(location const &i, location const &j)
location(char const *file, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)
Constructs a location.
line_type line() const
Gets the line number, if any.
void set(char const *file, line_type line, column_type column=0, line_type line_end=0, column_type column_end=0)
Sets the location information.
void operator&(serialization::Archiver &, const Diagnostic *&)
static parameters const empty
A empty instance for convenience.