first shot at Ticket #355: use a default-constructed "invalid" PlacementRef
Making PlacementRef default constructible this way would resolve the immediate problems; as any access goes through an index lookup and thus will throw. The bool check on this special ref yields false, so this solution seems to fill the bill.
This commit is contained in:
parent
2e62a3b01b
commit
474c293197
4 changed files with 16 additions and 1 deletions
|
|
@ -106,6 +106,13 @@ namespace mobject {
|
|||
validate(id_);
|
||||
}
|
||||
|
||||
/** Default is an NIL Placement ref. It throws on any access. */
|
||||
PlacementRef ()
|
||||
: id_()
|
||||
{
|
||||
REQUIRE (!isValid(), "hash-ID clash with existing ID");
|
||||
}
|
||||
|
||||
PlacementRef (PlacementRef const& r) ///< copy ctor
|
||||
: id_(r.id_)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace session {
|
|||
*/
|
||||
class ScopePath
|
||||
{
|
||||
vector<RefPlacement> path_;
|
||||
vector<Scope> path_;
|
||||
|
||||
public:
|
||||
ScopePath();
|
||||
|
|
|
|||
|
|
@ -42,6 +42,13 @@ namespace session {
|
|||
}
|
||||
|
||||
|
||||
Scope::Scope ()
|
||||
: anchor_()
|
||||
{
|
||||
REQUIRE (!anchor_.isValid());
|
||||
}
|
||||
|
||||
|
||||
ScopeLocator::ScopeLocator()
|
||||
: focusStack_(new QueryFocusStack)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ namespace session {
|
|||
|
||||
public:
|
||||
Scope (PlacementMO const& constitutingPlacement);
|
||||
Scope (); ///< unlocated NIL scope
|
||||
|
||||
static Scope const& containing (PlacementMO const& aPlacement); //////////////TODO really returning a const& here??
|
||||
static Scope const& containing (RefPlacement const& refPlacement);
|
||||
|
|
|
|||
Loading…
Reference in a new issue