2 |
|
#ifndef GSTR_H |
3 |
|
#define GSTR_H |
4 |
|
//--------------------------------------------------------------------------- |
5 |
+ |
#include "GBase.h" |
6 |
|
#include <string.h> |
7 |
|
#include <stdio.h> |
8 |
|
#include <stdlib.h> |
8 |
– |
#include "GBase.h" |
9 |
|
|
10 |
|
// This class uses reference counting and copy-on-write semantics |
11 |
|
|
107 |
|
int index(const GStr& s, int start_index = 0) const; |
108 |
|
int index(const char* s, int start_index = 0) const; |
109 |
|
int index(char c, int start_index = 0) const; |
110 |
< |
int rindex(char c) const; |
111 |
< |
int rindex(const char* str) const; |
110 |
> |
int rindex(char c, int end_index = -1) const; |
111 |
> |
int rindex(const char* str, int end_index = -1) const; |
112 |
|
bool contains(const GStr& s) const; |
113 |
|
bool contains(const char* s) const; |
114 |
|
bool contains(char c) const; |
115 |
|
bool startsWith(const char* s) const; |
116 |
+ |
bool startsWith(const GStr& s) const; |
117 |
+ |
bool endsWith(const char* s) const; |
118 |
+ |
bool endsWith(const GStr& s) const; |
119 |
|
GStr split(const char* delim); |
120 |
|
GStr split(char c); |
121 |
|
/* splits "this" in two parts, at the first (leftmost) |
150 |
|
size_t read(FILE* stream, const char* delimiter="\n", size_t bufsize=4096); |
151 |
|
//read next token from stream, using the given string as |
152 |
|
//a marker where the block should stop |
150 |
– |
|
151 |
– |
static const int max_token_size = 200; |
152 |
– |
static const int max_line_size = 600; |
153 |
|
const char* chars() const; |
154 |
|
const char* text() const; |
155 |
|
protected: |