Name.h 2.37 KB
Newer Older
con's avatar
con committed
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
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#ifndef CPLUSPLUS_NAME_H
#define CPLUSPLUS_NAME_H

#include "CPlusPlusForwardDeclarations.h"

Roberto Raggi's avatar
Roberto Raggi committed
26 27

namespace CPlusPlus {
con's avatar
con committed
28 29 30 31 32 33 34

class CPLUSPLUS_EXPORT Name
{
public:
    Name();
    virtual ~Name();

Roberto Raggi's avatar
Roberto Raggi committed
35
    virtual const Identifier *identifier() const = 0;
Roberto Raggi's avatar
Roberto Raggi committed
36

con's avatar
con committed
37 38 39 40 41 42
    bool isNameId() const;
    bool isTemplateNameId() const;
    bool isDestructorNameId() const;
    bool isOperatorNameId() const;
    bool isConversionNameId() const;
    bool isQualifiedNameId() const;
43
    bool isSelectorNameId() const;
con's avatar
con committed
44

45
    virtual const Identifier *asNameId() const { return 0; }
46 47 48 49 50
    virtual const TemplateNameId *asTemplateNameId() const { return 0; }
    virtual const DestructorNameId *asDestructorNameId() const { return 0; }
    virtual const OperatorNameId *asOperatorNameId() const { return 0; }
    virtual const ConversionNameId *asConversionNameId() const { return 0; }
    virtual const QualifiedNameId *asQualifiedNameId() const { return 0; }
51
    virtual const SelectorNameId *asSelectorNameId() const { return 0; }
con's avatar
con committed
52 53 54

    virtual bool isEqualTo(const Name *other) const = 0;

Roberto Raggi's avatar
Roberto Raggi committed
55 56
    void accept(NameVisitor *visitor) const;
    static void accept(const Name *name, NameVisitor *visitor);
con's avatar
con committed
57 58

protected:
Roberto Raggi's avatar
Roberto Raggi committed
59
    virtual void accept0(NameVisitor *visitor) const = 0;
con's avatar
con committed
60 61
};

62
} // namespace CPlusPlus
Roberto Raggi's avatar
Roberto Raggi committed
63

con's avatar
con committed
64 65

#endif // CPLUSPLUS_NAME_H