FileToken.h revision 87f34658dec9097d987d254a990ea7f311bfc95f
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#ifdef ENABLE_UNITTEST
12#include <gtest.h>
13#endif
14
15#include <mcld/Script/InputToken.h>
16#include <mcld/Support/Allocators.h>
17#include <mcld/Config/Config.h>
18
19namespace mcld
20{
21
22/** \class FileToken
23 *  \brief This class defines the interfaces to a filename in INPUT/GROUP
24 *         command.
25 */
26
27class FileToken : public InputToken
28{
29private:
30  friend class Chunk<FileToken, MCLD_SYMBOLS_PER_INPUT>;
31  FileToken();
32  FileToken(const std::string& pName, bool pAsNeeded);
33
34public:
35  ~FileToken();
36
37  static bool classof(const InputToken* pToken)
38  {
39    return pToken->type() == InputToken::File;
40  }
41
42  /* factory method */
43  static FileToken* create(const std::string& pName, bool pAsNeeded);
44  static void destroy(FileToken*& pToken);
45  static void clear();
46};
47
48} // namepsace of mcld
49
50#endif
51