本文整理汇总了C++中write_indent函数的典型用法代码示例。如果您正苦于以下问题:C++ write_indent函数的具体用法?C++ write_indent怎么用?C++ write_indent使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_indent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: op_dcl
/*
* A method is an `operation', therefore a method decl is an `op dcl'.
* I blame Elliot.
*/
static gboolean
op_dcl(TreeState *state)
{
GSList *doc_comments = IDL_IDENT(IDL_OP_DCL(state->tree).ident).comments;
/*
* Verify that e.g. non-scriptable methods in [scriptable] interfaces
* are declared so. Do this in a separate verification pass?
*/
if (!verify_method_declaration(state->tree))
return FALSE;
if (doc_comments != NULL) {
write_indent(state->file);
printlist(state->file, doc_comments);
}
xpidl_write_comment(state, 2);
write_indent(state->file);
if (!write_method_signature(state->tree, state->file, AS_DECL, NULL))
return FALSE;
fputs(" = 0;\n\n", state->file);
return TRUE;
}
示例2: do_const_dcl
static gboolean
do_const_dcl(TreeState *state)
{
struct _IDL_CONST_DCL *dcl = &IDL_CONST_DCL(state->tree);
const char *name = IDL_IDENT(dcl->ident).str;
gboolean is_signed;
GSList *doc_comments = IDL_IDENT(dcl->ident).comments;
IDL_tree real_type;
const char *const_format;
if (!verify_const_declaration(state->tree))
return FALSE;
if (doc_comments != NULL) {
write_indent(state->file);
printlist(state->file, doc_comments);
}
/* Could be a typedef; try to map it to the real type. */
real_type = find_underlying_type(dcl->const_type);
real_type = real_type ? real_type : dcl->const_type;
is_signed = IDL_TYPE_INTEGER(real_type).f_signed;
const_format = is_signed ? "%" IDL_LL "d" : "%" IDL_LL "uU";
write_indent(state->file);
fprintf(state->file, "enum { %s = ", name);
fprintf(state->file, const_format, IDL_INTEGER(dcl->const_exp).value);
fprintf(state->file, " };\n\n");
return TRUE;
}
示例3: write_indent
void Fl_Type::write_properties()
{
int level = 0;
for (Fl_Type* p = parent; p; p = p->parent) level++;
// repeat this for each attribute:
if (!label().empty()) {
write_indent(level+1);
write_word("label");
write_word(label());
}
if (!user_data().empty()) {
write_indent(level+1);
write_word("user_data");
write_word(user_data());
if (!user_data_type().empty()) {
write_word("user_data_type");
write_word(user_data_type());
}
}
if (!callback().empty()) {
write_indent(level+1);
write_word("callback");
write_word(callback());
}
if (is_parent() && open_) write_word("open");
if (selected) write_word("selected");
if (!tooltip().empty()) {
write_indent(level+1);
write_word("tooltip");
write_word(tooltip());
}
}
示例4: add_directory
static svn_error_t *
add_directory(const char *path,
void *parent_baton,
const char *copyfrom_path,
svn_revnum_t copyfrom_revision,
apr_pool_t *pool,
void **child_baton)
{
struct dir_baton *pb = parent_baton;
struct edit_baton *eb = pb->edit_baton;
struct dir_baton *b = apr_palloc(pool, sizeof(*b));
SVN_ERR(write_indent(eb, pool));
SVN_ERR(svn_stream_printf(eb->out, pool,
"add_directory : '%s' [from '%s':%ld]\n",
path, copyfrom_path, copyfrom_revision));
eb->indent_level++;
SVN_ERR(eb->wrapped_editor->add_directory(path,
pb->wrapped_dir_baton,
copyfrom_path,
copyfrom_revision,
pool,
&b->wrapped_dir_baton));
b->edit_baton = eb;
*child_baton = b;
return SVN_NO_ERROR;
}
示例5: open_file
static svn_error_t *
open_file(const char *path,
void *parent_baton,
svn_revnum_t base_revision,
apr_pool_t *pool,
void **file_baton)
{
struct dir_baton *pb = parent_baton;
struct edit_baton *eb = pb->edit_baton;
struct file_baton *fb = apr_palloc(pool, sizeof(*fb));
SVN_ERR(write_indent(eb, pool));
SVN_ERR(svn_stream_printf(eb->out, pool, "open_file : '%s':%ld\n",
path, base_revision));
eb->indent_level++;
SVN_ERR(eb->wrapped_editor->open_file(path,
pb->wrapped_dir_baton,
base_revision,
pool,
&fb->wrapped_file_baton));
fb->edit_baton = eb;
*file_baton = fb;
return SVN_NO_ERROR;
}
示例6: open_root
static svn_error_t *
open_root(void *edit_baton,
svn_revnum_t base_revision,
apr_pool_t *pool,
void **root_baton)
{
struct edit_baton *eb = edit_baton;
struct dir_baton *dir_baton = apr_palloc(pool, sizeof(*dir_baton));
SVN_ERR(write_indent(eb, pool));
SVN_ERR(svn_stream_printf(eb->out, pool, "open_root : %ld\n",
base_revision));
eb->indent_level++;
SVN_ERR(eb->wrapped_editor->open_root(eb->wrapped_edit_baton,
base_revision,
pool,
&dir_baton->wrapped_dir_baton));
dir_baton->edit_baton = edit_baton;
*root_baton = dir_baton;
return SVN_NO_ERROR;
}
示例7: write_indent
void Logger::_start(Event const &event) {
Util::ptr_shared<char> name=event.name();
if (empty_tag) {
log_stream << ">\n";
}
write_indent(log_stream, tag_stack().size());
log_stream << "<" << name.pointer();
unsigned property_count=event.propertyCount();
for ( unsigned i = 0 ; i < property_count ; i++ ) {
Event::PropertyPair property=event.property(i);
log_stream << " " << property.name.pointer() << "=\"";
write_escaped_value(log_stream, property.value);
log_stream << "\"";
}
log_stream.flush();
tag_stack().push_back(name);
empty_tag = true;
event.generateChildEvents();
}
示例8: write_section
/** Write a section to the output. */
static void write_section(t3_config_t *config, FILE *file, int indent) {
while (config != NULL) {
if (config->type == T3_CONFIG_PLIST) {
write_plist(config, file, indent);
config = config->next;
continue;
}
write_indent(file, indent);
fputs(config->name, file);
switch (config->type) {
case T3_CONFIG_BOOL:
case T3_CONFIG_INT:
case T3_CONFIG_NUMBER:
case T3_CONFIG_STRING:
case T3_CONFIG_LIST:
fputs(" = ", file);
write_value(config, file, indent);
fputc('\n', file);
break;
case T3_CONFIG_SECTION:
fputc(' ', file);
write_value(config, file, indent);
fputc('\n', file);
break;
default:
/* This can only happen if the client screws up the list, which
the interface does not allow by itself. */
break;
}
config = config->next;
}
}
示例9: write_value
/** Write a single value out to file. */
static void write_value(t3_config_t *config, FILE *file, int indent) {
switch (config->type) {
case T3_CONFIG_BOOL:
fputs(config->value.boolean ? "true" : "false", file);
break;
case T3_CONFIG_INT:
write_int(file, config->value.integer);
break;
case T3_CONFIG_NUMBER:
write_number(file, config->value.number);
break;
case T3_CONFIG_STRING:
write_string(file, config->value.string);
break;
case T3_CONFIG_LIST:
case T3_CONFIG_PLIST:
fputs("( ", file);
write_list(config->value.list, file, indent + 1);
fputs(" )", file);
break;
case T3_CONFIG_SECTION:
fputs("{\n", file);
write_section(config->value.list, file, indent + 1);
write_indent(file, indent);
fputc('}', file);
break;
default:
/* This can only happen if the client screws up the list. */
break;
}
}
示例10: write_indent
void Writer::operator() (const string_ref &s) {
if (need_indent) {
need_indent = 0;
write_indent();
}
append (s.begin(), s.length());
}
示例11: attr_dcl
static gboolean
attr_dcl(TreeState *state)
{
GSList *doc_comments;
if (!verify_attribute_declaration(state->tree))
return FALSE;
doc_comments =
IDL_IDENT(IDL_LIST(IDL_ATTR_DCL
(state->tree).simple_declarations).data).comments;
if (doc_comments != NULL && comment_level >= 2) {
write_indent(state->file);
printlist(state->file, doc_comments);
}
/*
* XXX lists of attributes with the same type, e.g.
* attribute string foo, bar sil;
* are legal IDL... but we don't do anything with 'em.
*/
if (IDL_LIST(IDL_ATTR_DCL(state->tree).simple_declarations).next != NULL) {
XPIDL_WARNING((state->tree, IDL_WARNING1,
"multiple attributes in a single declaration aren't "
"currently supported by xpidl"));
}
xpidl_write_comment(state, 2);
write_indent(state->file);
write_indent(state->file);
if (!write_attr_accessor(state->tree, state->file, TRUE, NULL))
return FALSE;
fputs(": Longword; stdcall;\n", state->file);
if (!IDL_ATTR_DCL(state->tree).f_readonly) {
write_indent(state->file);
write_indent(state->file);
if (!write_attr_accessor(state->tree, state->file, FALSE, NULL))
return FALSE;
fputs(": Longword; stdcall;\n", state->file);
}
/*fputc('\n', state->file);*/
return TRUE;
}
示例12: write_indent
void JsonOut::write_separator()
{
stream->put(',');
if (pretty_print) {
stream->put('\n');
write_indent();
}
need_separator = false;
}
示例13: end_object
virtual void end_object()
{
unindent();
if (indenting_ && !stack_.empty())
{
write_indent();
}
stack_.pop_back();
os_.put('}');
end_value();
}
示例14: do_end_object
void do_end_object() override
{
unindent();
if (indenting_ && !stack_.empty())
{
write_indent();
}
stack_.pop_back();
os_->put('}');
end_value();
}
示例15: do_begin_array
void do_begin_array() override
{
begin_structure();
if (indenting_ && !stack_.empty() && stack_.back().is_object())
{
write_indent();
}
stack_.push_back(stack_item(false));
bos_.put('[');
indent();
}