mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Add scope_t::empty and scope_t::size
This commit is contained in:
@@ -83,10 +83,20 @@ namespace scope
|
||||
return NULL_STR;
|
||||
}
|
||||
|
||||
bool scope_t::operator== (scope_t const& rhs) const { return (!path && !rhs.path) || (path && rhs.path && *path == *rhs.path); }
|
||||
size_t scope_t::size () const
|
||||
{
|
||||
return path ? path->scopes.size() : 0;
|
||||
}
|
||||
|
||||
bool scope_t::empty () const
|
||||
{
|
||||
return size() == 0;
|
||||
}
|
||||
|
||||
bool scope_t::operator== (scope_t const& rhs) const { return (empty() && rhs.empty()) || (path && rhs.path && *path == *rhs.path); }
|
||||
bool scope_t::operator!= (scope_t const& rhs) const { return !(*this == rhs); }
|
||||
bool scope_t::operator< (scope_t const& rhs) const { return (!path && rhs.path) || (path && rhs.path && *path < *rhs.path); }
|
||||
scope_t::operator bool () const { return path && !path->scopes.empty(); }
|
||||
bool scope_t::operator< (scope_t const& rhs) const { return (empty() && !rhs.empty()) || (path && rhs.path && *path < *rhs.path); }
|
||||
scope_t::operator bool () const { return !empty(); }
|
||||
|
||||
scope_t shared_prefix (scope_t const& lhs, scope_t const& rhs)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace scope
|
||||
void push_scope (std::string const& atom, bool contentScope = false);
|
||||
void pop_scope ();
|
||||
std::string back () const;
|
||||
size_t size () const;
|
||||
bool empty () const;
|
||||
|
||||
bool operator== (scope_t const& rhs) const;
|
||||
bool operator!= (scope_t const& rhs) const;
|
||||
|
||||
Reference in New Issue
Block a user