@ 261105.1

230518.1 · 5bdaff9e26ad27ed94ef7440f84690dcdfbe5524

removed using namespace std instructions

reading declarations

src/cli/cmdlineoptions.cpp

@@ -32,7 +32,6 @@ along with Highlight.  If not, see <http://www.gnu.org/licenses/>.  #include "arg_parser.h" -using namespace std;  enum Optcode {         S_OPT_ENCLOSE_PRE = 256, S_OPT_FORCE_OUTPUT,@@ -249,17 +248,17 @@ CmdLineOptions::CmdLineOptions ( const int argc, const char *argv[] ) :     parseRuntimeOptions(argc, argv);      if ( skipArg.size() && inputFileNames.size() > 1) {-        istringstream valueStream;-        string elem;+        std::istringstream valueStream;+        std::string elem;         valueStream.str ( StringTools::change_case ( skipArg,StringTools::CASE_LOWER ) );          while ( getline ( valueStream, elem, ';' ) ) {             ignoredFileTypes.insert ( elem );         } -        vector<string>::iterator file=inputFileNames.begin();+        std::vector<std::string>::iterator file=inputFileNames.begin();         while ( file!=inputFileNames.end()) {-            for ( set<string>::iterator ext=ignoredFileTypes.begin(); ext!=ignoredFileTypes.end(); ext++ ) {+            for ( std::set<std::string>::iterator ext=ignoredFileTypes.begin(); ext!=ignoredFileTypes.end(); ext++ ) {                 if (file!=inputFileNames.end() && StringTools::endsWith(  *file, *ext )) {                     file = inputFileNames.erase ( file );                     break;

src/cli/help.cpp

