/usr/include/hocon/config_render_options.hpp is in libcpp-hocon-dev 0.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #pragma once
#include "export.h"
namespace hocon {
/**
* <p>
* A set of options related to rendering a {@link config_value}. Passed to
* {@link config_value#render(config_render_options)}.
*
* <p>
* Here is an example of creating a {@code config_render_options}:
*
* <pre>
* config_render_options options =
* config_render_options().set_comments(false)
* </pre>
*/
class LIBCPP_HOCON_EXPORT config_render_options {
public:
/** Leaving the default arguments will result in a verbose rendering,
* which contains comments and therefore is not valid JSON.
* See {@link config_render_options#concise} for stripped-down options.
*/
config_render_options(bool origin_comments = true, bool comments = true,
bool formatted = true, bool json = true);
/**
* Returns concise render options (no whitespace or comments). For a
* resolved {@link config}, the concise rendering will be valid JSON.
*
* @return the concise render options
*/
static config_render_options concise();
/**
* Returns options with comments toggled. This controls human-written
* comments but not the autogenerated "origin of this setting" comments,
* which are controlled by {@link config_render_options#set_origin_comments}.
*
* @param value
* true to include comments in the render
* @return options with requested setting for comments
*/
config_render_options set_comments(bool value);
/**
* Returns whether the options enable comments. This method is mostly used
* by the config lib internally, not by applications.
*
* @return true if comments should be rendered
*/
bool get_comments() const;
/**
* Returns options with origin comments toggled. If this is enabled, the
* library generates comments for each setting based on the
* {@link config_value#origin} of that setting's value. For example these
* comments might tell you which file a setting comes from.
*
* <p>
* {@code set_origin_comments()} controls only these autogenerated
* "origin of this setting" comments, to toggle regular comments use
* {@link config_render_options#set_comments}.
*
* @param value
* true to include autogenerated setting-origin comments in the
* render
* @return options with origin comments toggled
*/
config_render_options set_origin_comments(bool value);
/**
* Returns whether the options enable automated origin comments. This method
* is mostly used by the config lib internally, not by applications.
*
* @return true if origin comments should be rendered
*/
bool get_origin_comments() const;
/**
* Returns options with formatting toggled. Formatting means indentation and
* whitespace, enabling formatting makes things prettier but larger.
*
* @param value
* true to enable formatting
* @return options with requested setting for formatting
*/
config_render_options set_formatted(bool value);
/**
* Returns whether the options enable formatting. This method is mostly used
* by the config lib internally, not by applications.
*
* @return true if the options enable formatting
*/
bool get_formatted() const;
/**
* Returns options with JSON toggled. JSON means that HOCON extensions
* (omitting commas, quotes for example) won't be used. However, whether to
* use comments is controlled by the separate {@link #set_comments(boolean)}
* and {@link #set_origin_comments(boolean)} options. So if you enable
* comments you will get invalid JSON despite setting this to true.
*
* @param value
* true to include non-JSON extensions in the render
* @return options with requested setting for JSON
*/
config_render_options set_json(bool value);
/**
* Returns whether the options enable JSON. This method is mostly used by
* the config lib internally, not by applications.
*
* @return true if only JSON should be rendered
*/
bool get_json() const;
private:
bool _origin_comments;
bool _comments;
bool _formatted;
bool _json;
};
} // namespace hocon
|