NazaraEngine/include/Nazara/Shader/ShaderLangSourceLocation.hpp

42 lines
1.5 KiB
C++

// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Shader module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_SHADER_SHADERLANGSOURCELOCATION_HPP
#define NAZARA_SHADER_SHADERLANGSOURCELOCATION_HPP
#include <Nazara/Prerequisites.hpp>
#include <Nazara/Shader/Config.hpp>
#include <memory>
#include <string>
namespace Nz::ShaderLang
{
struct SourceLocation
{
inline SourceLocation();
inline SourceLocation(unsigned int line, unsigned int column, std::shared_ptr<const std::string> file);
inline SourceLocation(unsigned int line, unsigned int startColumn, unsigned int endColumn, std::shared_ptr<const std::string> file);
inline SourceLocation(unsigned int startLine, unsigned int endLine, unsigned int startColumn, unsigned int endColumn, std::shared_ptr<const std::string> file);
inline void ExtendToLeft(const SourceLocation& leftLocation);
inline void ExtendToRight(const SourceLocation& rightLocation);
inline bool IsValid() const;
static inline SourceLocation BuildFromTo(const SourceLocation& leftSource, const SourceLocation& rightSource);
std::shared_ptr<const std::string> file; //< Since the same file will be used for every node, prevent storing X time the same path
UInt32 endColumn;
UInt32 endLine;
UInt32 startColumn;
UInt32 startLine;
};
}
#include <Nazara/Shader/ShaderLangSourceLocation.inl>
#endif // NAZARA_SHADER_SHADERLANGSOURCELOCATION_HPP