nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
iofun.hpp
Go to the documentation of this file.
1// src/builtin/include/nk/builtin/iofun.hpp
2//
3// Pure C++ Formatted input/output and stream printing functions.
4#pragma once
5
6#include <iostream>
7#include <memory_resource>
8#include <string>
9#include <nk/value/value.hpp>
10#include <nk/value/span.hpp>
11
12namespace nk::builtin {
13
16
17
24
31Value sprintf(const Value &fmt, Span<const Value> args, std::pmr::memory_resource *mr = nullptr);
32
39std::string sprintf(const std::string &fmt, Span<const Value> args, std::pmr::memory_resource *mr = nullptr);
40
44std::string dispFormat(const Value &a);
45
49void disp(const Value &v, std::ostream &os = std::cout);
50
58int fprintf(std::ostream &os, const std::string &fmt, Span<const Value> args, std::pmr::memory_resource *mr = nullptr);
59
66Value sscanf(const std::string &str, const std::string &fmt, std::pmr::memory_resource *mr = nullptr);
67
73void sscanf(Span<const Value> args, size_t nargout, Span<Value> outs, std::pmr::memory_resource *mr = nullptr);
74
75
77} // namespace nk::builtin
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
Value sprintf(const Value &fmt, Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
Formats data into a character array or string according to format specifier fmt (sprintf(fmt,...
Value sscanf(const std::string &str, const std::string &fmt, std::pmr::memory_resource *mr=nullptr)
Reads formatted data from a string according to format specifier fmt (sscanf(str, fmt)).
void disp(const Value &v, std::ostream &os=std::cout)
Displays value to the standard output or specified stream (disp(v)).
int fprintf(std::ostream &os, const std::string &fmt, Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
Formats and writes data to an output stream (fprintf(os, fmt, ...)).
std::string dispFormat(const Value &a)
Formats Value for terminal display via disp.