本文整理汇总了C++中IntrusiveRefCntPtr::getPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ IntrusiveRefCntPtr::getPtr方法的具体用法?C++ IntrusiveRefCntPtr::getPtr怎么用?C++ IntrusiveRefCntPtr::getPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IntrusiveRefCntPtr
的用法示例。
在下文中一共展示了IntrusiveRefCntPtr::getPtr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFromYAMLString
TEST_F(VFSFromYAMLTest, BasicVFSFromYAML) {
IntrusiveRefCntPtr<vfs::FileSystem> FS;
FS = getFromYAMLString("");
EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString("[]");
EXPECT_EQ(nullptr, FS.getPtr());
FS = getFromYAMLString("'string'");
EXPECT_EQ(nullptr, FS.getPtr());
EXPECT_EQ(3, NumDiagnostics);
}
示例2: Lower
TEST_F(VFSFromYAMLTest, UseExternalName) {
IntrusiveRefCntPtr<DummyFileSystem> Lower(new DummyFileSystem());
Lower->addRegularFile("//root/external/file");
IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLString(
"{ 'roots': [\n"
" { 'type': 'file', 'name': '//root/A',\n"
" 'external-contents': '//root/external/file'\n"
" },\n"
" { 'type': 'file', 'name': '//root/B',\n"
" 'use-external-name': true,\n"
" 'external-contents': '//root/external/file'\n"
" },\n"
" { 'type': 'file', 'name': '//root/C',\n"
" 'use-external-name': false,\n"
" 'external-contents': '//root/external/file'\n"
" }\n"
"] }", Lower);
ASSERT_TRUE(nullptr != FS.getPtr());
// default true
EXPECT_EQ("//root/external/file", FS->status("//root/A")->getName());
// explicit
EXPECT_EQ("//root/external/file", FS->status("//root/B")->getName());
EXPECT_EQ("//root/C", FS->status("//root/C")->getName());
// global configuration
FS = getFromYAMLString(
"{ 'use-external-names': false,\n"
" 'roots': [\n"
" { 'type': 'file', 'name': '//root/A',\n"
" 'external-contents': '//root/external/file'\n"
" },\n"
" { 'type': 'file', 'name': '//root/B',\n"
" 'use-external-name': true,\n"
" 'external-contents': '//root/external/file'\n"
" },\n"
" { 'type': 'file', 'name': '//root/C',\n"
" 'use-external-name': false,\n"
" 'external-contents': '//root/external/file'\n"
" }\n"
"] }", Lower);
ASSERT_TRUE(nullptr != FS.getPtr());
// default
EXPECT_EQ("//root/A", FS->status("//root/A")->getName());
// explicit
EXPECT_EQ("//root/external/file", FS->status("//root/B")->getName());
EXPECT_EQ("//root/C", FS->status("//root/C")->getName());
}
示例3: OverlayFileSystem
TEST_F(VFSFromYAMLTest, CaseSensitive) {
IntrusiveRefCntPtr<DummyFileSystem> Lower(new DummyFileSystem());
Lower->addRegularFile("//root/foo/bar/a");
IntrusiveRefCntPtr<vfs::FileSystem> FS =
getFromYAMLString("{ 'case-sensitive': 'true',\n"
" 'roots': [\n"
"{\n"
" 'type': 'directory',\n"
" 'name': '//root/',\n"
" 'contents': [ {\n"
" 'type': 'file',\n"
" 'name': 'XX',\n"
" 'external-contents': '//root/foo/bar/a'\n"
" }\n"
" ]\n"
"}]}",
Lower);
ASSERT_TRUE(FS.getPtr() != nullptr);
IntrusiveRefCntPtr<vfs::OverlayFileSystem> O(
new vfs::OverlayFileSystem(Lower));
O->pushOverlay(FS);
ErrorOr<vfs::Status> SS = O->status("//root/xx");
EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
SS = O->status("//root/xX");
EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
SS = O->status("//root/Xx");
EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError());
EXPECT_EQ(0, NumDiagnostics);
}