GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
make_valid_name_options Class Reference

Helper class for make_valid_name function calls. More...

#include "utils.h"

Collaboration diagram for make_valid_name_options:

Public Member Functions

 make_valid_name_options ()=default
 Default options for make_valid_name function calls. More...
 
 make_valid_name_options (const octave_value_list &args)
 Extract attribute-value-pairs from an octave_value_list of strings. More...
 
const std::string & get_prefix () const
 
const std::string & get_replacement_style () const
 

Private Attributes

std::string m_prefix {"x"}
 
std::string m_replacement_style {"underscore"}
 

Detailed Description

Helper class for make_valid_name function calls.

Extracting options separately for multiple (e.g. 1000+) function calls avoids expensive repetitive parsing of the very same options.

Definition at line 54 of file utils.h.

Constructor & Destructor Documentation

◆ make_valid_name_options() [1/2]

make_valid_name_options::make_valid_name_options ( )
default

Default options for make_valid_name function calls.

Calling the constructor without arguments is equivalent to:

make_valid_name_options (ovl ("ReplacementStyle", "underscore",
"Prefix", "x"));
make_valid_name_options()=default
Default options for make_valid_name function calls.
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211

◆ make_valid_name_options() [2/2]

make_valid_name_options::make_valid_name_options ( const octave_value_list args)

Extract attribute-value-pairs from an octave_value_list of strings.

If attributes occur multiple times, the rightmost pair is chosen.

make_valid_name_options (ovl ("ReplacementStyle", "hex", ...));

Definition at line 207 of file utils.cc.

References error(), iskeyword(), octave_value_list::length(), m_prefix, m_replacement_style, transform(), and valid_identifier().

Member Function Documentation

◆ get_prefix()

const std::string& make_valid_name_options::get_prefix ( ) const
inline
Returns
Prefix, see help matlab.lang.makeValidName.

Definition at line 88 of file utils.h.

Referenced by make_valid_name().

◆ get_replacement_style()

const std::string& make_valid_name_options::get_replacement_style ( ) const
inline
Returns
ReplacementStyle, see help matlab.lang.makeValidName.

Definition at line 84 of file utils.h.

Referenced by make_valid_name().

Member Data Documentation

◆ m_prefix

std::string make_valid_name_options::m_prefix {"x"}
private

Definition at line 93 of file utils.h.

Referenced by make_valid_name_options().

◆ m_replacement_style

std::string make_valid_name_options::m_replacement_style {"underscore"}
private

Definition at line 92 of file utils.h.

Referenced by make_valid_name_options().


The documentation for this class was generated from the following files: