tesseract  4.1.1
tesseract::StringParam Class Reference

#include <params.h>

Inheritance diagram for tesseract::StringParam:
tesseract::Param

Public Member Functions

 StringParam (const char *value, const char *name, const char *comment, bool init, ParamsVectors *vec)
 
 ~StringParam ()
 
 operator STRING & ()
 
const char * string () const
 
const char * c_str () const
 
bool empty ()
 
bool operator== (const STRING &other)
 
void operator= (const STRING &value)
 
void set_value (const STRING &value)
 
void ResetToDefault ()
 
void ResetFrom (const ParamsVectors *vec)
 
- Public Member Functions inherited from tesseract::Param
 ~Param ()=default
 
const char * name_str () const
 
const char * info_str () const
 
bool is_init () const
 
bool is_debug () const
 
bool constraint_ok (SetParamConstraint constraint) const
 

Additional Inherited Members

- Protected Member Functions inherited from tesseract::Param
 Param (const char *name, const char *comment, bool init)
 
- Protected Attributes inherited from tesseract::Param
const char * name_
 
const char * info_
 
bool init_
 
bool debug_
 

Detailed Description

Definition at line 204 of file params.h.

Constructor & Destructor Documentation

◆ StringParam()

tesseract::StringParam::StringParam ( const char *  value,
const char *  name,
const char *  comment,
bool  init,
ParamsVectors vec 
)
inline

Definition at line 206 of file params.h.

208  : Param(name, comment, init) {
209  value_ = value;
210  default_ = value;
211  params_vec_ = &(vec->string_params);
212  vec->string_params.push_back(this);
213  }
Param(const char *name, const char *comment, bool init)
Definition: params.h:127

◆ ~StringParam()

tesseract::StringParam::~StringParam ( )
inline

Definition at line 214 of file params.h.

214 { ParamUtils::RemoveParam<StringParam>(this, params_vec_); }

Member Function Documentation

◆ c_str()

const char* tesseract::StringParam::c_str ( ) const
inline

Definition at line 217 of file params.h.

217 { return value_.string(); }
const char * string() const
Definition: strngs.cpp:194

◆ empty()

bool tesseract::StringParam::empty ( )
inline

Definition at line 218 of file params.h.

218 { return value_.length() <= 0; }
int32_t length() const
Definition: strngs.cpp:189

◆ operator STRING &()

tesseract::StringParam::operator STRING & ( )
inline

Definition at line 215 of file params.h.

215 { return value_; }

◆ operator=()

void tesseract::StringParam::operator= ( const STRING value)
inline

Definition at line 220 of file params.h.

220 { value_ = value; }

◆ operator==()

bool tesseract::StringParam::operator== ( const STRING other)
inline

Definition at line 219 of file params.h.

219 { return value_ == other; }

◆ ResetFrom()

void tesseract::StringParam::ResetFrom ( const ParamsVectors vec)
inline

Definition at line 223 of file params.h.

223  {
224  for (int i = 0; i < vec->string_params.size(); ++i) {
225  if (strcmp(vec->string_params[i]->name_str(), name_) == 0) {
226  // printf("overriding param %s=%s by =%s\n", name_, value_,
227  // vec->string_params[i]->c_str());
228  value_ = *vec->string_params[i];
229  break;
230  }
231  }
232  }
const char * name_
Definition: params.h:132

◆ ResetToDefault()

void tesseract::StringParam::ResetToDefault ( )
inline

Definition at line 222 of file params.h.

222 { value_ = default_; }

◆ set_value()

void tesseract::StringParam::set_value ( const STRING value)
inline

Definition at line 221 of file params.h.

221 { value_ = value; }

◆ string()

const char* tesseract::StringParam::string ( ) const
inline

Definition at line 216 of file params.h.

216 { return value_.string(); }
const char * string() const
Definition: strngs.cpp:194

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