cprintf.cc (4039:b910b61a52b9) cprintf.cc (5756:88038cdbb9e1)
1/*
2 * Copyright (c) 2002-2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 26 unchanged lines hidden (view full) ---

35
36#include "base/cprintf.hh"
37
38using namespace std;
39
40namespace cp {
41
42Print::Print(std::ostream &stream, const std::string &format)
1/*
2 * Copyright (c) 2002-2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 26 unchanged lines hidden (view full) ---

35
36#include "base/cprintf.hh"
37
38using namespace std;
39
40namespace cp {
41
42Print::Print(std::ostream &stream, const std::string &format)
43 : stream(stream), format(format.c_str()), ptr(format.c_str())
43 : stream(stream), format(format.c_str()), ptr(format.c_str()), cont(false)
44{
45 saved_flags = stream.flags();
46 saved_fill = stream.fill();
47 saved_precision = stream.precision();
48}
49
50Print::Print(std::ostream &stream, const char *format)
44{
45 saved_flags = stream.flags();
46 saved_fill = stream.fill();
47 saved_precision = stream.precision();
48}
49
50Print::Print(std::ostream &stream, const char *format)
51 : stream(stream), format(format), ptr(format)
51 : stream(stream), format(format), ptr(format), cont(false)
52{
53 saved_flags = stream.flags();
54 saved_fill = stream.fill();
55 saved_precision = stream.precision();
56}
57
58Print::~Print()
59{
60}
61
62void
52{
53 saved_flags = stream.flags();
54 saved_fill = stream.fill();
55 saved_precision = stream.precision();
56}
57
58Print::~Print()
59{
60}
61
62void
63Print::process(Format &fmt)
63Print::process()
64{
64{
65 fmt.clear();
66
65 size_t len;
66
67 while (*ptr) {
68 switch (*ptr) {
69 case '%':
70 if (ptr[1] != '%')
71 goto processing;
72

--- 143 unchanged lines hidden (view full) ---

216 case '5':
217 case '6':
218 case '7':
219 case '8':
220 case '9':
221 number = number * 10 + (*ptr - '0');
222 break;
223
67 size_t len;
68
69 while (*ptr) {
70 switch (*ptr) {
71 case '%':
72 if (ptr[1] != '%')
73 goto processing;
74

--- 143 unchanged lines hidden (view full) ---

218 case '5':
219 case '6':
220 case '7':
221 case '8':
222 case '9':
223 number = number * 10 + (*ptr - '0');
224 break;
225
226 case '*':
227 if (have_precision)
228 fmt.get_precision = true;
229 else
230 fmt.get_width = true;
231 break;
232
224 case '%':
233 case '%':
225 assert("we shouldn't get here");
234 assert(false && "we shouldn't get here");
226 break;
227
228 default:
229 done = true;
230 break;
231 }
232
233 if (end_number) {

--- 52 unchanged lines hidden ---
235 break;
236
237 default:
238 done = true;
239 break;
240 }
241
242 if (end_number) {

--- 52 unchanged lines hidden ---