30.11.2013 - New PICollection namespace, Android support, my own PIVector implementation
This commit is contained in:
25
pifile.cpp
25
pifile.cpp
@@ -20,6 +20,27 @@
|
||||
#include "pifile.h"
|
||||
|
||||
|
||||
/*! \class PIFile
|
||||
* \brief Local file
|
||||
*
|
||||
* \section PIFile_sec0 Synopsis
|
||||
* This class provide access to local file. You can manipulate
|
||||
* binary content or use this class as text stream. To binary
|
||||
* access there are function \a read(), \a write(), and many
|
||||
* \a writeBinary() functions. For write variables to file in
|
||||
* their text representation threr are many "<<" operators.
|
||||
*
|
||||
* \section PIFile_sec1 Position
|
||||
* Each opened file has a read/write position - logical position
|
||||
* in the file content you read from or you write to. You can
|
||||
* find out current position with function \a pos(). Function
|
||||
* \a seek(llong position) move position to position "position",
|
||||
* \a seekToBegin() move position to the begin of file,
|
||||
* \a seekToEnd() move position to the end of file.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
bool PIFile::openDevice() {
|
||||
if (opened_) close();
|
||||
if (path_.isEmpty()) return false;
|
||||
@@ -94,11 +115,11 @@ llong PIFile::size() {
|
||||
}
|
||||
|
||||
|
||||
void PIFile::resize(llong new_size, char fill_) {
|
||||
void PIFile::resize(llong new_size, uchar fill_) {
|
||||
llong ds = new_size - size();
|
||||
if (ds == 0) return;
|
||||
if (ds > 0) {
|
||||
char * buff = new char[ds];
|
||||
uchar * buff = new uchar[ds];
|
||||
memset(buff, fill_, ds);
|
||||
write(buff, ds);
|
||||
delete[] buff;
|
||||
|
||||
Reference in New Issue
Block a user