当前位置: 首页>>代码示例>>C++>>正文


C++ Path::Push方法代码示例

本文整理汇总了C++中Path::Push方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::Push方法的具体用法?C++ Path::Push怎么用?C++ Path::Push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path::Push方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestList

bool TestList() {
    BEGIN_TEST;
    PathFixture fixture;
    ASSERT_TRUE(fixture.Create());

    Path path;
    ASSERT_EQ(ZX_OK, path.Push(fixture.path("foo")));

    fbl::unique_ptr<StringList> list;
    list = path.List();
    EXPECT_STR_EQ(list->first(), "ba");
    EXPECT_NULL(list->next());

    ASSERT_EQ(ZX_OK, path.Push("ba"));
    list = path.List();

    EXPECT_EQ(list->length(), 2);
    list->erase_if("r");
    list->erase_if("z");
    EXPECT_TRUE(list->is_empty());

    ASSERT_EQ(ZX_OK, path.Push("z/qu/ux"));
    list = path.List();
    EXPECT_TRUE(list->is_empty());

    END_TEST;
}
开发者ID:saltstar,项目名称:smartnix,代码行数:27,代码来源:path.cpp

示例2: if

// fit with expanding but without splitting
short Leaf::BestFitPath2(Stat *Stats, const Entry &ent, Path& BestPath)
{
int EntryI=ClosestOne(Stats,ent);
if (EntryI>=0) {
	BestPath.Push(EntryI,this);
	return TRUE;
	}
else if (actsize<MaxSize(Stats)) {
	BestPath.Push(actsize,this);
	return TRUE;
	}
else return FALSE;
}
开发者ID:fernandolucasrodriguez,项目名称:colorquantizer,代码行数:14,代码来源:cftree.cpp

示例3: TestRename

bool TestRename() {
    BEGIN_TEST;
    BEGIN_TEST;
    PathFixture fixture;
    ASSERT_TRUE(fixture.Create());

    Path path;
    ASSERT_EQ(ZX_OK, path.Push(fixture.path("foo/ba")));

    EXPECT_NE(ZX_OK, path.Rename("", "empty"));
    EXPECT_NE(ZX_OK, path.Rename("empty", ""));

    EXPECT_NE(ZX_OK, path.Rename("missing", "found"));

    fbl::unique_fd fd(open(fixture.path("foo/ba/r").c_str(), O_RDWR));
    EXPECT_TRUE(!!fd);
    fd.reset(open(fixture.path("foo/ba/s").c_str(), O_RDWR));
    EXPECT_FALSE(!!fd);

    EXPECT_EQ(ZX_OK, path.Rename("r", "s"));
    fd.reset(open(fixture.path("foo/ba/r").c_str(), O_RDWR));
    EXPECT_FALSE(!!fd);
    fd.reset(open(fixture.path("foo/ba/s").c_str(), O_RDWR));
    EXPECT_TRUE(!!fd);

    EXPECT_EQ(ZX_OK, path.Rename("s", "r"));
    fd.reset(open(fixture.path("foo/ba/r").c_str(), O_RDWR));
    EXPECT_TRUE(!!fd);
    fd.reset(open(fixture.path("foo/ba/s").c_str(), O_RDWR));
    EXPECT_FALSE(!!fd);

    EXPECT_EQ(ZX_OK, path.Rename("z", "y"));
    EXPECT_NE(ZX_OK, path.Push("z/qu/ux"));
    EXPECT_EQ(ZX_OK, path.Push("y/qu/ux"));

    path.Pop();
    EXPECT_EQ(ZX_OK, path.Rename("y", "z"));
    EXPECT_NE(ZX_OK, path.Push("y/qu/ux"));
    EXPECT_EQ(ZX_OK, path.Push("z/qu/ux"));

    END_TEST;
}
开发者ID:saltstar,项目名称:smartnix,代码行数:42,代码来源:path.cpp

示例4:

// fit with expanding but without splitting
short Nonleaf::BestFitPath2(Stat *Stats, const Entry &ent, Path& BestPath)
{
int EntryI=ClosestOne(Stats,ent);
if (EntryI>=0) {
	BestPath.Push(EntryI,this);	
	if (child[EntryI]->BestFitPath2(Stats,ent,BestPath)==TRUE) 
		return TRUE;
	else 	return FALSE;
	}
else return FALSE;
}
开发者ID:fernandolucasrodriguez,项目名称:colorquantizer,代码行数:12,代码来源:cftree.cpp

示例5: TestEnsureAndRemove

bool TestEnsureAndRemove() {
    BEGIN_TEST;
    PathFixture fixture;
    ASSERT_TRUE(fixture.Create());

    Path path;
    ASSERT_EQ(ZX_OK, path.Push(fixture.path()));
    ASSERT_EQ(ZX_OK, path.Push("foo/ba/z/qu"));

    EXPECT_EQ(ZX_OK, path.Ensure(""));
    EXPECT_NE(ZX_OK, path.Ensure("x"));
    EXPECT_EQ(ZX_OK, path.Ensure("ux"));
    EXPECT_EQ(ZX_OK, path.Ensure("corge"));
    EXPECT_EQ(ZX_OK, path.Ensure("g/rault"));
    EXPECT_EQ(ZX_OK, path.Ensure("g/arply"));

    EXPECT_NE(ZX_OK, path.Remove(""));
    EXPECT_EQ(ZX_OK, path.Remove("a"));

    EXPECT_EQ(ZX_OK, path.Remove("x"));
    EXPECT_NE(ZX_OK, path.Push("x"));

    EXPECT_EQ(ZX_OK, path.Remove("corge"));
    EXPECT_NE(ZX_OK, path.Push("corge"));

    EXPECT_EQ(ZX_OK, path.Remove("g"));
    EXPECT_NE(ZX_OK, path.Push("g"));

    path.Pop();
    EXPECT_EQ(ZX_OK, path.Remove("foo"));
    EXPECT_NE(ZX_OK, path.Push("foo"));

    END_TEST;
}
开发者ID:saltstar,项目名称:smartnix,代码行数:34,代码来源:path.cpp

示例6: TestReset

bool TestReset() {
    BEGIN_TEST;
    PathFixture fixture;
    ASSERT_TRUE(fixture.Create());

    Path path;
    ASSERT_EQ(ZX_OK, path.Push(fixture.path()));

    path.Reset();
    EXPECT_STR_EQ(path.c_str(), "/");

    END_TEST;
}
开发者ID:saltstar,项目名称:smartnix,代码行数:13,代码来源:path.cpp


注:本文中的Path::Push方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。