GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-string.cc File Reference
#include "oct-string.h"
#include <algorithm>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <string>
#include "Array.h"
#include "lo-ieee.h"
#include "lo-mappers.h"
#include "uniconv-wrappers.h"
#include "unistr-wrappers.h"
#include "unwind-prot.h"
Include dependency graph for oct-string.cc:

Go to the source code of this file.

Macros

#define INSTANTIATE_OCTAVE_STRING(T, API)
 

Typedefs

typedef octave::string::codecvt_u8::ExternT ExternT
 
typedef octave::string::codecvt_u8::InternT InternT
 
typedef octave::string::codecvt_u8::StateT StateT
 

Functions

static std::istringstream & extract_num (std::istringstream &is, double &num, bool &imag, bool &have_sign)
 
static bool is_imag_unit (int c)
 
template<>
octave_idx_type numel (const Array< char > &str)
 
template<typename T >
T::size_type numel (const T &str)
 
template OCTAVE_API bool octave::string::strcmp< std::string > (const std::string &, const std::string &)
 
template OCTAVE_API bool octave::string::strcmp< std::string > (const std::string &, const typename std::string ::value_type *)
 
template OCTAVE_API bool octave::string::strcmpi< std::string > (const std::string &, const std::string &)
 
template OCTAVE_API bool octave::string::strcmpi< std::string > (const std::string &, const typename std::string ::value_type *)
 
template OCTAVE_API bool octave::string::strncmp< std::string > (const std::string &, const std::string &, const typename std::string ::size_type)
 
template OCTAVE_API bool octave::string::strncmp< std::string > (const std::string &, const typename std::string ::value_type *, const typename std::string ::size_type)
 
template OCTAVE_API bool octave::string::strncmpi< std::string > (const std::string &, const std::string &, const typename std::string ::size_type n)
 
template OCTAVE_API bool octave::string::strncmpi< std::string > (const std::string &, const typename std::string ::value_type *, const typename std::string ::size_type)
 
template<typename T >
std::string rational_approx (T val, int len)
 
template OCTAVE_API std::string rational_approx< double > (double val, int len)
 
template OCTAVE_API std::string rational_approx< float > (float val, int len)
 
static void set_component (Complex &c, double num, bool imag)
 
static double single_num (std::istringstream &is)
 
template<>
bool sizes_cmp (const Array< char > &str_a, const Array< char > &str_b)
 
template<>
bool sizes_cmp (const Array< char > &str_a, const char *str_b)
 
template<typename T >
bool sizes_cmp (const T &str_a, const T &str_b)
 
template<typename T >
bool sizes_cmp (const T &str_a, const typename T::value_type *str_b)
 
template<typename T >
static bool str_data_cmp (const typename T::value_type *a, const typename T::value_type *b, const typename T::size_type n)
 
template<typename T >
static bool str_data_cmpi (const typename T::value_type *a, const typename T::value_type *b, const typename T::size_type n)
 
template<typename T >
T::size_type strlen (const typename T::value_type *str)
 

Macro Definition Documentation

◆ INSTANTIATE_OCTAVE_STRING

#define INSTANTIATE_OCTAVE_STRING (   T,
  API 
)
Value:
template API bool octave::string::strcmp<T> (const T&, const T&); \
template API bool \
octave::string::strcmp<T> (const T&, const typename T::value_type*); \
template API bool octave::string::strcmpi<T> (const T&, const T&); \
template API bool \
octave::string::strcmpi<T> (const T&, const typename T::value_type*); \
template API bool \
octave::string::strncmp<T> (const T&, const T&, \
const typename T::size_type); \
template API bool \
octave::string::strncmp<T> (const T&, const typename T::value_type*, \
const typename T::size_type); \
template API bool \
octave::string::strncmpi<T> (const T&, const T&, \
const typename T::size_type n); \
template API bool \
octave::string::strncmpi<T> (const T&, const typename T::value_type*, \
const typename T::size_type);
octave_idx_type n
Definition: mx-inlines.cc:753

