version 0.5.0_alpha
git-svn-id: svn://db.shs.com.ru/pip@8 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
File
|
||||
Copyright (C) 2014 Ivan Pelipenko peri4ko@gmail.com
|
||||
Copyright (C) 2015 Ivan Pelipenko peri4ko@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -24,7 +24,7 @@
|
||||
#define PIFILE_H
|
||||
|
||||
#include "piiodevice.h"
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
class PIP_EXPORT PIFile: public PIIODevice
|
||||
{
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
int precision() const {return prec_;}
|
||||
|
||||
//! Set float numbers write precision to "prec_" digits
|
||||
void setPrecision(int prec) {prec_ = prec; if (prec_ >= 0) prec_str = "." + itos(prec_); else prec_str = "";}
|
||||
void setPrecision(int prec) {prec_ = prec; if (prec_ >= 0) prec_str = "." + PIString::fromNumber(prec_); else prec_str = "";}
|
||||
|
||||
|
||||
//! Read from file to "read_to" no more than "max_size" and return readed bytes count
|
||||
@@ -206,9 +206,9 @@ public:
|
||||
//! Write to file text representation of "v"
|
||||
PIFile & operator <<(ullong v) {if (canWrite() && fd != 0) ret = fprintf(fd, "%llu", v); return *this;}
|
||||
//! Write to file text representation of "v" with precision \a precision()
|
||||
PIFile & operator <<(float v) {if (canWrite() && fd != 0) ret = fprintf(fd, ("%" + prec_str + "f").c_str(), v); return *this;}
|
||||
PIFile & operator <<(float v) {if (canWrite() && fd != 0) ret = fprintf(fd, ("%" + prec_str + "f").data(), v); return *this;}
|
||||
//! Write to file text representation of "v" with precision \a precision()
|
||||
PIFile & operator <<(double v) {if (canWrite() && fd != 0) ret = fprintf(fd, ("%" + prec_str + "lf").c_str(), v); return *this;}
|
||||
PIFile & operator <<(double v) {if (canWrite() && fd != 0) ret = fprintf(fd, ("%" + prec_str + "lf").data(), v); return *this;}
|
||||
|
||||
|
||||
//! Read from file text representation of "v"
|
||||
@@ -292,7 +292,7 @@ private:
|
||||
|
||||
FILE * fd;
|
||||
int ret, prec_;
|
||||
string prec_str;
|
||||
PIString prec_str;
|
||||
|
||||
};
|
||||
|
||||
@@ -301,7 +301,7 @@ inline PICout operator <<(PICout s, const PIFile::FileInfo & v) {
|
||||
s << "FileInfo(\"" << v.path << "\", " << PIString::readableSize(v.size) << ", "
|
||||
<< v.perm_user.toString() << " " << v.perm_group.toString() << " " << v.perm_other.toString() << ", "
|
||||
<< v.time_access.toString() << ", " << v.time_modification.toString()
|
||||
<< ", 0x" << Hex << v.flags << ")";
|
||||
<< ", 0x" << PICoutManipulators::Hex << v.flags << ")";
|
||||
s.restoreControl();
|
||||
return s;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user