mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 11:43:29 +01:00
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
/*
|
|
* 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
|
|
|
|
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:
|
|
using size_type = unsigned long;
|
|
|
|
String();
|
|
String( StringRef const& stringRef );
|
|
String( char const* rawString );
|
|
String( String const& other );
|
|
String( String&& other );
|
|
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 c_str() const noexcept -> char const*;
|
|
};
|
|
|
|
} // namespace Catch
|
|
|
|
#endif // CATCH_STRING_H_INCLUDED
|