本文整理汇总了C++中MyString::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ MyString::isEmpty方法的具体用法?C++ MyString::isEmpty怎么用?C++ MyString::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyString
的用法示例。
在下文中一共展示了MyString::isEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isRelative
// .
// ..
// .\
// ..\
// name
bool isRelative(MyString path)
{
assert(!path.isEmpty());
if (path.startWith(_T(".")))
{
return true;
}
else
{
int pos = path.find(_T('\\'));
MyString head = path.substr(0, pos);
if (!head.isEmpty() && isLegalName(head))
return true;
}
return false;
}
示例2: join
MyString join(MyString path, MyString name)
{
if (path[path.size() - 1] != _T('\\') && !name.isEmpty() && !name.startWith(_T("\\")))
{
path += _T("\\");
}
path += name;
return path;
}
示例3: isDir
bool VirtualDiskNode::isDir(MyString path) const
{
if (!isNormalizedPath(path))
{
assert(0);
return false;
}
path = path.toLower();
MyString dir_path = dirname(path);
DirNode* parent = const_cast<VirtualDiskNode*>(this)->getDirNode(dir_path);
if (!parent)
return false;
MyString name = basename(path);
if (name.isEmpty())
return true;
int dir = parent->findSubDir(name);
return dir != -1;
}
示例4: CommandException
SmartPtr<CommandInterface> CommandFactory::create(const MyString& command)
{
MyString name;
Vector<MyString> pathes;
Vector<MyString> switches;
int flag = parse(command, &name, &pathes, &switches);
if (name.isEmpty())
{
if (pathes.size() == 1
&& _istalpha(pathes[0][0])
&& pathes[0][1] == _T(':'))
{
name = _T("change_volumn");
}
if (flag == -1)
{
throw CommandException(_T("无法识别的命令\n"));
}
}
name = name.toLower();
for (int i = 0; i < switches.size(); ++i)
{
switches[i] = switches[i].toLower();
}
SmartPtr<CommandInterface> ret;
if (name == _T("prompt"))
{
ret = SmartPtr<CommandInterface>(new CommandPrompt);
}
else if (name == _T("change_volumn"))
{
ret = SmartPtr<CommandInterface>(new CommandChangeVolumn);
}
else if (name == _T("cd"))
{
ret = SmartPtr<CommandInterface>(new CommandCd);
}
else if (name == _T("dir"))
{
ret = SmartPtr<CommandInterface>(new CommandDir);
}
else if (name == _T("mkdir"))
{
ret = SmartPtr<CommandInterface>(new CommandMkdir);
}
else if (name == _T("rmdir"))
{
ret = SmartPtr<CommandInterface>(new CommandRmdir);
}
else if (name == _T("copy"))
{
ret = SmartPtr<CommandInterface>(new CommandCopy);
}
else if (name == _T("del"))
{
ret = SmartPtr<CommandInterface>(new CommandDel);
}
else if (name == _T("compare"))
{
ret = SmartPtr<CommandInterface>(new CommandCompare);
}
else
{
throw CommandException(_T("无法识别的命令\n"));
}
ret->setPathes(pathes);
ret->setSwitches(switches);
return ret;
}