OpenPine C++ API
C++ wrapper for the OpenPine Pine Script VM
Loading...
Searching...
No Matches
input_symbol.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 InputSymbol(const ffi::InputSymbol& data) : data_(data) {}
30 int64_t id() const { return data_.id; }
32 std::string_view defaultValue() const {
33 return detail::refToView(data_.default_value);
34 }
35
36 std::optional<std::string_view> title() const {
37 return detail::optRefToView(data_.has_title, data_.title);
38 }
39
40 std::optional<std::string_view> tooltip() const {
41 return detail::optRefToView(data_.has_tooltip, data_.tooltip);
42 }
43
44 std::optional<std::string_view> inlineGroup() const {
45 return detail::optRefToView(data_.has_inline, data_.inline_);
46 }
47
48 std::optional<std::string_view> group() const {
49 return detail::optRefToView(data_.has_group, data_.group);
50 }
51
52 uint64_t display() const { return data_.display; }
54 bool active() const { return data_.active; }
56 bool confirm() const { return data_.confirm; }
57
58 private:
59 ffi::InputSymbol data_;
60};
61
62} // namespace inputs
63} // namespace openpine
int64_t id() const
Input ID.
std::optional< std::string_view > tooltip() const
Optional tooltip.
std::optional< std::string_view > title() const
Optional title.
uint64_t display() const
Display bitmask.
bool confirm() const
Whether the input requires confirmation.
InputSymbol(const ffi::InputSymbol &data)
Constructs from FFI data.
bool active() const
Whether the input is active.
std::optional< std::string_view > inlineGroup() const
Optional inline group name.
std::string_view defaultValue() const
Default value.
std::optional< std::string_view > group() const
Optional group name.
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.
std::string_view refToView(const ffi::PineStringRef &ref)
Shared helpers for converting C ABI string refs to std::string_view.
Re-exports FFI types into the openpine namespace.