directive.qbk 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307
  1. [/==============================================================================
  2. Copyright (C) 2001-2011 Hartmut Kaiser
  3. Copyright (C) 2001-2011 Joel de Guzman
  4. Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. ===============================================================================/]
  7. [section:directive Generator Directives]
  8. This module includes different generator directives. It includes alignment
  9. directives (`left_align[]`, `center[]`, and `right_align[]`), repetition
  10. (`repeat[]`), directives controlling automatic delimiting (`verbatim[]`,
  11. `no_delimit[]`, and `delimit[]`), controlling case sensitivity (`upper[]` and
  12. `lower[]`), field width (`maxwidth[]`), buffering (`buffer[]`), splitting into
  13. columns (`columns[]`) and attribute handling (`duplicate[]`, `omit[]`, and
  14. `skip[]`).
  15. [heading Module Header]
  16. // forwards to <boost/spirit/home/karma/directive.hpp>
  17. #include <boost/spirit/include/karma_directive.hpp>
  18. Also, see __include_structure__.
  19. [/////////////////////////////////////////////////////////////////////////////]
  20. [section:alignment Alignment Generator Directives (`left_align[]`, `center[]`, `right_align[]`)]
  21. [heading Description]
  22. The alignment directives allow to left align, right align or center output
  23. emitted by other generators into columns of a specified width while using
  24. an arbitrary generator to create the padding.
  25. [heading Header]
  26. For the `left_align[]` directive:
  27. // forwards to <boost/spirit/home/karma/directive/left_alignment.hpp>
  28. #include <boost/spirit/include/karma_left_alignment.hpp>
  29. For the `center[]` directive:
  30. // forwards to <boost/spirit/home/karma/directive/center_alignment.hpp>
  31. #include <boost/spirit/include/karma_center_alignment.hpp>
  32. For the `right_align[]` directive:
  33. // forwards to <boost/spirit/home/karma/directive/right_alignment.hpp>
  34. #include <boost/spirit/include/karma_right_alignment.hpp>
  35. Also, see __include_structure__.
  36. [heading Namespace]
  37. [table
  38. [[Name]]
  39. [[`boost::spirit::left_align // alias: boost::spirit::karma::left_align` ]]
  40. [[`boost::spirit::center // alias: boost::spirit::karma::center` ]]
  41. [[`boost::spirit::right_align // alias: boost::spirit::karma::right_align` ]]
  42. ]
  43. [heading Model of]
  44. [:__unary_generator_concept__]
  45. [variablelist Notation
  46. [[`a`] [A generator object]]
  47. [[`pad`] [A generator object, or a __karma_lazy_argument__ that
  48. evaluates to a generator object]]
  49. [[`A`, `Pad`] [Attribute types of the generators `a` and `pad`]]
  50. [[`width`] [Numeric literal, any unsigned integer value, or
  51. a __karma_lazy_argument__ that evaluates to an unsigned
  52. integer value]]]
  53. [heading Expression Semantics]
  54. Semantics of an expression is defined only where it differs from, or is not
  55. defined in __unary_generator_concept__.
  56. [table
  57. [[Expression] [Semantics]]
  58. [[`left_align[a]`] [Generate `a` left aligned in a column of
  59. width as defined by the preprocessor constant
  60. `BOOST_KARMA_DEFAULT_FIELD_LENGTH`
  61. (default: 10), while using `space` to emit
  62. the necessary padding. This generator succeeds as
  63. long as its embedded generator `a` does not
  64. fail (unless the underlying output stream
  65. reports an error).]]
  66. [[`left_align(width)[a]`] [Generate `a` left aligned in a column of
  67. the given `width`, while using `space` to emit
  68. the necessary padding. This generator succeeds as
  69. long as its embedded generator `a` does not
  70. fail (unless the underlying output stream
  71. reports an error).]]
  72. [[`left_align(pad)[a]`] [Generate `a` left aligned in a column of
  73. width as defined by the preprocessor constant
  74. `BOOST_KARMA_DEFAULT_FIELD_LENGTH`
  75. (default: 10), while using the generator `pad`
  76. to emit the necessary padding. This generator
  77. succeeds as long as its embedded and padding
  78. generators `a` and `pad` do not fail (except
  79. if the underlying output stream reports an
  80. error).]]
  81. [[`left_align(width, pad)[a]`] [Generate `a` left aligned in a column of
  82. the given `width`, while using the generator
  83. `pad` to emit the necessary padding. This
  84. generator succeeds as long as its embedded
  85. and padding generators `a` and `pad` do not
  86. fail (unless the underlying output stream
  87. reports an error).]]
  88. [[`center[a]`] [Generate `a` centered in a column of
  89. width as defined by the preprocessor constant
  90. `BOOST_KARMA_DEFAULT_FIELD_LENGTH`
  91. (default: 10), while using `space` to emit
  92. the necessary padding. This generator succeeds as
  93. long as its embedded generator `a` does not
  94. fail (unless the underlying output stream
  95. reports an error).]]
  96. [[`center(width)[a]`] [Generate `a` centered in a column of
  97. the given `width`, while using `space` to emit
  98. the necessary padding. This generator succeeds as
  99. long as its embedded generator `a` does not
  100. fail (unless the underlying output stream
  101. reports an error).]]
  102. [[`center(pad)[a]`] [Generate `a` centered in a column of
  103. width as defined by the preprocessor constant
  104. `BOOST_KARMA_DEFAULT_FIELD_LENGTH`
  105. (default: 10), while using the generator `pad`
  106. to emit the necessary padding. This generator
  107. succeeds as long as its embedded and padding
  108. generators `a` and `pad` do not fail (except
  109. if the underlying output stream reports an
  110. error).]]
  111. [[`center(width, pad)[a]`] [Generate `a` centered in a column of
  112. the given `width`, while using the generator
  113. `pad` to emit the necessary padding. This
  114. generator succeeds as long as its embedded
  115. and padding generators `a` and `pad` do not
  116. fail (unless the underlying output stream
  117. reports an error).]]
  118. [[`right_align[a]`] [Generate `a` right aligned in a column of
  119. width as defined by the preprocessor constant
  120. `BOOST_KARMA_DEFAULT_FIELD_LENGTH`
  121. (default: 10), while using `space` to emit
  122. the necessary padding. This generator succeeds as
  123. long as its embedded generator `a` does not
  124. fail (unless the underlying output stream
  125. reports an error).]]
  126. [[`right_align(width)[a]`] [Generate `a` right aligned in a column of
  127. the given `width`, while using `space` to emit
  128. the necessary padding. This generator succeeds as
  129. long as its embedded generator `a` does not
  130. fail (unless the underlying output stream
  131. reports an error).]]
  132. [[`right_align(pad)[a]`] [Generate `a` right aligned in a column of
  133. width as defined by the preprocessor constant
  134. `BOOST_KARMA_DEFAULT_FIELD_LENGTH`
  135. (default: 10), while using the generator `pad`
  136. to emit the necessary padding. This generator
  137. succeeds as long as its embedded and padding
  138. generators `a` and `pad` do not fail (except
  139. if the underlying output stream reports an
  140. error).]]
  141. [[`right_align(width, pad)[a]`] [Generate `a` right aligned in a column of
  142. the given `width`, while using the generator
  143. `pad` to emit the necessary padding. This
  144. generator succeeds as long as its embedded
  145. and padding generators `a` and `pad` do not
  146. fail (unless the underlying output stream
  147. reports an error).]]
  148. ]
  149. [note None of the generator directives listed above limits the emitted output
  150. to the respective column width. If the emitted output is longer than
  151. the specified (or implied) column width, the generated output overruns
  152. the column to the right.
  153. If the output needs to be limited to a specified column width, use the
  154. `maxwidth[]` directive, for instance:
  155. ``
  156. maxwidth(8)[right_align(12)["1234567890"]]
  157. ``
  158. which will output (without the quotes): ``" 123456"``
  159. ]
  160. [heading Attributes]
  161. See __karma_comp_attr_notation__.
  162. [table
  163. [[Expression] [Attribute]]
  164. [[`left_align[]`]
  165. [``a: A --> left_align[a]: A
  166. a: Unused --> left_align[a]: Unused``]]
  167. [[`left_align(width)[]`]
  168. [``a: A --> left_align(width)[a]: A
  169. a: Unused --> left_align(width)[a]: Unused``]]
  170. [[`left_align(pad)[]`]
  171. [``a: A, pad: Pad --> left_align(pad)[a]: A
  172. a: Unused, pad: Pad --> left_align(pad)[a]: Unused``]]
  173. [[`left_align(pad, width)[]`]
  174. [``a: A, pad: Pad --> left_align(pad, width)[a]: A
  175. a: Unused, pad: Pad --> left_align(pad, width)[a]: Unused``]]
  176. [[`center[]`]
  177. [``a: A --> center[a]: A
  178. a: Unused --> center[a]: Unused``]]
  179. [[`center(width)[]`]
  180. [``a: A --> center(width)[a]: A
  181. a: Unused --> center(width)[a]: Unused``]]
  182. [[`center(pad)[]`]
  183. [``a: A, pad: Pad --> center(pad)[a]: A
  184. a: Unused, pad: Pad --> center(pad)[a]: Unused``]]
  185. [[`center(pad, width)[]`]
  186. [``a: A, pad: Pad --> center(pad, width)[a]: A
  187. a: Unused, pad: Pad --> center(pad, width)[a]: Unused``]]
  188. [[`right_align[]`]
  189. [``a: A --> right_align[a]: A
  190. a: Unused --> right_align[a]: Unused``]]
  191. [[`right_align(width)[]`]
  192. [``a: A --> right_align(width)[a]: A
  193. a: Unused --> right_align(width)[a]: Unused``]]
  194. [[`right_align(pad)[]`]
  195. [``a: A, pad: Pad --> right_align(pad)[a]: A
  196. a: Unused, pad: Pad --> right_align(pad)[a]: Unused``]]
  197. [[`right_align(pad, width)[]`]
  198. [``a: A, pad: Pad --> right_align(pad, width)[a]: A
  199. a: Unused, pad: Pad --> right_align(pad, width)[a]: Unused``]]
  200. ]
  201. [heading Complexity]
  202. [:The overall complexity of an alignment generator directive is defined by
  203. the complexity of its embedded and padding generator. The complexity of the
  204. left alignment directive generator itself is O(1). The complexity of the
  205. center and right alignment directive generators is O(N), where `N` is the
  206. number of characters emitted by the embedded and padding generators.]
  207. [heading Example]
  208. [note The test harness for the example(s) below is presented in the
  209. __karma_basics_examples__ section.]
  210. Some includes:
  211. [reference_karma_includes]
  212. Some using declarations:
  213. [reference_karma_using_declarations_alignment]
  214. Basic usage of the alignment generators:
  215. [reference_karma_alignment]
  216. [endsect] [/ alignment]
  217. [/////////////////////////////////////////////////////////////////////////////]
  218. [section:repeat Repetition Generator Directive (`repeat[]`)]
  219. [heading Description]
  220. The repetition directive allows to repeat an arbitrary generator expression
  221. while optionally specifying the lower and upper repetition counts. It provides
  222. a more powerful and flexible mechanism for repeating a generator. There are
  223. grammars that are impractical and cumbersome, if not impossible, for the basic
  224. EBNF iteration syntax ([karma_kleene unary `'*'`] and the [karma_plus unary `'+'`])
  225. to specify. Examples:
  226. * A file name may have a maximum of 255 characters only.
  227. * A specific bitmap file format has exactly 4096 RGB color information.
  228. * A 256 bit binary string (1..256 1s or 0s).
  229. [heading Header]
  230. // forwards to <boost/spirit/home/karma/directive/repeat.hpp>
  231. #include <boost/spirit/include/karma_repeat.hpp>
  232. Also, see __include_structure__.
  233. [heading Namespace]
  234. [table
  235. [[Name]]
  236. [[`boost::spirit::repeat // alias: boost::spirit::karma::repeat` ]]
  237. [[`boost::spirit::inf // alias: boost::spirit::karma::inf` ]]
  238. ]
  239. [heading Model of]
  240. [:__unary_generator_concept__]
  241. [variablelist Notation
  242. [[`a`] [A generator object]]
  243. [[`num, num1, num2`][Numeric literals, any unsigned integer value, or
  244. a __karma_lazy_argument__ that evaluates to an
  245. unsigned integer value]]
  246. [[`inf`] [Placeholder expression standing for 'no upper repeat
  247. limit']]
  248. ]
  249. [heading Expression Semantics]
  250. Semantics of an expression is defined only where it differs from, or is not
  251. defined in __unary_generator_concept__.
  252. [table
  253. [[Expression] [Semantics]]
  254. [[`repeat[a]`] [Repeat the generator `a` zero or more times.
  255. This generator succeeds as long as its
  256. embedded generator `a` does not fail (except
  257. if the underlying output stream reports an
  258. error). This variant of `repeat[]` is
  259. semantically equivalent to the
  260. [karma_kleene Kleene Star operator `*a`]]]
  261. [[`repeat(num)[a]`] [Repeat the generator `a` exactly `num`
  262. times. This generator succeeds as long as its
  263. embedded generator `a` does not fail and
  264. as long as the associated attribute
  265. (container) contains at least `num` elements
  266. (unless the underlying output stream
  267. reports an error).]]
  268. [[`repeat(num1, num2)[a]`] [Repeat the generator `a` at least `num1`
  269. times but not more than `num2` times. This
  270. generator succeeds as long as its
  271. embedded generator `a` does not fail and
  272. as long as the associated attribute
  273. (container) contains at least `num1` elements
  274. (unless the underlying output stream
  275. reports an error). If the associated
  276. attribute (container) does contain more
  277. than `num2` elements, this directive
  278. limits the repeat count to `num2`. ]]
  279. [[`repeat(num, inf)[a]`] [Repeat the generator `a` at least `num1`
  280. times. No upper limit for the repeat count
  281. is set. This generator succeeds as long as
  282. its embedded generator `a` does not fail
  283. and as long as the associated attribute
  284. (container) contains at least `num` elements
  285. (unless the underlying output stream
  286. reports an error).]]
  287. ]
  288. [note All failing iterations of the embedded generator will consume one element
  289. from the supplied attribute. The overall `repeat[a]` will succeed as long
  290. as the iteration criteria (number of successful invocations of the
  291. embedded generator) is fulfilled (unless the underlying output stream
  292. reports an error).]
  293. [heading Attributes]
  294. See __karma_comp_attr_notation__.
  295. [table
  296. [[Expression] [Attribute]]
  297. [[`repeat[a]`]
  298. [``a: A --> repeat[a]: vector<A>
  299. a: Unused --> repeat[a]: Unused``]]
  300. [[`repeat(num)[a]`]
  301. [``a: A --> repeat(num)[a]: vector<A>
  302. a: Unused --> repeat(num)[a]: Unused``]]
  303. [[`repeat(num1, num2)[a]`]
  304. [``a: A --> repeat(num1, num2)[a]: vector<A>
  305. a: Unused --> repeat(num1, num2)[a]: Unused``]]
  306. [[`repeat(num, inf)[a]`]
  307. [``a: A --> repeat(num, inf)[a]: vector<A>
  308. a: Unused --> repeat(num, inf)[a]: Unused``]]
  309. ]
  310. [important The table above uses `vector<A>` as placeholders only.
  311. The notation of `vector<A>` stands for /any STL container/ holding
  312. elements of type `A`.]
  313. It is important to note, that the `repeat[]` directive does not perform any
  314. buffering of the output generated by its embedded elements. That means that
  315. any failing element generator might have already generated some output, which
  316. is /not/ rolled back.
  317. [tip The simplest way to force a `repeat[]` directive to behave as if it did
  318. buffering is to wrap it into a buffering directive (see
  319. __karma_buffer__):
  320. ``buffer[repeat[a]]``
  321. which will /not/ generate any output in case of a failing generator
  322. `repeat[a]`. The expression:
  323. ``repeat[buffer[a]]``
  324. will not generate any partial output from a generator `a` if it fails
  325. generating in the middle of its output. The overall expression will
  326. still generate the output as produced by all succeeded invocations of
  327. the generator `a`.]
  328. [heading Complexity]
  329. [:The overall complexity of the repetition generator is defined by the
  330. complexity of its embedded generator. The complexity of the repeat itself is
  331. O(N), where N is the number of repetitions to execute.]
  332. [heading Example]
  333. [note The test harness for the example(s) below is presented in the
  334. __karma_basics_examples__ section.]
  335. Some includes:
  336. [reference_karma_includes]
  337. Some using declarations:
  338. [reference_karma_using_declarations_repeat]
  339. Basic usage of `repeat` generator directive:
  340. [reference_karma_repeat]
  341. [endsect] [/ repeat]
  342. [/////////////////////////////////////////////////////////////////////////////]
  343. [section:delimit Generator Directives Controlling Automatic Delimiting (`verbatim[]`, `no_delimit[]`, `delimit[]`)]
  344. [heading Description]
  345. The directives `delimit[]`, `no_delimit[]`, and `verbatim[]` can be used to
  346. control automatic delimiting. The directives `verbatim[]` and `no_delimit[]`
  347. disable any automatic delimiting, while the directive `delimit[]` (re-)enables
  348. automatic delimiting.
  349. [heading Header]
  350. For the `verbatim[]` directive:
  351. // forwards to <boost/spirit/home/karma/directive/verbatim.hpp>
  352. #include <boost/spirit/include/karma_verbatim.hpp>
  353. For the `no_delimit[]` directive:
  354. // forwards to <boost/spirit/home/karma/directive/no_delimit.hpp>
  355. #include <boost/spirit/include/karma_no_delimit.hpp>
  356. For the `delimit[]` directive:
  357. // forwards to <boost/spirit/home/karma/directive/delimit.hpp>
  358. #include <boost/spirit/include/karma_delimit.hpp>
  359. Also, see __include_structure__.
  360. [heading Namespace]
  361. [table
  362. [[Name]]
  363. [[`boost::spirit::verbatim // alias: boost::spirit::karma::verbatim` ]]
  364. [[`boost::spirit::no_delimit // alias: boost::spirit::karma::no_delimit` ]]
  365. [[`boost::spirit::delimit // alias: boost::spirit::karma::delimit` ]]
  366. ]
  367. [heading Model of]
  368. [:__unary_generator_concept__]
  369. [variablelist Notation
  370. [[`a`] [A generator object]]
  371. [[`d`] [A generator object, or a __karma_lazy_argument__ that
  372. evaluates to a generator object]]
  373. [[`A`, `D`] [Attribute types of the generators `a` and `d`]]]
  374. [heading Expression Semantics]
  375. Semantics of an expression is defined only where it differs from, or is not
  376. defined in __unary_generator_concept__.
  377. [table
  378. [[Expression] [Semantics]]
  379. [[`delimit[a]`] [Enable automatic delimiting for the embedded generator
  380. `a` while using the `space` generator as the
  381. delimiting generator. If used inside a `verbatim[]`
  382. directive it re-enables the delimiter generator as used
  383. outside of this `verbatim[]` instead. The directive succeeds
  384. as long as the embedded generator succeeded (unless
  385. the underlying output stream reports an error).]]
  386. [[`delimit(d)[a]`] [Enable automatic delimiting for the embedded generator
  387. `a` while using the generator `d` as the
  388. delimiting generator. The directive succeeds
  389. as long as the embedded generator succeeded (unless
  390. the underlying output stream reports an error).]]
  391. [[`verbatim[a]`] [Disable automatic delimiting for the embedded generator
  392. `a`. The directive succeeds
  393. as long as the embedded generator succeeded (unless
  394. the underlying output stream reports an error). This
  395. directive it has no effect if it is used when no
  396. delimiting is active. When delimiting is active this
  397. directive performs a post-delimit step (which is
  398. different from the behavior of `no_delimit[]`).]]
  399. [[`no_delimit[a]`] [Disable automatic delimiting for the embedded generator
  400. `a`. The directive succeeds
  401. as long as the embedded generator succeeded (unless
  402. the underlying output stream reports an error). This
  403. directive it has no effect if it is used when no
  404. delimiting is active. When delimiting is active this
  405. directive does not perform a post-delimit step (which is
  406. different from the behavior of `verbatim[]`.]]
  407. ]
  408. [heading Attributes]
  409. See __karma_comp_attr_notation__.
  410. [table
  411. [[Expression] [Attribute]]
  412. [[`delimit[a]`]
  413. [``a: A --> delimit[a]: A
  414. a: Unused --> delimit[a]: Unused``]]
  415. [[`delimit(d)[a]`]
  416. [``a: A, d: D --> delimit(d)[a]: A
  417. a: Unused, d: D --> delimit(d)[a]: Unused``]]
  418. [[`verbatim[a]`]
  419. [``a: A --> verbatim[a]: A
  420. a: Unused --> verbatim[a]: Unused``]]
  421. [[`no_delimit[a]`]
  422. [``a: A --> no_delimit[a]: A
  423. a: Unused --> no_delimit[a]: Unused``]]
  424. ]
  425. [heading Complexity]
  426. [:The overall complexity of the generator directives `delimit[]`, `verbatim[]`,
  427. and `no_delimit[]` is defined by the complexity of its embedded generators.
  428. The complexity of the directives themselves is O(1).]
  429. [heading Example]
  430. [note The test harness for the example(s) below is presented in the
  431. __karma_basics_examples__ section.]
  432. Some includes:
  433. [reference_karma_includes_simple]
  434. Some using declarations:
  435. [reference_karma_using_declarations_delimit]
  436. Basic usage of `delimit` generator directive:
  437. [reference_karma_delimit]
  438. [endsect] [/ verbatim/delimit/no_delimit]
  439. [/////////////////////////////////////////////////////////////////////////////]
  440. [section:upperlower Generator Directives Controlling Case Sensitivity (`upper[]`, `lower[]`)]
  441. [heading Description]
  442. The generator directives `ns::lower[]` and `ns::upper[]` force their embedded
  443. generators to emit lower case or upper case only characters based on the
  444. interpretation of the generated characters in the character set defined by
  445. `ns` (see __karma_char_encoding_namespace__).
  446. [heading Header]
  447. // forwards to <boost/spirit/home/karma/directive/upper_lower_case.hpp>
  448. #include <boost/spirit/include/karma_upper_lower_case.hpp>
  449. Also, see __include_structure__.
  450. [heading Namespace]
  451. [table
  452. [[Name]]
  453. [[`ns::lower`]]
  454. [[`ns::upper`]]
  455. ]
  456. In the table above, `ns` represents a __karma_char_encoding_namespace__.
  457. [heading Model of]
  458. [:The model of `lower[]` and `upper[]` is the model of its subject generator.]
  459. [variablelist Notation
  460. [[`a`] [A generator object]]
  461. [[`A`] [Attribute type of the generator `a`]]
  462. [[`ns`] [A __karma_char_encoding_namespace__.]]]
  463. [heading Expression Semantics]
  464. The `lower[]` and `upper[]` directives have no special generator semantics.
  465. They are pure modifier directives. They indirectly influence the way all
  466. subject generators work. They add information (the `tag::upper` or `tag::lower`)
  467. to the `Modifier` template parameter used while transforming the `proto::expr`
  468. into the corresponding generator expression. This is achieved by the
  469. following specializations:
  470. namespace boost { namespace spirit
  471. {
  472. template <typename CharEncoding>
  473. struct is_modifier_directive<
  474. karma::domain
  475. , tag::char_code<tag::lower, CharEncoding> >
  476. : mpl::true_
  477. {};
  478. template <typename CharEncoding>
  479. struct is_modifier_directive<
  480. karma::domain
  481. , tag::char_code<tag::upper, CharEncoding> >
  482. : mpl::true_
  483. }}
  484. (for more details see the section describing the compilation process of the
  485. __boost_proto__ expression into the corresponding generator expressions).
  486. [table
  487. [[Expression] [Semantics]]
  488. [[`ns::lower[a]`] [Generate `a` as lower case, interpreted in the
  489. character set defined by `ns`. The directive succeeds
  490. as long as the embedded generator succeeded (unless
  491. the underlying output stream reports an error).]]
  492. [[`ns::upper[a]`] [Generate `a` as upper case, interpreted in the
  493. character set defined by `ns`. The directive succeeds
  494. as long as the embedded generator succeeded (unless
  495. the underlying output stream reports an error).]]
  496. ]
  497. [note If both directives are 'active' with regard to a generator, the
  498. innermost of those directives takes precedence. For instance:
  499. ``
  500. generate(sink, ascii::lower['A' << ascii::upper['b']])
  501. ``
  502. will generate `"aB"` (without the quotes).
  503. Further, the directives will have no effect on generators emitting
  504. characters not having an upper case or lower case equivalent in the
  505. character set defined by `ns`.
  506. ]
  507. [heading Attributes]
  508. See __karma_comp_attr_notation__.
  509. [table
  510. [[Expression] [Attribute]]
  511. [[`ns:lower[a]`]
  512. [``a: A --> ns:lower[a]: A
  513. a: Unused --> ns:lower[a]: Unused``]]
  514. [[`ns:upper[a]`]
  515. [``a: A --> ns:upper[a]: A
  516. a: Unused --> ns:upper[a]: Unused``]]
  517. ]
  518. [heading Complexity]
  519. [:The overall complexity of the generator directives `ns::lower[]` and `ns::upper[]`
  520. is defined by the complexity of its embedded generators. The directives
  521. themselves are compile time only directives, having no impact on runtime
  522. performance.]
  523. [heading Example]
  524. [note The test harness for the example(s) below is presented in the
  525. __karma_basics_examples__ section.]
  526. Some includes:
  527. [reference_karma_includes_simple]
  528. Some using declarations:
  529. [reference_karma_using_declarations_upperlower]
  530. Basic usage of the `upper` and `lower` generator directives:
  531. [reference_karma_upperlower]
  532. [endsect] [/ upper/lower]
  533. [/////////////////////////////////////////////////////////////////////////////]
  534. [section:maxwidth Generator Directives Controlling the Maximum Field Width (`maxwidth[]`)]
  535. [heading Description]
  536. The `maxwidth[]` directive allows to limit (truncate) the overall length of the
  537. output generated by the embedded generator.
  538. [heading Header]
  539. // forwards to <boost/spirit/home/karma/directive/maxwidth.hpp>
  540. #include <boost/spirit/include/karma_maxwidth.hpp>
  541. Also, see __include_structure__.
  542. [table
  543. [[Name]]
  544. [[`boost::spirit::maxwidth // alias: boost::spirit::karma::maxwidth` ]]
  545. ]
  546. [heading Model of]
  547. [:__unary_generator_concept__]
  548. [variablelist Notation
  549. [[`a`] [A generator object]]
  550. [[`A`] [Attribute type of the generator `a`]]
  551. [[`num`] [Numeric literal, any unsigned integer value, or
  552. a __karma_lazy_argument__ that evaluates to an unsigned
  553. integer value]]]
  554. [heading Expression Semantics]
  555. Semantics of an expression is defined only where it differs from, or is not
  556. defined in __unary_generator_concept__.
  557. [table
  558. [[Expression] [Semantics]]
  559. [[`maxwidth[a]`] [Limit the overall length of the emitted output of
  560. the embedded generator (including characters
  561. generated by automatic delimiting) to the number
  562. of characters as defined by the preprocessor constant
  563. `BOOST_KARMA_DEFAULT_FIELD_MAXWIDTH`. Any additional
  564. output is truncated. The directive succeeds as long
  565. as the embedded generator succeeded (unless
  566. the underlying output stream reports an error).]]
  567. [[`maxwidth(num)[a]`] [Limit the overall length of the emitted output of
  568. the embedded generator (including characters
  569. generated by automatic delimiting) to the number
  570. of characters as defined by `num`. Any additional
  571. output is truncated. The directive succeeds as long
  572. as the embedded generator succeeded (unless the
  573. underlying output stream reports an error).]]
  574. ]
  575. [note The `maxwidth[]` generator directive does not pad the generated output
  576. to fill the specified column width. If the emitted output is shorter
  577. than the specified (or implied) column width, the generated output will
  578. be more narrow than the column width.
  579. If the output needs to always be equal to a specified column width, use
  580. one of the alignment directives `left-align[]`, `center[]`, or
  581. `right_align[]`, for instance:
  582. ``
  583. maxwidth(8)[left_align(8)["1234"]]
  584. ``
  585. which will output: `"1234 "` (without the quotes).
  586. ]
  587. [heading Attributes]
  588. See __karma_comp_attr_notation__.
  589. [table
  590. [[Expression] [Attribute]]
  591. [[`maxwidth[a]`]
  592. [``a: A --> maxwidth[a]: A
  593. a: Unused --> maxwidth[a]: Unused``]]
  594. [[`maxwidth(num)[a]`]
  595. [``a: A --> maxwidth(num)[a]: A
  596. a: Unused --> maxwidth(num)[a]: Unused``]]
  597. ]
  598. [heading Complexity]
  599. [:The overall complexity of the generator directive `maxwidth[]`
  600. is defined by the complexity of its embedded generator. The complexity of the
  601. directive itself is O(N), where `N` is the number of characters generated
  602. by the maxwidth directive.]
  603. [heading Example]
  604. [note The test harness for the example(s) below is presented in the
  605. __karma_basics_examples__ section.]
  606. Some includes:
  607. [reference_karma_includes_simple]
  608. Some using declarations:
  609. [reference_karma_using_declarations_maxwidth]
  610. Basic usage of `maxwidth` generator directive:
  611. [reference_karma_maxwidth]
  612. [endsect] [/ maxwidth]
  613. [/////////////////////////////////////////////////////////////////////////////]
  614. [section:buffer Generator Directive for Temporary Output Buffering (`buffer[]`)]
  615. [heading Description]
  616. All generator components (except the __karma_alternative__ generator) pass
  617. their generated output directly to the underlying output stream. If a generator
  618. fails halfway through, the output generated so far is not 'rolled back'. The
  619. buffering generator directive allows to avoid this unwanted output to be
  620. generated. It temporarily redirects the output produced by the embedded
  621. generator into a buffer. This buffer is flushed to the underlying stream only
  622. after the embedded generator succeeded, but is discarded otherwise.
  623. [heading Header]
  624. // forwards to <boost/spirit/home/karma/directive/buffer.hpp>
  625. #include <boost/spirit/include/karma_buffer.hpp>
  626. Also, see __include_structure__.
  627. [table
  628. [[Name]]
  629. [[`boost::spirit::buffer // alias: boost::spirit::karma::buffer` ]]
  630. ]
  631. [heading Model of]
  632. [:__unary_generator_concept__]
  633. [variablelist Notation
  634. [[`a`] [A generator object]]
  635. [[`A`] [Attribute type of generator `a`]]]
  636. [heading Expression Semantics]
  637. Semantics of an expression is defined only where it differs from, or is not
  638. defined in __unary_generator_concept__.
  639. [table
  640. [[Expression] [Semantics]]
  641. [[`buffer[a]`] [The embedded generator `a` is invoked but its output
  642. is temporarily intercepted and stored in an internal
  643. buffer. If `a` succeeds the buffer content is flushed
  644. to the underlying output stream, otherwise the buffer
  645. content is discarded. The buffer directive succeeds
  646. as long as the embedded generator succeeded (unless
  647. the underlying output stream reports an error).]]
  648. ]
  649. [tip If you want to make the buffered generator succeed regardless of the
  650. outcome of the embedded generator, simply wrap the `buffer[a]` into an
  651. additional optional: `-buffer[a]` (see __karma_optional__).]
  652. [heading Attributes]
  653. See __karma_comp_attr_notation__.
  654. [table
  655. [[Expression] [Attribute]]
  656. [[`buffer[a]`]
  657. [``a: A --> buffer[a]: A
  658. a: Unused --> buffer[a]: Unused``]]
  659. ]
  660. [heading Complexity]
  661. [:The overall complexity of the buffering generator directive is defined by the
  662. complexity of its embedded generator. The complexity of the buffering
  663. directive generator itself is O(N), where N is the number of characters
  664. buffered.]
  665. [heading Example]
  666. [note The test harness for the example(s) below is presented in the
  667. __karma_basics_examples__ section.]
  668. Some includes:
  669. [reference_karma_includes]
  670. Some using declarations:
  671. [reference_karma_using_declarations_buffer]
  672. Basic usage of a buffering generator directive. It shows how the partial
  673. output generated in the first example does not show up in the generated output
  674. as the plus generator fails (no data is available, see __karma_plus__).
  675. [reference_karma_buffer]
  676. [endsect] [/ buffer]
  677. [/////////////////////////////////////////////////////////////////////////////]
  678. [section:omit Generator Directives Consuming Attributes (`omit[]` and `skip[]`)]
  679. [heading Description]
  680. The directives `omit[]` and `skip[]` consumes the attribute type of the
  681. embedded generator without generating any output. The `omit[]` directive
  682. will still execute the embedded generator while discarding the generated output
  683. afterwards. The `skip[]` directive will not execute the embedded generator, but
  684. will use it only to extract the exposed attribute type.
  685. [heading Header]
  686. // forwards to <boost/spirit/home/karma/directive/omit.hpp>
  687. #include <boost/spirit/include/karma_omit.hpp>
  688. Also, see __include_structure__.
  689. [table
  690. [[Name]]
  691. [[`boost::spirit::omit // alias: boost::spirit::karma::omit` ]]
  692. [[`boost::spirit::skip // alias: boost::spirit::karma::skip` ]]
  693. ]
  694. [heading Model of]
  695. [:__unary_generator_concept__]
  696. [variablelist Notation
  697. [[`a`] [A generator object]]
  698. [[`A`] [Attribute type of generator `a`]]]
  699. [heading Expression Semantics]
  700. Semantics of an expression is defined only where it differs from, or is not
  701. defined in __unary_generator_concept__.
  702. [table
  703. [[Expression] [Semantics]]
  704. [[`omit[a]`] [The `omit` directive consumes the attribute type of the
  705. embedded generator `A` without generating any output.
  706. It succeeds always. The embedded generator is executed
  707. and any generated output is discarded.]]
  708. [[`skip[a]`] [The `skip` directive consumes the attribute type of the
  709. embedded generator `A` without generating any output.
  710. It succeeds always. The embedded generator is not
  711. executed.]]
  712. ]
  713. [heading Attributes]
  714. See __karma_comp_attr_notation__.
  715. [table
  716. [[Expression] [Attribute]]
  717. [[`omit[a]`]
  718. [``a: A --> omit[a]: A
  719. a: Unused --> omit[a]: Unused``]]
  720. [[`skip[a]`]
  721. [``a: A --> skip[a]: A
  722. a: Unused --> skip[a]: Unused``]]
  723. ]
  724. [heading Complexity]
  725. [:The overall complexity of the `omit[]` directive depends on the complexity
  726. of the embedded generator. The overall complexity of the `skip[]` generator
  727. directive is O(1) as it does not generate any output.]
  728. [heading Example]
  729. [note The test harness for the example(s) below is presented in the
  730. __karma_basics_examples__ section.]
  731. Some includes:
  732. [reference_karma_includes]
  733. Some using declarations:
  734. [reference_karma_using_declarations_omit]
  735. Basic usage of a `omit` generator directive. It shows how it consumes the first
  736. element of the provided attribute without generating anything, leaving the
  737. second element of the attribute to the non-wrapped `double_` generator.
  738. [reference_karma_omit]
  739. Generally, this directive is helpful in situations, where the attribute type
  740. contains more information (elements) than need to be used to generate the
  741. required output. Normally in such situations we would resolve to use semantic
  742. actions to explicitly pass the correct parts of the overall attribute to the
  743. generators. The `omit` directive helps achieving the same without having to use
  744. semantic actions.
  745. Consider the attribute type:
  746. typedef fusion::vector<int, double, std::string> attribute_type;
  747. where we need to generate output only from the first and last element:
  748. typedef std::back_insert:iterator<std::string> iterator_type;
  749. karma::rule<iterator_type, attribute_type()> r;
  750. r = int_[_1 = phoenix::at_c<0>(_val)] << string[_1 = phoenix::at_c<2>(_val)];
  751. std::string str;
  752. iterator_type sink(str);
  753. generate(sink, r, attribute_type(1, 2.0, "example")); // will generate: '1example'
  754. This is error prone and not really readable. The same can be achieved by using
  755. the `omit` directive:
  756. r = int_ << omit[double_] << string;
  757. which is at the same time more readable and more efficient as we don't have to
  758. use semantic actions.
  759. The semantics of using the `skip[]` directive are identical to the `omit[]`
  760. directive, except that it does not actually execute the embedded generator.
  761. For this reason it is usually preferable to utilize the `skip[]` directive
  762. instead of the `omit[]` directive. On the other hand, the `omit[]` directive
  763. is very useful whenever the embedded generator produces side effects (has
  764. semantic actions which need to be executed).
  765. [endsect] [/ omit]
  766. [/////////////////////////////////////////////////////////////////////////////]
  767. [section:duplicate Generator Directive Duplicating Attributes (`duplicate[]`)]
  768. [heading Description]
  769. The directive `duplicate[]` duplicates its attribute to all elements of the
  770. embedded generator if this is a sequence generator. Otherwise it does nothing.
  771. [heading Header]
  772. // forwards to <boost/spirit/home/karma/directive/duplicate.hpp>
  773. #include <boost/spirit/include/karma_duplicate.hpp>
  774. Also, see __include_structure__.
  775. [table
  776. [[Name]]
  777. [[`boost::spirit::duplicate // alias: boost::spirit::karma::duplicate` ]]
  778. ]
  779. [heading Model of]
  780. [:__unary_generator_concept__]
  781. [variablelist Notation
  782. [[`a`] [A generator object]]
  783. [[`A`] [Attribute type of generator `a`]]]
  784. [heading Expression Semantics]
  785. Semantics of an expression is defined only where it differs from, or is not
  786. defined in __unary_generator_concept__.
  787. [table
  788. [[Expression] [Semantics]]
  789. [[`duplicate[a]`] [The `duplicate` directive duplicates the supplied
  790. attribute for all elements of a embedded sequence
  791. generator. For all other types of embedded generators
  792. it has no effect. It succeeds as long as its embedded
  793. generator does not fail.]]
  794. ]
  795. [heading Attributes]
  796. See __karma_comp_attr_notation__.
  797. [table
  798. [[Expression] [Attribute]]
  799. [[`duplicate[a]`]
  800. [``a: A --> duplicate[a]: A
  801. a: tuple<A, A, ...> --> duplicate[a]: A
  802. a: Unused --> duplicate[a]: Unused``]]
  803. ]
  804. If the embedded generator of the `duplicate[]` directive is a sequence it is
  805. expected that all elements of this sequence expose either the same attribute
  806. type, an compatible attribute type, or `unused`. In this case, the
  807. `duplicate[]` directive exposes the attribute type of its first element. The
  808. behavior of the `duplicate[]` directive is undefined if the elements of an
  809. embedded sequence do not expose the same attributes. Most likely, the
  810. corresponding expression will not compile.
  811. [heading Complexity]
  812. [:The overall complexity of the `duplicate[]` directive depends on the complexity
  813. of the embedded generator.]
  814. [heading Example]
  815. [note The test harness for the example(s) below is presented in the
  816. __karma_basics_examples__ section.]
  817. Some includes:
  818. [reference_karma_includes]
  819. Some using declarations:
  820. [reference_karma_using_declarations_duplicate]
  821. Basic usage of the `duplicate` generators:
  822. [reference_karma_duplicate]
  823. [endsect] [/ duplicate]
  824. [/////////////////////////////////////////////////////////////////////////////]
  825. [section:columns Generator Directive Separating Output Into Columns (`columns[]`)]
  826. [heading Description]
  827. The `columns[]` directive separates the output emitted by the embedded
  828. generator by inserting special column separators.
  829. [heading Header]
  830. // forwards to <boost/spirit/home/karma/directive/columns.hpp>
  831. #include <boost/spirit/include/karma_columns.hpp>
  832. Also, see __include_structure__.
  833. [table
  834. [[Name]]
  835. [[`boost::spirit::columns // alias: boost::spirit::karma::columns` ]]
  836. ]
  837. [heading Model of]
  838. [:__unary_generator_concept__]
  839. [variablelist Notation
  840. [[`a`] [A generator object]]
  841. [[`g`] [A generator object, or a __karma_lazy_argument__ that
  842. evaluates to a generator object, will be used to emit column
  843. separators]]
  844. [[`A`] [Attribute type of generator `a`]
  845. [[`num`] [Numeric literal, any unsigned integer value, or
  846. a __karma_lazy_argument__ that evaluates to an unsigned
  847. integer value defining the number of items to emit in between
  848. the column separators]]]
  849. [heading Expression Semantics]
  850. Semantics of an expression is defined only where it differs from, or is not
  851. defined in __unary_generator_concept__.
  852. [table
  853. [[Expression] [Semantics]]
  854. [[`columns[a]`] [The `columns` directive invokes a generator after
  855. each N-th element of the embedded generator has been
  856. emitted. The number of columns is defined by the
  857. preprocessor constant `BOOST_KARMA_DEFAULT_COLUMNS`.
  858. The column separator used will be `karma::eol`.]]
  859. [[`columns(num)[a]`][The `columns` directive invokes a generator after
  860. each N-th element of the embedded generator has been
  861. emitted. The number of columns is defined by the
  862. argument to the directive `num`.
  863. The column separator used will be `karma::eol`.]]
  864. [[`columns(g)[a]`] [The `columns` directive invokes a generator after
  865. each N-th element of the embedded generator has been
  866. emitted. The number of columns is defined by the
  867. preprocessor constant `BOOST_KARMA_DEFAULT_COLUMNS`.
  868. The column separator used will be `g`.]]
  869. [[`columns(num, g)[a]`] [The `columns` directive invokes a generator after
  870. each N-th element of the embedded generator has been
  871. emitted. The number of columns is defined by the
  872. argument to the directive `num`.
  873. The column separator used will be `g`.]]
  874. ]
  875. [heading Attributes]
  876. See __karma_comp_attr_notation__.
  877. [table
  878. [[Expression] [Attribute]]
  879. [[`columns[a]`]
  880. [``a: A --> columns[a]: A
  881. a: Unused --> columns[a]: Unused``]]
  882. [[`columns(num)[a]`]
  883. [``a: A --> columns(num)[a]: A
  884. a: Unused --> columns(num)[a]: Unused``]]
  885. [[`columns(g)[a]`]
  886. [``a: A --> columns(g)[a]: A
  887. a: Unused --> columns(g)[a]: Unused``]]
  888. [[`columns(num, g)[a]`]
  889. [``a: A --> columns(num, g)[a]: A
  890. a: Unused --> columns(num, g)[a]: Unused``]]
  891. ]
  892. [heading Complexity]
  893. [:The overall complexity of the `columns` generator directive depends on the
  894. complexity of the embedded generator. The complexity of the `columns` generator
  895. directive itself is O(N), where `N` is the number of inserted column
  896. separators.]
  897. [heading Example]
  898. [note The test harness for the example(s) below is presented in the
  899. __karma_basics_examples__ section.]
  900. Some includes:
  901. [reference_karma_includes]
  902. Some using declarations:
  903. [reference_karma_using_declarations_columns]
  904. Basic usage of the `columns` generators:
  905. [reference_karma_columns]
  906. [endsect] [/ columns]
  907. [/////////////////////////////////////////////////////////////////////////////]
  908. [section:as Generator Directives Forcing Atomic Extraction (`as<T>, as_string[], as_wstring[]`)]
  909. [heading Description]
  910. The `as<T>` class forces the atomic extraction of a container type `T` from it's
  911. consumed attribute. Usually, repetitive generators (such as __karma_kleene__,
  912. etc) or sequences exposing a `vector<A>` will extract elements from the
  913. container supplied as their consumed attribute by looping through the
  914. containers iterators. In some cases, this may be undesirable. The `as<T>`
  915. class creates a directive that will pass an unnamed temporary object of type
  916. `T` to it's subject, if extracting `T` from it's consumed attribute determined
  917. at generation-time to be valid. __customize_valid_as__ is called by `as<T>` to
  918. determine validity; if it returns false, the generator fails. Subsequent
  919. extraction is performed by calling __customize_as__.
  920. [note `T` is required to be a container type. If __customize_is_container__
  921. does not return true for `T`, a compile-time error will occur.]
  922. [heading Header]
  923. // forwards to <boost/spirit/home/karma/directive/as.hpp>
  924. #include <boost/spirit/include/karma_as.hpp>
  925. Also, see __include_structure__.
  926. [heading Namespace]
  927. [table
  928. [[Name]]
  929. [[`boost::spirit::as_string // alias: boost::spirit::karma::as_string` ]]
  930. [[`boost::spirit::as_wstring // alias: boost::spirit::karma::as_wstring` ]]
  931. ]
  932. [heading Synopsis]
  933. template <typename T>
  934. struct as;
  935. [heading Template parameters]
  936. [table
  937. [[Parameter] [Description] [Default]]
  938. [[`T`] [A container type.] [none]]
  939. ]
  940. [heading Model of]
  941. [:__unary_generator_concept__]
  942. [variablelist Notation
  943. [[`a`] [A __generator_concept__.]]
  944. [[`attr`] [The attribute supplied to the directive.]]
  945. ]
  946. [heading Expression Semantics]
  947. Semantics of an expression is defined only where it differs from, or is
  948. not defined in __unary_generator_concept__.
  949. [table
  950. [[Expression] [Semantics]]
  951. [[`as<T>()[a]`] [Extract an instance of `T` from `attr`, and
  952. invoke the subject generator `a`, supplying
  953. the unnamed temporary as it's attribute.]]
  954. [[`as_string[a]`] [Equivalent to `as<std::string>()[a]`]]
  955. [[`as_wstring[a]`] [Equivalent to `as<std::wstring>()[a]`]]
  956. ]
  957. [heading Attributes]
  958. See __karma_comp_attr_notation__.
  959. [table
  960. [[Expression] [Attribute]]
  961. [[`as<T>()[a]`] [`a: A --> as<T>()[a]: T`]]
  962. ]
  963. [heading Complexity]
  964. [:The complexity is defined by the complexity of the subject generator, `a`, and
  965. the complexity of the extraction unnamed contianer of type `T` from the
  966. attribute `attr`.]
  967. [heading Example]
  968. [note The test harness for the example(s) below is presented in the
  969. __karma_basics_examples__ section.]
  970. Some using declarations:
  971. [reference_karma_using_declarations_as]
  972. Simple usage of `as<T>`, `as_string` and `as_wstring`:
  973. [reference_karma_as]
  974. [endsect] [/ as]
  975. [endsect] [/ directives]