//Auto-generated by kalyptus. DO NOT EDIT.
package org.trinitydesktop.koala;

import org.trinitydesktop.qt.TQt;
import org.trinitydesktop.qt.QtSupport;
import org.trinitydesktop.qt.TQDataStream;
import org.trinitydesktop.qt.TQFile;
import org.trinitydesktop.qt.TQTextStream;

/**

 The KSaveFile class has been made to write out changes to an existing
 file atomically.
 This means that EITHER:
 a)
   All changes have been written successfully to the file.
 b)
   Some error occurred, no changes have been written whatsoever and the
   old file is still in place.
 		@short    The KSaveFile class has been made to write out changes to an existing  file atomically.

*/
public class KSaveFile implements QtSupport {
	private long _qt;
	private boolean _allocatedInJavaWorld = true;
	protected KSaveFile(Class dummy){}

	/**
		 Creates a new KSaveFile with the given file name.
			@param filename the path of the file
			@param mode the mode of the file (see chmod(1))
		    		@short    Creates a new KSaveFile with the given file name.
	*/
	public KSaveFile(String filename, int mode) {
		newKSaveFile(filename,mode);
	}
	private native void newKSaveFile(String filename, int mode);
	public KSaveFile(String filename) {
		newKSaveFile(filename);
	}
	private native void newKSaveFile(String filename);
	/**
		 Returns the status of the file based on errno. (see errno.h)
		 0 means OK.
			 You should check the status after object creation to check
		 whether a file could be created in the first place.
			 You may check the status after closing the file to verify that
		 the file has indeed been written correctly.
				@return the errno status, 0 means ok

		@short    Returns the status of the file based on errno.
	*/
	public native int status();
	/**
		 The name of the file as passed to the constructor.
				@return The name of the file, or null if opening the
         file has failed

		@short    The name of the file as passed to the constructor.
	*/
	public native String name();
	/**
		 An integer file descriptor open for writing to the file.
				@return The file descriptor, or a negative number if opening
         the temporary file failed

		@short    An integer file descriptor open for writing to the file.
	*/
	public native int handle();
	/**
		 A FILE stream open for writing to the file.
				@return FILE* stream open for writing to the file, or 0
         if opening the temporary file failed

		@short    A FILE  stream open for writing to the file.
	*/
	// FILE* fstream(); >>>> NOT CONVERTED
	/**
		 A TQFile open for writing to the file.
				@return A TQFile open for writing to the file, or 0 if
         opening the temporary file failed.

		@short    A TQFile  open for writing to the file.
	*/
	public native TQFile file();
	/**
		 A TQTextStream open for writing to the file.
				@return A TQTextStream that is open for writing to the file, or 0
         if opening the temporary file failed

		@short    A TQTextStream  open for writing to the file.
	*/
	public native TQTextStream textStream();
	/**
		 A TQDataStream open for writing to the file.
				@return A TQDataStream that is open for writing to the file, or 0
         if opening the file failed

		@short    A TQDataStream  open for writing to the file.
	*/
	public native TQDataStream dataStream();
	/**
		 Aborts the write operation and removes any intermediate files
		 This implies a close.
				@short    Aborts the write operation and removes any intermediate files  This implies a close.
	*/
	public native void abort();
	/**
		 Closes the file and makes the changes definitive.
		 Returns 'true' is successful, or 'false' if an error has occurred.
		 See status() for details about errors.
				@return true if successful, or false if an error has occurred.

		@short    Closes the file and makes the changes definitive.
	*/
	public native boolean close();
	/**
		 Static method to create a backup file before saving.
		 You can use this method even if you don't use KSaveFile.
			@param filename the file to backup
			@param backupDir optional directory where to save the backup file in.
		 If empty (the default), the backup will be in the same directory as <code>filename.</code>
			@param backupExtension the extension to append to <code>filename</code>, "~" by default.
				@short    Static method to create a backup file before saving.
	*/
	public static native boolean backupFile(String filename, String backupDir, String backupExtension);
	public static native boolean backupFile(String filename, String backupDir);
	public static native boolean backupFile(String filename);
	/** Deletes the wrapped C++ instance */
	protected native void finalize() throws InternalError;
	/** Delete the wrapped C++ instance ahead of finalize() */
	public native void dispose();
	/** Has the wrapped C++ instance been deleted? */
	public native boolean isDisposed();
}
