mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* all except pol * pol and includes under defines * something weird has happened * remove own folder from include searchpath * fixed remaining, adapted include style for external headers * missing include
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#include "bscript/compiler/model/ScopeName.h"
|
|
|
|
#include "clib/clib.h"
|
|
#include "clib/strutil.h"
|
|
|
|
namespace Pol::Bscript::Compiler
|
|
{
|
|
ScopeName ScopeName::Global = ScopeName( "" );
|
|
ScopeName ScopeName::None = ScopeName();
|
|
ScopeName ScopeName::Super = ScopeName( Compiler::SUPER );
|
|
|
|
ScopeName::ScopeName( std::string name ) : std::optional<std::string>( std::move( name ) ) {}
|
|
|
|
ScopeName::ScopeName() : std::optional<std::string>( std::nullopt ) {}
|
|
|
|
bool ScopeName::global() const
|
|
{
|
|
return empty() || value().empty();
|
|
}
|
|
|
|
bool ScopeName::super() const
|
|
{
|
|
return has_value() && Clib::caseInsensitiveEqual( value(), ScopeName::Super.value() );
|
|
}
|
|
|
|
bool ScopeName::empty() const
|
|
{
|
|
return !has_value();
|
|
}
|
|
|
|
std::string ScopeName::string() const
|
|
{
|
|
return value_or( "" );
|
|
}
|
|
bool ScopeName::operator<( const ScopeName& other ) const
|
|
{
|
|
if ( !has_value() && !other.has_value() )
|
|
{
|
|
return false;
|
|
}
|
|
if ( !has_value() && other.has_value() )
|
|
{
|
|
return true;
|
|
}
|
|
if ( has_value() && !other.has_value() )
|
|
{
|
|
return false;
|
|
}
|
|
return stricmp( value().c_str(), other.value().c_str() ) < 0;
|
|
}
|
|
} // namespace Pol::Bscript::Compiler
|