Script
Public Slots | Public Member Functions | Properties | Private Attributes | List of all members
File Class Reference

Interface to operating system File operations, ie open, close, read, write... More...

#include <qsUtil.h>

Inheritance diagram for File:
Inheritance graph
[legend]
Collaboration diagram for File:
Collaboration graph
[legend]

Public Slots

void open (int accessMode)
 Open the file with specific access mode.
 
void close ()
 Close the file.
 
void remove ()
 Remove the file.
 
int readByte ()
 Read the next char of the file.
 
String read ()
 Read all the file.
 
String readLine ()
 Read one line of the file.
 
StringList readLines ()
 Read each line of the file.
 
void writeByte (int byte)
 Write a char in the file.
 
void write (String &data, int length=-1)
 Write a string in the file.
 
void writeLine (String &data)
 Write a string in the file and go next line.
 

Public Member Functions

 File (String &file, QScriptContext *context)
 
 ~File ()
 
String fileName ()
 
String path ()
 
String absFileName ()
 
String baseName ()
 
String extension ()
 
String symLink ()
 
bool exists ()
 
bool isReadable ()
 
bool isWritable ()
 
bool isExecutable ()
 
bool isHidden ()
 
bool eof ()
 
QDateTime created ()
 
QDateTime lastModified ()
 
QDateTime lastRead ()
 
int size ()
 

Properties

String name
 file name
 
String path
 file path
 
String fullName
 file name
 
String baseName
 
String extension
 file extension
 
String symLink
 
bool exists
 file exist
 
bool readable
 file readable flag
 
bool writable
 file writable flag
 
bool executable
 file executable flag
 
bool hidden
 file hidden flag
 
bool eof
 file reach end
 
QDateTime created
 Date when the file was created.
 
QDateTime lastModified
 Date when the file was modified.
 
QDateTime lastRead
 date when the file was readed
 
int size
 Size of he file.
 

Private Attributes

QFile * file
 
QScriptContext * context
 

Detailed Description

Interface to operating system File operations, ie open, close, read, write...

You can use it in Script Editor only.

var file = new File( filePath );
if ( file.exists )
{
var message = "The output file \"" + file.name + "\" exists. Do you wish to overwrite it?"
var ans = MessageBox.warning(message, MessageBox.Yes, MessageBox.No);
var check = MessageBox.Yes;
if(ans != MessageBox.Yes)
return false;
}
return true;

Constructor & Destructor Documentation

File::File ( String &  file,
QScriptContext *  context 
)
File::~File ( )

Member Function Documentation

String File::absFileName ( )
String File::baseName ( )
void File::close ( )
inlineslot

Close the file.

QDateTime File::created ( )
bool File::eof ( )
bool File::exists ( )
String File::extension ( )
String File::fileName ( )
bool File::isExecutable ( )
bool File::isHidden ( )
bool File::isReadable ( )
bool File::isWritable ( )
QDateTime File::lastModified ( )
QDateTime File::lastRead ( )
void File::open ( int  accessMode)
slot

Open the file with specific access mode.

String File::path ( )
String File::read ( )
slot

Read all the file.

int File::readByte ( )
slot

Read the next char of the file.

String File::readLine ( )
slot

Read one line of the file.

StringList File::readLines ( )
slot

Read each line of the file.

void File::remove ( )
slot

Remove the file.

int File::size ( )
String File::symLink ( )
void File::write ( String &  data,
int  length = -1 
)
slot

Write a string in the file.

void File::writeByte ( int  byte)
slot

Write a char in the file.

void File::writeLine ( String &  data)
inlineslot

Write a string in the file and go next line.

Member Data Documentation

QScriptContext* File::context
private
QFile* File::file
private

Property Documentation

String File::baseName
read
QDateTime File::created
read

Date when the file was created.

bool File::eof
read

file reach end

bool File::executable
read

file executable flag

bool File::exists
read

file exist

String File::extension
read

file extension

String File::fullName
read

file name

bool File::hidden
read

file hidden flag

QDateTime File::lastModified
read

Date when the file was modified.

QDateTime File::lastRead
read

date when the file was readed

String File::name
read

file name

String File::path
read

file path

bool File::readable
read

file readable flag

int File::size
read

Size of he file.

String File::symLink
read
bool File::writable
read

file writable flag


The documentation for this class was generated from the following file: