/** This file is a part of rexy's general purpose library Copyright (C) 2020 rexy712 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ #include "string_base.hpp" #include //exchange, swap #include //memcpy #include //strcpy, strlen namespace rexy{ char* string_base::release(void){ return std::exchange(m_data, nullptr); } char& string_base::operator[](size_t i){ return m_data[i]; } const char& string_base::operator[](size_t i)const{ return m_data[i]; } static_string::static_string(const char* c): static_string(const_cast(c), strlen(c)){} static_string& static_string::operator=(const char* c){ m_data = const_cast(c); m_length = strlen(c); return *this; } static_string& static_string::operator=(const static_string& s){ m_data = s.m_data; m_length = s.m_length; return *this; } }