Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Blame | Last modification | View Log | Download | RSS feed

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