demotool/c-project.hh

38 lines
896 B
C++

#pragma once
#ifndef REAL_BUILD
# include "externals.hh"
#endif
#include <ebcl/Sets.hh>
class A_ProjectPathListener
{
public:
virtual ~A_ProjectPathListener( ) = 0;
virtual void projectPathChanged( ) noexcept = 0;
};
struct T_Project
{
void setBasePath( T_String const& path ) noexcept;
T_String const& basePath( ) const noexcept
{ return basePath_; }
T_String pathOf( T_String const& file ) const noexcept;
T_String pathOf( char const* file ) const noexcept;
void addListener( A_ProjectPathListener* listener ) noexcept
{ listeners_.add( listener ); }
void removeListener( A_ProjectPathListener* listener ) noexcept
{ listeners_.remove( listener ); }
private:
T_String basePath_{ T_String::Pooled( "." ) };
ebcl::T_Set< A_ProjectPathListener* > listeners_{
ebcl::UseTag< ebcl::ArrayBacked< 16 > >( )
};
void setBasePathInternal( T_String path ) noexcept;
};