Update CS:GO team score gamedata.
3 * =============================================================================
5 * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, version 3.0, as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to link the
21 * code of this program (as well as its derivative works) to "Half-Life 2," the
22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally, AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 * or <http://www.sourcemod.net/license.php>.
32 #ifndef _INCLUDE_SOURCEMOD_LIBRARY_INTERFACE_SYS_H_
33 #define _INCLUDE_SOURCEMOD_LIBRARY_INTERFACE_SYS_H_
37 * @brief Defines platform-dependent operations, such as opening libraries and files.
40 #include <IShareSys.h>
45 #define SMINTERFACE_LIBRARYSYS_NAME "ILibrarySys"
46 #define SMINTERFACE_LIBRARYSYS_VERSION 5
50 FileTime_LastAccess = 0, /* Last access (not available on FAT) */
51 FileTime_Created = 1, /* Creation (not available on FAT) */
52 FileTime_LastChange = 2, /* Last modification */
58 /** Virtual destructor (calls CloseLibrary) */
64 * @brief Closes dynamic library and invalidates pointer.
66 virtual void CloseLibrary() =0;
69 * @brief Retrieves a symbol pointer from the dynamic library.
71 * @param symname Symbol name.
72 * @return Symbol pointer, NULL if not found.
74 virtual void *GetSymbolAddress(const char *symname) =0;
78 * @brief Directory browsing abstraction.
83 /** Virtual destructor */
89 * @brief Returns true if there are more files to read, false otherwise.
91 virtual bool MoreFiles() =0;
94 * @brief Advances to the next entry in the stream.
96 virtual void NextEntry() =0;
99 * @brief Returns the name of the current entry.
101 virtual const char *GetEntryName() =0;
104 * @brief Returns whether the current entry is a directory.
106 virtual bool IsEntryDirectory() =0;
109 * @brief Returns whether the current entry is a file.
111 virtual bool IsEntryFile() =0;
114 * @brief Returns true if the current entry is valid
115 * (Used similarly to MoreFiles).
117 virtual bool IsEntryValid() =0;
121 * @brief Contains various operating system specific code.
123 class ILibrarySys : public SMInterface
126 virtual const char *GetInterfaceName()
128 return SMINTERFACE_LIBRARYSYS_NAME;
130 virtual unsigned int GetInterfaceVersion()
132 return SMINTERFACE_LIBRARYSYS_VERSION;
136 * @brief Opens a dynamic library file.
138 * @param path Path to library file (.dll/.so).
139 * @param error Buffer for any error message (may be NULL).
140 * @param maxlength Maximum length of error buffer.
141 * @return Pointer to an ILibrary, NULL if failed.
143 virtual ILibrary *OpenLibrary(const char *path, char *error, size_t maxlength) =0;
146 * @brief Opens a directory for reading.
148 * @param path Path to directory.
149 * @return Pointer to an IDirectory, NULL if failed.
151 virtual IDirectory *OpenDirectory(const char *path) =0;
154 * @brief Closes a directory and frees its handle.
156 * @param dir Pointer to IDirectory.
158 virtual void CloseDirectory(IDirectory *dir) =0;
161 * @brief Returns true if a path exists.
163 virtual bool PathExists(const char *path) =0;
166 * @brief Returns true if the path is a normal file.
168 virtual bool IsPathFile(const char *path) =0;
171 * @brief Returns true if the path is a normal directory.
173 virtual bool IsPathDirectory(const char *path) =0;
176 * @brief Gets a platform-specific error message.
177 * This should only be called when an ILibrary function fails.
178 * Win32 equivalent: GetLastError() + FormatMessage()
179 * POSIX equivalent: errno + strerror()
181 * @param error Error message buffer.
182 * @param maxlength Maximum length of error buffer.
184 virtual void GetPlatformError(char *error, size_t maxlength) =0;
187 * @brief Formats a string similar to snprintf(), except
188 * corrects all non-platform compatible path separators to be
189 * the correct platform character.
191 * @param buffer Output buffer pointer.
192 * @param maxlength Output buffer size.
193 * @param pathfmt Format string of path.
194 * @param ... Format string arguments.
196 virtual size_t PathFormat(char *buffer, size_t maxlength, const char *pathfmt, ...) =0;
199 * @brief Returns a pointer to the extension in a filename.
201 * @param filename Name of file from which the extension should be extracted.
202 * @return Pointer to file extension.
204 virtual const char *GetFileExtension(const char *filename) =0;
207 * @brief Creates a directory.
209 * @param path Full, absolute path of the directory to create.
210 * @return True on success, false otherwise.
212 virtual bool CreateFolder(const char *path) =0;
215 * @brief Returns the requested timestamp of a file.
217 * NOTE: On FAT file systems, the access and creation times
220 * @param path Path to file.
221 * @param type FileTimeType of time value to request.
222 * @param pTime Pointer to store time.
223 * @return True on success, false on failure.
225 virtual bool FileTime(const char *path, FileTimeType type, time_t *pTime) =0;
228 * @brief Retrieve the file component of the given path.
230 * @param buffer Output buffer.
231 * @param maxlength Length of the output buffer.
232 * @param path Path to search for a filename.
233 * @return Number of bytes written to buffer, not including the null terminator.
235 virtual size_t GetFileFromPath(char *buffer, size_t maxlength, const char *path) =0;
239 #endif //_INCLUDE_SOURCEMOD_LIBRARY_INTERFACE_SYS_H_