Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <cctype>
- #include <cstring>
- #include <iostream>
- #include <vector>
- class String {
- public:
- explicit String();
- explicit String(size_t size, char character);
- String(const char* const_str);
- String(const String& source);
- void Swap(String& src);
- String& operator=(const String& src);
- ~String();
- size_t Size() const;
- size_t& Size();
- size_t& Capacity();
- const char* Data();
- const char* Data() const;
- bool Empty() const;
- char& operator[](size_t index);
- const char& operator[](size_t index) const;
- size_t Capacity() const;
- void Resize(size_t new_size);
- void Resize(size_t new_size, char character);
- void PushBack(char character);
- void Reserve(size_t new_cap);
- void PopBack();
- void ShrinkToFit();
- void Clear();
- char& Front();
- const char& Front() const;
- const char& Back() const;
- char& Back();
- friend std::ostream& operator<<(std::ostream& os, const String& str);
- friend std::istream& operator>>(std::istream& is, String& str);
- String operator+(const String& other) const;
- String& operator+=(const String& other);
- String& operator*=(size_t n);
- String operator*(size_t n) const;
- bool operator==(const String& other) const;
- bool operator<=(const String& other) const;
- bool operator<(const String& other) const;
- bool operator>(const String& other) const;
- bool operator>=(const String& other) const;
- bool operator!=(const String& other) const;
- String Join(const std::vector<String>& strings) const;
- std::vector<String> Split(const char* separator = " ") const;
- void Print() const;
- void Free();
- private:
- unsigned long size_;
- unsigned long capacity_;
- char* string_;
- };
- // void Substr(const char* input, int offset, int len, char* dest);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement