Skip to content

Commit

Permalink
Forgot to check in the CustomStruct.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
shaovoon committed Nov 21, 2013
1 parent 648ea29 commit 2550e6d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 42 deletions.
37 changes: 16 additions & 21 deletions Cpp11/PreVS2012UnitTest/CustomStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

Elmax::ostream operator <<(Elmax::ostream& os, const MyStruct& val)
{
std::string temp = boost::lexical_cast<std::string>(val.a);
std::wstring str = Elmax::BaseConverter::ConvToString(temp);
str += L",";
temp = boost::lexical_cast<std::string>(val.b);
str += Elmax::BaseConverter::ConvToString(temp);
str += L",";

os.set_str(os.str() + str);
os << val.a;
os << L",";
os << val.b;
os << L",";

return os;
}

Expand All @@ -23,25 +20,23 @@ Elmax::istream operator >>(Elmax::istream& is, MyStruct& val)

Elmax::ostream operator <<(Elmax::ostream& os, const DiffDelimiterStruct& val)
{
std::string temp = boost::lexical_cast<std::string>(val.a);
std::wstring str = Elmax::BaseConverter::ConvToString(temp);
str += L"|";
temp = boost::lexical_cast<std::string>(val.b);
str += Elmax::BaseConverter::ConvToString(temp);
str += L"|";

os.set_str(os.str() + str);
os << val.a;
os << L"|";
os << val.b;
os << L"|";

return os;
}

Elmax::istream operator >>(Elmax::istream& is, DiffDelimiterStruct& val)
{
Elmax::istream new_is(is.str(), L"|");
std::wstring old_delimiter = is.set_delimiter(L"|");

new_is >> val.a;
new_is >> val.b;
is >> val.a;
is >> val.b;

is.set_str(new_is.str());
is.set_delimiter(old_delimiter);

return is;
}
}

37 changes: 16 additions & 21 deletions Cpp11/UnitTest/CustomStruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@

Elmax::ostream operator <<(Elmax::ostream& os, const MyStruct& val)
{
std::string temp = boost::lexical_cast<std::string>(val.a);
std::wstring str = Elmax::BaseConverter::ConvToString(temp);
str += L",";
temp = boost::lexical_cast<std::string>(val.b);
str += Elmax::BaseConverter::ConvToString(temp);
str += L",";

os.set_str(os.str() + str);
os << val.a;
os << L",";
os << val.b;
os << L",";

return os;
}

Expand All @@ -24,25 +21,23 @@ Elmax::istream operator >>(Elmax::istream& is, MyStruct& val)

Elmax::ostream operator <<(Elmax::ostream& os, const DiffDelimiterStruct& val)
{
std::string temp = boost::lexical_cast<std::string>(val.a);
std::wstring str = Elmax::BaseConverter::ConvToString(temp);
str += L"|";
temp = boost::lexical_cast<std::string>(val.b);
str += Elmax::BaseConverter::ConvToString(temp);
str += L"|";

os.set_str(os.str() + str);
os << val.a;
os << L"|";
os << val.b;
os << L"|";

return os;
}

Elmax::istream operator >>(Elmax::istream& is, DiffDelimiterStruct& val)
{
Elmax::istream new_is(is.str(), L"|");
std::wstring old_delimiter = is.set_delimiter(L"|");

new_is >> val.a;
new_is >> val.b;
is >> val.a;
is >> val.b;

is.set_str(new_is.str());
is.set_delimiter(old_delimiter);

return is;
}
}

0 comments on commit 2550e6d

Please sign in to comment.