本文整理汇总了C++中Document::IsNull方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::IsNull方法的具体用法?C++ Document::IsNull怎么用?C++ Document::IsNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::IsNull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: a
TYPED_TEST(DocumentMove, MoveAssignment) {
typedef TypeParam Allocator;
typedef GenericDocument<UTF8<>, Allocator> Document;
Allocator allocator;
Document a(&allocator);
a.Parse("[\"one\", \"two\", \"three\"]");
EXPECT_FALSE(a.HasParseError());
EXPECT_TRUE(a.IsArray());
EXPECT_EQ(3u, a.Size());
EXPECT_EQ(&a.GetAllocator(), &allocator);
// Document b; b = a; // does not compile (!is_copy_assignable)
Document b;
b = std::move(a);
EXPECT_TRUE(a.IsNull());
EXPECT_TRUE(b.IsArray());
EXPECT_EQ(3u, b.Size());
EXPECT_EQ(&a.GetAllocator(), (void*)0);
EXPECT_EQ(&b.GetAllocator(), &allocator);
b.Parse("{\"Foo\": \"Bar\", \"Baz\": 42}");
EXPECT_FALSE(b.HasParseError());
EXPECT_TRUE(b.IsObject());
EXPECT_EQ(2u, b.MemberCount());
// Document c; c = a; // does not compile (see static_assert)
Document c;
c = std::move(b);
EXPECT_TRUE(b.IsNull());
EXPECT_TRUE(c.IsObject());
EXPECT_EQ(2u, c.MemberCount());
EXPECT_EQ(&b.GetAllocator(), (void*)0);
EXPECT_EQ(&c.GetAllocator(), &allocator);
}
示例2: loadSupportedApiList
//将支持api保存到mSupportedApiSet
void Device::loadSupportedApiList(const Document &replyJson)
{
mSupportedApiSet.clear();
if (replyJson == NULL || replyJson.IsNull())
return;
if (replyJson.HasMember("error"))
{
return;
}
Value::ConstArray a = replyJson["result"].GetArray()[0].GetArray();
for (Value::ConstValueIterator itr = a.Begin(); itr != a.End(); ++itr)
{
mSupportedApiSet.insert(itr->GetString());
}
}
示例3: s
TEST(SchemaValidatingReader, Invalid) {
Document sd;
sd.Parse("{\"type\":\"string\",\"minLength\":2,\"maxLength\":3}");
SchemaDocument s(sd);
Document d;
StringStream ss("\"ABCD\"");
SchemaValidatingReader<kParseDefaultFlags, StringStream, UTF8<> > reader(ss, s);
d.Populate(reader);
EXPECT_FALSE(reader.GetParseResult());
EXPECT_FALSE(reader.IsValid());
EXPECT_EQ(kParseErrorTermination, reader.GetParseResult().Code());
EXPECT_STREQ("maxLength", reader.GetInvalidSchemaKeyword());
EXPECT_TRUE(reader.GetInvalidSchemaPointer() == SchemaDocument::PointerType(""));
EXPECT_TRUE(reader.GetInvalidDocumentPointer() == SchemaDocument::PointerType(""));
EXPECT_TRUE(d.IsNull());
}
示例4: retrieveJPG
//获取jpg数据
DWORD WINAPI retrieveJPG(LPVOID param)
{
CLiveview *dlg = (CLiveview *)param;
Document replyJson;
replyJson = dlg->indevice->startLiveview();
if (replyJson.IsNull())
{
//通讯失败
dlg->fetching = false;
dlg->FreshUI();
return -1;
}
if (replyJson.HasMember("error"))
{
//相机故障
dlg->fetching = false;
dlg->FreshUI();
return -1;
}
CString liveviewUrl = replyJson["result"].GetArray()[0].GetString();
LiveviewSlicer slicer;
if (!slicer.open(liveviewUrl))
{
//读取数据失败
dlg->fetching = false;
dlg->FreshUI();
return -1;
}
dlg->fetching = true;
while (dlg->fetching)
{
Payload payload = slicer.nextPayload();
LONG size = payload.jpegDataSize;
if (size <= 0)
{
slicer.close();
break;
}
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, size);
PUCHAR pData = (PUCHAR)GlobalLock(hGlobal);
int readLen = 0;
while (readLen < size)
{
readLen += slicer.file->Read(pData + readLen, size - readLen);
}
GlobalUnlock(hGlobal);
payload.paddingData = new UCHAR[payload.paddingDataSize];
readLen = 0;
while (readLen < payload.paddingDataSize)
{
readLen += slicer.file->Read(payload.paddingData + readLen,
payload.paddingDataSize - readLen);
}
delete[] payload.paddingData;
while (dlg->mJpegQueue.size() >= 5)
{
GlobalFree(dlg->mJpegQueue.front());
dlg->mJpegQueue.pop();
}
dlg->mJpegQueue.push(hGlobal);
}
//退出了
while (!dlg->mJpegQueue.empty())
{
dlg->mJpegQueue.pop();
}
dlg->fetching = false;
dlg->FreshUI();
return -1;
}