📄 alignment.hh
字号:
#ifndef ALIGNMENT_HH#define ALIGNMENT_HH#include <click/string.hh>class Alignment { int _chunk; int _offset; Alignment(int a, int b, int) : _chunk(a), _offset(b) { } public: Alignment() : _chunk(0), _offset(0) { } Alignment(int, int); int chunk() const { return _chunk; } int offset() const { return _offset; } bool bad() const { return _chunk < 0; } bool empty() const { return _chunk == 0; } bool operator==(const Alignment &) const; bool operator!=(const Alignment &) const; bool operator<=(const Alignment &) const; Alignment &operator+=(int); Alignment &operator-=(int); Alignment &operator|=(const Alignment &); Alignment &operator&=(const Alignment &); String unparse() const; String s() const { return unparse(); }};inlineAlignment::Alignment(int c, int o) : _chunk(c), _offset(o){ assert(c > 0 && o >= 0 && o < c);}inline boolAlignment::operator==(const Alignment &o) const{ return _chunk == o._chunk && _offset == o._offset;}inline boolAlignment::operator!=(const Alignment &o) const{ return _chunk != o._chunk || _offset != o._offset;}inline Alignment &Alignment::operator-=(int off){ return *this += (-off);}inline Alignmentoperator+(Alignment a, int off){ return a += off;}inline Alignmentoperator-(Alignment a, int off){ return a += (-off);}inline Alignmentoperator|(Alignment a, const Alignment &b){ return a |= b;}inline Alignmentoperator&(Alignment a, const Alignment &b){ return a &= b;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -