11/*
22 -------------------------------------------------------------------------------
33 This file is part of the Private Message Database.
4- Copyright (C) 2012, 2013, 2014 Dirk Stolle
4+ Copyright (C) 2012, 2013, 2014, 2025 Dirk Stolle
55
66 This program is free software: you can redistribute it and/or modify
77 it under the terms of the GNU General Public License as published by
3636#include < string>
3737#include < vector>
3838#include " BBCode.hpp"
39+ #include " HTMLStandard.hpp"
3940#ifndef NO_SMILIES_IN_PARSER
4041 #include " Smilie.hpp"
4142#endif
4445#endif
4546
4647/* * \brief BBCodeParser:
47- transforms a given text containing BB codes to HTML code via the
48+ Transforms a given text containing BB codes to (X) HTML code via the
4849 parse() function. All codes that should be replaced have to be added
4950 before parsing. Use addCode() for that. Smilies added via addSmilie()
5051 will be replaced, too.
5152*/
5253class BBCodeParser
5354{
5455 public:
55- /* * constructor */
5656 BBCodeParser ();
5757
5858
59- /* * \brief transforms BB codes in text to HTML codes (still incomplete)
59+ /* * \brief Transforms BB codes in text to (X) HTML codes (still incomplete).
6060 *
6161 * \param text the original text
6262 * \param forumURL the base URL of the forum (some BB codes might require
63- this URL for proper transformation of code to HTML)
64- * \param isXHTML if set to true, smilie transformations will produce XHTML
65- image tags
63+ this URL for proper transformation of code to (X)HTML)
64+ * \param standard the HTML standard to use during transformation (HTML or XHTML)
6665 * \param nl2br if set to true, new line characters will be converted to
6766 the corresponding (X)HTML code for line breaks
6867 * \return Returns the transformed/parsed text.
6968 */
70- std::string parse (std::string text, const std::string& forumURL, const bool isXHTML , const bool nl2br) const ;
69+ std::string parse (std::string text, const std::string& forumURL, const HTMLStandard standard , const bool nl2br) const ;
7170
7271
7372 #ifndef NO_PREPROCESSORS_IN_PARSER
74- /* * \brief adds a new text preprocessor to the parser
73+ /* * \brief Adds a new text preprocessor to the parser.
7574 *
7675 * \param preProc pointer to the text processor object that should be added
7776 * \remarks The passed pointers must live for the whole lifetime of the
@@ -92,7 +91,7 @@ class BBCodeParser
9291 #endif
9392
9493
95- /* * \brief adds a new bb code to the parser
94+ /* * \brief Adds a new BB code to the parser.
9695 *
9796 * \param code pointer to the BB code object that should be added
9897 * \remarks
@@ -113,16 +112,16 @@ class BBCodeParser
113112
114113
115114 #ifndef NO_SMILIES_IN_PARSER
116- /* * \brief adds a new smilie to the parser
115+ /* * \brief Adds a new smilie to the parser.
117116 *
118- * \param sm the smilie
117+ * \param sm the smilie to add
119118 */
120119 void addSmilie (const Smilie& sm);
121120 #endif
122121
123122
124123 #ifndef NO_POSTPROCESSORS_IN_PARSER
125- /* * \brief adds a new text postprocessor to the parser
124+ /* * \brief Adds a new text postprocessor to the parser.
126125 *
127126 * \param postProc pointer to the text processor object that should be added
128127 *
@@ -145,26 +144,26 @@ class BBCodeParser
145144 #endif
146145
147146 #ifndef NO_PREPROCESSORS_IN_PARSER
148- /* * clears all added preprocessors */
147+ /* * Clears all added preprocessors. */
149148 inline void clearPreProcessors ()
150149 {
151150 m_PreProcs.clear ();
152151 }
153152 #endif
154153
155154
156- /* * \brief clears all added BB codes
155+ /* * \brief Clears all added BB codes.
157156 *
158157 * \remarks
159158 * Clearing codes right before calling parse() without any addCode()
160159 * calls in between will result in no BB codes being parsed. However,
161- * smilies might still get parsed.
160+ * smilies might still get parsed, if there are any .
162161 */
163162 void clearCodes ();
164163
165164
166165 #ifndef NO_SMILIES_IN_PARSER
167- /* * \brief clears all added smilies
166+ /* * \brief Clears all added smilies.
168167 *
169168 * \remarks
170169 * Clearing smilies right before calling parse() without any addSmile()
@@ -175,7 +174,7 @@ class BBCodeParser
175174 #endif
176175
177176 #ifndef NO_POSTPROCESSORS_IN_PARSER
178- /* * clears all added postprocessors */
177+ /* * Clears all added postprocessors. */
179178 inline void clearPostProcessors ()
180179 {
181180 m_PostProcs.clear ();
@@ -192,6 +191,6 @@ class BBCodeParser
192191 std::vector<TextProcessor*> m_PostProcs;
193192 #endif
194193 std::vector<BBCode*> m_Codes;
195- };// class
194+ }; // class
196195
197196#endif // BBCODEPARSER_HPP
0 commit comments