1 //===- NameSpec.h ---------------------------------------------------------===//
2 //
3 //                     The MCLinker Project
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef MCLD_SCRIPT_NAMESPEC_H_
10 #define MCLD_SCRIPT_NAMESPEC_H_
11 
12 #include "mcld/Config/Config.h"
13 #include "mcld/Script/InputToken.h"
14 #include "mcld/Support/Allocators.h"
15 
16 namespace mcld {
17 
18 /** \class NameSpec
19  *  \brief This class defines the interfaces to a namespec in INPUT/GROUP
20  *         command.
21  */
22 
23 class NameSpec : public InputToken {
24  private:
25   friend class Chunk<NameSpec, MCLD_SYMBOLS_PER_INPUT>;
26   NameSpec();
27   NameSpec(const std::string& pName, bool pAsNeeded);
28 
29  public:
30   ~NameSpec();
31 
classof(const InputToken * pToken)32   static bool classof(const InputToken* pToken) {
33     return pToken->type() == InputToken::NameSpec;
34   }
35 
36   /* factory method */
37   static NameSpec* create(const std::string& pName, bool pAsNeeded);
38   static void destroy(NameSpec*& pToken);
39   static void clear();
40 };
41 
42 }  // namespace mcld
43 
44 #endif  // MCLD_SCRIPT_NAMESPEC_H_
45