musrfit  1.9.2
PStringNumberList Class Reference

#include <PMusr.h>

Public Member Functions

 PStringNumberList (char *str)
 
 PStringNumberList (std::string str)
 
virtual ~PStringNumberList ()
 
virtual bool Parse (std::string &errorMsg, bool ignoreFirstToken=false)
 
virtual PUIntVector GetList ()
 

Private Member Functions

virtual bool IsNumber (std::string &str)
 
virtual void StripSpaces ()
 

Private Attributes

std::string fString
 
bool fIsValid
 
PUIntVector fList
 

Detailed Description

Helper class which parses list of numbers of the following 3 forms and its combination. (i) list of integers separted by spaces, e.g. 1 3 7 14 (ii) a range of integers of the form nS-nE, e.g. 13-27 which will generate 13, 14, 15, .., 26, 27 (iii) a sequence of integers of the form nS:nE:nStep, e.g. 10:20:2 which will generate 10, 12, 14, .., 18, 20

Definition at line 860 of file PMusr.h.

Constructor & Destructor Documentation

◆ PStringNumberList() [1/2]

PStringNumberList::PStringNumberList ( char *  str)
inline

Definition at line 862 of file PMusr.h.

References fString.

◆ PStringNumberList() [2/2]

PStringNumberList::PStringNumberList ( std::string  str)
inline

Definition at line 863 of file PMusr.h.

References fString.

◆ ~PStringNumberList()

virtual PStringNumberList::~PStringNumberList ( )
inlinevirtual

Definition at line 864 of file PMusr.h.

References fList.

Member Function Documentation

◆ GetList()

virtual PUIntVector PStringNumberList::GetList ( )
inlinevirtual

Definition at line 867 of file PMusr.h.

References fList.

Referenced by main().

◆ IsNumber()

virtual bool PStringNumberList::IsNumber ( std::string &  str)
inlineprivatevirtual

Definition at line 874 of file PMusr.h.

◆ Parse()

bool PStringNumberList::Parse ( std::string &  errorMsg,
bool  ignoreFirstToken = false 
)
virtual

Helper class which parses list of numbers of the following 3 forms and its combination. (i) list of integers separted by spaces, e.g. 1 3 7 14 (ii) a range of integers of the form nS-nE, e.g. 13-27 which will generate 13, 14, 15, .., 26, 27 (iii) a sequence of integers of the form nS:nE:nStep, e.g. 10:20:2 which will generate 10, 12, 14, .., 18, 20

Parameters
errorMsgerror message
ignoreFirstTokenif true, the first parse token will be ignored
Returns
true if parse has been successful, otherwise false

Definition at line 1938 of file PMusr.cpp.

Referenced by main().

◆ StripSpaces()

void PStringNumberList::StripSpaces ( )
privatevirtual

This routine removes arbitray number of spaces between '-' and ':', e.g. 123 - 125 will be converted to 123-125, etc.

Definition at line 2050 of file PMusr.cpp.

Member Data Documentation

◆ fIsValid

bool PStringNumberList::fIsValid
private

Definition at line 871 of file PMusr.h.

◆ fList

PUIntVector PStringNumberList::fList
private

Definition at line 872 of file PMusr.h.

Referenced by GetList(), and ~PStringNumberList().

◆ fString

std::string PStringNumberList::fString
private

Definition at line 870 of file PMusr.h.

Referenced by PStringNumberList().


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