1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#ifndef DPSTRING_H
#define DPSTRING_H
#include <ctype.h>
#include <string>
#include <string.h>
#include "defines.h"
class dpRegExp;
// BEGIN PARSE FOR DPUSER2C
class dpString : public std::string {
public:
dpString();
dpString(const char *);
dpString(const std::string &);
dpString(const dpString &);
~dpString();
void operator+=(const dpString &);
void operator+=(const char*);
void operator+=(const char);
const char *to_c_str() const;
dpString mid(dpint64 begin, dpint64 length) const;
dpString &remove(dpint64, dpint64);
static dpString number(const long number);
dpString right(const dpint64 length) const;
dpString left(const dpint64 length) const;
dpString upper();
dpString lower();
void setNum(const double);
void setNum(const long);
void truncate(dpint64 length);
void sprintf(const char *, ...);
dpString &replace(dpint64, dpint64, const char *);
dpString &replace(const dpString &, const dpString &);
dpString &replace(const dpRegExp &before, const dpString &after);
float toFloat(bool *ok = NULL);
double toDouble();
int contains(const char);
int contains(const char *);
long strpos(dpString &, const bool);
dpString simplifyWhiteSpace();
dpString stripWhiteSpace();
dpString & strtrim(int = 0);
bool isEmpty() const;
};
// END PARSE FOR DPUSER2C
class dpRegExp : public dpString {
public:
dpRegExp(const dpString &s) : dpString(s) { }
};
class dpChar {
public:
dpChar() { rep = 0; }
dpChar(const char c) { rep = c; }
bool isDigit() { return isdigit(rep) != 0; }
bool operator==(const char c) { return rep == c; }
protected:
char rep;
};
#endif /* DPSTRING_H */
|