Extended source_location with column and translation unit info

This commit is contained in:
Bartek Kryza
2023-06-12 00:42:37 +02:00
parent 84ec4733cc
commit 43cc5cb49f
7 changed files with 55 additions and 27 deletions

View File

@@ -132,29 +132,6 @@ private:
};
} // namespace clanguml::common::model
namespace std {
/*
template <> struct hash<clanguml::common::model::filesystem_path> {
std::size_t operator()(
const clanguml::common::model::filesystem_path &key) const
{
using clanguml::common::model::path;
std::size_t seed = key.size();
for (const auto &ns : key) {
seed ^=
std::hash<std::string>{}(ns) +
clanguml::util::hash_seed(seed);
}
return seed;
}
};
*/
} // namespace std
namespace std {
template <>
struct hash<std::reference_wrapper<clanguml::common::model::source_file>> {

View File

@@ -40,10 +40,21 @@ public:
void set_file_relative(const std::string &file) { file_relative_ = file; }
const std::string &translation_unit() const { return translation_unit_; }
void set_translation_unit(const std::string &translation_unit)
{
translation_unit_ = translation_unit;
}
unsigned int line() const { return line_; }
void set_line(const unsigned line) { line_ = line; }
unsigned int column() const { return column_; }
void set_column(const unsigned column) { column_ = column; }
unsigned int location_id() const { return hash_; }
void set_location_id(unsigned int h) { hash_ = h; }
@@ -51,7 +62,9 @@ public:
private:
std::string file_;
std::string file_relative_;
std::string translation_unit_;
unsigned int line_{0};
unsigned int column_{0};
unsigned int hash_{0};
};
} // namespace clanguml::common::model