#include "StdAfx.h"
#include "ViewableWhitespace.h"
-static bool f_initialized=false;
+/** @brief Is structure initialized? */
+static bool f_initialized = false;
#ifdef UNICODE
// For UNICODE build, there is just one set which is always used
// tab, space, cr, lf, eol
-struct ViewableWhitespaceChars
+
+/** @brief Structure for whitespace characters.
+ * Char order is tab, space, cr, lf, eol.
+ */
+static struct ViewableWhitespaceChars
// Do not use L literals, as they involve runtime mbcs expansion, apparently
f_specialChars = {
- 0
- , L" " // U+BB: RIGHT POINTING DOUBLE ANGLE QUOTATION MARK
- , L" " // U+B7: MIDDLE DOT
- , L" " // U+A7: SECTION SIGN
- , L" " // U+B6: PILCROW SIGN
- , L" " // U+A4: CURRENCY SIGN
+ 0,
+ L" ", // U+BB: RIGHT POINTING DOUBLE ANGLE QUOTATION MARK
+ L" ", // U+B7: MIDDLE DOT
+ L" ", // U+A7: SECTION SIGN
+ L" ", // U+B6: PILCROW SIGN
+ L" " // U+A4: CURRENCY SIGN
};
+
+/**
+ * @brief Initialize whitespace chars structure.
+ */
static void initialize()
{
f_specialChars.c_tab[0] = 0xBB;
static CMap<int, int, int, int> f_offset; // map codepage to offset
// tab, space, cr, lf, eol
+/** @brief Structure for whitespace characters.
+ * Char order is tab, space, cr, lf, eol.
+ */
static struct ViewableWhitespaceChars
f_specialChars[] = {
{ 0, ">", ".", "$", "!", "&" } // default all-ASCII for unhandled codepages
, { 1257, "\xBB", "\xB7", "\xA7", "\xB6", "\xA4" } // CP-1257 Windows Baltic Rim
};
+/**
+ * @brief Initialize whitespace chars structure.
+ */
static void initialize()
{
for (int i=0; i<sizeof(f_specialChars)/sizeof(f_specialChars[0]); ++i)
#endif
-
+/**
+ * @brief Return viewable whitespace chars.
+ * @param [in] codepage Used codepage (only efective in ANSI builds).
+ * @return Pointer to structure having viewable chars.
+ */
const ViewableWhitespaceChars * GetViewableWhitespaceChars(int codepage)
{
if (!f_initialized)
+/**
+ * @file ViewableWhitespace.h
+ *
+ * @brief Repository of character tables used to display whitespace (when View/Whitespace enabled)
+ */
+// RCS ID line follows -- this is updated by CVS
+// $Id$
+
#ifndef ViewableWhitespace_included_h
#define ViewableWhitespace_included_h
-struct ViewableWhitespaceChars {
- int c_codepage; // unused in UNICODE
- TCHAR c_tab[3];
- TCHAR c_space[3];
- TCHAR c_cr[3];
- TCHAR c_lf[3];
- TCHAR c_eol[3]; // generic eol
+/**
+ * @brief Structure containing characters for viewable whitespace chars.
+ *
+ * These characters are used when user wants to see whitespace characters
+ * in editor.
+ */
+struct ViewableWhitespaceChars
+{
+ int c_codepage; /**< Used codepage, unused in UNICODE. */
+ TCHAR c_tab[3]; /**< Visible character for tabs. */
+ TCHAR c_space[3]; /**< Visible character for spaces. */
+ TCHAR c_cr[3]; /**< Visible character for CR EOL chars. */
+ TCHAR c_lf[3]; /**< Visible character for LF EOL chars. */
+ TCHAR c_eol[3]; /**< Visible character for general EOL chars. */
};
const ViewableWhitespaceChars * GetViewableWhitespaceChars(int codepage);