?? directory.cpp
字號(hào):
#include "directory.h"using namespace std;Directory::Directory() { path = "/";}Directory::Directory(const string& dir) { path = dir;}Directory::operator string() const { return path;}void Directory::cd(const string& dir) { if(dir=="..") cdUp(); else if(dir!=".") if(dir[0]=='/') path = dir; else { if(path[path.length()-1]!='/') path += '/'; path += dir; }}void Directory::cdUp() { if(path=="/") return; int slash = path.rfind('/', path.length()-2); if(slash>0) path.resize(slash); else path = "/";}string Directory::buildFullname(const string& prefix, const string& suffix) { string full; if(prefix[prefix.length()-1]=='/') full = prefix.substr(0, prefix.length()-1); else full = prefix; if(suffix[0]!='/') { full += path; if(full[full.length()-1]!='/') full += '/'; } full += suffix; return full;}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -