blob: 494ae3222a4bbf3d92a6df56525615eecf3e6455 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- ResourceScriptToken.h -----------------------------------*- C++-*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===---------------------------------------------------------------------===//
9//
10// This declares the .rc script tokens.
11// The list of available tokens is located at ResourceScriptTokenList.h.
12//
13// Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380599(v=vs.85).aspx
14//
15//===---------------------------------------------------------------------===//
16
17#ifndef LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_SCRIPTTOKEN_H
18#define LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_SCRIPTTOKEN_H
19
20#include "llvm/ADT/StringRef.h"
21
22namespace llvm {
23
24// A definition of a single resource script token. Each token has its kind
25// (declared in ResourceScriptTokenList) and holds a value - a reference
26// representation of the token.
27// RCToken does not claim ownership on its value. A memory buffer containing
28// the token value should be stored in a safe place and cannot be freed
29// nor reallocated.
30class RCToken {
31public:
32 enum class Kind {
33#define TOKEN(Name) Name,
34#define SHORT_TOKEN(Name, Ch) Name,
35#include "ResourceScriptTokenList.h"
36#undef TOKEN
37#undef SHORT_TOKEN
38 };
39
40 RCToken(RCToken::Kind RCTokenKind, StringRef Value);
41
42 // Get an integer value of the integer token.
43 uint32_t intValue() const;
44 bool isLongInt() const;
45
46 StringRef value() const;
47 Kind kind() const;
48
49 // Check if a token describes a binary operator.
50 bool isBinaryOp() const;
51
52private:
53 Kind TokenKind;
54 StringRef TokenValue;
55};
56
57} // namespace llvm
58
59#endif