Esempio n. 1
0
static inline void		write_format_pos(uintmax_t nbr, t_pfflags *flags,
							char *buff, int *index)
{
	int					n;

	n = init(nbr, flags) - 1;
	if (!FT_BIT_VAL(flags->flg, FTPF_ZERO_PADDING))
		while (++n < flags->nformat)
			buff[++*index] = ' ';
	if ((nbr || FT_BIT_VAL(flags->flg, FTPF_FORCE_PREFIX_)) &&
			FT_BIT_VAL(flags->flg, FTPF_PREFIX))
	{
		if ((flags->base == 8) || (flags->base == 16))
			buff[++*index] = '0';
		else
			write_base(buff, index, flags);
		if (flags->base == 16)
			buff[++*index] =
				(FT_BIT_VAL(flags->flg, FTPF_HEX_UPCASE) ? 'X' : 'x');
	}
	if (FT_BIT_VAL(flags->flg, FTPF_ZERO_PADDING))
		while (++n < flags->nformat)
			buff[++*index] = '0';
	write_uint(nbr, buff, flags, index);
}
Esempio n. 2
0
/**
 * The default method to write a message to w_fname
 * in (size of serialized msg,msg serialized as string)*
 * format
 */
bool DocumentWriter::write(const google::protobuf::Message& msg) {
    return write_base(w_output, msg);
}