1 //===- FileToken.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_FILETOKEN_H_
10 #define MCLD_SCRIPT_FILETOKEN_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 FileToken
19  *  \brief This class defines the interfaces to a filename in INPUT/GROUP
20  *         command.
21  */
22 
23 class FileToken : public InputToken {
24  private:
25   friend class Chunk<FileToken, MCLD_SYMBOLS_PER_INPUT>;
26   FileToken();
27   FileToken(const std::string& pName, bool pAsNeeded);
28 
29  public:
30   ~FileToken();
31 
classof(const InputToken * pToken)32   static bool classof(const InputToken* pToken) {
33     return pToken->type() == InputToken::File;
34   }
35 
36   /* factory method */
37   static FileToken* create(const std::string& pName, bool pAsNeeded);
38   static void destroy(FileToken*& pToken);
39   static void clear();
40 };
41 
42 }  // namespace mcld
43 
44 #endif  // MCLD_SCRIPT_FILETOKEN_H_
45