Doxygen
Loading...
Searching...
No Matches
outputgen.cpp File Reference
#include <stdexcept>
#include <stdlib.h>
#include "doxygen.h"
#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 60 of file outputgen.cpp.

61{
62 if (s)
63 {
64 const int tabSize = Config_getInt(TAB_SIZE);
65 char c;
66 while ((c=*s++))
67 {
68 switch(c)
69 {
70 case '\t': col+=tabSize - (col%tabSize);
71 break;
72 case '\n': col=0;
73 break;
74 default:
75 col++;
76 if (c<0) // multi-byte character
77 {
78 int numBytes = getUTF8CharNumBytes(c);
79 for (int i=0;i<numBytes-1 && (c=*s++);i++) {} // skip over extra chars
80 if (c==0) return col; // end of string half way a multibyte char
81 }
82 break;
83 }
84 }
85 }
86 return col;
87}
#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:24

References Config_getInt, and getUTF8CharNumBytes().

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