SourceMod SDK  1.7
SourceMod::ILibrarySys Class Referenceabstract

Contains various operating system specific code. More...

#include <public/ILibrarySys.h>

Inheritance diagram for SourceMod::ILibrarySys:
SourceMod::SMInterface

Public Member Functions

virtual const char * GetInterfaceName ()
 Must return a string defining the interface's unique name.
 
virtual unsigned int GetInterfaceVersion ()
 Must return an integer defining the interface's version.
 
virtual ILibraryOpenLibrary (const char *path, char *error, size_t maxlength)=0
 Opens a dynamic library file. More...
 
virtual IDirectoryOpenDirectory (const char *path)=0
 Opens a directory for reading. More...
 
virtual void CloseDirectory (IDirectory *dir)=0
 Closes a directory and frees its handle. More...
 
virtual bool PathExists (const char *path)=0
 Returns true if a path exists.
 
virtual bool IsPathFile (const char *path)=0
 Returns true if the path is a normal file.
 
virtual bool IsPathDirectory (const char *path)=0
 Returns true if the path is a normal directory.
 
virtual void GetPlatformError (char *error, size_t maxlength)=0
 Gets a platform-specific error message. This should only be called when an ILibrary function fails. Win32 equivalent: GetLastError() + FormatMessage() POSIX equivalent: errno + strerror() More...
 
virtual size_t PathFormat (char *buffer, size_t maxlength, const char *pathfmt,...)=0
 Formats a string similar to snprintf(), except corrects all non-platform compatible path separators to be the correct platform character. More...
 
virtual const char * GetFileExtension (const char *filename)=0
 Returns a pointer to the extension in a filename. More...
 
virtual bool CreateFolder (const char *path)=0
 Creates a directory. More...
 
virtual bool FileTime (const char *path, FileTimeType type, time_t *pTime)=0
 Returns the requested timestamp of a file. More...
 
virtual size_t GetFileFromPath (char *buffer, size_t maxlength, const char *path)=0
 Retrieve the file component of the given path. More...
 
- Public Member Functions inherited from SourceMod::SMInterface
virtual bool IsVersionCompatible (unsigned int version)
 Must return whether the requested version number is backwards compatible. Note: This can be overridden for breaking changes or custom versioning. More...
 

Detailed Description

Contains various operating system specific code.

Member Function Documentation

virtual void SourceMod::ILibrarySys::CloseDirectory ( IDirectory dir)
pure virtual

Closes a directory and frees its handle.

Parameters
dirPointer to IDirectory.
virtual bool SourceMod::ILibrarySys::CreateFolder ( const char *  path)
pure virtual

Creates a directory.

Parameters
pathFull, absolute path of the directory to create.
Returns
True on success, false otherwise.
virtual bool SourceMod::ILibrarySys::FileTime ( const char *  path,
FileTimeType  type,
time_t *  pTime 
)
pure virtual

Returns the requested timestamp of a file.

NOTE: On FAT file systems, the access and creation times may not be valid.

Parameters
pathPath to file.
typeFileTimeType of time value to request.
pTimePointer to store time.
Returns
True on success, false on failure.
virtual const char* SourceMod::ILibrarySys::GetFileExtension ( const char *  filename)
pure virtual

Returns a pointer to the extension in a filename.

Parameters
filenameName of file from which the extension should be extracted.
Returns
Pointer to file extension.
virtual size_t SourceMod::ILibrarySys::GetFileFromPath ( char *  buffer,
size_t  maxlength,
const char *  path 
)
pure virtual

Retrieve the file component of the given path.

Parameters
bufferOutput buffer.
maxlengthLength of the output buffer.
pathPath to search for a filename.
Returns
Number of bytes written to buffer, not including the null terminator.
virtual void SourceMod::ILibrarySys::GetPlatformError ( char *  error,
size_t  maxlength 
)
pure virtual

Gets a platform-specific error message. This should only be called when an ILibrary function fails. Win32 equivalent: GetLastError() + FormatMessage() POSIX equivalent: errno + strerror()

Parameters
errorError message buffer.
maxlengthMaximum length of error buffer.
virtual IDirectory* SourceMod::ILibrarySys::OpenDirectory ( const char *  path)
pure virtual

Opens a directory for reading.

Parameters
pathPath to directory.
Returns
Pointer to an IDirectory, NULL if failed.
virtual ILibrary* SourceMod::ILibrarySys::OpenLibrary ( const char *  path,
char *  error,
size_t  maxlength 
)
pure virtual

Opens a dynamic library file.

Parameters
pathPath to library file (.dll/.so).
errorBuffer for any error message (may be NULL).
maxlengthMaximum length of error buffer.
Returns
Pointer to an ILibrary, NULL if failed.
virtual size_t SourceMod::ILibrarySys::PathFormat ( char *  buffer,
size_t  maxlength,
const char *  pathfmt,
  ... 
)
pure virtual

Formats a string similar to snprintf(), except corrects all non-platform compatible path separators to be the correct platform character.

Parameters
bufferOutput buffer pointer.
maxlengthOutput buffer size.
pathfmtFormat string of path.
...Format string arguments.

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