mirror of
https://github.com/Relintai/programming_tutorials.git
synced 2025-04-29 22:08:00 +02:00
41 lines
785 B
C++
41 lines
785 B
C++
#ifndef STRING_H
|
|
#define STRING_H
|
|
|
|
class String {
|
|
|
|
public:
|
|
void push_back(const int element);
|
|
void pop_back();
|
|
void remove(const int index);
|
|
void erase(const int element);
|
|
void clear();
|
|
bool empty() const;
|
|
int get(const int index);
|
|
const int &get(const int index) const;
|
|
void set(const int index, const int value);
|
|
|
|
int size() const;
|
|
int capacity() const;
|
|
void ensure_capacity(const int capacity);
|
|
void resize(const int s);
|
|
void append_array(const String &other);
|
|
int find(const int val) const;
|
|
|
|
int *dataw();
|
|
const int *data() const;
|
|
|
|
const int &operator[](const int index) const;
|
|
int &operator[](const int index);
|
|
|
|
String();
|
|
String(int prealloc);
|
|
String(int prealloc, int grow_by);
|
|
|
|
private:
|
|
int *_data;
|
|
int _actual_size;
|
|
int _size;
|
|
int _grow_by;
|
|
};
|
|
|
|
#endif |