Blender V5.0
spreadsheet_column_values.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "DNA_space_types.h"
8
10#include "BLI_string_ref.hh"
11
13
15
20
26 protected:
27 std::string name_;
28
31
32 public:
33 ColumnValues(std::string name,
36 : name_(std::move(name)), data_(std::move(data)), display_hint_(display_hint)
37 {
38 /* The array should not be empty. */
40 }
41
42 virtual ~ColumnValues() = default;
43
45 {
46 return cpp_type_to_column_type(data_.type());
47 }
48
50 {
51 return name_;
52 }
53
54 int size() const
55 {
56 return data_.size();
57 }
58
59 const GVArray &data() const
60 {
61 return data_;
62 }
63
68
77 float fit_column_width_px(const std::optional<int64_t> &max_sample_size = std::nullopt) const;
78
81 const std::optional<int64_t> &max_sample_size = std::nullopt) const;
82};
83
84} // namespace blender::ed::spreadsheet
#define BLI_assert(a)
Definition BLI_assert.h:46
#define final(a, b, c)
Definition BLI_hash.h:19
eSpreadsheetColumnValueType
ColumnValues(std::string name, GVArray data, const ColumnValueDisplayHint display_hint=ColumnValueDisplayHint::None)
eSpreadsheetColumnValueType type() const
float fit_column_values_width_px(const std::optional< int64_t > &max_sample_size=std::nullopt) const
float fit_column_width_px(const std::optional< int64_t > &max_sample_size=std::nullopt) const
eSpreadsheetColumnValueType cpp_type_to_column_type(const CPPType &type)