1a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)//===-- ClangNamespaceDecl.h ------------------------------------*- C++ -*-===//
2a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)//
3a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)//                     The LLVM Compiler Infrastructure
4a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)//
5a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)// This file is distributed under the University of Illinois Open Source
6a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)// License. See LICENSE.TXT for details.
7a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)//
8a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)//===----------------------------------------------------------------------===//
9a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)
10a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#ifndef liblldb_ClangNamespaceDecl_h_
11a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#define liblldb_ClangNamespaceDecl_h_
12a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)
13a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#include "lldb/lldb-public.h"
14#include "lldb/Core/ClangForward.h"
15
16namespace lldb_private {
17
18class ClangNamespaceDecl
19{
20public:
21    ClangNamespaceDecl () :
22        m_ast (NULL),
23        m_namespace_decl (NULL)
24    {
25    }
26
27    ClangNamespaceDecl (clang::ASTContext *ast, clang::NamespaceDecl *namespace_decl) :
28        m_ast (ast),
29        m_namespace_decl (namespace_decl)
30    {
31    }
32
33    ClangNamespaceDecl (const ClangNamespaceDecl &rhs) :
34        m_ast (rhs.m_ast),
35        m_namespace_decl (rhs.m_namespace_decl)
36    {
37    }
38
39    const ClangNamespaceDecl &
40    operator = (const ClangNamespaceDecl &rhs)
41    {
42        m_ast = rhs.m_ast;
43        m_namespace_decl = rhs.m_namespace_decl;
44        return *this;
45    }
46
47    //------------------------------------------------------------------
48    /// Convert to bool operator.
49    ///
50    /// This allows code to check a ClangNamespaceDecl object to see if
51    /// it contains a valid namespace decl using code such as:
52    ///
53    /// @code
54    /// ClangNamespaceDecl ns_decl(...);
55    /// if (ns_decl)
56    /// { ...
57    /// @endcode
58    ///
59    /// @return
60    ///     /b True this object contains a valid namespace decl, \b
61    ///     false otherwise.
62    //------------------------------------------------------------------
63    operator bool() const
64    {
65        return m_ast != NULL && m_namespace_decl != NULL;
66    }
67
68    clang::ASTContext *
69    GetASTContext() const
70    {
71        return m_ast;
72    }
73
74    void
75    SetASTContext (clang::ASTContext *ast)
76    {
77        m_ast = ast;
78    }
79
80    clang::NamespaceDecl *
81    GetNamespaceDecl () const
82    {
83        return m_namespace_decl;
84    }
85
86    void
87    SetNamespaceDecl (clang::NamespaceDecl *namespace_decl)
88    {
89        m_namespace_decl = namespace_decl;
90    }
91
92    std::string
93    GetQualifiedName () const;
94
95protected:
96    clang::ASTContext  *m_ast;
97    clang::NamespaceDecl *m_namespace_decl;
98};
99
100
101} // namespace lldb_private
102
103#endif // #ifndef liblldb_ClangNamespaceDecl_h_
104