@@ -26,256 +26,255 @@ along with Highlight.  If not, see <http://www.gnu.org/licenses/>. #include <iostream> #include "help.h" -using namespace std;  namespace Help { void printHelp(const std::string &topic) {     if (topic=="syntax" || topic=="lang")  {-        cout <<"SYNTAX HELP:\n\n";-        cout <<"A language definition describes syntax elements of a programming language which\n";-        cout <<"will be highlighted by different colours and font types.\n";-        cout <<"\n";-        cout <<"These definitions are saved as Lua scripts in HL_DATA_DIR/langDefs.\n";-        cout <<"File extensions and shebangs are mapped to language definitions in \n";-        cout <<"filetypes.conf (see --print-config for the configuration search paths).\n";-        cout <<"\n";-        cout <<"Apply custom language definitions with --config-file or as absolute path to -S.\n";-        cout <<"\n";-        cout <<"Use plug-in scripts (--plug-in) to modify syntax parsing and output.\n";-        cout <<"\n";-        cout <<"Print all installed language definitions with --list-scripts=langs.\n";-        cout <<"\n";-        cout <<"Exemplary config files:\n";-        cout <<"c.lang:      C and C++ syntax file (compiled sources) \n";-        cout <<"python.lang: Python syntax file    (script sources)\n";-        cout <<"ini.lang:    INI syntax file       (configuration)\n";-        cout <<"xml.lang:    XML syntax file       (markup)\n";-        cout <<"\n";-        cout <<"Refer to README files for configuration syntax and examples.\n";+        std::cout <<"SYNTAX HELP:\n\n";+        std::cout <<"A language definition describes syntax elements of a programming language which\n";+        std::cout <<"will be highlighted by different colours and font types.\n";+        std::cout <<"\n";+        std::cout <<"These definitions are saved as Lua scripts in HL_DATA_DIR/langDefs.\n";+        std::cout <<"File extensions and shebangs are mapped to language definitions in \n";+        std::cout <<"filetypes.conf (see --print-config for the configuration search paths).\n";+        std::cout <<"\n";+        std::cout <<"Apply custom language definitions with --config-file or as absolute path to -S.\n";+        std::cout <<"\n";+        std::cout <<"Use plug-in scripts (--plug-in) to modify syntax parsing and output.\n";+        std::cout <<"\n";+        std::cout <<"Print all installed language definitions with --list-scripts=langs.\n";+        std::cout <<"\n";+        std::cout <<"Exemplary config files:\n";+        std::cout <<"c.lang:      C and C++ syntax file (compiled sources) \n";+        std::cout <<"python.lang: Python syntax file    (script sources)\n";+        std::cout <<"ini.lang:    INI syntax file       (configuration)\n";+        std::cout <<"xml.lang:    XML syntax file       (markup)\n";+        std::cout <<"\n";+        std::cout <<"Refer to README files for configuration syntax and examples.\n";      } else if (topic=="theme") {-        cout <<"THEME HELP:\n\n";-        cout <<"A colour theme defines the formatting of recognized syntax elements.\n";-        cout <<"\n";-        cout <<"These descriptions are saved as Lua scripts in HL_DATA_DIR/themes.\n";-        cout <<"\n";-        cout <<"Apply custom themes with --config-file or as absolute path to --theme.\n";-        cout <<"\n";-        cout <<"Use plug-in scripts (--plug-in) to modify the formatting output.\n";-        cout <<"\n";-        cout <<"Print all installed themes with --list-scripts=themes.\n";-        cout <<"\n";-        cout <<"Add 'base16/' as prefix to read a theme of the Base16 set.\n";-        cout <<"\n";-        cout <<"Exemplary config files:\n";-        cout <<"darkspectrum.theme: dark canvas (vim) \n";-        cout <<"edit-eclipse:       light canvas (IDE)\n";-        cout <<"bespin.lang:        dark canvas  (Base16)\n";-        cout <<"\n";-        cout <<"Refer to README files for configuration syntax and examples.\n";+        std::cout <<"THEME HELP:\n\n";+        std::cout <<"A colour theme defines the formatting of recognized syntax elements.\n";+        std::cout <<"\n";+        std::cout <<"These descriptions are saved as Lua scripts in HL_DATA_DIR/themes.\n";+        std::cout <<"\n";+        std::cout <<"Apply custom themes with --config-file or as absolute path to --theme.\n";+        std::cout <<"\n";+        std::cout <<"Use plug-in scripts (--plug-in) to modify the formatting output.\n";+        std::cout <<"\n";+        std::cout <<"Print all installed themes with --list-scripts=themes.\n";+        std::cout <<"\n";+        std::cout <<"Add 'base16/' as prefix to read a theme of the Base16 set.\n";+        std::cout <<"\n";+        std::cout <<"Exemplary config files:\n";+        std::cout <<"darkspectrum.theme: dark canvas (vim) \n";+        std::cout <<"edit-eclipse:       light canvas (IDE)\n";+        std::cout <<"bespin.lang:        dark canvas  (Base16)\n";+        std::cout <<"\n";+        std::cout <<"Refer to README files for configuration syntax and examples.\n";      } else if (topic=="config") {-        cout <<"CONFIG HELP:\n\n";-        cout <<"Highlight is configured by a set of Lua scripts and environment variables.\n";-        cout <<"See --print-config for the configuration file search paths.\n\n";-        cout <<"List of environment variables:\n";-        cout <<"HIGHLIGHT_DATADIR: sets the path to highlight's configuration scripts\n";-        cout <<"HIGHLIGHT_OPTIONS: may contain command line options, but no input file paths\n\n";-        cout <<"Highlight reads TERM and COLORTERM to determine the appropriate default output.\n";+        std::cout <<"CONFIG HELP:\n\n";+        std::cout <<"Highlight is configured by a set of Lua scripts and environment variables.\n";+        std::cout <<"See --print-config for the configuration file search paths.\n\n";+        std::cout <<"List of environment variables:\n";+        std::cout <<"HIGHLIGHT_DATADIR: sets the path to highlight's configuration scripts\n";+        std::cout <<"HIGHLIGHT_OPTIONS: may contain command line options, but no input file paths\n\n";+        std::cout <<"Highlight reads TERM and COLORTERM to determine the appropriate default output.\n";     } else if (topic=="plugin" || topic=="plug-in") {-        cout <<"PLUG-IN HELP:\n\n";-        cout <<"The plug-in interface allows modifications of syntax parsing, colouring and\n";-        cout <<"the document's header and footer.\n";-        cout <<"\n";-        cout <<"The --plug-in option reads the path of a Lua script which overrides or\n";-        cout <<"enhances the settings of theme and language definition files. Plug-ins make\n";-        cout <<"it possible to apply custom settings without the need to edit installed\n";-        cout <<"configuration files.\n";-        cout <<"You can apply multiple plugins by using the --plug-in option more than once.\n";-        cout <<"\n";-        cout <<"Pass arguments to a plug-in with --plug-in-param.\n";-        cout <<"\n";-        cout <<"Print all installed themes with --list-scripts=plugins.\n";-        cout <<"\n";-        cout <<"Exemplary config files:\n";-        cout <<"cpp_qt.lua:             Add Qt keywords to C and C++ (simple structure)\n";-        cout <<"outhtml_codefold.lua:   Adds code folding for C style languages, and more (advanced)\n";-        cout <<"bash_ref_man7_org.lua:  Add man7.org reference links to Bash output (advanced)\n";-        cout <<"\n";-        cout <<"See README_PLUGINS.adoc for a detailed description and examples of packaged plugins.\n";+        std::cout <<"PLUG-IN HELP:\n\n";+        std::cout <<"The plug-in interface allows modifications of syntax parsing, colouring and\n";+        std::cout <<"the document's header and footer.\n";+        std::cout <<"\n";+        std::cout <<"The --plug-in option reads the path of a Lua script which overrides or\n";+        std::cout <<"enhances the settings of theme and language definition files. Plug-ins make\n";+        std::cout <<"it possible to apply custom settings without the need to edit installed\n";+        std::cout <<"configuration files.\n";+        std::cout <<"You can apply multiple plugins by using the --plug-in option more than once.\n";+        std::cout <<"\n";+        std::cout <<"Pass arguments to a plug-in with --plug-in-param.\n";+        std::cout <<"\n";+        std::cout <<"Print all installed themes with --list-scripts=plugins.\n";+        std::cout <<"\n";+        std::cout <<"Exemplary config files:\n";+        std::cout <<"cpp_qt.lua:             Add Qt keywords to C and C++ (simple structure)\n";+        std::cout <<"outhtml_codefold.lua:   Adds code folding for C style languages, and more (advanced)\n";+        std::cout <<"bash_ref_man7_org.lua:  Add man7.org reference links to Bash output (advanced)\n";+        std::cout <<"\n";+        std::cout <<"See README_PLUGINS.adoc for a detailed description and examples of packaged plugins.\n";      } else if (topic=="test") {-        cout <<"SYNTAX TEST HELP:\n\n";-        cout <<"The syntax parsing can be validated with test state indicators embedded in comments.\n";-        cout <<"These are recognized in files saved as syntax_test_*.\n\n";-        cout <<"A test case is defined by two entities: column and expected state.\n";-        cout <<"The column is defined by ^ (here) or < (comment start / first column).\n";-        cout <<"This indicator points at the tested syntax element of the previous line.\n";-        cout <<"The state identifiers match the corresponding HTML output CSS class names.\n\n";-        cout <<"See README_TESTCASES.adoc for a detailed description and examples.\n";+        std::cout <<"SYNTAX TEST HELP:\n\n";+        std::cout <<"The syntax parsing can be validated with test state indicators embedded in comments.\n";+        std::cout <<"These are recognized in files saved as syntax_test_*.\n\n";+        std::cout <<"A test case is defined by two entities: column and expected state.\n";+        std::cout <<"The column is defined by ^ (here) or < (comment start / first column).\n";+        std::cout <<"This indicator points at the tested syntax element of the previous line.\n";+        std::cout <<"The state identifiers match the corresponding HTML output CSS class names.\n\n";+        std::cout <<"See README_TESTCASES.adoc for a detailed description and examples.\n";     } else if (topic=="lsp") {-        cout <<"LANGUAGE SERVER PROTOCOL HELP:\n\n";-        cout <<"Highlight can invoke LSP servers to enhance its output. Warning: These features are WIP.\n";-        cout <<"Language servers are be configured in the lsp.conf file. Each parameter of this file\n";-        cout <<"can also be set using --ls-exec, --ls-option, --ls-delay and --ls-syntax.\n";-        cout <<"Important: LSP features require absolute input paths and disable reformatting (-F).\n";+        std::cout <<"LANGUAGE SERVER PROTOCOL HELP:\n\n";+        std::cout <<"Highlight can invoke LSP servers to enhance its output. Warning: These features are WIP.\n";+        std::cout <<"Language servers are be configured in the lsp.conf file. Each parameter of this file\n";+        std::cout <<"can also be set using --ls-exec, --ls-option, --ls-delay and --ls-syntax.\n";+        std::cout <<"Important: LSP features require absolute input paths and disable reformatting (-F).\n";     } else {-        cout<<"USAGE: highlight [OPTIONS]... [FILES]...\n";-        cout<<"\n";-        cout<<"General options:\n";-        cout<<"\n";-        cout<<" -B, --batch-recursive=<wc>     convert all matching files, searches subdirs\n";-        cout<<"                                  (Example: -B '*.cpp')\n";-        cout<<" -D, --data-dir=<directory>     set path to data directory\n";-        cout<<"     --config-file=<file>       set path to a lang or theme file\n";-        cout<<" -d, --outdir=<directory>       name of output directory\n";-        cout<<" -h, --help[=topic]             print this help or a topic description\n";-        cout<<"                                  <topic> = [syntax, theme, plugin, config, test, lsp]\n";-        cout<<" -i, --input=<file>             name of single input file\n";-        cout<<" -o, --output=<file>            name of single output file\n";-        cout<<" -P, --progress                 print progress bar in batch mode\n";-        cout<<" -q, --quiet                    suppress progress info in batch mode\n";-        cout<<" -S, --syntax=<type|path>       specify type of source code or syntax file path\n";-        cout<<"     --syntax-by-name=<name>    specify type of source code by given name\n";-        cout<<"                                  will not read a file of this name, useful for stdin\n";-        cout<<"     --syntax-supported         test if the given syntax can be loaded\n";-        cout<<" -v, --verbose                  print debug info; repeat to show more information\n";-        cout<<"     --force[=syntax]           generate output if input syntax is unknown\n";-        cout<<"     --list-scripts=<type>      list installed scripts\n";-        cout<<"                                  <type> = [langs, themes, plugins]\n";-        cout<<"     --list-cat=<categories>    filter the scripts by the given categories\n";-        cout<<"                                  (example: --list-cat='source;script')\n";-        cout<<"     --max-size=<size>          set maximum input file size\n";-        cout<<"                                  (examples: 512M, 1G; default: 256M)\n";-        cout<<"     --plug-in=<script>         execute Lua plug-in script; repeat option to\n";-        cout<<"                                  execute multiple plug-ins\n";-        cout<<"     --plug-in-param=<value>    set plug-in input parameter\n";-        cout<<"     --print-config             print path configuration\n";-        cout<<"     --print-style              print stylesheet only (see --style-outfile)\n";-        cout<<"     --skip=<list>              ignore listed unknown file types\n";-        cout<<"                                  (Example: --skip='bak;c~;h~')\n";+        std::cout<<"USAGE: highlight [OPTIONS]... [FILES]...\n";+        std::cout<<"\n";+        std::cout<<"General options:\n";+        std::cout<<"\n";+        std::cout<<" -B, --batch-recursive=<wc>     convert all matching files, searches subdirs\n";+        std::cout<<"                                  (Example: -B '*.cpp')\n";+        std::cout<<" -D, --data-dir=<directory>     set path to data directory\n";+        std::cout<<"     --config-file=<file>       set path to a lang or theme file\n";+        std::cout<<" -d, --outdir=<directory>       name of output directory\n";+        std::cout<<" -h, --help[=topic]             print this help or a topic description\n";+        std::cout<<"                                  <topic> = [syntax, theme, plugin, config, test, lsp]\n";+        std::cout<<" -i, --input=<file>             name of single input file\n";+        std::cout<<" -o, --output=<file>            name of single output file\n";+        std::cout<<" -P, --progress                 print progress bar in batch mode\n";+        std::cout<<" -q, --quiet                    suppress progress info in batch mode\n";+        std::cout<<" -S, --syntax=<type|path>       specify type of source code or syntax file path\n";+        std::cout<<"     --syntax-by-name=<name>    specify type of source code by given name\n";+        std::cout<<"                                  will not read a file of this name, useful for stdin\n";+        std::cout<<"     --syntax-supported         test if the given syntax can be loaded\n";+        std::cout<<" -v, --verbose                  print debug info; repeat to show more information\n";+        std::cout<<"     --force[=syntax]           generate output if input syntax is unknown\n";+        std::cout<<"     --list-scripts=<type>      list installed scripts\n";+        std::cout<<"                                  <type> = [langs, themes, plugins]\n";+        std::cout<<"     --list-cat=<categories>    filter the scripts by the given categories\n";+        std::cout<<"                                  (example: --list-cat='source;script')\n";+        std::cout<<"     --max-size=<size>          set maximum input file size\n";+        std::cout<<"                                  (examples: 512M, 1G; default: 256M)\n";+        std::cout<<"     --plug-in=<script>         execute Lua plug-in script; repeat option to\n";+        std::cout<<"                                  execute multiple plug-ins\n";+        std::cout<<"     --plug-in-param=<value>    set plug-in input parameter\n";+        std::cout<<"     --print-config             print path configuration\n";+        std::cout<<"     --print-style              print stylesheet only (see --style-outfile)\n";+        std::cout<<"     --skip=<list>              ignore listed unknown file types\n";+        std::cout<<"                                  (Example: --skip='bak;c~;h~')\n"; -        cout<<"     --stdout                   output to stdout (batch mode, --print-style)\n";-        cout<<"     --validate-input           test if input is text, remove Unicode BOM\n";-        cout<<"     --service-mode             run in service mode, not stopping until signaled\n";+        std::cout<<"     --stdout                   output to stdout (batch mode, --print-style)\n";+        std::cout<<"     --validate-input           test if input is text, remove Unicode BOM\n";+        std::cout<<"     --service-mode             run in service mode, not stopping until signaled\n"; #if _WIN32-        cout<<"     --disable-echo             disable console echo back for stdin data\n";+        std::cout<<"     --disable-echo             disable console echo back for stdin data\n"; #endif // _WIN32-        cout<<"     --version                  print version and copyright information\n";-        cout<<"\n\n";-        cout<<"Output formatting options:\n";-        cout<<"\n";-        cout<<" -O, --out-format=<format>      output file in given format\n";-        cout<<"                                  <format>=[html, xhtml, latex, tex, odt, rtf,\n";-        cout<<"                                  ansi, xterm256, truecolor, bbcode, pango, svg]\n";-        cout<<" -c, --style-outfile=<file>     name of style file or print to stdout, if\n";-        cout<<"                                  'stdout' is given as file argument\n";+        std::cout<<"     --version                  print version and copyright information\n";+        std::cout<<"\n\n";+        std::cout<<"Output formatting options:\n";+        std::cout<<"\n";+        std::cout<<" -O, --out-format=<format>      output file in given format\n";+        std::cout<<"                                  <format>=[html, xhtml, latex, tex, odt, rtf,\n";+        std::cout<<"                                  ansi, xterm256, truecolor, bbcode, pango, svg]\n";+        std::cout<<" -c, --style-outfile=<file>     name of style file or print to stdout, if\n";+        std::cout<<"                                  'stdout' is given as file argument\n"; -        cout<<" -e, --style-infile=<file>      to be included in style-outfile (deprecated)\n";-        cout<<"                                  use a plug-in file instead\n";+        std::cout<<" -e, --style-infile=<file>      to be included in style-outfile (deprecated)\n";+        std::cout<<"                                  use a plug-in file instead\n"; -        cout<<" -f, --fragment                 omit document header and footer\n";-        cout<<" -F, --reformat=<style>         reformats and indents output in given style\n";-        cout<<"                                  <style> = [allman, gnu, google, horstmann,\n";-        cout<<"                                  java, kr, linux, lisp, mozilla, otbs, pico,\n";-        cout<<"                                  vtk, ratliff, stroustrup, webkit, whitesmith]\n";+        std::cout<<" -f, --fragment                 omit document header and footer\n";+        std::cout<<" -F, --reformat=<style>         reformats and indents output in given style\n";+        std::cout<<"                                  <style> = [allman, gnu, google, horstmann,\n";+        std::cout<<"                                  java, kr, linux, lisp, mozilla, otbs, pico,\n";+        std::cout<<"                                  vtk, ratliff, stroustrup, webkit, whitesmith]\n"; -        cout<<" -I, --include-style            include style definition in output file\n";-        cout<<" -J, --line-length=<num>        line length before wrapping (see -V, -W)\n";-        cout<<" -j, --line-number-length=<num> line number width incl. left padding (default: 5)\n";-        cout<<"     --line-range=<start-end>   output only lines from number <start> to <end>\n";+        std::cout<<" -I, --include-style            include style definition in output file\n";+        std::cout<<" -J, --line-length=<num>        line length before wrapping (see -V, -W)\n";+        std::cout<<" -j, --line-number-length=<num> line number width incl. left padding (default: 5)\n";+        std::cout<<"     --line-range=<start-end>   output only lines from number <start> to <end>\n"; -        cout<<" -k, --font=<font>              set font (specific to output format)\n";-        cout<<" -K, --font-size=<num?>         set font size (specific to output format)\n";-        cout<<" -l, --line-numbers             print line numbers in output file\n";-        cout<<" -m, --line-number-start=<cnt>  start line numbering with cnt (assumes -l)\n";-        cout<<" -s, --style=<style|path>       set colour style (theme) or theme file path\n";-        cout<<" -t, --replace-tabs=<num>       replace tabs by <num> spaces\n";-        cout<<" -T, --doc-title=<title>        document title\n";-        cout<<" -u, --encoding=<enc>           set output encoding which matches input file\n";-        cout<<"                                  encoding; omit encoding info if set to NONE\n";-        cout<<" -V, --wrap-simple              wrap lines after 80 (default) characters w/o\n";-        cout<<"                                  indenting function parameters and statements\n";-        cout<<" -W, --wrap                     wrap lines after 80 (default) characters\n";-        cout<<"     --wrap-no-numbers          omit line numbers of wrapped lines\n";-        cout<<"                                  (assumes -l)\n";-        cout<<" -z, --zeroes                   pad line numbers with 0's\n";-        cout<<"     --isolate                  output each syntax token separately (verbose output)\n";-        cout<<"     --keep-injections          output plug-in injections in spite of -f\n";-        cout<<"     --kw-case=<case>           change case of case insensitive keywords\n";-        cout<<"                                  <case> =  [upper, lower, capitalize]\n";-        cout<<"     --no-trailing-nl[=mode]    omit trailing newline. If mode is empty-file, omit\n";-        cout<<"                                  only for empty input\n";-        cout<<"     --no-version-info          omit version info comment\n";+        std::cout<<" -k, --font=<font>              set font (specific to output format)\n";+        std::cout<<" -K, --font-size=<num?>         set font size (specific to output format)\n";+        std::cout<<" -l, --line-numbers             print line numbers in output file\n";+        std::cout<<" -m, --line-number-start=<cnt>  start line numbering with cnt (assumes -l)\n";+        std::cout<<" -s, --style=<style|path>       set colour style (theme) or theme file path\n";+        std::cout<<" -t, --replace-tabs=<num>       replace tabs by <num> spaces\n";+        std::cout<<" -T, --doc-title=<title>        document title\n";+        std::cout<<" -u, --encoding=<enc>           set output encoding which matches input file\n";+        std::cout<<"                                  encoding; omit encoding info if set to NONE\n";+        std::cout<<" -V, --wrap-simple              wrap lines after 80 (default) characters w/o\n";+        std::cout<<"                                  indenting function parameters and statements\n";+        std::cout<<" -W, --wrap                     wrap lines after 80 (default) characters\n";+        std::cout<<"     --wrap-no-numbers          omit line numbers of wrapped lines\n";+        std::cout<<"                                  (assumes -l)\n";+        std::cout<<" -z, --zeroes                   pad line numbers with 0's\n";+        std::cout<<"     --isolate                  output each syntax token separately (verbose output)\n";+        std::cout<<"     --keep-injections          output plug-in injections in spite of -f\n";+        std::cout<<"     --kw-case=<case>           change case of case insensitive keywords\n";+        std::cout<<"                                  <case> =  [upper, lower, capitalize]\n";+        std::cout<<"     --no-trailing-nl[=mode]    omit trailing newline. If mode is empty-file, omit\n";+        std::cout<<"                                  only for empty input\n";+        std::cout<<"     --no-version-info          omit version info comment\n"; -        cout<<"\n\n";-        cout<<"(X)HTML output options:\n";-        cout<<"\n";-        cout<<" -a, --anchors                  attach anchor to line numbers\n";-        cout<<" -y, --anchor-prefix=<str>      set anchor name prefix\n";-        cout<<" -N, --anchor-filename          use input file name as anchor prefix\n";-        cout<<" -C, --print-index              print index with hyperlinks to output files\n";-        cout<<" -n, --ordered-list             print lines as ordered list items\n";-        cout<<"     --class-name=<name>        set CSS class name prefix;\n";-        cout<<"                                  omit class name if set to NONE\n";-        cout<<"     --inline-css               output CSS within each tag (verbose output)\n";-        cout<<"     --enclose-pre              enclose fragmented output with pre tag \n";-        cout<<"                                  (assumes -f)\n";-        cout<<"\n\n";-        cout<<"LaTeX output options:\n";-        cout<<"\n";-        cout<<" -b, --babel                    disable Babel package shorthands\n";-        cout<<" -r, --replace-quotes           replace double quotes by \\dq{}\n";-        cout<<"     --beamer                   adapt output for the Beamer package\n";-        cout<<"     --pretty-symbols           improve appearance of brackets and other symbols\n";-        cout<<"\n\n";-        cout<<"RTF output options:\n";-        cout<<"\n";-        cout<<"     --page-color               include page color attributes\n";-        cout<<" -x, --page-size=<ps>           set page size \n";-        cout<<"                                  <ps> = [a3, a4, a5, b4, b5, b6, letter]\n";-        cout<<"     --char-styles              include character stylesheets\n";-        cout<<"\n\n";-        cout<<"SVG output options:\n";-        cout<<"\n";-        cout<<"     --height                   set image height (units allowed)\n";-        cout<<"     --width                    set image width (see --height)\n";-        cout<<"\n\n";-        cout<<"Terminal escape output options (xterm256 or truecolor):\n";-        cout<<"\n";-        cout<<"     --canvas[=width]           set background colour padding (default: 80)\n";-        cout<<"\n\n";+        std::cout<<"\n\n";+        std::cout<<"(X)HTML output options:\n";+        std::cout<<"\n";+        std::cout<<" -a, --anchors                  attach anchor to line numbers\n";+        std::cout<<" -y, --anchor-prefix=<str>      set anchor name prefix\n";+        std::cout<<" -N, --anchor-filename          use input file name as anchor prefix\n";+        std::cout<<" -C, --print-index              print index with hyperlinks to output files\n";+        std::cout<<" -n, --ordered-list             print lines as ordered list items\n";+        std::cout<<"     --class-name=<name>        set CSS class name prefix;\n";+        std::cout<<"                                  omit class name if set to NONE\n";+        std::cout<<"     --inline-css               output CSS within each tag (verbose output)\n";+        std::cout<<"     --enclose-pre              enclose fragmented output with pre tag \n";+        std::cout<<"                                  (assumes -f)\n";+        std::cout<<"\n\n";+        std::cout<<"LaTeX output options:\n";+        std::cout<<"\n";+        std::cout<<" -b, --babel                    disable Babel package shorthands\n";+        std::cout<<" -r, --replace-quotes           replace double quotes by \\dq{}\n";+        std::cout<<"     --beamer                   adapt output for the Beamer package\n";+        std::cout<<"     --pretty-symbols           improve appearance of brackets and other symbols\n";+        std::cout<<"\n\n";+        std::cout<<"RTF output options:\n";+        std::cout<<"\n";+        std::cout<<"     --page-color               include page color attributes\n";+        std::cout<<" -x, --page-size=<ps>           set page size \n";+        std::cout<<"                                  <ps> = [a3, a4, a5, b4, b5, b6, letter]\n";+        std::cout<<"     --char-styles              include character stylesheets\n";+        std::cout<<"\n\n";+        std::cout<<"SVG output options:\n";+        std::cout<<"\n";+        std::cout<<"     --height                   set image height (units allowed)\n";+        std::cout<<"     --width                    set image width (see --height)\n";+        std::cout<<"\n\n";+        std::cout<<"Terminal escape output options (xterm256 or truecolor):\n";+        std::cout<<"\n";+        std::cout<<"     --canvas[=width]           set background colour padding (default: 80)\n";+        std::cout<<"\n\n"; -        cout<<"Language Server options:\n\n";-        cout<<"     --ls-profile=<server>      read LSP configuration from lsp.conf\n";-        cout<<"     --ls-delay=<ms>            set server initialization delay\n";-        cout<<"     --ls-exec=<bin>            set server executable name\n";-        cout<<"     --ls-option=<option>       set server CLI option (can be repeated)\n";-        cout<<"     --ls-hover                 execute hover requests (HTML output only)\n";-        cout<<"     --ls-semantic              retrieve semantic token types (requires LSP 3.16)\n";-        cout<<"     --ls-syntax=<lang>         set syntax which is understood by the server\n";-        cout<<"     --ls-syntax-error          retrieve syntax error information\n";-        cout<<"                                  (assumes --ls-hover or --ls-semantic)\n";-        cout<<"     --ls-workspace=<dir>       set workspace directory to init. the server\n";-        cout<<"     --ls-legacy                do not require a server capabilities response\n";-        cout<<"\n\n";+        std::cout<<"Language Server options:\n\n";+        std::cout<<"     --ls-profile=<server>      read LSP configuration from lsp.conf\n";+        std::cout<<"     --ls-delay=<ms>            set server initialization delay\n";+        std::cout<<"     --ls-exec=<bin>            set server executable name\n";+        std::cout<<"     --ls-option=<option>       set server CLI option (can be repeated)\n";+        std::cout<<"     --ls-hover                 execute hover requests (HTML output only)\n";+        std::cout<<"     --ls-semantic              retrieve semantic token types (requires LSP 3.16)\n";+        std::cout<<"     --ls-syntax=<lang>         set syntax which is understood by the server\n";+        std::cout<<"     --ls-syntax-error          retrieve syntax error information\n";+        std::cout<<"                                  (assumes --ls-hover or --ls-semantic)\n";+        std::cout<<"     --ls-workspace=<dir>       set workspace directory to init. the server\n";+        std::cout<<"     --ls-legacy                do not require a server capabilities response\n";+        std::cout<<"\n\n"; -        cout<<"If no in- or output files are specified, stdin and stdout will be used.\n";-        cout<<"Reading from stdin can also be triggered using the '-' option.\n";-        cout<<"Default output format: xterm256 or truecolor if appropriate, HTML otherwise.\n";-        cout<<"Style definitions are stored in highlight.css (HTML, XHTML, SVG) or\n";-        cout<<"highlight.sty (LaTeX, TeX) if neither -c nor -I is given.\n";-        cout<<"Reformatting code (-F) will only work with C, C++, C# and Java input files.\n";-        cout<<"LSP features require absolute input paths and disable reformatting (-F).\n";-        cout<<"Wrapping lines with -V or -W will cause faulty highlighting of long single\n";-        cout<<"line comments and directives. Using line-range might interfere with multi\n";-        cout<<"line syntax elements. Use with caution.\n\n";+        std::cout<<"If no in- or output files are specified, stdin and stdout will be used.\n";+        std::cout<<"Reading from stdin can also be triggered using the '-' option.\n";+        std::cout<<"Default output format: xterm256 or truecolor if appropriate, HTML otherwise.\n";+        std::cout<<"Style definitions are stored in highlight.css (HTML, XHTML, SVG) or\n";+        std::cout<<"highlight.sty (LaTeX, TeX) if neither -c nor -I is given.\n";+        std::cout<<"Reformatting code (-F) will only work with C, C++, C# and Java input files.\n";+        std::cout<<"LSP features require absolute input paths and disable reformatting (-F).\n";+        std::cout<<"Wrapping lines with -V or -W will cause faulty highlighting of long single\n";+        std::cout<<"line comments and directives. Using line-range might interfere with multi\n";+        std::cout<<"line syntax elements. Use with caution.\n\n"; -        cout<<"Run highlight --list-scripts=langs to see all supported syntax types.\n\n";-        cout<<"Refer to README files how to apply plug-ins to customize the output.\n\n";-        cout<<"Updates and information: http://www.andre-simon.de/\n";+        std::cout<<"Run highlight --list-scripts=langs to see all supported syntax types.\n\n";+        std::cout<<"Refer to README files how to apply plug-ins to customize the output.\n\n";+        std::cout<<"Updates and information: http://www.andre-simon.de/\n";     } } 

