mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
- Added missing projects "VFS" & "export" to SVN
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4447 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* bfVFS : vfs/Aspects/vfs_logging.h
|
||||
* - Logging interface and macros that will be used to report errors/warnings to the using program
|
||||
*
|
||||
* Copyright (C) 2008 - 2010 (BF) john.bf.smith@googlemail.com
|
||||
*
|
||||
* This file is part of the bfVFS library
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef VFS_LOGGING_H
|
||||
#define VFS_LOGGING_H
|
||||
|
||||
#include <vfs/vfs_config.h>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
class String;
|
||||
namespace Aspects
|
||||
{
|
||||
enum LogType { LOG_INFO, LOG_WARNING, LOG_ERROR, LOG_DEBUG };
|
||||
|
||||
class ILogger
|
||||
{
|
||||
public:
|
||||
virtual void Msg(const wchar_t* msg) = 0;
|
||||
virtual void Msg(const char* msg) = 0;
|
||||
};
|
||||
|
||||
VFS_API void setLogger(LogType type, ILogger* logger);
|
||||
VFS_API ILogger* getLogger(LogType type);
|
||||
|
||||
VFS_API void setLogger( ILogger* info_logger, ILogger* warning_logger, ILogger* error_logger, ILogger* debug_logger );
|
||||
|
||||
void Debug(vfs::String const& msg);
|
||||
void Debug(const wchar_t* msg);
|
||||
void Debug(const char* msg);
|
||||
|
||||
void Info(vfs::String const& msg);
|
||||
void Info(const wchar_t* msg);
|
||||
void Info(const char* msg);
|
||||
|
||||
void Warning(vfs::String const& msg);
|
||||
void Warning(const wchar_t* msg);
|
||||
void Warning(const char* msg);
|
||||
|
||||
void Error(vfs::String const& msg);
|
||||
void Error(const wchar_t* msg);
|
||||
void Error(const char* msg);
|
||||
};
|
||||
};
|
||||
|
||||
#if !defined VFS_DISABLE_LOGGING
|
||||
|
||||
# if !defined VFS_LOG_DEBUG
|
||||
# define VFS_LOG_DEBUG(msg) (vfs::Aspects::Debug(msg))
|
||||
# endif
|
||||
|
||||
# if !defined VFS_LOG_INFO
|
||||
# define VFS_LOG_INFO(msg) (vfs::Aspects::Info(msg))
|
||||
# endif
|
||||
|
||||
# if !defined VFS_LOG_WARNING
|
||||
# define VFS_LOG_WARNING(msg) (vfs::Aspects::Warning(msg))
|
||||
# endif
|
||||
|
||||
# if !defined VFS_LOG_ERROR
|
||||
# define VFS_LOG_ERROR(msg) (vfs::Aspects::Error(msg))
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
# if !defined VFS_LOG_DEBUG
|
||||
# define VFS_LOG_DEBUG(msg)
|
||||
# endif
|
||||
|
||||
# if !defined VFS_LOG_INFO
|
||||
# define VFS_LOG_INFO(msg)
|
||||
# endif
|
||||
|
||||
# if !defined VFS_LOG_WARNING
|
||||
# define VFS_LOG_WARNING(msg)
|
||||
# endif
|
||||
|
||||
# if !defined VFS_LOG_ERROR
|
||||
# define VFS_LOG_ERROR(msg)
|
||||
# endif
|
||||
|
||||
#endif // VFS_DISABLE_LOGGING
|
||||
|
||||
#endif // VFS_LOGGING_H
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* bfVFS : vfs/Aspects/vfs_settings.h
|
||||
* - library runtime settings,
|
||||
* - e.g., to use Unicode strings or regular for file names
|
||||
*
|
||||
* Copyright (C) 2008 - 2010 (BF) john.bf.smith@googlemail.com
|
||||
*
|
||||
* This file is part of the bfVFS library
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VFS_SETTIGNS_H_
|
||||
#define _VFS_SETTIGNS_H_
|
||||
|
||||
#include <vfs/vfs_config.h>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
class VFS_API Settings
|
||||
{
|
||||
public:
|
||||
static void setUseUnicode(bool useUnicode);
|
||||
static bool getUseUnicode();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // _VFS_SETTIGNS_H_
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* bfVFS : vfs/Aspects/vfs_synchronization.h
|
||||
* - Interface for Mutexes and Locks, implementation can or has to be provided by the using program
|
||||
*
|
||||
* Copyright (C) 2008 - 2010 (BF) john.bf.smith@googlemail.com
|
||||
*
|
||||
* This file is part of the bfVFS library
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef VFS_SYNCHRONIZATION_H
|
||||
#define VFS_SYNCHRONIZATION_H
|
||||
|
||||
#include <vfs/vfs_config.h>
|
||||
|
||||
namespace vfs
|
||||
{
|
||||
namespace Aspects
|
||||
{
|
||||
class IMutex
|
||||
{
|
||||
public:
|
||||
virtual void lock() {};
|
||||
virtual void unlock() {};
|
||||
};
|
||||
|
||||
class IMutexFactory
|
||||
{
|
||||
public:
|
||||
virtual IMutex* createMutex() = 0;
|
||||
};
|
||||
|
||||
VFS_API void setMutexFactory(IMutexFactory* mutex_factory);
|
||||
VFS_API IMutexFactory* getMutexFactory();
|
||||
|
||||
class Mutex
|
||||
{
|
||||
public:
|
||||
Mutex();
|
||||
~Mutex();
|
||||
|
||||
void lock();
|
||||
void unlock();
|
||||
private:
|
||||
int _locked;
|
||||
IMutex* _mutex;
|
||||
};
|
||||
|
||||
class ScopedLock
|
||||
{
|
||||
public:
|
||||
ScopedLock(Mutex& mutex) : _mutex(mutex) {
|
||||
this->_mutex.lock();
|
||||
}
|
||||
~ScopedLock(){
|
||||
this->_mutex.unlock();
|
||||
}
|
||||
private:
|
||||
Mutex& _mutex;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VFS_SYNCHRONIZE
|
||||
# if !defined VFS_LOCK
|
||||
# define VFS_LOCK(mutex) vfs::Aspects::ScopedLock _scoped_lock(mutex)
|
||||
# endif
|
||||
#else
|
||||
# if !defined VFS_LOCK
|
||||
# define VFS_LOCK(mutex)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif // VFS_SYNCHRONIZATION_H
|
||||
Reference in New Issue
Block a user