rainmeter-studio/Library/Export.h

120 lines
3.2 KiB
C
Raw Normal View History

2009-02-10 18:37:48 +00:00
/*
2012-01-08 17:35:29 +00:00
Copyright (C) 2011 Kimmo Pekkola, Birunthan Mohanathas
2009-02-10 18:37:48 +00:00
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __EXPORT_H__
#define __EXPORT_H__
#ifdef LIBRARY_EXPORTS
2012-01-08 17:35:29 +00:00
#define LIBRARY_DECLSPEC __declspec(dllexport)
2009-02-10 18:37:48 +00:00
#else
2012-01-08 17:35:29 +00:00
#define LIBRARY_DECLSPEC __declspec(dllimport)
#endif // LIBRARY_EXPORTS
2011-12-30 16:16:22 +00:00
2012-01-08 17:35:29 +00:00
#ifdef __cplusplus
#define LIBRARY_EXPORT extern "C" LIBRARY_DECLSPEC
#define PLUGIN_EXPORT extern "C" __declspec(dllexport)
#else
#define LIBRARY_EXPORT LIBRARY_DECLSPEC
#define PLUGIN_EXPORT __declspec(dllexport)
#endif // __cplusplus
//
// Exported functions
//
2009-02-10 18:37:48 +00:00
#ifdef __cplusplus
2012-01-08 17:35:29 +00:00
LIBRARY_EXPORT LPCWSTR RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures = TRUE);
#else
LIBRARY_EXPORT LPCWSTR RmReadString(void* rm, LPCWSTR option, LPCWSTR defValue, BOOL replaceMeasures);
#endif // __cplusplus
LIBRARY_EXPORT double RmReadFormula(void* rm, LPCWSTR option, double defValue);
LIBRARY_EXPORT LPCWSTR RmPathToAbsolute(void* rm, LPCWSTR relativePath);
LIBRARY_EXPORT void RmExecute(void* skin, LPCWSTR command);
LIBRARY_EXPORT void* RmGet(void* rm, int type);
enum RmGetType
2009-02-10 18:37:48 +00:00
{
2012-01-08 17:35:29 +00:00
RMG_MEASURENAME = 0,
RMG_SKIN = 1,
RMG_SETTINGSFILE = 2
};
2011-12-30 16:16:22 +00:00
2012-01-08 17:35:29 +00:00
LIBRARY_EXPORT BOOL LSLog(int type, LPCWSTR unused, LPCWSTR message);
2011-12-30 16:16:22 +00:00
2012-01-08 17:35:29 +00:00
/* DEPRECATED */ LIBRARY_EXPORT __declspec(deprecated) LPCWSTR ReadConfigString(LPCWSTR section, LPCWSTR option, LPCWSTR defValue);
/* DEPRECATED */ LIBRARY_EXPORT __declspec(deprecated) LPCWSTR PluginBridge(LPCWSTR command, LPCWSTR data);
//
// Wrapper functions
//
#ifndef LIBRARY_EXPORTS
__inline LPCWSTR RmReadPath(void* rm, LPCWSTR option, LPCWSTR defValue)
{
LPCWSTR relativePath = RmReadString(rm, option, defValue, TRUE);
return RmPathToAbsolute(rm, relativePath);
}
__inline int RmReadInt(void* rm, LPCWSTR option, int defValue)
{
LPCWSTR value = RmReadString(rm, option, L"", TRUE);
return (*value) ? _wtoi(value) : defValue;
}
__inline double RmReadDouble(void* rm, LPCWSTR option, double defValue)
{
LPCWSTR value = RmReadString(rm, option, L"", TRUE);
return (*value) ? wcstod(value, NULL) : defValue;
}
__inline LPCWSTR RmGetMeasureName(void* rm)
{
return (LPCWSTR)RmGet(rm, RMG_MEASURENAME);
}
__inline LPCWSTR RmGetSettingsFile()
{
return (LPCWSTR)RmGet(NULL, RMG_SETTINGSFILE);
2011-12-30 16:16:22 +00:00
}
2011-12-30 17:18:34 +00:00
2012-01-08 17:35:29 +00:00
__inline void* RmGetSkin(void* rm)
{
return (void*)RmGet(rm, RMG_SKIN);
}
__inline void RmLog(int level, LPCWSTR message)
{
LSLog(level, NULL, message);
}
enum LOGLEVEL
{
LOG_ERROR = 1,
LOG_WARNING = 2,
LOG_NOTICE = 3,
LOG_DEBUG = 4
};
#endif // LIBRARY_EXPORTS
#endif