src/cli/main.cpp

@@ -40,14 +40,13 @@ along with Highlight.  If not, see <http://www.gnu.org/licenses/>.  #define MAX_LINE__WIDTH       80 -using namespace std;  void HLCmdLineApp::printVersionInfo(bool quietMode) {     if (quietMode) {-        cout << highlight::Info::getVersion() << "\n";+        std::cout << highlight::Info::getVersion() << "\n";     } else {-        cout << "\n highlight version "+        std::cout << "\n highlight version "             << highlight::Info::getVersion()             << "\n Copyright (C) 2002-2023 Andre Simon <a dot simon at mailbox.org>"             << "\n\n Argparser class"@@ -70,43 +69,43 @@ void HLCmdLineApp::printVersionInfo(bool quietMode)  void HLCmdLineApp::printBadInstallationInfo() {-    cerr << "highlight: Data directory not found ("<<DataDir::LSB_DATA_DIR<<")."+    std::cerr << "highlight: Data directory not found ("<<DataDir::LSB_DATA_DIR<<")."          " Bad installation or wrong "<< OPT_DATADIR << " parameter."          << "\n\nCopy the highlight files into one of the directories listed "          << "in INSTALL.\nYou may also set the data directory with "          << OPT_DATADIR << ".\n"; } -int HLCmdLineApp::printInstalledFiles(const string& where, const string& wildcard, const string& kind, const string& option, const string& categoryFilterList)+int HLCmdLineApp::printInstalledFiles(const std::string& where, const std::string& wildcard, const std::string& kind, const std::string& option, const std::string& categoryFilterList) {-    vector <string> filePaths;-    string searchDir = where + wildcard;+    std::vector <string> filePaths;+    std::string searchDir = where + wildcard;      bool directoryOK = Platform::getDirectoryEntries ( filePaths, searchDir, true );     if ( !directoryOK ) {-        cerr << "highlight: Could not access directory "+        std::cerr << "highlight: Could not access directory "              <<  searchDir              << ", aborted.\n";         return EXIT_FAILURE;     } -    sort ( filePaths.begin(), filePaths.end() );-    string suffix, desc;+    std::sort ( filePaths.begin(), filePaths.end() );+    std::string suffix, desc;     Diluculum::LuaValueMap categoryMap;-    cout << "\nInstalled " << kind << "s";+    std::cout << "\nInstalled " << kind << "s";      if (categoryFilterList.size())-        cout << " matching \""<<categoryFilterList<<"\"";+        std::cout << " matching \""<<categoryFilterList<<"\""; -    cout << " (located in " << where << "):\n\n";+    std::cout << " (located in " << where << "):\n\n";     int matchedFileCnt=0;     std::set<string> categoryNames;     std::set<string> categoryFilters; -    istringstream valueStream;-    string catFilter;-    valueStream.str ( StringTools::change_case ( categoryFilterList,StringTools::CASE_LOWER ) );-    while ( getline ( valueStream, catFilter, ';' ) ) {+    std::istringstream valueStream;+    std::string catFilter;+    valueStream.str ( StringTools::change_case ( categoryFilterList, StringTools::CASE_LOWER ) );+    while ( std::getline ( valueStream, catFilter, ';' ) ) {         categoryFilters.insert ( catFilter );     } @@ -139,41 +138,41 @@ int HLCmdLineApp::printInstalledFiles(const string& where, const string& wildcar              matchedFileCnt++;             if (kind=="langDef") {-                cout << setw ( 30 ) <<setiosflags ( ios::left ) <<desc<<": "<<suffix;+                std::cout << setw ( 30 ) <<setiosflags ( ios::left ) <<desc<<": "<<suffix;                  int extCnt=0;                 for (StringMap::iterator it=dataDir.assocByExtension.begin(); it!=dataDir.assocByExtension.end(); it++) {                     if (it->second==suffix ) {-                        cout << ((++extCnt==1)?" ( ":" ")<<it->first;+                        std::cout << ((++extCnt==1)?" ( ":" ")<<it->first;                     }                 }-                cout << ((extCnt)?" )":"");+                std::cout << ((extCnt)?" )":"");             } else {-                cout << setw ( 30 ) <<setiosflags ( ios::left ) <<suffix<<": "<<desc;+                std::cout << setw ( 30 ) <<setiosflags ( ios::left ) <<suffix<<": "<<desc;              }-            cout << endl;+            std::cout << endl;         } catch (std::runtime_error &error) {-            cout << "Failed to read '" << path<< "': " << error.what() << endl;+            std::cout << "Failed to read '" << path << "': " << error.what() << endl;         }     }      if (!matchedFileCnt) {-        cout <<"No files found." << endl;+        std::cout <<"No files found." << endl;     } else {          if (!categoryFilters.size()){-            cout << "\nFound "<<kind<<" categories:\n\n";+            std::cout << "\nFound "<<kind<<" categories:\n\n";             for (std::set<string>::iterator it=categoryNames.begin(); it!=categoryNames.end(); ++it)                 std::cout << *it<< ' ';-            cout << "\n";+            std::cout << "\n";         } -        cout <<"\nUse name of the desired "<<kind+        std::cout <<"\nUse name of the desired "<<kind             << " with --" << option << ". Filter categories with --list-cat." << endl;          if (kind=="theme") {-            cout <<"\nAdd base16/ prefix to apply a Base16 theme." << endl;+            std::cout <<"\nAdd base16/ prefix to apply a Base16 theme." << endl;         }          printConfigInfo();@@ -247,17 +246,17 @@ void HLCmdLineApp::printDebugInfo ( const highlight::SyntaxReader *lang,  void HLCmdLineApp::printConfigInfo ( ) {-    cout << "\nConfig file search directories:\n";+    std::cout << "\nConfig file search directories:\n";     dataDir.printConfigPaths();-    cout << "\nFiletype config file:\n"<<dataDir.getFiletypesConfPath ( "filetypes" ) <<"\n";-    cout << endl;+    std::cout << "\nFiletype config file:\n"<<dataDir.getFiletypesConfPath ( "filetypes" ) <<"\n";+    std::cout << endl; #ifdef HL_DATA_DIR-    cout << "Compiler directive HL_DATA_DIR = " <<HL_DATA_DIR<< "\n";+    std::cout << "Compiler directive HL_DATA_DIR = " <<HL_DATA_DIR<< "\n"; #endif #ifdef HL_CONFIG_DIR-    cout << "Compiler directive HL_CONFIG_DIR = " <<HL_CONFIG_DIR<< "\n";+    std::cout << "Compiler directive HL_CONFIG_DIR = " <<HL_CONFIG_DIR<< "\n"; #endif-    cout << endl;+    std::cout << endl; }  int HLCmdLineApp::getNumDigits ( int i )@@ -275,20 +274,20 @@ void HLCmdLineApp::printProgressBar ( int total, int count )     if ( !total ) return;     int p=100*count / total;     int numProgressItems=p/10;-    cout << "\r[";+    std::cout << "\r[";     for ( int i=0; i<10; i++ ) {-        cout << ( ( i<numProgressItems ) ?"#":" " );+        std::cout << ( ( i<numProgressItems ) ?"#":" " );     }-    cout<< "] " <<setw ( 3 ) <<p<<"%, "<<count << " / " << total << "  " <<flush;+    std::cout<< "] " <<setw ( 3 ) <<p<<"%, "<<count << " / " << total << "  " <<flush;     if ( p==100 ) {-        cout << endl;+        std::cout << endl;     } }  void HLCmdLineApp::printCurrentAction ( const string&outfilePath,                                         int total, int count, int countWidth ) {-    cout << "Writing file "+    std::cout << "Writing file "          << setw ( countWidth ) << count          << " of "          << total@@ -342,9 +341,9 @@ bool HLCmdLineApp::serviceModeCheck(CmdLineOptions &options, highlight::CodeGene      cerr << flush;     if (! service_mode_tag.empty())-        cout << service_mode_tag << endl;+        std::cout << service_mode_tag << endl; -    cout << flush;+    std::cout << flush;      if (cin.eof())         return false;@@ -525,7 +524,7 @@ int HLCmdLineApp::run ( const int argc, const char*argv[] )             string langDefPath (options.getAbsLangPath().empty() ? dataDir.getLangPath ( resolvedSuffix +".lang") : options.getAbsLangPath());              if (generator->loadLanguage( langDefPath ) == highlight::LOAD_OK) {-                cout << "highlight: This syntax is supported\n";+                std::cout << "highlight: This syntax is supported\n";                 return EXIT_SUCCESS;             } else {                 cerr << "highlight: This syntax is not supported\n";@@ -669,7 +668,7 @@ int HLCmdLineApp::run ( const int argc, const char*argv[] )     generator->setFilesCnt(fileCount);      while ( (serviceModeCheck(options, generator.get(), suffix, i) || i < fileCount) && !initError ) {-        cout.flush();+        std::cout.flush();          if ( Platform::fileSize(inFileList[i]) > options.getMaxFileSize() ) { @@ -906,7 +905,7 @@ int HLCmdLineApp::run ( const int argc, const char*argv[] )             } else {                 twoPassMode=true;                 if ( !options.quietMode() &&  !options.forceStdout() ) {-                    cout << "Enabling two-pass mode using "<<twoPassOutFile<<"\n";+                    std::cout << "Enabling two-pass mode using "<<twoPassOutFile<<"\n";                 }                 //start over, add plug-in to list in next iteration                 usedFileNames.clear();

src/core/keystore.cpp

@@ -29,7 +29,7 @@ along with Highlight.  If not, see <http://www.gnu.org/licenses/>. namespace highlight { -map<string, string> KeyStore::keyStoreMap;+std::map<std::string, std::string> KeyStore::keyStoreMap;  KeyStore::KeyStore() {}

src/gui-qt/highlight.pro

@@ -57,9 +57,10 @@ win32 {      INCLUDEPATH += F:\libs\lua_5.4.0\     INCLUDEPATH += ../../include-    INCLUDEPATH += F:/libs/boost_1_70_0+    INCLUDEPATH += F:/libs/boost_1_82_0      DEFINES += WIN32+    DEFINES -= NOCRYPT     CONFIG += static     LIBS += -LF:\git\highlight\src -lhighlight 

src/gui-qt/main.cpp

@@ -27,6 +27,8 @@ along with Highlight.  If not, see <http://www.gnu.org/licenses/>.  //?? https://codereview.qt-project.org/#change,51048 +#undef NOCRYPT+ #include <QtGlobal>  #if (QT_VERSION < QT_VERSION_CHECK(5,0,0))@@ -40,6 +42,7 @@ along with Highlight.  If not, see <http://www.gnu.org/licenses/>.  #include "mainwindow.h" + int main(int argc, char *argv[]) {     QApplication app(argc, argv);

src/include/keystore.h

@@ -34,7 +34,6 @@ along with Highlight.  If not, see <http://www.gnu.org/licenses/>. #include <Diluculum/LuaFunction.hpp> #include <Diluculum/LuaVariable.hpp> -using namespace std;  namespace highlight {@@ -47,7 +46,7 @@ public:     ~KeyStore();      /** maps keys to values to be accessed in Lua Code*/-    static map <string, string> keyStoreMap;+    static std::map <std::string, std::string> keyStoreMap;      static int luaStore (lua_State *L); };

src/include/themereader.h

@@ -38,13 +38,12 @@ along with Highlight.  If not, see <http://www.gnu.org/licenses/>. #include "elementstyle.h" #include "stylecolour.h" -using namespace std;  namespace highlight {  /** maps keyword class names and the corresponding formatting information*/-typedef map <string, ElementStyle> KeywordStyles;+typedef map <std::string, ElementStyle> KeywordStyles;  /** iterator for keyword styles*/ typedef KeywordStyles::const_iterator KSIterator;@@ -62,13 +61,13 @@ private:     ElementStyle defaultElem;     ElementStyle canvas; -    string errorMsg;-    string desc, categories;-    string themeInjections;+    std::string errorMsg;+    std::string desc, categories;+    std::string themeInjections; -    vector<Diluculum::LuaFunction*> pluginChunks;+    std::vector<Diluculum::LuaFunction*> pluginChunks; -    map<string, int> semanticStyleMap;+    map<std::string, int> semanticStyleMap;      bool fileOK, restoreStyles, dirtyAttributes; @@ -84,7 +83,7 @@ private:      float getBrightness(const Colour& colour) const; -    OutputType getOutputType(const string &typeDesc);+    OutputType getOutputType(const std::string &typeDesc);  public:     /** Constructor */@@ -96,7 +95,7 @@ public:           \param outputType           \param loadSemanticStyles           \return True if successful */-    bool load ( const string & styleDefinitionFile, OutputType outputType=HTML, bool loadSemanticStyles = false );+    bool load ( const std::string & styleDefinitionFile, OutputType outputType=HTML, bool loadSemanticStyles = false );      void addUserChunk(const Diluculum::LuaFunction& chunk)     {@@ -104,25 +103,25 @@ public:     }      /** \return class names defined in the theme file */-    vector <string> getClassNames() const;+    std::vector <std::string> getClassNames() const;      /** \return keyword styles */     KeywordStyles getKeywordStyles() const;      /** \return Font size */-    string getErrorMessage() const;+    std::string getErrorMessage() const; -    const string &getDescription() const+    const std::string &getDescription() const     {         return desc;     } -    const string &getCategoryDescription() const+    const std::string &getCategoryDescription() const     {         return categories;     } -    string getInjections() const;+    std::string getInjections() const;      /** \return Background colour*/     Colour getBgColour() const;@@ -172,18 +171,18 @@ public:     /** \param className Name of keyword class (eg kwa, kwb, .., kwd)         \return keyword style of the given className     */-    ElementStyle getKeywordStyle ( const string &className ) ;+    ElementStyle getKeywordStyle ( const std::string &className ) ;      /** \return True if language definition was found */     bool found() const ; -    int getSemanticStyle(const string &type);+    int getSemanticStyle(const std::string &type);      int getSemanticTokenStyleCount() const;      int getKeywordStyleCount() const; -    void overrideAttributes( vector<int>& attributes);+    void overrideAttributes( std::vector<int>& attributes);      float getContrast() const; };

src/w32-projects/highlight-setup-x86.iss

@@ -5,7 +5,7 @@ AppName=Highlight Code Converter  AppVerName=Highlight-OutputBaseFilename=highlight-setup-4.4-x64+OutputBaseFilename=highlight-setup-4.6-x64  AppPublisher=André Simon AppPublisherURL=http://www.andre-simon.de

src/w32-projects/highlight-setup.iss

@@ -5,7 +5,7 @@ AppName=Highlight Code Converter  AppVerName=Highlight-OutputBaseFilename=highlight-setup-4.4+OutputBaseFilename=highlight-setup-4.6  AppPublisher=André Simon AppPublisherURL=http://www.andre-simon.de

src/w32-projects/highlight_lib/highlight_lib.pro

@@ -15,5 +15,5 @@ SOURCES += F:\git\highlight\src\core\Diluculum\*.cpp  INCLUDEPATH += F:\libs\lua_5.4.0 INCLUDEPATH += ../../include-INCLUDEPATH += F:\libs\boost_1_70_0+INCLUDEPATH += F:\libs\boost_1_82_0 QMAKE_CXXFLAGS += -std=c++11