bpp-core3  3.0.0
BppString.cpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #include <ostream>
6 
7 #include "BppString.h"
8 
9 namespace bpp
10 {
11 BppString::BppString() = default;
12 BppString::BppString(const char* value)
13  : text_(value)
14 {}
15 BppString::BppString(const std::string& value)
16  : text_(value)
17 {}
18 BppString& BppString::operator=(const char* value)
19 {
20  text_ = value;
21  return *this;
22 }
23 BppString& BppString::operator=(const std::string& value)
24 {
25  text_ = value;
26  return *this;
27 }
28 
29 BppString* BppString::clone() const { return new BppString(*this); }
30 
31 const std::string& BppString::toSTL() const { return text_; }
32 
33 std::ostream& operator<<(std::ostream& out, const BppString& s)
34 {
35  out << s.toSTL();
36  return out;
37 }
38 } // namespace bpp
std::string text_
Definition: BppString.h:21
BppString * clone() const
Create a copy of this object and send a pointer to it.
Definition: BppString.cpp:29
BppString & operator=(const char *value)
Definition: BppString.cpp:18
std::ostream & operator<<(std::ostream &out, const BppBoolean &s)
Definition: BppBoolean.h:32
The BppString object class. This class extends the stl::string class to support the Clonable interfac...
Definition: BppString.h:18
const std::string & toSTL() const
Definition: BppString.cpp:31