?? paco.cc
字號:
//=======================================================================// paco.cc//-----------------------------------------------------------------------// This file is part of the package paco// Copyright (C) 2004-2007 David Rosal <david.3r@gmail.com>// For more information visit http://paco.sourceforge.net//=======================================================================#include "config.h"#include "paco.h"#include <sstream>#include <iomanip>#include <fnmatch.h>using std::string;using namespace Paco;//// Check whether @path matches any path in the colon-separated @list of paths.// Shell-like wildcards in @list are expanded.//bool Paco::inPaths(string const& path, string const& list){ std::istringstream s(list + ":"); string buf; while (getline(s, buf, ':') && buf.size()) { if (buf == "/" || !fnmatch(buf.c_str(), path.c_str(), 0) || !path.find(buf + "/")) return true; } return false;}string Paco::sizeStr(int unit, float size){ if (size < 0) return "@"; std::ostringstream s; if (unit <= 0) { // HUMAN_READABLE if (size < KILOBYTE) s << static_cast<int>(size); else if (size < MEGABYTE) s << static_cast<long>(size) / KILOBYTE << "k"; else if (size < (10 * MEGABYTE)) s << std::setprecision(2) << size / MEGABYTE << "M"; else s << static_cast<long>(size / MEGABYTE) << "M"; } else s << static_cast<long>(size / unit); return s.str();}string Paco::sizeStr(int unit, long size){ return sizeStr(unit, static_cast<float>(size));}X::X(string const& msg): std::runtime_error(msg){ }XErrno::XErrno(string const& msg): std::runtime_error(msg + ": " + strerror(errno)){ }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -