20 #ifndef GEOS_DATAREPOSITORY_DATACONTEXT_HPP_
21 #define GEOS_DATAREPOSITORY_DATACONTEXT_HPP_
26 #include "common/format/Format.hpp"
30 namespace dataRepository
98 ToStringInfo(
string const & targetName,
string const & filePath,
size_t line );
154 {
return m_typeName; }
160 {
return m_filePath; }
173 {
return m_offsetInLine; }
185 string const m_typeName;
187 string const m_filePath;
191 size_t const m_offsetInLine;
193 size_t const m_offset;
198 ToStringInfo getToStringInfo()
const override;
213 struct GEOS_FMT_NS::formatter<
geos::dataRepository::DataContext > : GEOS_FMT_NS::formatter< std::string >
223 return GEOS_FMT_NS::formatter< std::string >::format( dataContext.
toString(), ctx );
string getTargetName() const
virtual ToStringInfo getToStringInfo() const =0
This method exposes the raw data of a DataContext, in order to access and format it (notably in toStr...
virtual string toString() const =0
DataContext(string const &targetName)
Construct a new DataContext object.
string const m_targetName
friend std::ostream & operator<<(std::ostream &os, const DataContext &ctx)
Insert contextual information in the provided stream.
virtual ~DataContext()
Destroy the DataContext object.
string getTypeName() const
string getFilePath() const
DataFileContext(xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlAttribute const &att, xmlWrapper::xmlAttributePos const &attPos)
Construct the file context of a Group from an xml node.
DataFileContext(xmlWrapper::xmlNode const &targetNode, xmlWrapper::xmlNodePos const &nodePos)
Construct the file context of a Group from an xml node.
string toString() const override
size_t getOffsetInLine() const
static constexpr size_t npos
Error value for when an offset / line position is undefined.
pugi::xml_attribute xmlAttribute
auto format(geos::dataRepository::DataContext const &dataContext, format_context &ctx) const
Format the specified DataContext to a string.
ToStringInfo(string const &targetName, string const &filePath, size_t line)
Construct a new ToStringInfo object from a DataContext that has input file info.
size_t m_line
the file line of the DataFileContext, if it exists (an empty string otherwise)
ToStringInfo(string const &targetName)
Construct a new ToStringInfo object from a DataContext that has no input file info.
bool hasInputFileInfo() const
string m_filePath
the file path of the DataFileContext, if it exists (an empty string otherwise)
string m_targetName
the targetName of the DataContext