本文整理汇总了C++中TStr::Save方法的典型用法代码示例。如果您正苦于以下问题:C++ TStr::Save方法的具体用法?C++ TStr::Save怎么用?C++ TStr::Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStr
的用法示例。
在下文中一共展示了TStr::Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeJson
void TNodeJsFOut::writeJson(const v8::FunctionCallbackInfo<v8::Value>& Args) {
v8::Isolate* Isolate = v8::Isolate::GetCurrent();
v8::HandleScope HandleScope(Isolate);
PJsonVal JsonVal = TNodeJsUtil::GetArgJson(Args, 0);
TStr JsonStr = JsonVal->SaveStr();
TNodeJsFOut* JsFOut = ObjectWrap::Unwrap<TNodeJsFOut>(Args.This());
EAssertR(!JsFOut->SOut.Empty(), "Output stream already closed!");
JsonStr.Save(*JsFOut->SOut);
Args.GetReturnValue().Set(Args.Holder());
}
示例2: FOut
TEST(TStr, SaveLoad) {
const TStr FNm = "test1.txt";
const TStr Empty;
const TStr Alphabet = "abcdefghijklmnoprstuvz";
TStr Empty1, Alphabet1;
// is big
Empty.Save(*TFOut::New(FNm, false)(), false);
Empty1 = Alphabet;
Empty1.Load(*TFIn::New(FNm)(), false);
EXPECT_EQ(Empty, Empty1);
EXPECT_EQ(Empty, TStr(*TFIn::New(FNm)(), false));
EXPECT_EQ(0, Empty1.Len());
Empty.Save(*TFOut::New(FNm, false)(), false);
Empty1 = Empty;
Empty1.Load(*TFIn::New(FNm)(), false);
EXPECT_EQ(Empty, Empty1);
EXPECT_EQ(Empty, TStr(*TFIn::New(FNm)(), false));
EXPECT_EQ(0, Empty1.Len());
Alphabet.Save(*TFOut::New(FNm, false)(), false);
Alphabet1 = Alphabet;
Alphabet1.Load(*TFIn::New(FNm)(), false);
EXPECT_EQ(Alphabet, Alphabet1);
EXPECT_EQ(Alphabet, TStr(*TFIn::New(FNm)(), false));
Alphabet.Save(*TFOut::New(FNm, false)(), false);
Alphabet1 = Empty;
Alphabet1.Load(*TFIn::New(FNm)(), false);
EXPECT_EQ(Alphabet, Alphabet1);
EXPECT_EQ(Alphabet, TStr(*TFIn::New(FNm)(), false));
// is small
Empty.Save(*TFOut::New(FNm, false)(), true);
Empty1 = Alphabet;
Empty1.Load(*TFIn::New(FNm)(), true);
EXPECT_EQ(Empty, Empty1);
EXPECT_EQ(Empty, TStr(*TFIn::New(FNm)(), true));
EXPECT_EQ(0, Empty1.Len());
Empty.Save(*TFOut::New(FNm, false)(), true);
Empty1 = Empty;
Empty1.Load(*TFIn::New(FNm)(), true);
EXPECT_EQ(Empty, Empty1);
EXPECT_EQ(Empty, TStr(*TFIn::New(FNm)(), true));
EXPECT_EQ(0, Empty1.Len());
Alphabet.Save(*TFOut::New(FNm, false)(), true);
Alphabet1 = Alphabet;
Alphabet1.Load(*TFIn::New(FNm)(), true);
EXPECT_EQ(Alphabet, Alphabet1);
EXPECT_EQ(Alphabet, TStr(*TFIn::New(FNm)(), true));
Alphabet.Save(*TFOut::New(FNm, false)(), true);
Alphabet1 = Empty;
Alphabet1.Load(*TFIn::New(FNm)(), true);
EXPECT_EQ(Alphabet, Alphabet1);
EXPECT_EQ(Alphabet, TStr(*TFIn::New(FNm)(), true));
// normal constructor
{
TFOut FOut(FNm, false);
FOut.PutStr(Empty);
}
EXPECT_EQ(Empty, TStr(TFIn::New(FNm)));
EXPECT_EQ(0, TStr(TFIn::New(FNm)).Len());
{
TFOut FOut(FNm, false);
FOut.PutStr(Alphabet);
}
EXPECT_EQ(Alphabet, TStr(TFIn::New(FNm)));
}