PageRenderTime 44ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/dev/sqtpp/Options.h

#
C++ Header | 738 lines | 155 code | 97 blank | 486 comment | 1 complexity | 6acb43b19c3ed13b6e2c64b0f3d3770c MD5 | raw file
  1. /**
  2. ** @file
  3. ** @author Ralf Seidel
  4. ** @brief Declaration of the #sqtpp::Options.
  5. **
  6. ** Š 2004-2006 by Heinrich und Seidel GbR Wuppertal.
  7. */
  8. #ifndef SQTPP_OPTIONS_H
  9. #define SQTPP_OPTIONS_H
  10. #if _MSC_VER > 10
  11. #pragma once
  12. #endif
  13. #include "Range.h"
  14. namespace sqtpp {
  15. class CmdArgs;
  16. class OptionsStack;
  17. /**
  18. ** @brief Options for preprocessing.
  19. **
  20. ** @todo Make options accessible through string interface to
  21. ** allow modification of options by preprocessor
  22. ** @code
  23. ** \#pragma option( id, value )
  24. ** @endcode
  25. ** directives.
  26. */
  27. class Options
  28. {
  29. private:
  30. public:
  31. /**
  32. ** @brief Enumeration of new line handling.
  33. */
  34. enum NewLineOutput
  35. {
  36. /// Undefined / initial value.
  37. NLO_UNDEFINED,
  38. /// Keep new line characters as found in the input (default if output is a file).
  39. NLO_AS_IS,
  40. /// Use operating system standard line ending (default if output is stdout).
  41. NLO_OS_DEFAULT,
  42. /// Emit line feeds only (UNIX convention).
  43. NLO_LF,
  44. /// Emit line feeds only (Mac convention).
  45. NLO_CR,
  46. /// Emit line feeds only (Windows/DOS convention).
  47. NLO_CRLF
  48. };
  49. /**
  50. ** @brief Source code language.
  51. **
  52. ** Used to predefine some of the preprocessor options.
  53. ** This option is controlled by the command line argument /T.
  54. */
  55. enum Language {
  56. /// Undefined / initial value.
  57. LNG_UNDEFINED,
  58. /// Plain text.
  59. LNG_TEXT,
  60. /// XML / XHTML
  61. LNG_XML,
  62. /// Good old c
  63. LNG_C,
  64. /// c++
  65. LNG_CPP,
  66. /// Microsofts assembler
  67. LNG_ASM,
  68. /// Resource compiler
  69. LNG_RC,
  70. /// Transact SQL (Microsoft / Sybase SQL dialect)
  71. LNG_SQL
  72. };
  73. /**
  74. ** @brief Debugging informations about the defined languages.
  75. */
  76. class LanguageInfo {
  77. public:
  78. /// The language id
  79. const Language language;
  80. /// The enumeration symbol.
  81. const wchar_t* pwszSymbol;
  82. /// The symbol that will be defined for this language.
  83. const wchar_t* pwszMacro;
  84. // Initialising constructor.
  85. LanguageInfo( Language eLanguage, const wchar_t* pwszSymbol, const wchar_t* pwszMacro );
  86. private:
  87. // Assignment operator (not implemented).
  88. LanguageInfo& operator= ( const LanguageInfo& that );
  89. };
  90. /**
  91. ** @brief String quoting options.
  92. */
  93. enum Quoting {
  94. /// Undefined / initial value.
  95. QUOT_UNDEFINED = 0,
  96. /// When quoting use c like backslash escape characters.
  97. QUOT_ESCAPE = L'\\',
  98. /// When quoting duplicate the quote characters (default for SQL script preprocessing).
  99. QUOT_DOUBLE = L'\"'
  100. };
  101. /**
  102. ** @brief Options how emitted strings are delimited.
  103. */
  104. enum StringDelimiter {
  105. /// Undefined / initial value.
  106. STRD_UNDEFINED = 0,
  107. /// Use standard double quotes.
  108. STRD_DOUBLE = L'\"',
  109. /// Use single quotes.
  110. STRD_SINGLE = L'\''
  111. };
  112. private:
  113. /**
  114. ** @brief Character used to seperate directories in the command line arguments.
  115. **
  116. ** For Windows the character is a semicolon. For the others it is a colon.
  117. */
  118. static const wchar_t m_wcDirectorySeperator;
  119. /**
  120. ** @brief The string emitted for line feeds if the "use os default" option is used.
  121. */
  122. static const wchar_t* m_pszOsDefaultNewLine;
  123. /**
  124. ** @brief Informations about all definable source file languages.
  125. */
  126. static const LanguageInfo m_languageInfo[];
  127. /**
  128. ** @brief The input source code language.
  129. **
  130. ** Default: C @par
  131. **
  132. ** Possible values: @par
  133. ** <table>
  134. ** <tr><th>Language</th><th>Description</th></tr>
  135. ** <tr><td>Text </td><td>Does no preproccing but simply reads and writes the input</td></tr>
  136. ** <tr><td>XML </td><td>Optional removal of blanks and comments only.</td></tr>
  137. ** <tr><td>C </td><td>C Language</td></tr>
  138. ** <tr><td>C++ </td><td>C++ Language</td></tr>
  139. ** <tr><td>RC </td><td>Microsoft Windows / OS/2 resource file language</td></tr>
  140. ** <tr><td>ASM </td><td>Assembler</td></tr>
  141. ** <tr><td>SQL </td><td>SQL Language</td></tr>
  142. ** </table>
  143. */
  144. Language m_eLanguage;
  145. /**
  146. ** @brief Option how to quotes inside a string are formatted.
  147. **
  148. ** <table>
  149. ** <tr><th>Language</th><th>Default</th></tr>
  150. ** <tr><td>Text </td><td>N/A</td></tr>
  151. ** <tr><td>XML </td><td>N/A</td></tr>
  152. ** <tr><td>C </td><td>Backslah notation</td></tr>
  153. ** <tr><td>C++ </td><td>Backslah notation</td></tr>
  154. ** <tr><td>RC </td><td>Backslah notation</td></tr>
  155. ** <tr><td>ASM </td><td>Backslah notation</td></tr>
  156. ** <tr><td>SQL </td><td>Double quotes</td></tr>
  157. ** </table>
  158. */
  159. Quoting m_eQuoting;
  160. /**
  161. ** @brief Option how to quote string.
  162. **
  163. ** <table>
  164. ** <tr><th>Language</th><th>Default</th></tr>
  165. ** <tr><td>Text </td><td>N/A</td></tr>
  166. ** <tr><td>XML </td><td>N/A</td></tr>
  167. ** <tr><td>C </td><td>double quotes (")</td></tr>
  168. ** <tr><td>C++ </td><td>double quotes (")</td></tr>
  169. ** <tr><td>RC </td><td>double quotes (")</td></tr>
  170. ** <tr><td>ASM </td><td>double quotes (")</td></tr>
  171. ** <tr><td>SQL </td><td>single quotes (')</td></tr>
  172. ** </table>
  173. */
  174. StringDelimiter m_eStringDelimiter;
  175. /**
  176. ** @brief Option if an how new lines in the input stream should be converted.
  177. **
  178. ** By default the new line characters CR & LF are returned in the ouput as they are
  179. ** found in the input stream. This option can be used to transform them into the
  180. ** conventions for Unix, Mac or Windows.
  181. */
  182. NewLineOutput m_eNewLineOutput;
  183. /**
  184. ** @brief Emit line number and file information?
  185. **
  186. ** If this flag is set the pre processor will emit \#line directive to
  187. ** synchronize the current input position with the position in the output
  188. ** stream.
  189. **
  190. ** Defaults:
  191. **
  192. ** <table>
  193. ** <tr><th>Language</th><th>Default</th></tr>
  194. ** <tr><td>Text </td><td>false </td></tr>
  195. ** <tr><td>XML </td><td>false </td></tr>
  196. ** <tr><td>C </td><td>true </td></tr>
  197. ** <tr><td>C++ </td><td>true </td></tr>
  198. ** <tr><td>RC </td><td>false </td></tr>
  199. ** <tr><td>ASM </td><td>false </td></tr>
  200. ** <tr><td>SQL </td><td>true </td></tr>
  201. ** </table>
  202. */
  203. bool m_bEmitLine;
  204. /**
  205. ** @brief Keep block comments?
  206. **
  207. ** Defaults:
  208. ** <table>
  209. ** <tr><th>Language</th><th>Default</th></tr>
  210. ** <tr><td>Text </td><td>true </td></tr>
  211. ** <tr><td>XML </td><td>true </td></tr>
  212. ** <tr><td>C </td><td>false </td></tr>
  213. ** <tr><td>C++ </td><td>false </td></tr>
  214. ** <tr><td>RC </td><td>false </td></tr>
  215. ** <tr><td>ASM </td><td>false </td></tr>
  216. ** <tr><td>SQL </td><td>false </td></tr>
  217. ** </table>
  218. */
  219. bool m_bKeepBlockComments;
  220. /**
  221. ** @brief Keep line comments?
  222. **
  223. ** Defaults:
  224. ** <table>
  225. ** <tr><th>Language</th><th>Default</th></tr>
  226. ** <tr><td>Text </td><td>true </td></tr>
  227. ** <tr><td>XML </td><td>true </td></tr>
  228. ** <tr><td>C </td><td>false </td></tr>
  229. ** <tr><td>C++ </td><td>false </td></tr>
  230. ** <tr><td>RC </td><td>false </td></tr>
  231. ** <tr><td>ASM </td><td>false </td></tr>
  232. ** <tr><td>SQL </td><td>false </td></tr>
  233. ** </table>
  234. */
  235. bool m_bKeepLineComments;
  236. /**
  237. ** @brief Keep SQL line comments?
  238. **
  239. ** Defaults:
  240. ** <table>
  241. ** <tr><th>Language</th><th>Default</th></tr>
  242. ** <tr><td>Text </td><td>true </td></tr>
  243. ** <tr><td>XML </td><td>true </td></tr>
  244. ** <tr><td>C </td><td>true </td></tr>
  245. ** <tr><td>C++ </td><td>true </td></tr>
  246. ** <tr><td>RC </td><td>true </td></tr>
  247. ** <tr><td>ASM </td><td>true </td></tr>
  248. ** <tr><td>SQL </td><td>true </td></tr>
  249. ** </table>
  250. */
  251. bool m_bKeepSqlComments;
  252. /**
  253. ** @brief Expand macros in several lines.
  254. **
  255. ** Traditionally the C preprocess expands all macros in one single line. This makes the produced
  256. ** code sometimes hardly readable. If the <code>MultiLineMacroExpansion</code> option is set the
  257. ** expanded macro will have line breaks at the same position as its defintion.
  258. **
  259. ** Example:
  260. **
  261. ** @code
  262. ** #define MACRO \
  263. ** A \
  264. ** B \
  265. ** C
  266. **
  267. ** MACRO
  268. ** @endcode
  269. **
  270. ** will lead to
  271. **
  272. ** @code
  273. ** A
  274. ** B
  275. ** C
  276. ** @endcode
  277. **
  278. ** instead of
  279. **
  280. ** @code
  281. ** A B C
  282. ** @endcode
  283. **
  284. ** Defaults:
  285. **
  286. ** <table>
  287. ** <tr><th>Language</th><th>Default</th></tr>
  288. ** <tr><td>Text </td><td>N/A </td></tr>
  289. ** <tr><td>XML </td><td>N/A </td></tr>
  290. ** <tr><td>C </td><td>false </td></tr>
  291. ** <tr><td>C++ </td><td>false </td></tr>
  292. ** <tr><td>RC </td><td>false </td></tr>
  293. ** <tr><td>ASM </td><td>false </td></tr>
  294. ** <tr><td>SQL </td><td>true </td></tr>
  295. ** </table>
  296. */
  297. bool m_bMultiLineMacroExpansion;
  298. /**
  299. ** @brief Allow strings to exceed the end of the line.
  300. **
  301. **
  302. */
  303. bool m_bMultiLineStringLiterals;
  304. /**
  305. ** @brief Expand macros found in a macro argument list?
  306. **
  307. ** Example:
  308. **
  309. ** @code
  310. ** #define CONCATE( DO, CONCATE ) DO#CONCATE
  311. ** CONCATE( A, B )
  312. ** CONCATE( CONCATE( A, B ), C )
  313. ** @endcode
  314. **
  315. ** By default the c preprocessor producess the following result:
  316. **
  317. ** @code
  318. ** AB
  319. ** CONCATE( A, B )C
  320. ** @endcode
  321. **
  322. ** The this option is set the result will be:
  323. ** @code
  324. ** AB
  325. ** ABC
  326. ** @endcode
  327. **
  328. ** @todo This option is currently not supported.
  329. ** To implement this feature the processor must become a stack of token sources. Whenever
  330. ** a macro is found in the argument list the current token source will be replaced with the
  331. ** tokens of the expanded macros.
  332. */
  333. bool m_bExpandMacroArguments;
  334. /**
  335. ** @brief Never output more than one empty line.
  336. **
  337. ** Defaults:
  338. **
  339. ** <table>
  340. ** <tr><th>Language</th><th>Default</th></tr>
  341. ** <tr><td>Text </td><td>false </td></tr>
  342. ** <tr><td>XML </td><td>false </td></tr>
  343. ** <tr><td>C </td><td>false </td></tr>
  344. ** <tr><td>C++ </td><td>false </td></tr>
  345. ** <tr><td>RC </td><td>false </td></tr>
  346. ** <tr><td>ASM </td><td>false </td></tr>
  347. ** <tr><td>SQL </td><td>false </td></tr>
  348. ** </table>
  349. */
  350. bool m_bEliminateEmptyLines;
  351. /**
  352. ** @brief Remove leading blanks from the ouput.
  353. **
  354. ** Defaults:
  355. ** <table>
  356. ** <tr><th>Language</th><th>Default</th></tr>
  357. ** <tr><td>Text </td><td>false </td></tr>
  358. ** <tr><td>XML </td><td>false </td></tr>
  359. ** <tr><td>C </td><td>false </td></tr>
  360. ** <tr><td>C++ </td><td>false </td></tr>
  361. ** <tr><td>RC </td><td>false </td></tr>
  362. ** <tr><td>ASM </td><td>false </td></tr>
  363. ** <tr><td>SQL </td><td>false </td></tr>
  364. ** </table>
  365. */
  366. bool m_bTrimLeadingBlanks;
  367. /**
  368. ** @brief Remove trailing blanks from the ouput.
  369. **
  370. ** Defaults:
  371. ** <table>
  372. ** <tr><th>Language</th><th>Default</th></tr>
  373. ** <tr><td>Text </td><td>false </td></tr>
  374. ** <tr><td>XML </td><td>false </td></tr>
  375. ** <tr><td>C </td><td>false </td></tr>
  376. ** <tr><td>C++ </td><td>false </td></tr>
  377. ** <tr><td>RC </td><td>false </td></tr>
  378. ** <tr><td>ASM </td><td>false </td></tr>
  379. ** <tr><td>SQL </td><td>false </td></tr>
  380. ** </table>
  381. */
  382. bool m_bTrimTrailingBlanks;
  383. /**
  384. ** @brief Ignore the current working directory when searching for include files?
  385. **
  386. ** Defaults:
  387. **
  388. ** <table>
  389. ** <tr><th>Language</th><th>Default</th></tr>
  390. ** <tr><td>Text </td><td>N/A </td></tr>
  391. ** <tr><td>XML </td><td>N/A </td></tr>
  392. ** <tr><td>C </td><td>false </td></tr>
  393. ** <tr><td>C++ </td><td>false </td></tr>
  394. ** <tr><td>RC </td><td>false </td></tr>
  395. ** <tr><td>ASM </td><td>false </td></tr>
  396. ** <tr><td>SQL </td><td>false </td></tr>
  397. ** </table>
  398. */
  399. bool m_bIgnoreCWD;
  400. /**
  401. ** @brief Do not define any buildin macro?
  402. */
  403. bool m_bUndefAllBuildin;
  404. /**
  405. ** @brief Enable support for AdSales NG source tags.
  406. */
  407. bool m_bSupportAdSalesNG;
  408. /**
  409. ** @brief Verbose message output.
  410. */
  411. bool m_bVerbose;
  412. /**
  413. ** @brief Option to let sqtpp write all error messages
  414. ** to the normal output.
  415. ** This option is used to support test scenarios than expect all
  416. ** output in a single file
  417. */
  418. bool m_bWriteErrorsToOutput;
  419. /**
  420. ** @brief The codepage of the input.
  421. **
  422. ** Default is 1252 (ANSI - Latin I).
  423. **
  424. ** The following codepages are defined on windows:
  425. **
  426. ** @htmlinclude "codepages.html"
  427. */
  428. unsigned short m_nInputCodePage;
  429. /**
  430. ** @brief The codepage of the output.
  431. **
  432. ** Default is 1252 (ANSI / WINDOWS 1252)
  433. **
  434. ** The following codepages are defined on windows:
  435. **
  436. ** @htmlinclude "doc/codepages.html"
  437. */
  438. unsigned short m_nOutputCodePage;
  439. /**
  440. ** @brief The range in the input file to emit output for.
  441. **
  442. ** Default is unrestricted i.e. emit output for all input.
  443. ** The range option is implemented to allow the caller
  444. ** of an GUI frontend to restrict the output to the
  445. ** current selection in the an editor.
  446. */
  447. Range m_outputRange;
  448. /**
  449. ** @brief The file to which output should be written (default is "" / stdout).
  450. **
  451. ** If no file is specified the preprocessor will write all output to stdout.
  452. */
  453. wstring m_sOutputFile;
  454. /**
  455. ** @brief Include directories specified as command line parameter.
  456. **
  457. ** Defaults:
  458. **
  459. ** <table>
  460. ** <tr><th>Language</th><th>Default</th></tr>
  461. ** <tr><td>Text </td><td>N/A</td></tr>
  462. ** <tr><td>C </td><td></td></tr>
  463. ** <tr><td>C++ </td><td></td></tr>
  464. ** <tr><td>RC </td><td></td></tr>
  465. ** <tr><td>ASM </td><td></td></tr>
  466. ** <tr><td>SQL </td><td></td></tr>
  467. ** </table>
  468. */
  469. wstring m_sIncludeDirectories;
  470. /**
  471. ** @brief Macros defined on the command line with /D.
  472. */
  473. StringDictionary m_macroDefines;
  474. /**
  475. ** @brief Macros undefined on the command line with /U.
  476. */
  477. StringArray m_macroUndefines;
  478. /**
  479. ** @brief Format string to be used when emmitting the __DATE__ macro.
  480. **
  481. ** Default:
  482. **
  483. ** @code
  484. ** "%b %d %Y"
  485. ** @endcode
  486. **
  487. */
  488. std::wstring m_sDateFormat;
  489. /**
  490. ** @brief Format string to be used when emmitting the __TIME__ macro.
  491. **
  492. ** The formatted string will be enclosed in quotes. Which kind of quotes are used
  493. ** depends on the quote option.
  494. ** Defaults:
  495. **
  496. ** @code
  497. ** "%H:%M:%S"
  498. ** @endcode
  499. */
  500. std::wstring m_sTimeFormat;
  501. /**
  502. ** @brief Format string to be used when emmitting the __TIMESTAMP__ macro.
  503. */
  504. std::wstring m_sTimestampFormat;
  505. /**
  506. ** @brief Collection of directories to search included files for.
  507. */
  508. StringArray m_includeDirectories;
  509. public:
  510. // The constructor.
  511. Options();
  512. // The destructor.
  513. virtual ~Options() throw();
  514. // Get default options.
  515. const Options& getDefaultOptions();
  516. /// Get the source language format.
  517. Language getLanguage() const throw() { return m_eLanguage; }
  518. /// Set the source language format.
  519. void setLanguage( Language language ) throw() { m_eLanguage = language; }
  520. /// Get the codepage of the (8 bit) input files.
  521. unsigned short getInputCodePage() const throw() { return m_nInputCodePage; }
  522. /// Set the codepage of the (8 bit) input files.
  523. void setInputCodePage( unsigned short cp ) throw() { m_nInputCodePage = cp; }
  524. /// Get the range in the _input_ file to restrict output for.
  525. const Range& getOutputRange() const throw() { return m_outputRange; }
  526. /// Set the range in the _input_ file to restrict output for.
  527. void setOutputRange( const Range& range ) throw() { m_outputRange = range; }
  528. /// Get the codepage for the output file.
  529. unsigned short getOutputCodePage() const throw() { return m_nOutputCodePage; }
  530. /// Set the codepage of the (8 bit) input files.
  531. void setOutputCodePage( unsigned short cp ) throw() { m_nOutputCodePage = cp; }
  532. /// Get the path of the file to which the output should be written.
  533. const wstring& getOutputFile() const throw() { return m_sOutputFile; }
  534. /// Set the path of the file to which the output should be written.
  535. void setOutputFile( const wstring& sPath ) throw() { m_sOutputFile = sPath; }
  536. /// Get some information about the given language.
  537. static const LanguageInfo& getLanguageInfo( Language language ) throw();
  538. /// Get some information about the configured language.
  539. const LanguageInfo& getLanguageInfo() const throw() { return Options::getLanguageInfo( m_eLanguage ); }
  540. /// Get the quoting option.
  541. Quoting getStringQuoting() const throw() { return m_eQuoting; }
  542. /// Get the string quoting option.
  543. void setStringQuoting( Quoting quoting ) throw() { m_eQuoting = quoting; }
  544. /// Get the string to emit for line feeds if the "use os default" option is used.
  545. static const wchar_t* getOsDefaultNewLine() { return m_pszOsDefaultNewLine; }
  546. static void setOsDefaultNewLine( const wchar_t* pszNewLine) { m_pszOsDefaultNewLine = pszNewLine; }
  547. /// Get the new line (cr and/or lf) transformation option.
  548. NewLineOutput getNewLineOutput() const throw() { return m_eNewLineOutput; }
  549. /// set the new line (cr and/or lf) transformation option.
  550. void setNewLineOutput( NewLineOutput option ) throw() { m_eNewLineOutput = option; }
  551. /// See #m_eStringDelimiter.
  552. StringDelimiter getStringDelimiter() const throw() { return m_eStringDelimiter; }
  553. /// See #m_eStringDelimiter.
  554. void setStringDelimiter( StringDelimiter delimiter ) throw() { m_eStringDelimiter = delimiter; }
  555. /// See #m_bVerbose
  556. bool verbose() const { return m_bVerbose; }
  557. /// See #m_bVerbose
  558. void verbose( bool bValue ) { m_bVerbose = bValue; }
  559. /// Get the date format string.
  560. const std::wstring getDateFormat() const;
  561. /// Set the date format string.
  562. void setDateFormat( const std::wstring& format ) { m_sDateFormat = format; }
  563. /// Get the time format string.
  564. const std::wstring getTimeFormat() const;
  565. /// Set the time format string.
  566. void setTimeFormat( const std::wstring& format ) { m_sTimeFormat = format; }
  567. /// Get the time format string.
  568. const std::wstring getTimestampFormat() const;
  569. /// Set the time format string.
  570. void setTimestampFormat( const std::wstring& format ) { m_sTimestampFormat = format; }
  571. /// Test if quote characters insided string are escaped by double quotes e.g. "A""B";
  572. bool doubleQuoteEscaping() const throw() { return ( m_eQuoting & QUOT_DOUBLE ) != 0 ; }
  573. /// Do not define any buildin macro?
  574. bool undefAllBuildin() const throw() { return m_bUndefAllBuildin; }
  575. /// Check if block comments should be emmited.
  576. bool keepBlockComments() const throw() { return m_bKeepBlockComments; }
  577. /// Set if block comments should be emmited.
  578. void keepBlockComments( bool bKeep ) throw() { m_bKeepBlockComments = bKeep; }
  579. /// Check if line comments should be emmited.
  580. bool keepLineComments() const throw() { return m_bKeepLineComments; }
  581. /// Set if line comments should be emmited.
  582. void keepLineComments( bool bKeep ) throw() { m_bKeepLineComments = bKeep; }
  583. /// Check if SQL comments should be emmited.
  584. bool keepSqlComments() const throw() { return m_bKeepSqlComments; }
  585. /// Set if SQL comments should be emmited.
  586. void keepSqlComments( bool bKeep ) throw() { m_bKeepSqlComments = bKeep; }
  587. /// Switch any comment option on or off
  588. void keepComments( bool bKeep ) throw();
  589. /// Check if line information should be emitted by the processor.
  590. bool emitLine() const throw() { return m_bEmitLine; }
  591. /// Check if line information should be emitted by the processor.
  592. void emitLine( bool bEmit ) throw() { m_bEmitLine = bEmit; }
  593. /// Check if new lines in macros should not be replace with a single space character.
  594. bool multiLineMacroExpansion() const throw() { return m_bMultiLineMacroExpansion; }
  595. /// Check if new lines in macros should not be replaced with a single space character.
  596. void multiLineMacroExpansion( bool bExpand ) throw() { m_bMultiLineMacroExpansion = bExpand; }
  597. /// Test if string literals may exceed the end of a line.
  598. bool multiLineStringLiterals() const throw() { return m_bMultiLineStringLiterals; };
  599. /// Set option to allow or disallow strings to exceed the end of a line
  600. void multiLineStringLiterals( bool bAllow ) throw() { m_bMultiLineStringLiterals = bAllow; };
  601. /// Check if macro arguments are to expanded if they include any other argument (see #m_bExpandMacroArguments).
  602. bool expandMacroArguments() const throw() { return m_bExpandMacroArguments; }
  603. /// Check if macro arguments are to expanded if they include any other argument (see #m_bExpandMacroArguments).
  604. void expandMacroArguments( bool bExpand ) throw() { m_bExpandMacroArguments = bExpand; }
  605. /// Check if support for S4M AdSalesNG source tags is enabled.
  606. bool supportAdSalesNG() const throw() { return m_bSupportAdSalesNG; }
  607. /// Enable/disable support for S4M AdSales NG source tags.
  608. void supportAdSalesNG( bool bEnable ) throw() { m_bSupportAdSalesNG = bEnable; }
  609. /// Check if leading blanks should be suppressed.
  610. bool trimLeadingBlanks() const throw() { return m_bTrimLeadingBlanks; }
  611. /// Check if trailing blanks should be suppressed.
  612. bool trimTrailingBlanks() const throw() { return m_bTrimTrailingBlanks; }
  613. /// Check if empty line should be suppressed.
  614. bool eliminateEmptyLines() const throw() { return m_bEliminateEmptyLines; }
  615. /// Set if empty line should be suppressed.
  616. void eliminateEmptyLines( bool bEliminate ) throw() { m_bEliminateEmptyLines = bEliminate; }
  617. /// Get option it sqtpp uses the default output stream for error messages.
  618. bool writeErrorsToOutput() const throw() { return m_bWriteErrorsToOutput; }
  619. /// Set option to let sqtpp use the default output stream for error messages.
  620. void writeErrorsToOutput( bool bValue ) throw() { m_bWriteErrorsToOutput = bValue; }
  621. /// Add the given directories to the array of included directories.
  622. void addIncludeDirectories( const wchar_t* pwszIncludeDirectories );
  623. /// Get all included directories.
  624. const StringArray& getIncludeDirectories() const throw() { return m_includeDirectories; }
  625. /// Get macros to be undefined (passed at the command line).
  626. const StringArray& getUndefines() const throw() { return m_macroUndefines; }
  627. /// Get macros to be defined before first file is processed (passed at the command line).
  628. const StringDictionary& getDefines() const throw() { return m_macroDefines; }
  629. private:
  630. /// Set the default options for the source code language.
  631. void setLanguageDefaults();
  632. friend class sqtpp::CmdArgs;
  633. };
  634. /**
  635. ** @brief A stack of options (for pragma push/pop(Options).
  636. */
  637. class OptionsStack : public std::stack<Options>
  638. {
  639. };
  640. } // namespace
  641. #endif // SQTPP_OPTIONS_H