📄 file.h
字号:
//=======================================================================// File.h//-----------------------------------------------------------------------// 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//=======================================================================#ifndef LIBPACO_FILE_H#define LIBPACO_FILE_H#include <string>namespace Paco {class File{ public: File(std::string const& __name, long __size, short __flags = 0) : mName(__name), mSize(__size), mFlags(__flags) { } ~File() { } // Codes used in the logs static int const SIZEOF_SYMLINK = -1; static int const SIZEOF_MISSING = -2; // Bits for mFlags static int const SHARED = (1 << 0); static int const MISSING = (1 << 1); // Accessors long size() const { return mSize; } long& size() { return mSize; } std::string const& name() const { return mName; } std::string& name() { return mName; } bool symlink() const { return mSize == SIZEOF_SYMLINK; } bool shared() const { return mFlags & SHARED; } bool missing() const { return mFlags & MISSING; } void shared(bool set) { setFlag(SHARED, set); } void missing(bool set) { setFlag(MISSING, set); } private: std::string mName; long mSize; short mFlags; // Prevent copies File(File const&); File& operator=(File const&); void setFlag(int flag, bool set) { if (set) mFlags |= flag; else mFlags &= ~flag; }}; // class File} // namespace Paco#endif // LIBPACO_FILE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -