MString streaming work.
This commit is contained in:
parent
77d5ea61dd
commit
f6e5e60e5b
10
MString.cpp
10
MString.cpp
@ -154,6 +154,16 @@ namespace coreutils {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MString &MString::operator<<(std::ostream (*f)(std::ostream&)) {
|
||||||
|
MString &MString::operator<<(std::basic_ostream<char> (*pf)(std::basic_ostream<char>&)) {
|
||||||
|
// int temp = length;
|
||||||
|
// int len = length + value.length();
|
||||||
|
// setSize(len);
|
||||||
|
// memcpy(data + temp, value.c_str(), value.length());
|
||||||
|
std::cout << "xxx" << std::endl;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
void MString::insert(char ch, int offset) {
|
void MString::insert(char ch, int offset) {
|
||||||
setSize(length + 1);
|
setSize(length + 1);
|
||||||
for (int ix = length; ix >= offset; ix--)
|
for (int ix = length; ix >= offset; ix--)
|
||||||
|
12
MString.h
12
MString.h
@ -4,6 +4,7 @@
|
|||||||
#include "ZString.h"
|
#include "ZString.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
namespace coreutils
|
namespace coreutils
|
||||||
{
|
{
|
||||||
@ -126,7 +127,9 @@ namespace coreutils
|
|||||||
|
|
||||||
MString &operator<<(const int value);
|
MString &operator<<(const int value);
|
||||||
|
|
||||||
// MString& operator<<(coreutils::ZString &zstring);
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
MString &operator<<(coreutils::ZString zstring);
|
MString &operator<<(coreutils::ZString zstring);
|
||||||
|
|
||||||
@ -140,6 +143,13 @@ namespace coreutils
|
|||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
|
||||||
|
// MString &operator<<(std::ostream (*f)(std::ostream&) );
|
||||||
|
MString &operator<<(std::basic_ostream<char> (*pf)(std::basic_ostream<char>&));
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
void insert(char ch, int offset);
|
void insert(char ch, int offset);
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
g++ -o zstring_test zstring_test.cpp -I.. -L.. -lCoreUtils
|
g++ -o zstring_test zstring_test.cpp -I.. -L.. -lCoreUtils
|
||||||
g++ -o mstring_test mstring_test.cpp -I.. -L.. -lCoreUtils
|
g++ -o mstring_test mstring_test.cpp -I.. -L.. -lCoreUtils
|
||||||
g++ -o jstring_test jstring_test.cpp -I.. -L.. -lCoreUtils
|
#g++ -o jstring_test jstring_test.cpp -I.. -L.. -lCoreUtils
|
||||||
|
Binary file not shown.
@ -79,6 +79,9 @@ int main(int argc, char **argv) {
|
|||||||
test22 << test23;
|
test22 << test23;
|
||||||
std::cout << "mstring << string: [" << test22 << "]" << std::endl;
|
std::cout << "mstring << string: [" << test22 << "]" << std::endl;
|
||||||
|
|
||||||
|
// coreutils::MString test24 = std::endl;
|
||||||
|
// std::cout << "mstring << endl: " << test24 << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user