Doxygen
Loading...
Searching...
No Matches
outputgen.cpp File Reference
#include "outputgen.h"
#include "message.h"
#include "portable.h"
Include dependency graph for outputgen.cpp:

Go to the source code of this file.

Functions

size_t updateColumnCount (const char *s, size_t col)

Function Documentation

◆ updateColumnCount()

size_t updateColumnCount ( const char * s,
size_t col )

Definition at line 58 of file outputgen.cpp.

59{
60 if (s)
61 {
62 const int tabSize = Config_getInt(TAB_SIZE);
63 char c;
64 while ((c=*s++))
65 {
66 switch(c)
67 {
68 case '\t': col+=tabSize - (col%tabSize);
69 break;
70 case '\n': col=0;
71 break;
72 default:
73 col++;
74 if (static_cast<signed char>(c)<0) // multi-byte character
75 {
76 int numBytes = getUTF8CharNumBytes(c);
77 for (int i=0;i<numBytes-1 && (c=*s++);i++) {} // skip over extra chars
78 if (c==0) return col; // end of string half way a multibyte char
79 }
80 break;
81 }
82 }
83 }
84 return col;
85}
#define Config_getInt(name)
Definition config.h:34
uint8_t getUTF8CharNumBytes(char c)
Returns the number of bytes making up a single UTF8 character given the first byte in the sequence.
Definition utf8.cpp:27

References Config_getInt, and getUTF8CharNumBytes().

Referenced by HtmlCodeGenerator::codify(), LatexCodeGenerator::codify(), ManCodeGenerator::codify(), RTFCodeGenerator::codify(), OutputGenIntf::endEmbeddedDoc(), writeDocbookCodeString(), and writeXMLCodeString().