OpenPine C++ API
C++ wrapper for the OpenPine Pine Script VM
Loading...
Searching...
No Matches
input_price.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#if (defined(_MSVC_LANG) ? _MSVC_LANG : __cplusplus) < 201703L
9#error "OpenPine C++ wrapper headers require C++17."
10#endif
11
12#include <optional>
13#include <string_view>
14
15#include "../ffi.hpp"
16#include "../string_ref.hpp"
17#include "../types.hpp"
18
19namespace openpine {
20namespace inputs {
21
26 public:
28 explicit InputPrice(const ffi::InputPrice& data) : data_(data) {}
30 int64_t id() const { return data_.id; }
32 double defaultValue() const { return data_.default_value; }
34 std::optional<std::string_view> title() const {
35 return detail::optRefToView(data_.has_title, data_.title);
36 }
37
38 std::optional<std::string_view> tooltip() const {
39 return detail::optRefToView(data_.has_tooltip, data_.tooltip);
40 }
41
42 std::optional<std::string_view> inlineGroup() const {
43 return detail::optRefToView(data_.has_inline, data_.inline_);
44 }
45
46 std::optional<std::string_view> group() const {
47 return detail::optRefToView(data_.has_group, data_.group);
48 }
49
50 uint64_t display() const { return data_.display; }
52 bool active() const { return data_.active; }
54 bool confirm() const { return data_.confirm; }
55
56 private:
57 ffi::InputPrice data_;
58};
59
60} // namespace inputs
61} // namespace openpine
std::optional< std::string_view > tooltip() const
Optional tooltip.
uint64_t display() const
Display bitmask.
InputPrice(const ffi::InputPrice &data)
Constructs from FFI data.
bool confirm() const
Whether the input requires confirmation.
bool active() const
Whether the input is active.
std::optional< std::string_view > group() const
Optional group name.
std::optional< std::string_view > inlineGroup() const
Optional inline group name.
std::optional< std::string_view > title() const
Optional title.
double defaultValue() const
Default value.
int64_t id() const
Input ID.
std::optional< std::string_view > optRefToView(bool has_field, const ffi::PineStringRef &ref)
Returns optional string_view when has_field is true, otherwise std::nullopt.
Shared helpers for converting C ABI string refs to std::string_view.
Re-exports FFI types into the openpine namespace.