本文整理汇总了C++中FileObject::containsObject方法的典型用法代码示例。如果您正苦于以下问题:C++ FileObject::containsObject方法的具体用法?C++ FileObject::containsObject怎么用?C++ FileObject::containsObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileObject
的用法示例。
在下文中一共展示了FileObject::containsObject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cd
void FileCommands::cd(FileSystemUser* fileSystem, string path) {
FileObject* fo = fileSystem->getFileObject();
vector<string> dirs = StringService::pathSplit(path);
int oldPos = fo->getPos();
for(int i = 0; i<dirs.size(); ++i) {
if(dirs[i]!="..") {
if(!fo->containsObject(dirs[i])) {
notFoundPath(path);
fo->setPos(oldPos);
return;
}else {
fo->go(dirs[i]);
}
}else {
fo->goUp();
}
}
for(int i = 0; i<dirs.size(); ++i) {
if(dirs[i] == "..") {
fileSystem->cdUp();
}else {
fileSystem->cdDir(dirs[i]);
}
}
}
示例2: remfile
void FileCommands::remfile(FileSystemUser* fileSystem, string file) {
FileObject* fo = fileSystem->getFileObject();
if(!fo->containsObject(file)) {
notFoundFile(file);
return;
}
string sys = fileSystem->getSystem();
int t = fo->getObject(file);
sys.erase(t, fo->getPos() - t - 1);
fileSystem->setNewSystem(sys);
fo->remObj(file);
}
示例3: show
void FileCommands::show(FileSystemUser* fileSystem, string fileName) {
FileObject* fo = fileSystem->getFileObject();
fileName += fileDelim;
if(fo->containsObject(fileName)) {
string content = fo->getFileContent(fileName);
cout<<endl<<"\t"<<fileName<<endl<<endl<<content<<endl;
}else {
notFoundFile(fileName);
return;
}
}
示例4: mkfile
void FileCommands::mkfile(FileSystemUser* fileSystem, string file) {
FileObject* fo = fileSystem->getFileObject();
if(fo->containsObject(file)) {
duplicateNames(file);
return;
}
file += fileDelim;
file += openDelim;
file += closeDelim;
fo->setEndPos();
string sys = fileSystem->getSystem();
sys.insert(fo->getPos(), file);
fileSystem->setNewSystem(sys);
fo->addObj(file);
}
示例5: mkdir
void FileCommands::mkdir(FileSystemUser* fileSystem, string dir) {
FileObject* fo = fileSystem->getFileObject();
if(fo->containsObject(dir)) {
duplicateNames(dir);
return;
}
dir += "{";
dir += "}";
fo->setEndPos();
string sys = fileSystem->getSystem();
sys.insert(fo->getPos(), dir);
fileSystem->setNewSystem(sys);
fo->addObj(dir);
}
示例6: remdir
void FileCommands::remdir(FileSystemUser* fileSystem, string dir) {
FileObject* fo = fileSystem->getFileObject();
if(!fo->containsObject(dir)) {
notFoundDir(dir);
return;
}
string sys = fileSystem->getSystem();
int t = fo->getObject(dir);
cout<<"t: "<<t<<" pos:"<<fo->getPos()<<endl;
if(fo->getPos() == fo->getBeginPos()) {
fo->setEndPos();
}
sys.erase(t, fo->getPos() - t);
fileSystem->setNewSystem(sys);
fo->remObj(dir);
}