1/* 2 * Copyright (c) 2003-2005 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; --- 74 unchanged lines hidden (view full) --- 83} 84 85template <typename T> 86inline void 87_format_integer(std::ostream &out, const T &data, Format &fmt) 88{ 89 using namespace std; 90 |
91 ios::fmtflags flags(out.flags()); 92 |
93 switch (fmt.base) { 94 case Format::hex: 95 out.setf(std::ios::hex, std::ios::basefield); 96 break; 97 98 case Format::oct: 99 out.setf(std::ios::oct, std::ios::basefield); 100 break; --- 33 unchanged lines hidden (view full) --- 134 135 if (fmt.print_sign) 136 out.setf(std::ios::showpos); 137 138 if (fmt.uppercase) 139 out.setf(std::ios::uppercase); 140 141 out << data; |
142 143 out.flags(flags); |
144} 145 146template <typename T> 147inline void 148_format_float(std::ostream &out, const T &data, Format &fmt) 149{ 150 using namespace std; 151 |
152 ios::fmtflags flags(out.flags()); 153 |
154 switch (fmt.float_format) { 155 case Format::scientific: 156 if (fmt.precision != -1) { 157 if (fmt.width > 0) 158 out.width(fmt.width); 159 160 if (fmt.precision == 0) 161 fmt.precision = 1; --- 28 unchanged lines hidden (view full) --- 190 191 if (fmt.width > 0) 192 out.width(fmt.width); 193 194 break; 195 } 196 197 out << data; |
198 199 out.flags(flags); |
200} 201 202template <typename T> 203inline void 204_format_string(std::ostream &out, const T &data, Format &fmt) 205{ 206 using namespace std; 207 --- 162 unchanged lines hidden --- |