Update procedures
[shapes.git] / source / corelocation.h
blob546f9b44b9d40e22d05a1345ed567643a3e60c3b
1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * any later version.
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2015 Henrik Tidefelt
19 #pragma once
21 #include "refcount.h"
22 #include "identifier.h"
23 #include "methodid.h"
24 #include "Shapes_Ast_decls.h"
25 #include "Shapes_Kernel_decls.h"
27 #include <iostream>
29 namespace Shapes
31 namespace Interaction
34 class CoreLocation
36 public:
37 virtual ~CoreLocation( );
39 virtual void show( std::ostream & os ) const = 0;
42 std::ostream & operator << ( std::ostream & os, const CoreLocation & self );
44 class CharPtrLocation : public CoreLocation
46 const char * loc_;
47 public:
48 CharPtrLocation( const char * loc );
49 virtual ~CharPtrLocation( );
50 virtual void show( std::ostream & os ) const;
53 class CharRefPtrLocation : public CoreLocation
55 RefCountPtr< const char > loc_;
56 public:
57 CharRefPtrLocation( const RefCountPtr< const char > & loc );
58 virtual ~CharRefPtrLocation( );
59 virtual void show( std::ostream & os ) const;
62 class BoundLocation : public CoreLocation
64 Ast::PlacedIdentifier loc_;
65 Ast::Identifier::Type type_;
66 public:
67 BoundLocation( const Ast::PlacedIdentifier & loc, Ast::Identifier::Type type = Ast::Identifier::VARIABLE );
68 virtual ~BoundLocation( );
69 virtual void show( std::ostream & os ) const;
72 class MethodLocation : public CoreLocation
74 Kernel::MethodId method_;
75 public:
76 MethodLocation( const Kernel::MethodId method );
77 virtual ~MethodLocation( );
78 virtual void show( std::ostream & os ) const;
81 class MutatorLocation : public CoreLocation
83 RefCountPtr< const ::Shapes::Lang::Class > class_;
84 const char * name_;
85 public:
86 MutatorLocation( const Kernel::State * state, const char * name );
87 virtual ~MutatorLocation( );
88 virtual void show( std::ostream & os ) const;
91 /* Location based on FileID, presenting itself by means of
92 * FileID::name.
94 class FileIDLocation : public CoreLocation
96 const Ast::FileID * fileID_; /* All FileID pointers are owned by FileID. */
97 public:
98 FileIDLocation( const Ast::FileID * fileID );
99 virtual ~FileIDLocation( );
100 virtual void show( std::ostream & os ) const;