1 #ifndef OST_IO_FORMATTED_LINE_HH
2 #define OST_IO_FORMATTED_LINE_HH
5 #define snprintf _snprintf
16 namespace ost {
namespace io {
61 for (
size_t i=0, e=(curr-
int(minus))/2; i<e; ++i) {
62 std::swap(
data[
int(minus)+i],
data[curr-i-1]);
93 bool minus=rounded_val<0;
94 rounded_val=std::abs(rounded_val);
95 int int_val=int(rounded_val);
107 for (
size_t i=0, e=(curr-
int(minus))/2; i<e; ++i) {
108 std::swap(
data[
int(minus)+i],
data[curr-i-1]);
117 rounded_val-=int(rounded_val);
120 int m=int(rounded_val);
121 rounded_val-=int(rounded_val);
146 assert(str.
length()==len_);
147 memcpy(data_, str.
data(), str.
size());
153 assert(str.
size()<=len_);
160 assert(str.
size()<=len_);
161 memcpy(data_, str.
data(), str.
size());
180 memset(data_,
' ', len_);
190 data_(new char[width]), len_(width)
197 memset(data_,
' ', len_);
203 assert(start>=0 && start+len<=static_cast<int>(len_));
207 const char*
Data()
const {
return data_; }