File: context.hpp

package info (click to toggle)
openmw 0.50.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,076 kB
  • sloc: cpp: 380,958; xml: 2,192; sh: 1,449; python: 911; makefile: 26; javascript: 5
file content (47 lines) | stat: -rw-r--r-- 1,283 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef COMPILER_CONTEXT_H_INCLUDED
#define COMPILER_CONTEXT_H_INCLUDED

#include <string>
namespace ESM
{
    class RefId;
}

namespace Compiler
{
    class Extensions;

    class Context
    {
        const Extensions* mExtensions;

    public:
        Context()
            : mExtensions(nullptr)
        {
        }

        virtual ~Context() = default;

        virtual bool canDeclareLocals() const = 0;
        ///< Is the compiler allowed to declare local variables?

        void setExtensions(const Extensions* extensions = nullptr) { mExtensions = extensions; }

        const Extensions* getExtensions() const { return mExtensions; }

        virtual char getGlobalType(const std::string& name) const = 0;
        ///< 'l: long, 's': short, 'f': float, ' ': does not exist.

        virtual std::pair<char, bool> getMemberType(const std::string& name, const ESM::RefId& id) const = 0;
        ///< Return type of member variable \a name in script \a id or in script of reference of
        /// \a id
        /// \return first: 'l: long, 's': short, 'f': float, ' ': does not exist.
        /// second: true: script of reference

        virtual bool isId(const ESM::RefId& name) const = 0;
        ///< Does \a name match an ID, that can be referenced?
    };
}

#endif