accessor.h 728 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (c) 2021 Samuel Maddock <[email protected]>.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_COMMON_GIN_HELPER_ACCESSOR_H_
  5. #define ELECTRON_SHELL_COMMON_GIN_HELPER_ACCESSOR_H_
  6. #include "base/memory/raw_ptr_exclusion.h"
  7. namespace gin_helper {
  8. // Wrapper for a generic value to be used as an accessor in a
  9. // gin_helper::Dictionary.
  10. template <typename T>
  11. struct AccessorValue {
  12. T Value;
  13. };
  14. template <typename T>
  15. struct AccessorValue<const T&> {
  16. T Value;
  17. };
  18. template <typename T>
  19. struct AccessorValue<const T*> {
  20. RAW_PTR_EXCLUSION T* Value;
  21. };
  22. } // namespace gin_helper
  23. #endif // ELECTRON_SHELL_COMMON_GIN_HELPER_ACCESSOR_H_