1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2012-2015 Adam Wulkiewicz, Lodz, Poland.
6 // This file was modified by Oracle on 2014, 2015.
7 // Modifications copyright (c) 2014-2015, Oracle and/or its affiliates.
9 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
11 // Use, modification and distribution is subject to the Boost Software License,
12 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
16 #ifndef QUICKBOOK_OUTPUT_HPP
17 #define QUICKBOOK_OUTPUT_HPP
23 #include <boost/algorithm/string.hpp>
25 #include <doxygen_elements.hpp>
26 #include <parameter_predicates.hpp>
28 std::string qbk_escaped(std::string const& s)
30 // Replace _ by unicode to avoid accidental quickbook underlining.
31 // 1) do NOT do this in quickbook markup, so not within []
32 // (e.g. to avoid [include get_point.qbk] having unicoded)
33 // 2) \[ and \] should not count as []
34 std::size_t const len = s.length();
36 std::string result = "";
37 for (std::size_t i = 0; i < len; i++)
41 case '[' : counter++; break;
42 case ']' : counter--; break;
67 inline void next_item(std::string const& first, std::string const& indent,
68 std::size_t items_per_line,
69 std::size_t& index, std::ostream& out)
73 if (index % items_per_line == 0)
75 out << "," << std::endl << indent;
89 void quickbook_template_parameter_list(std::vector<parameter> const& parameters,
90 std::string const& related_name,
93 if (!parameters.empty())
95 std::string const header = "template<";
96 std::size_t index = 0;
97 std::string const indent(header.length(), ' ');
99 BOOST_FOREACH(parameter const& p, parameters)
101 if (p.fulltype.empty())
103 std::cerr << "Warning: template parameter " << p.name << " has no type in " << related_name << std::endl;
106 next_item("", indent, 4, index, out);
109 out << ">" << std::endl;
114 void quickbook_synopsis(function const& f, std::ostream& out)
117 quickbook_template_parameter_list(f.template_parameters, f.name, out);
121 case function_constructor_destructor :
124 case function_member :
125 out << f.return_type << " " << f.name;
130 case function_define :
131 out << "#define " << f.name;
133 case function_unknown :
138 // Output the parameters
139 // Because we want to be able to skip, we cannot use the argstring
141 std::size_t index = 0;
142 std::string const indent(f.name.length() + f.return_type.length() + 2, ' ');
143 BOOST_FOREACH(parameter const& p, f.parameters)
147 next_item("(", indent, 3, index, out);
149 out << p.fulltype << (p.fulltype.empty() ? "" : " ")
151 << (p.default_value.empty() ? "" : " = ")
159 else if (f.type != function_define)
171 void quickbook_synopsis(enumeration const& e, std::ostream& out)
173 out << "``enum " << e.name;
176 bool has_many_values = e.enumeration_values.size() > 4;
178 BOOST_FOREACH(enumeration_value const& value, e.enumeration_values)
184 out << std::endl << "{";
190 out << std::endl << " " << value.name;
194 out << (first ? " {" : ", ") << value.name;
196 if (! value.initializer.empty())
198 // Doxygen 1.6 does not include "=" in the <initializer> tag, Doxygen 1.8 does.
199 // We just remove the "=" to have consistent output
200 out << " = " << boost::trim_copy(boost::replace_all_copy(value.initializer, "=", ""));
217 inline bool includes(std::string const& filename, std::string const& header)
221 std::ifstream cpp_file(filename.c_str());
222 if (cpp_file.is_open())
224 while (! cpp_file.eof() )
227 std::getline(cpp_file, line);
229 if (boost::starts_with(line, "#include")
230 && boost::contains(line, header))
240 std::string fix_location(std::string const& raw_location)
242 if ( raw_location.find("detail/") == std::string::npos
243 || raw_location.find("/interface.hpp") == std::string::npos )
248 std::string fixed_location(raw_location);
250 fixed_location.erase(fixed_location.find("detail/"), 7u);
251 fixed_location.erase(fixed_location.find("/interface"), 10u);
253 return fixed_location;
257 std::string fix_include_header(std::string const& header)
259 if ( header.find("geometry/geometry.hpp") == std::string::npos )
264 std::string fixed_header(header);
266 fixed_header.erase(fixed_header.find("geometry/"), 9u);
272 void quickbook_header(std::string const& raw_location,
273 configuration const& config,
276 std::string location = fix_location(raw_location);
278 if (! location.empty())
280 std::vector<std::string> including_headers;
282 // Select headerfiles containing to this location
283 BOOST_FOREACH(std::string const& header, config.convenience_headers)
285 if (includes(config.convenience_header_path + header, location))
287 including_headers.push_back(header);
291 out << "[heading Header]" << std::endl;
292 if (! including_headers.empty())
295 << (including_headers.size() > 1 ? " one of" : "")
296 << std::endl << std::endl;
297 BOOST_FOREACH(std::string const& header, including_headers)
299 out << "`#include <" << fix_include_header(config.start_include + header) << ">`" << std::endl << std::endl;
302 out << std::endl << "Or" << std::endl << std::endl;
304 out << "`#include <" << location << ">`" << std::endl;
310 void quickbook_markup(std::vector<markup> const& qbk_markup,
311 markup_order_type order, markup_type type,
314 bool has_output = false;
315 BOOST_FOREACH(markup const& inc, qbk_markup)
317 if (inc.type == type && inc.order == order)
319 out << inc.value << std::endl;
331 void quickbook_string_with_heading_if_present(std::string const& heading,
332 std::string const& contents, std::ostream& out)
334 if (! contents.empty())
336 out << "[heading " << heading << "]" << std::endl
337 << qbk_escaped(contents) << std::endl
342 inline std::string to_section_name(std::string const& name)
344 // Make section-name lowercase and remove :: because these are filenames
345 return boost::to_lower_copy(boost::replace_all_copy(name, "::", "_"));
348 void quickbook_output_function_parameters(function const& f, std::ostream& out)
350 BOOST_FOREACH(parameter const& p, f.parameters)
354 out << "[* " << p.fulltype << "]: ['" << p.name << "]: " << p.brief_description << std::endl << std::endl;
361 void quickbook_output_function_return(function const& f, std::ostream& out)
363 if (! f.return_description.empty())
365 out << f.return_description << std::endl;
371 inline std::string namespace_skipped(std::string const& name, configuration const& config)
373 return config.skip_namespace.empty()
375 : boost::replace_all_copy(name, config.skip_namespace, "")
379 inline std::string output_if_different(std::string const& s, std::string const& s2)
381 return boost::equals(s, s2)
387 inline void quickbook_output_indexterm(std::string const& term, std::ostream& out
388 //, std::string const& secondary = ""
392 if (boost::contains(term, "::"))
394 // "Unnamespace" it and add all terms (also namespaces)
395 std::vector<std::string> splitted;
396 std::string for_split = boost::replace_all_copy(term, "::", ":");
397 boost::split(splitted, for_split, boost::is_any_of(":"), boost::token_compress_on);
398 BOOST_FOREACH(std::string const& part, splitted)
400 out << "<indexterm><primary>" << part << "</primary></indexterm>";
405 out << "<indexterm><primary>" << term;
406 /*if (! secondary.empty())
408 out << "<secondary>" << secondary << "</secondary>";
410 out << "</primary></indexterm>";
412 out << "'''" << std::endl;
415 void quickbook_output(function const& f, configuration const& config, std::ostream& out)
417 // Write the parsed function
418 int arity = (int)f.parameters.size();
420 std::string additional_description;
422 if (! f.additional_description.empty())
424 additional_description = " (";
425 additional_description += f.additional_description;
426 additional_description += ")";
429 out << "[section:" << to_section_name(f.name);
430 // Make section name unique if necessary by arity and additional description
434 if (! f.additional_description.empty())
436 out << "_" << boost::to_lower_copy(boost::replace_all_copy(f.additional_description, " ", "_"));
440 << additional_description
444 quickbook_output_indexterm(f.name, out);
446 out << qbk_escaped(f.brief_description) << std::endl;
449 quickbook_string_with_heading_if_present("Description", f.detailed_description, out);
452 quickbook_markup(f.qbk_markup, markup_before, markup_synopsis, out);
453 out << "[heading Synopsis]" << std::endl;
454 quickbook_synopsis(f, out);
455 quickbook_markup(f.qbk_markup, markup_after, markup_synopsis, out);
458 out << "[heading Parameters]" << std::endl
461 out << "[table" << std::endl << "[";
462 if (f.type != function_define)
464 out << "[Type] [Concept] ";
466 out << "[Name] [Description] ]" << std::endl;
468 // First: output any template parameter which is NOT used in the normal parameter list
469 BOOST_FOREACH(parameter const& tp, f.template_parameters)
473 std::vector<parameter>::const_iterator it = std::find_if(f.parameters.begin(), f.parameters.end(), par_by_type(tp.name));
475 if (it == f.parameters.end())
477 out << "[[" << tp.name << "] [" << tp.brief_description << "] [ - ] [Must be specified]]" << std::endl;
482 BOOST_FOREACH(parameter const& p, f.parameters)
487 std::vector<parameter>::const_iterator it = std::find_if(f.template_parameters.begin(),
488 f.template_parameters.end(), par_by_name(p.type));
490 if (f.type != function_define)
492 out << "[" << p.fulltype
493 << "] [" << (it == f.template_parameters.end() ? "" : it->brief_description)
497 << "] [" << p.brief_description
502 out << "]" << std::endl
506 quickbook_string_with_heading_if_present("Returns", f.return_description, out);
508 quickbook_header(f.location, config, out);
509 quickbook_markup(f.qbk_markup, markup_any, markup_default, out);
512 out << "[endsect]" << std::endl;
516 void quickbook_output(enumeration const& e, configuration const& config, std::ostream& out)
518 out << "[section:" << to_section_name(e.name);
523 quickbook_output_indexterm(e.name, out);
524 BOOST_FOREACH(enumeration_value const& value, e.enumeration_values)
526 quickbook_output_indexterm(value.name, out);
529 out << e.brief_description << std::endl;
532 quickbook_string_with_heading_if_present("Description", e.detailed_description, out);
535 quickbook_markup(e.qbk_markup, markup_before, markup_synopsis, out);
536 out << "[heading Synopsis]" << std::endl;
537 quickbook_synopsis(e, out);
538 quickbook_markup(e.qbk_markup, markup_after, markup_synopsis, out);
541 out << "[heading Values]" << std::endl
544 out << "[table" << std::endl << "[";
545 out << "[Value] [Description] ]" << std::endl;
547 BOOST_FOREACH(enumeration_value const& value, e.enumeration_values)
549 out << "[[" << value.name
550 << "] [" << value.brief_description
554 out << "]" << std::endl
558 quickbook_header(e.location, config, out);
559 quickbook_markup(e.qbk_markup, markup_any, markup_default, out);
562 out << "[endsect]" << std::endl;
566 void quickbook_output_function(std::vector<function> const& functions,
568 std::string const& title,
569 configuration const& , std::ostream& out)
571 std::string returns = type == function_constructor_destructor ? "" : " [Returns]";
572 out << "[heading " << title << "(s)]" << std::endl
573 << "[table" << std::endl
574 << "[[Function] [Description] [Parameters] " << returns << "]" << std::endl;
576 BOOST_FOREACH(function const& f, functions)
581 quickbook_synopsis(f, out);
582 out << "] [" << f.brief_description << "] [";
583 quickbook_output_function_parameters(f, out);
585 if ( type != function_constructor_destructor )
587 out << "[" << std::endl;
588 quickbook_output_function_return(f, out);
589 out << "]" << std::endl;
591 out << "]" << std::endl;
594 out << "]" << std::endl
598 void quickbook_output(class_or_struct const& cos, configuration const& config, std::ostream& out)
601 std::string short_name = namespace_skipped(cos.fullname, config);
603 // Write the parsed function
604 out << "[section:" << to_section_name(short_name) << " " << short_name << "]" << std::endl
607 quickbook_output_indexterm(short_name, out);
609 out << cos.brief_description << std::endl;
612 quickbook_string_with_heading_if_present("Description", cos.detailed_description, out);
614 quickbook_markup(cos.qbk_markup, markup_before, markup_synopsis, out);
615 out << "[heading Synopsis]" << std::endl
617 quickbook_template_parameter_list(cos.template_parameters, cos.name, out);
618 out << (cos.is_class ? "class" : "struct")
619 << " " << short_name << std::endl;
621 if (! cos.base_classes.empty())
625 BOOST_FOREACH(base_class const& bc, cos.base_classes)
629 out << std::endl << " , ";
631 out << output_if_different(bc.derivation, "private")
632 << output_if_different(bc.virtuality, "non-virtual")
633 << namespace_skipped(bc.name, config);
639 out << "{" << std::endl;
640 if (! cos.variables.empty() && config.output_member_variables)
642 size_t maxlength = 0;
643 BOOST_FOREACH(parameter const& p, cos.variables)
647 size_t length = 6 + p.fulltype.size() + p.name.size();
648 if (length > maxlength) maxlength = length;
651 BOOST_FOREACH(parameter const& p, cos.variables)
655 size_t length = 4 + p.fulltype.size() + p.name.size();
656 out << " " << p.fulltype << " " << p.name << ";";
657 if (! p.brief_description.empty())
659 while(length++ < maxlength) out << " ";
660 out << "// " << p.brief_description;
668 out << " // ..." << std::endl;
670 out << "};" << std::endl
671 << "``" << std::endl << std::endl;
672 quickbook_markup(cos.qbk_markup, markup_after, markup_synopsis, out);
676 if (! cos.template_parameters.empty())
678 bool has_default = false;
679 BOOST_FOREACH(parameter const& p, cos.template_parameters)
681 if (! p.default_value.empty())
687 out << "[heading Template parameter(s)]" << std::endl
688 << "[table" << std::endl
694 out << " [Description]]" << std::endl;
696 BOOST_FOREACH(parameter const& p, cos.template_parameters)
698 out << "[[" << p.fulltype;
701 out << "] [" << p.default_value;
703 out << "] [" << p.brief_description << "]]" << std::endl;
705 out << "]" << std::endl
710 std::map<function_type, int> counts;
711 BOOST_FOREACH(function const& f, cos.functions)
716 if (counts[function_constructor_destructor] > 0)
718 quickbook_output_function(cos.functions, function_constructor_destructor, "Constructor", config, out);
721 if (counts[function_member] > 0)
723 quickbook_output_function(cos.functions, function_member, "Member Function", config, out);
726 quickbook_header(cos.location, config, out);
727 quickbook_markup(cos.qbk_markup, markup_any, markup_default, out);
729 out << "[endsect]" << std::endl
734 // ----------------------------------------------------------------------------------------------- //
736 // ----------------------------------------------------------------------------------------------- //
738 std::string remove_template_parameters(std::string const& name)
741 std::string::size_type prev_i = 0, i = 0;
742 int blocks_counter = 0;
745 std::string::size_type next_begin = name.find('<', i);
746 std::string::size_type next_end = name.find('>', i);
748 if ( next_begin == next_end )
750 res += name.substr(prev_i, next_begin - prev_i);
753 else if ( next_begin < next_end )
756 if ( blocks_counter == 0 )
757 res += name.substr(prev_i, next_begin - prev_i) + "<...>";
764 if ( blocks_counter == 0 )
772 std::string replace_brackets(std::string const& str)
774 return boost::replace_all_copy(boost::replace_all_copy(str, "[", "\\["), "]", "\\]");
777 void quickbook_output_enumerations(std::vector<enumeration> const& enumerations,
778 configuration const& ,
781 out << "[table" << std::endl
782 << "[[Enumeration][Description]]" << std::endl;
784 for ( size_t i = 0 ; i < enumerations.size() ; ++i )
786 enumeration const& e = enumerations[i];
788 out << "[[[link " << e.id << " `";
790 out << "`]][" << e.brief_description << "]]" << std::endl;
792 out << "]" << std::endl
796 void quickbook_synopsis_short(function const& f, std::ostream& out)
798 if ( f.type != function_unknown )
802 BOOST_FOREACH(parameter const& p, f.parameters)
804 if ( !p.skip && p.default_value.empty() )
806 out << (first ? "(" : ", ") << remove_template_parameters(p.fulltype_without_links);
814 else if (f.type != function_define)
818 void quickbook_output_functions(std::vector<function> const& functions,
820 configuration const& ,
822 bool display_all = false,
823 std::string const& ColTitle = "Function")
825 bool show_modifiers = false;
826 BOOST_FOREACH(function const& f, functions)
828 if ( (display_all || f.type == type) && (f.is_const || f.is_static) && !f.brief_description.empty() )
829 show_modifiers = true;
834 if ( show_modifiers )
836 out << "[" << ColTitle << "]";
837 out << "[Description]";
838 out << "]" << std::endl;
840 for ( size_t i = 0 ; i < functions.size() ; ++i )
842 function const& f = functions[i];
844 if ( f.brief_description.empty() )
847 if (display_all || f.type == type)
850 if ( show_modifiers )
853 out << (f.is_static ? "`static`" : "");
854 out << (f.is_const ? " `const`" : "");
857 out << "[[link " << f.id << " `";
858 quickbook_synopsis_short(f, out);
860 out << "[" << f.brief_description << "]";
861 out << "]" << std::endl;
864 out << "]" << std::endl
868 void output_paragraphs_note_warning(element const& el, std::ostream & out)
870 // Additional paragraphs
871 if ( !el.paragraphs.empty() )
873 BOOST_FOREACH(paragraph const& p, el.paragraphs)
875 if ( !p.title.empty() )
876 out << "[heading " << p.title << "]" << std::endl;
878 out << "\n\n" << std::endl;
879 out << p.text << std::endl;
885 if ( !el.note.empty() )
887 out << "[note " << el.note << "]" << std::endl;
892 if ( !el.warning.empty() )
894 out << "[warning " << el.warning << "]" << std::endl;
899 void inline_str_with_links(std::string const& str, std::ostream & out)
901 typedef std::string::size_type ST;
903 bool link_started = false;
905 for ( ST i = 0 ; i < str.size() ; ++i )
909 if ( str[i] == '[' && str.substr(i, 6) == "[link " )
932 if ( str[i] == '\\' )
936 if ( i < str.size() )
939 else if ( str[i] == ']' )
942 link_started = false;
955 void quickbook_template_parameter_list_alt(std::vector<parameter> const& parameters, std::ostream& out)
957 std::string next_param;
959 if ( 2 < parameters.size() )
960 next_param = std::string("`,`\n") + " ";
964 if (!parameters.empty())
966 out << "`template<`" ;
968 BOOST_FOREACH(parameter const& p, parameters)
970 out << (first ? "" : next_param.c_str());
971 inline_str_with_links(p.fulltype, out);
973 if ( !p.default_value.empty() )
976 // don't display default values from details
977 if ( p.default_value.find("detail") != std::string::npos )
980 inline_str_with_links(p.default_value, out);
989 void quickbook_synopsis_alt(function const& f, std::ostream& out)
992 quickbook_template_parameter_list_alt(f.template_parameters, out);
995 std::size_t offset = 1; // '('
998 case function_constructor_destructor :
999 out << "`" << f.name << "`";
1000 offset += f.name.size();
1002 case function_member :
1003 case function_free :
1004 // don't display return types from details
1005 if ( f.return_type.find("detail") != std::string::npos )
1007 out << "/unspecified/";
1012 inline_str_with_links(f.return_type, out);
1013 offset += f.return_type_without_links.size();
1015 out << " `" << f.name << "`";
1016 offset += 1 + f.name.size();
1018 case function_define :
1019 out << "`#define " << f.name << "`";
1020 offset += 8 + f.name.size();
1022 case function_unknown :
1027 std::string par_end("`,` ");
1028 if ( 2 < f.parameters.size() )
1029 par_end = std::string("`,`\n") + std::string(offset, ' ');
1031 // Output the parameters
1032 // Because we want to be able to skip, we cannot use the argstring
1035 BOOST_FOREACH(parameter const& p, f.parameters)
1039 out << (first ? "`(`" : par_end);
1040 if ( !p.fulltype.empty() )
1042 inline_str_with_links(p.fulltype, out);
1045 if ( !p.name.empty() )
1046 out << "`" << p.name << "`";
1047 if ( !p.default_value.empty() )
1050 // don't display default values from details
1051 if ( p.default_value.find("detail") != std::string::npos )
1054 inline_str_with_links(p.default_value, out);
1062 else if (f.type != function_define)
1071 void quickbook_synopsis_alt(class_or_struct const& cos, configuration const& config, std::ostream & out)
1073 std::string short_name = namespace_skipped(cos.fullname, config);
1077 quickbook_template_parameter_list_alt(cos.template_parameters, out);
1080 out << (cos.is_class ? "`class " : "`struct ");
1082 std::string::size_type last_scope = std::string::npos;
1083 std::string::size_type i = short_name.find("<");
1084 for(std::string::size_type j = short_name.find("::") ; j < i ; j = short_name.find("::", j+1))
1086 if ( last_scope == std::string::npos )
1087 out << short_name << "`" << std::endl;
1089 out << short_name.substr(last_scope + 2) << "`" << std::endl;
1092 if (! cos.base_classes.empty())
1095 BOOST_FOREACH(base_class const& bc, cos.base_classes)
1097 // don't display base classes from details
1098 if ( bc.name.find("detail") != std::string::npos )
1104 out << std::endl << " , ";
1105 out << output_if_different(bc.derivation, "private")
1106 << output_if_different(bc.virtuality, "non-virtual")
1107 << namespace_skipped(bc.name, config);
1111 out << "`" << std::endl;
1114 out << "`{`" << std::endl
1115 << "` // ...`" << std::endl
1116 << "`};`" << std::endl
1117 << "]" << std::endl << std::endl;
1120 void quickbook_synopsis_alt(enumeration const& e, std::ostream& out)
1122 std::string values_separator =
1123 e.enumeration_values.size() <= 2 ?
1125 ( std::string(",\n") + std::string(e.name.size() + 7, ' ') );
1127 out << "``enum " << e.name << " ";
1129 BOOST_FOREACH(enumeration_value const& value, e.enumeration_values)
1131 out << (first ? "{" : values_separator.c_str());
1133 if ( !value.initializer.empty() )
1135 out << " = " << boost::trim_copy(boost::replace_all_copy(value.initializer, "=", ""));
1148 template <typename Range>
1149 bool has_brief_description(Range const& rng)
1151 typedef typename Range::value_type V;
1152 BOOST_FOREACH(V const& bc, rng)
1154 if ( !bc.brief_description.empty() )
1160 template <typename Range>
1161 bool has_brief_description(Range const& rng, function_type t)
1163 typedef typename Range::value_type V;
1164 BOOST_FOREACH(V const& bc, rng)
1166 if ( bc.type == t && !bc.brief_description.empty() )
1172 void quickbook_output_functions_details(std::vector<function> const& functions,
1174 configuration const& ,
1176 bool display_all = false)
1178 for ( size_t i = 0 ; i < functions.size() ; ++i )
1180 function const& f = functions[i];
1182 if ( f.brief_description.empty() )
1185 if ( display_all || f.type == type )
1188 std::stringstream ss;
1189 quickbook_synopsis_short(f, ss);
1190 out << "[#" << f.id << "]" << std::endl;
1191 out << "[section " << replace_brackets(ss.str()) << "]" << std::endl;
1193 quickbook_output_indexterm(f.name, out);
1195 // Brief description
1196 out << f.brief_description << std::endl;
1199 // Detail description
1200 if ( !f.detailed_description.empty() )
1202 out << "[heading Description]" << std::endl;
1203 out << f.detailed_description;
1207 quickbook_markup(f.qbk_markup, markup_before, markup_synopsis, out);
1208 out << "[heading Synopsis]" << std::endl;
1209 quickbook_synopsis_alt(f, out);
1210 quickbook_markup(f.qbk_markup, markup_after, markup_synopsis, out);
1212 if ( f.is_static || f.is_virtual || f.is_explicit || f.is_const )
1214 out << "[heading Modifier(s)]" << std::endl;
1216 << (f.is_static ? "static " : "")
1217 << (f.is_virtual ? "virtual " : "")
1218 << (f.is_explicit ? "explicit " : "")
1219 << (f.is_const ? "const " : "")
1223 // Template parameters
1224 if ( !f.template_parameters.empty() && has_brief_description(f.template_parameters) )
1226 out << "[heading Template parameter(s)]" << std::endl
1227 << "[table" << std::endl
1228 << "[[Parameter] [Description]]" << std::endl;
1230 BOOST_FOREACH(parameter const& p, f.template_parameters)
1232 if ( p.brief_description.empty() )
1236 if ( p.fulltype.find("typename ") == 0 )
1237 out << p.fulltype.substr(9);
1238 else if ( p.fulltype.find("class ") == 0 )
1239 out << p.fulltype.substr(6);
1242 out << "`][" << p.brief_description << "]]" << std::endl;
1244 out << "]" << std::endl
1249 if ( !f.parameters.empty() && has_brief_description(f.parameters) )
1251 out << "[heading Parameter(s)]" << std::endl;
1252 out << "[table " << std::endl;
1254 if ( f.type != function_define )
1256 out << "[Name][Description]]" << std::endl;
1257 BOOST_FOREACH(parameter const& p, f.parameters)
1262 if ( f.type != function_define )
1265 inline_str_with_links(p.fulltype, out);
1268 out << "[ `" << p.name << "` ][" << p.brief_description << "]]"<< std::endl;
1271 out << "]" << std::endl;
1275 if ( !f.precondition.empty() )
1277 out << "[heading Precondition(s)]" << std::endl;
1278 out << f.precondition << std::endl;
1283 if ( !f.return_description.empty() )
1285 out << "[heading Returns]" << std::endl;
1286 out << f.return_description << std::endl;
1289 // Additional paragraphs, note, warning
1290 output_paragraphs_note_warning(f, out);
1293 quickbook_markup(f.qbk_markup, markup_any, markup_default, out);
1296 out << "[endsect]" << std::endl
1297 //<< "[br]" << std::endl
1303 void quickbook_output_enumeration_details(enumeration const& e, configuration const& , std::ostream& out)
1305 out << "[#" << e.id << "]\n";
1306 out << "[section " << e.name << "]" << std::endl
1309 quickbook_output_indexterm(e.name, out);
1310 BOOST_FOREACH(enumeration_value const& value, e.enumeration_values)
1312 quickbook_output_indexterm(value.name, out);
1315 out << e.brief_description << std::endl;
1318 if ( !e.detailed_description.empty() )
1320 out << "[heading Description]\n\n";
1321 out << e.detailed_description << "\n\n";
1324 // Additional paragraphs, note, warning
1325 output_paragraphs_note_warning(e, out);
1327 quickbook_markup(e.qbk_markup, markup_any, markup_default, out);
1330 quickbook_markup(e.qbk_markup, markup_before, markup_synopsis, out);
1331 out << "[heading Synopsis]" << std::endl;
1332 quickbook_synopsis_alt(e, out);
1333 quickbook_markup(e.qbk_markup, markup_after, markup_synopsis, out);
1336 out << "[heading Values]" << std::endl
1339 out << "[table" << std::endl << "[";
1340 out << "[Value] [Description] ]" << std::endl;
1342 BOOST_FOREACH(enumeration_value const& value, e.enumeration_values)
1344 out << "[[" << value.name << "] [" << value.brief_description << "]]\n";
1349 out << "[endsect]" << std::endl;
1353 void quickbook_output_alt(documentation const& doc, configuration const& config, std::ostream& out)
1355 if ( !doc.group_id.empty() )
1357 std::cout << "[section:" << doc.group_id << " " << doc.group_title << "]" << std::endl;
1360 if ( !doc.enumerations.empty() )
1362 std::cout << "[heading Enumerations]\n";
1363 quickbook_output_enumerations(doc.enumerations, config, out);
1366 if ( !doc.defines.empty() )
1368 std::cout << "[heading Defines]\n";
1369 quickbook_output_functions(doc.defines, function_unknown, config, out, true, "Define");
1372 if ( !doc.functions.empty() )
1374 std::cout << "[heading Functions]\n";
1375 quickbook_output_functions(doc.functions, function_unknown, config, out, true, "Function");
1378 BOOST_FOREACH(enumeration const& e, doc.enumerations)
1380 quickbook_output_enumeration_details(e, config, out);
1383 quickbook_output_functions_details(doc.defines, function_unknown, config, out, true);
1384 quickbook_output_functions_details(doc.functions, function_unknown, config, out, true);
1386 if ( !doc.group_id.empty() )
1388 out << "[endsect]" << std::endl
1393 void quickbook_output_alt(class_or_struct const& cos, configuration const& config, std::ostream& out)
1396 std::string short_name = namespace_skipped(cos.fullname, config);
1398 BOOST_ASSERT(configuration::alt == config.output_style);
1400 if ( !cos.id.empty() )
1401 out << "[#" << cos.id << "]" << std::endl;
1402 out << "[section " << short_name << "]" << std::endl << std::endl;
1404 // WARNING! Can't be used in the case of specializations
1405 quickbook_output_indexterm(short_name, out);
1409 out << cos.brief_description << std::endl;
1414 quickbook_string_with_heading_if_present("Description", cos.detailed_description, out);
1416 // Additional paragraphs, note, warning
1417 output_paragraphs_note_warning(cos, out);
1420 quickbook_markup(cos.qbk_markup, markup_any, markup_default, out);
1424 quickbook_header(cos.location, config, out);
1428 quickbook_markup(cos.qbk_markup, markup_before, markup_synopsis, out);
1429 out << "[heading Synopsis]" << std::endl;
1430 quickbook_synopsis_alt(cos, config, out);
1431 quickbook_markup(cos.qbk_markup, markup_after, markup_synopsis, out);
1433 // Template parameters
1435 if (! cos.template_parameters.empty())
1437 if ( has_brief_description(cos.template_parameters) )
1439 out << "[heading Template parameter(s)]" << std::endl
1440 << "[table" << std::endl
1441 << "[[Parameter] [Description]]" << std::endl;
1443 BOOST_FOREACH(parameter const& p, cos.template_parameters)
1445 if ( p.brief_description.empty() )
1449 if ( p.fulltype.find("typename ") == 0 )
1450 out << p.fulltype.substr(9);
1451 else if ( p.fulltype.find("class ") == 0 )
1452 out << p.fulltype.substr(6);
1455 out << "`][" << p.brief_description << "]]" << std::endl;
1457 out << "]" << std::endl
1464 if ( !cos.typedefs.empty() )
1466 if ( has_brief_description(cos.typedefs) )
1468 out << "[heading Typedef(s)]" << std::endl
1469 << "[table" << std::endl
1471 out << " [Description]]" << std::endl;
1473 BOOST_FOREACH(base_element const& e, cos.typedefs)
1475 if ( e.brief_description.empty() )
1479 if ( !e.id.empty() )
1480 out << "[#" << e.id << "]" << " ";
1481 out << "`" << e.name << "`";
1482 out << "][" << e.brief_description << "]]" << std::endl;
1484 out << "]" << std::endl
1491 bool display_ctors = has_brief_description(cos.functions, function_constructor_destructor);
1492 bool display_members = has_brief_description(cos.functions, function_member);
1494 std::map<function_type, int> counts;
1495 BOOST_FOREACH(function const& f, cos.functions)
1500 if (display_ctors && counts[function_constructor_destructor] > 0)
1502 out << "[heading Constructor(s) and destructor]" << std::endl;
1503 quickbook_output_functions(cos.functions, function_constructor_destructor, config, out);
1506 if (display_members && counts[function_member] > 0)
1508 out << "[heading Member(s)]" << std::endl;
1509 quickbook_output_functions(cos.functions, function_member, config, out);
1514 //if ( display_ctors || display_members )
1515 // out << "[br]" << std::endl;
1517 if (display_ctors && counts[function_constructor_destructor] > 0)
1518 quickbook_output_functions_details(cos.functions, function_constructor_destructor, config, out);
1520 if (display_members && counts[function_member] > 0)
1521 quickbook_output_functions_details(cos.functions, function_member, config, out);
1525 out << "[endsect]" << std::endl
1529 #endif // QUICKBOOK_OUTPUT_HPP