ResourceScriptToken.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- ResourceScriptToken.h -----------------------------------*- C++-*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===---------------------------------------------------------------------===//
  13. //
  14. // This declares the .rc script tokens.
  15. // The list of available tokens is located at ResourceScriptTokenList.h.
  16. //
  17. // Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380599(v=vs.85).aspx
  18. //
  19. //===---------------------------------------------------------------------===//
  20. #ifndef LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_SCRIPTTOKEN_H
  21. #define LLVM_INCLUDE_LLVM_SUPPORT_WINDOWS_RESOURCE_SCRIPTTOKEN_H
  22. #include "llvm/ADT/StringRef.h"
  23. namespace llvm {
  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.
  30. class RCToken {
  31. public:
  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. RCToken(RCToken::Kind RCTokenKind, StringRef Value);
  40. // Get an integer value of the integer token.
  41. uint32_t intValue() const;
  42. bool isLongInt() const;
  43. StringRef value() const;
  44. Kind kind() const;
  45. // Check if a token describes a binary operator.
  46. bool isBinaryOp() const;
  47. private:
  48. Kind TokenKind;
  49. StringRef TokenValue;
  50. };
  51. } // namespace llvm
  52. #endif
  53. #ifdef __GNUC__
  54. #pragma GCC diagnostic pop
  55. #endif