demotool/c-project.hh

46 lines
1 KiB
C++
Raw Normal View History

2017-11-24 14:13:39 +01:00
#pragma once
#ifndef REAL_BUILD
# include "externals.hh"
#endif
#include <ebcl/Sets.hh>
struct T_Project;
2017-11-24 14:13:39 +01:00
class A_ProjectPathListener
{
friend struct T_Project;
2017-11-24 14:13:39 +01:00
public:
virtual ~A_ProjectPathListener( ) = 0;
protected:
2017-11-24 14:13:39 +01:00
virtual void projectPathChanged( ) noexcept = 0;
};
struct T_Project
{
2017-12-27 14:15:49 +01:00
explicit T_Project( T_FSPath const& path ) noexcept
{ setBasePath( path ); }
2017-12-27 14:15:49 +01:00
void setBasePath( T_FSPath const& path ) noexcept;
2017-11-24 14:13:39 +01:00
2017-12-27 14:15:49 +01:00
T_FSPath const& basePath( ) const noexcept
2017-11-24 14:13:39 +01:00
{ return basePath_; }
2017-12-27 14:53:19 +01:00
T_FSPath pathOf( T_FSPath const& file ) const noexcept;
T_FSPath pathOf( char const* file ) const noexcept;
T_String strPathOf( T_FSPath const& file ) const noexcept;
T_String strPathOf( char const* file ) const noexcept;
2017-11-24 14:13:39 +01:00
void addListener( A_ProjectPathListener* listener ) noexcept
{ listeners_.add( listener ); }
void removeListener( A_ProjectPathListener* listener ) noexcept
{ listeners_.remove( listener ); }
private:
2017-12-27 14:15:49 +01:00
T_FSPath basePath_;
2017-11-24 14:13:39 +01:00
ebcl::T_Set< A_ProjectPathListener* > listeners_{
ebcl::UseTag< ebcl::ArrayBacked< 16 > >( )
};
};