pcsetdbg.cxx

来自「PTypes (C++ Portable Types Library) is a」· CXX 代码 · 共 80 行

CXX
80
字号
/* * *  C++ Portable Types Library (PTypes) *  Version 1.7.5   Released 9-Mar-2003 * *  Copyright (c) 2001, 2002, 2003 Hovik Melikyan * *  http://www.melikyan.com/ptypes/ *  http://ptypes.sourceforge.net/ * */#include "ptypes.h"PTYPES_BEGINstatic char hexchar(uchar c) {    if (c < 10)        return char(c + '0');    else        return char(c - 10 + 'a');}inline bool isprintable(uchar c) {    return ((c >= ' ') && (c < 127));}static string showmember(uchar c) {    if ((c == '-') || (c == '~'))        return string('~') + string(c);    else if (isprintable(c))        return c;    else     {        string ret = "~  ";        ret[1] = hexchar(uchar(c >> 4));        ret[2] = hexchar(uchar(c & 0x0f));        return ret;    }}string asstring(const cset& s){    string ret;    int l = -1, r = -1;    for(int i = 0; i <= _csetbits; i++)     {        if (i < _csetbits && uchar(i) & s)         {            if (l == -1)                l = i;            else                r = i;        }        else if (l != -1)         {            concat(ret, showmember(uchar(l)));            if (r != -1) {                if (r > l + 1)                     concat(ret, '-');                concat(ret, showmember(uchar(r)));            }            l = -1;            r = -1;        }    }    return ret;}PTYPES_END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?