Definition at line 213 of file oct-string.cc.

Typedef Documentation

◆ ExternT

typedef octave::string::codecvt_u8::ExternT ExternT

Definition at line 611 of file oct-string.cc.

◆ InternT

typedef octave::string::codecvt_u8::InternT InternT

Definition at line 610 of file oct-string.cc.

◆ StateT

typedef octave::string::codecvt_u8::StateT StateT

Definition at line 612 of file oct-string.cc.

Function Documentation

◆ extract_num()

static std::istringstream& extract_num ( std::istringstream &  is,
double &  num,
bool &  imag,
bool &  have_sign 
)
static

Definition at line 301 of file oct-string.cc.

References imag(), is_imag_unit(), and single_num().

◆ is_imag_unit()

static bool is_imag_unit ( int  c)
inlinestatic

Definition at line 241 of file oct-string.cc.

Referenced by extract_num().

◆ numel() [1/2]

template<>
octave_idx_type numel ( const Array< char > &  str)

Definition at line 78 of file oct-string.cc.

References Array< T, Alloc >::numel().

◆ numel() [2/2]

template<typename T >
T::size_type numel ( const T &  str)

Definition at line 71 of file oct-string.cc.

Referenced by ov_range< T >::ov_range(), intNDArray< T >::abs(), all_scalar_1x1(), intNDArray< T >::any_element_not_one_or_zero(), range< T, typename std::enable_if< std::is_floating_point< T >::value >::type >::array_value(), Array< T, Alloc >::as_column(), dim_vector::as_column(), octave_uint64_matrix::as_mxArray(), ov_range< T >::as_mxArray(), Array< T, Alloc >::as_row(), dim_vector::as_row(), Array< T, Alloc >::assign(), Sparse< T, Alloc >::assign(), octave_uint64_matrix::bool_array_value(), octave_lazy_index::byte_size(), Array< T, Alloc >::byte_size(), octave_bool_matrix::char_array_value(), octave_uint64_matrix::char_array_value(), ov_range< T >::char_array_value(), Sparse< T, Alloc >::checkelem(), range< T, typename std::enable_if< std::is_floating_point< T >::value >::type >::cols(), Range::cols(), range< T, typename std::enable_if< std::is_floating_point< T >::value >::type >::columns(), Range::columns(), ov_range< T >::complex_value(), textscan_format_list::current(), Array< T, Alloc >::delete_elements(), Sparse< T, Alloc >::delete_elements(), Array< T, Alloc >::diag(), ov_range< T >::dims(), ov_range< T >::do_index_op(), do_simple_cellfun(), ov_range< T >::double_value(), string_vector::empty(), ov_range< T >::fast_elem_extract(), Fbitshift(), Fgmtime(), Array< T, Alloc >::fill(), fill_matrix(), Array< T, Alloc >::find(), ov_range< T >::float_complex_value(), octave_base_diag< DMT, MT >::float_value(), ov_range< T >::float_value(), Flocaltime(), Fquit(), MArray< T >::idx_add(), MArray< double >::idx_max(), MArray< T >::idx_max(), img_float2uint(), ind2sub(), Array< T, Alloc >::index(), Sparse< T, Alloc >::index(), octave_base_diag< DMT, MT >::is_true(), ov_range< T >::is_true(), Array< T, Alloc >::isempty(), DiagArray2< T >::isempty(), PermMatrix::isempty(), range< T, typename std::enable_if< std::is_floating_point< T >::value >::type >::isempty(), Range::isempty(), Array< T, Alloc >::issorted(), octave_map::length(), Array< T, Alloc >::lookup(), range< T, typename std::enable_if< std::is_floating_point< T >::value >::type >::make_n_element_range(), Array< T, Alloc >::map(), string_vector::max_length(), textscan_format_list::next(), octave_lazy_index::nnz(), Array< T, Alloc >::nnz(), Array< T, Alloc >::nth_element(), intNDArray< T >::operator!(), ov_range< T >::print_name_tag(), Array< T, Alloc >::resize1(), ov_range< T >::short_disp(), intNDArray< T >::signum(), Array< T, Alloc >::test(), ov_range< T >::try_narrowing_conversion(), and set_path_model::update_data().

