// ui/gfx/mojom/linear_gradient.mojom-data-view.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file defines XDataView for type traits and can be included in
// _mojom_traits.h definitions but otherwise please use .mojom-forward.h,
// .mojom-shared.h or .mojom.h.

// IWYU pragma: private
// IWYU pragma: friend "traits"

#ifndef UI_GFX_MOJOM_LINEAR_GRADIENT_MOJOM_DATA_VIEW_H_
#define UI_GFX_MOJOM_LINEAR_GRADIENT_MOJOM_DATA_VIEW_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "ui/gfx/mojom/linear_gradient.mojom-shared-internal.h"


namespace gfx::mojom {
class StepDataView;

class LinearGradientDataView;



}  // gfx::mojom


namespace mojo {
namespace internal {

template <>
struct MojomTypeTraits<::gfx::mojom::StepDataView> {
  using Data = ::gfx::mojom::internal::Step_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

template <>
struct MojomTypeTraits<::gfx::mojom::LinearGradientDataView> {
  using Data = ::gfx::mojom::internal::LinearGradient_Data;
  using DataAsArrayElement = Pointer<Data>;
  static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};

}  // namespace internal
}  // namespace mojo


namespace gfx::mojom {


class StepDataView {
 public:
  StepDataView() = default;

  StepDataView(
      internal::Step_Data* data,
      mojo::Message* message)
      : data_(data) {}

  bool is_null() const { return !data_; }
  float fraction() const {
    return data_->fraction;
  }
  uint8_t alpha() const {
    return data_->alpha;
  }
 private:
  internal::Step_Data* data_ = nullptr;
};


class LinearGradientDataView {
 public:
  LinearGradientDataView() = default;

  LinearGradientDataView(
      internal::LinearGradient_Data* data,
      mojo::Message* message)
      : data_(data), message_(message) {}

  bool is_null() const { return !data_; }
  int16_t angle() const {
    return data_->angle;
  }
  uint8_t step_count() const {
    return data_->step_count;
  }
  inline void GetStepsDataView(
      mojo::ArrayDataView<StepDataView>* output);

  template <typename UserType>
  [[nodiscard]] bool ReadSteps(UserType* output) {
    
    auto* pointer = data_->steps.Get();
    return mojo::internal::Deserialize<mojo::ArrayDataView<::gfx::mojom::StepDataView>>(
        pointer, output, message_);
  }
 private:
  internal::LinearGradient_Data* data_ = nullptr;
  mojo::Message* message_ = nullptr;
};


}  // gfx::mojom

#endif  // UI_GFX_MOJOM_LINEAR_GRADIENT_MOJOM_DATA_VIEW_H_