Summary

Tab is a simple class to hold the number of tabs used during output.

Source

// $Id: tab.cpp,v 1.1 1999/02/12 14:39:13 shields Exp $
copyright notice

#include "tab.h"

int Tab::tab_size = Tab::DEFAULT_TAB_SIZE;

//
// Compute the length of a wide character string segment
// after expanding tabs.
//

int Tab::Wcslen(wchar_t *line, int start, int end)
{
    for (int i = start--; i <= end; i++)
    {
        if (line[i] == U_HORIZONTAL_TAB)
        {
            int offset = (i - start) - 1;
            start -= ((tab_size - 1) - offset % tab_size);
        }
    }

    return (end - start);
}