1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#pragma once
#include <string>
#include <ostream>
#include <stdint.h>
namespace citygml {
class DocumentLocation {
public:
virtual const std::string& getDocumentFileName() const = 0;
virtual uint64_t getCurrentLine() const = 0;
virtual uint64_t getCurrentColumn() const = 0;
};
inline std::ostream& operator<<( std::ostream& os, const DocumentLocation& o ) {
if (o.getCurrentLine() == 0) {
os << " unknown location";
} else {
os << " line " << o.getCurrentLine();
if (o.getCurrentColumn() > 0) {
os << ", column " << o.getCurrentColumn();
}
}
if (!o.getDocumentFileName().empty()) {
os << " in file " << o.getDocumentFileName();
}
return os;
}
}
|