1 #ifndef ROSE_SourceLocation_H
2 #define ROSE_SourceLocation_H
4 #include <Rose/Location.h>
6 #include <boost/filesystem.hpp>
7 #include <boost/serialization/access.hpp>
8 #include <boost/serialization/nvp.hpp>
9 #include <boost/shared_ptr.hpp>
10 #include <boost/unordered_set.hpp>
11 #include <Sawyer/Optional.h>
60 using NamePtr = boost::shared_ptr<boost::filesystem::path>;
67 struct NameHasher {
size_t operator()(
const NamePtr&)
const; };
68 struct NameEquivalence {
bool operator()(
const NamePtr&,
const NamePtr&)
const; };
69 using FileNames = boost::unordered_set<NamePtr, NameHasher, NameEquivalence>;
70 static SAWYER_THREAD_TRAITS::Mutex classMutex_;
71 static FileNames fileNames_;
74 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
75 friend class boost::serialization::access;
78 void serialize(S &s,
unsigned version) {
79 s & BOOST_SERIALIZATION_NVP(fileName_);
80 s & BOOST_SERIALIZATION_NVP(line_);
81 s & BOOST_SERIALIZATION_NVP(column_);
118 virtual std::string
toString()
const override;
123 virtual void print(std::ostream&)
const override;
152 virtual bool isValid()
const override;
161 virtual const boost::filesystem::path&
fileName()
const;
179 void registerFileName();
virtual const Sawyer::Optional< size_t > & column() const
Column number.
virtual std::string printableName() const override
Convert location to escaped string.
virtual ~SourceLocation()
Destructor.
static SourceLocation parse(const std::string &)
Construct a new source location by parsing a string.
Information about a source location.
Base class for location types.
virtual const boost::filesystem::path & fileName() const
File name associated with this location.
virtual bool operator<=(const Location &) const override
Ordered comparison.
virtual bool operator>(const Location &) const override
Ordered comparison.
SourceLocation()
Default constructor.
virtual size_t line() const
Line number.
virtual std::string toString() const override
Convert location to string.
Main namespace for the ROSE library.
virtual bool operator<(const Location &) const override
Ordered comparison.
virtual bool isEqual(const Location &) const override
Equality and inequality.
virtual bool operator>=(const Location &) const override
Ordered comparison.
virtual bool isValid() const override
Test whether this object is valid.
virtual void print(std::ostream &) const override
Output location to a stream.