KiCad PCB EDA Suite
class_am_param.cpp File Reference

Go to the source code of this file.

Functions

int ReadInt (char *&text, bool aSkipSeparator=true)
 Function ReadInt reads an int from an ASCII character buffer. More...
 
double ReadDouble (char *&text, bool aSkipSeparator=true)
 Function ReadDouble reads a double from an ASCII character buffer. More...
 

Function Documentation

double ReadDouble ( char *&  text,
bool  aSkipSeparator = true 
)

Function ReadDouble reads a double from an ASCII character buffer.

If there is a comma after the double, then skip over that.

Parameters
textA reference to a character pointer from which the ASCII double is read from and the pointer advanced for each character read.
aSkipSeparator= true (default) to skip comma
Returns
double

Definition at line 291 of file rs274_read_XY_and_IJ_coordinates.cpp.

Referenced by AM_PARAM::ReadParam().

292 {
293  double ret = strtod( text, &text );
294 
295  if( *text == ',' || isspace( *text ) )
296  {
297  if( aSkipSeparator )
298  ++text;
299  }
300 
301  return ret;
302 }
int ReadInt ( char *&  text,
bool  aSkipSeparator = true 
)

Function ReadInt reads an int from an ASCII character buffer.

If there is a comma after the int, then skip over that.

Parameters
textA reference to a character pointer from which bytes are read and the pointer is advanced for each byte read.
aSkipSeparator= true (default) to skip comma
Returns
int - The int read in.

Definition at line 268 of file rs274_read_XY_and_IJ_coordinates.cpp.

Referenced by AM_PARAM::ReadParam().

269 {
270  int ret = (int) strtol( text, &text, 10 );
271 
272  if( *text == ',' || isspace( *text ) )
273  {
274  if( aSkipSeparator )
275  ++text;
276  }
277 
278  return ret;
279 }