catch2/include/internal/catch_string.h

53 lines
1.5 KiB
C
Raw Normal View History

2017-06-29 12:18:14 +02:00
/*
* Copyright 2016 Two Blue Cubes Ltd. All rights reserved.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef CATCH_STRING_H_INCLUDED
#define CATCH_STRING_H_INCLUDED
2017-08-05 23:53:21 +02:00
#include <cstddef>
2017-06-29 12:18:14 +02:00
namespace Catch {
class StringData;
class StringRef;
class StringBuilder;
/// An owning, ref-counted, immutable string type.
/// The ref count (not visible here as it is defined in StringData) is atomic
/// so instances should be safe to share across threads
class String {
friend class StringRef;
friend class StringBuilder;
StringData const* m_data = nullptr;
public:
2017-08-05 23:53:21 +02:00
using size_type = size_t;
2017-06-29 12:18:14 +02:00
String();
String( StringRef const& stringRef );
String( char const* rawString );
String( String const& other );
String( String&& other ) noexcept;
2017-06-29 12:18:14 +02:00
String( StringBuilder&& stringBuf );
~String() noexcept;
auto operator = ( String const& other ) -> String&;
auto operator == ( StringRef const& other ) const noexcept -> bool;
auto operator == ( char const* other ) const noexcept -> bool;
auto empty() const noexcept -> bool;
auto size() const noexcept -> size_type;
auto numberOfCharacters() const noexcept -> size_type;
2017-06-29 12:18:14 +02:00
auto c_str() const noexcept -> char const*;
};
} // namespace Catch
#endif // CATCH_STRING_H_INCLUDED