Solid File System

Virtual file system enigne that can be embedded into your software.

OnFileSetSize event/delegate/callback

Filter:

Pascal    Plain C    C++ (DLL/Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

SolFSStorage     See also    

Overview

This event is fired when SolFS needs to resize the storage.

Declaration

[Pascal]
    TSolFSSetFileSizeEvent = procedure( Sender : TObject; FileHandle : THandle; NewSize : Int64; var Result : LongInt) of object;

[Plain C]
    typedef Error (__stdcall *SolFSSetFileSizeFunc)( LongWord UserData, LongLongWord NewSize, Handle FileHandle);

[C++ (DLL/Lib)]
    typedef Error (__stdcall *SolFSSetFileSizeFunc)( LongWord UserData, LongLongWord NewSize, Handle FileHandle);

[C++ (VCL)]
    typedef void (__closure *TSolFSSetFileSizeEvent)( System::TObject* Sender, Handle FileHandle, LongLongWord NewSize, Error& Result);

[C++ (.NET)]
    public __delegate void SolFSSetFileSizeEvent( SolFSStorage* Sender, LongLongWord FileHandle, UInt32 NewSize, Int32 __gc &Result);

[C#]
    public void SolFSSetFileSizeEvent( SolFS.SolFSStorage Sender, uint FileHandle, ulong NewSize, ref int Result);

[VB.NET]
    Sub SolFSSetFileSizeEvent( ByVal Sender As SolFS.SolFSStorage, ByVal FileHandle As UInt32, ByVal NewSize As UInt64, ByRef Result As Int32)

[Java]
    void ISolFSFileEvents.onFileSetSize(long newSize)

Parameters

  • Sender - reference to the class that called the delegate/event handler.
  • FileHandle - Handle to the storage, whose size needs to be set.
  • NewSize - contains new size of the storage.
  • Result - out parameter (return value for DLL) where the application places the result of the operation. If you are working with file system, Win32 error code is a good candidate for placing to Result parameter. Otherwise you can use any other error codes, just be sure that 0 means success.
    [Java]See Description for details about error reporting in Java.

  • [Plain C] UserData - application-defined parameter which is specified when creating the storage and passed back to callback function.

Description

This event is fired when SolFS needs to change the size of the storage. You don't need to clean newly allocated space if the storage size was increased.

The callback/event handler must be set before the storage is opened.

[Java]
You need to implement ISolFSFileEvents interface in your code and pass the object, that implements the events, to one of SolFSStorage constructors that accept storageEvents parameter.

[Java]
ERROR REPORTING: In Java you can't return more than one parameter, so the natural way is to throw an exception. You can throw any exception, and this exception will be passed back to the code, which called one of SolFS functions. So if you use callback mechanism and throw exception from within event handlers, be sure to wrap each call to SolFS methods with try/catch.

See also

Information about callbacks (Operating System edition only)     OnGetFileSize    

Back to top