127 lines
1.9 KiB
C++
127 lines
1.9 KiB
C++
#ifndef __SString_h__
|
|
#define __SString_h__
|
|
|
|
#include "includes"
|
|
|
|
namespace coreutils {
|
|
|
|
///
|
|
/// Use the PString object when advanced parsing algorithms are required to simplify
|
|
/// parsing. Two methods of parsing are available within the PString object. One
|
|
/// method involves using the split method to divide the string into several PString
|
|
/// objects. Split separates the string based upon a delimiter. Another method employs
|
|
/// the use of the getToken methods provided to move to through the string and assign
|
|
/// values based upon the followed path.
|
|
///
|
|
|
|
class PString {
|
|
|
|
public:
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
PString();
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
PString(std::string pstring);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
std::vector<PString> & getList();
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
std::string str();
|
|
|
|
///
|
|
/// Return the current value of the PString as a string of
|
|
/// specified length.
|
|
///
|
|
|
|
std::string str(int len);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
std::vector<PString> split(std::string delimiter, int maxSize = 0);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
std::string getTokenInclude(std::string include);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
std::string getTokenExclude(std::string exclude);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
coreutils::PString operator[](int index);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
bool eod();
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
bool ifNext(std::string value);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
int skipWhitespace();
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
std::string goeol();
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
std::string readBlock(size_t size);
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
int cursor = 0;
|
|
|
|
///
|
|
///
|
|
///
|
|
|
|
int size();
|
|
|
|
private:
|
|
std::string pstring;
|
|
std::vector<PString> list;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|