◆ octave::string::strcmp< std::string >() [1/2]

template OCTAVE_API bool octave::string::strcmp< std::string > ( const std::string &  ,
const std::string &   
)

◆ octave::string::strcmp< std::string >() [2/2]

template OCTAVE_API bool octave::string::strcmp< std::string > ( const std::string &  ,
const typename std::string ::value_type *   
)

◆ octave::string::strcmpi< std::string >() [1/2]

template OCTAVE_API bool octave::string::strcmpi< std::string > ( const std::string &  ,
const std::string &   
)

◆ octave::string::strcmpi< std::string >() [2/2]

template OCTAVE_API bool octave::string::strcmpi< std::string > ( const std::string &  ,
const typename std::string ::value_type *   
)

◆ octave::string::strncmp< std::string >() [1/2]

template OCTAVE_API bool octave::string::strncmp< std::string > ( const std::string &  ,
const std::string &  ,
const typename std::string ::size_type   
)

◆ octave::string::strncmp< std::string >() [2/2]

template OCTAVE_API bool octave::string::strncmp< std::string > ( const std::string &  ,
const typename std::string ::value_type *  ,
const typename std::string ::size_type   
)

◆ octave::string::strncmpi< std::string >() [1/2]

template OCTAVE_API bool octave::string::strncmpi< std::string > ( const std::string &  ,
const std::string &  ,
const typename std::string ::size_type  n 
)

◆ octave::string::strncmpi< std::string >() [2/2]

template OCTAVE_API bool octave::string::strncmpi< std::string > ( const std::string &  ,
const typename std::string ::value_type *  ,
const typename std::string ::size_type   
)

◆ rational_approx()

template<typename T >
std::string rational_approx ( val,
int  len 
)

Definition at line 696 of file oct-string.cc.

References abs(), d, isinf(), isnan(), len, max(), min(), n, round(), and x_nint().

Referenced by qStringValueFor().

◆ rational_approx< double >()

template OCTAVE_API std::string rational_approx< double > ( double  val,
int  len 
)

◆ rational_approx< float >()

template OCTAVE_API std::string rational_approx< float > ( float  val,
int  len 
)

◆ set_component()

static void set_component ( Complex c,
double  num,
bool  imag 
)
inlinestatic

Definition at line 441 of file oct-string.cc.

References imag().

◆ single_num()

static double single_num ( std::istringstream &  is)
static

Definition at line 245 of file oct-string.cc.

References Inf, NaN, and octave_NA.

Referenced by extract_num().

◆ sizes_cmp() [1/4]

template<>
bool sizes_cmp ( const Array< char > &  str_a,
const Array< char > &  str_b 
)

Definition at line 99 of file oct-string.cc.

References Array< T, Alloc >::dims().

◆ sizes_cmp() [2/4]

template<>
bool sizes_cmp ( const Array< char > &  str_a,
const char *  str_b 
)

◆ sizes_cmp() [3/4]

template<typename T >
bool sizes_cmp ( const T &  str_a,
const T &  str_b 
)

Definition at line 92 of file oct-string.cc.

◆ sizes_cmp() [4/4]

template<typename T >
bool sizes_cmp ( const T &  str_a,
const typename T::value_type *  str_b 
)

Definition at line 106 of file oct-string.cc.

◆ str_data_cmp()

template<typename T >
static bool str_data_cmp ( const typename T::value_type *  a,
const typename T::value_type *  b,
const typename T::size_type  n 
)
static

Definition at line 47 of file oct-string.cc.

References n.

◆ str_data_cmpi()

template<typename T >
static bool str_data_cmpi ( const typename T::value_type *  a,
const typename T::value_type *  b,
const typename T::size_type  n 
)
static

Definition at line 58 of file oct-string.cc.

References n.

◆ strlen()