示例#1
0
文件: xi-util.C 项目: luyukunphy/namd
void XStr::line_append_padding(const char c, int lineWidth)
{
    XStr xs;
    int count = 0;

    for(unsigned int i=0; i<len; i++) {
        if(s[i] == '\n') {
            // found line ending
            while(count++ < lineWidth-1)
                xs << " ";
            xs << c << "\n";
            count=0;
        } else if(s[i] == '\t') {
            // found tab, convert to 2 spaces
            xs << "  ";
            count+=2;
        } else {
            // found non-line ending
            xs << s[i];
            count++;
        }
    }
    delete[] s;
    initTo(xs.charstar());
}
示例#2
0
文件: xi-util.C 项目: luyukunphy/namd
void XStr::line_append(const char c)
{
    XStr xs;
    for(unsigned int i=0; i<len; i++) {
        if(s[i] == '\n')
            xs << c << "\n";
        else
            xs << s[i];
    }
    delete[] s;
    initTo(xs.charstar());
}