#include <sample2.h>
Definition at line 39 of file sample2.h.
◆ MyString() [1/3]
Definition at line 53 of file sample2.h.
53: c_string_(nullptr) {}
◆ MyString() [2/3]
MyString::MyString |
( |
const char * |
a_c_string | ) |
|
|
inlineexplicit |
Definition at line 56 of file sample2.h.
56 : c_string_(nullptr) {
58 }
void Set(const char *c_string)
◆ MyString() [3/3]
MyString::MyString |
( |
const MyString & |
string | ) |
|
|
inline |
Definition at line 61 of file sample2.h.
61 : c_string_(nullptr) {
62 Set(
string.c_string_);
63 }
◆ ~MyString()
Definition at line 69 of file sample2.h.
69{ delete[] c_string_; }
◆ c_string()
const char * MyString::c_string |
( |
| ) |
const |
|
inline |
◆ CloneCString()
const char * MyString::CloneCString |
( |
const char * |
a_c_string | ) |
|
|
static |
Definition at line 37 of file sample2.cc.
37 {
38 if (a_c_string == nullptr) return nullptr;
39
40 const size_t len = strlen(a_c_string);
41 char* const clone = new char[ len + 1 ];
42 memcpy(clone, a_c_string, len + 1);
43
44 return clone;
45}
◆ Length()
size_t MyString::Length |
( |
| ) |
const |
|
inline |
Definition at line 74 of file sample2.h.
74{ return c_string_ == nullptr ? 0 : strlen(c_string_); }
◆ Set()
void MyString::Set |
( |
const char * |
c_string | ) |
|
Definition at line 49 of file sample2.cc.
49 {
50
52 delete[] c_string_;
53 c_string_ = temp;
54}
static const char * CloneCString(const char *a_c_string)
The documentation for this class was generated from the following files:
- /media/home/debian/src/github/tesseract-ocr/tesseract/unittest/third_party/googletest/googletest/samples/sample2.h
- /media/home/debian/src/github/tesseract-ocr/tesseract/unittest/third_party/googletest/googletest/samples/sample2.cc