mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
93 lines
4.0 KiB
C
93 lines
4.0 KiB
C
/******************************************************************************
|
|
* *
|
|
* *
|
|
* Notepad3 *
|
|
* *
|
|
* Config.h *
|
|
* Methods to read and write configuration *
|
|
* *
|
|
* (c) Rizonesoft 2008-2019 *
|
|
* https://rizonesoft.com *
|
|
* *
|
|
* *
|
|
*******************************************************************************/
|
|
#pragma once
|
|
#ifndef _NP3_CONFIG_H_
|
|
#define _NP3_CONFIG_H_
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "TypeDefs.h"
|
|
#include "Helpers.h"
|
|
|
|
//==== Ini-File Handling =============================================
|
|
|
|
bool FindIniFile();
|
|
int TestIniFile();
|
|
bool CreateIniFile();
|
|
bool CreateIniFileEx(LPCWSTR lpszIniFile);
|
|
void LoadSettings();
|
|
void SaveSettings(bool);
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool LoadIniFile(LPCWSTR lpIniFilePath);
|
|
bool SaveIniFile(LPCWSTR lpIniFilePath);
|
|
void ReleaseIniFile();
|
|
|
|
size_t IniSectionGetString(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault,
|
|
LPWSTR lpReturnedString, size_t cchReturnedString);
|
|
int IniSectionGetInt(LPCWSTR lpSectionName, LPCWSTR lpKeyName, int iDefault);
|
|
double IniSectionGetDouble(LPCWSTR lpSectionName, LPCWSTR lpKeyName, double dDefault);
|
|
bool IniSectionGetBool(LPCWSTR lpSectionName, LPCWSTR lpKeyName, bool bDefault);
|
|
|
|
inline DocPos IniSectionGetPos(LPCWSTR lpSectionName, LPCWSTR lpKeyName, DocPos posDefault) {
|
|
return (DocPos)IniSectionGetInt(lpSectionName, lpKeyName, (MBWC_DocPos_Cast)posDefault);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool IniSectionSetString(LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpString);
|
|
bool IniSectionSetInt(LPCWSTR lpSectionName, LPCWSTR lpKeyName, int iValue);
|
|
bool IniSectionSetHex(LPCWSTR lpSectionName, LPCWSTR lpKeyName, int iValue);
|
|
bool IniSectionSetDouble(LPCWSTR lpSectionName, LPCWSTR lpKeyName, double dValue);
|
|
bool IniSectionSetBool(LPCWSTR lpSectionName, LPCWSTR lpName, bool bValue);
|
|
|
|
inline bool IniSectionSetPos(LPCWSTR lpSectionName, LPCWSTR lpKeyName, DocPos posValue) {
|
|
return IniSectionSetInt(lpSectionName, lpKeyName, (MBWC_DocPos_Cast)posValue);
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
bool IniSectionClear(LPCWSTR lpSectionName, bool bRemoveEmpty);
|
|
bool IniClearAllSections(LPCWSTR lpPrefix, bool bRemoveEmpty);
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// ==========================================
|
|
// open file , get/set value, save(set) file
|
|
// ==========================================
|
|
|
|
size_t IniFileGetString(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpDefault,
|
|
LPWSTR lpReturnedString, size_t cchReturnedString);
|
|
bool IniFileSetString(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, LPCWSTR lpString);
|
|
|
|
int IniFileGetInt(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, int iDefault);
|
|
bool IniFileSetInt(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, int iValue);
|
|
|
|
bool IniFileGetBool(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, bool bDefault);
|
|
bool IniFileSetBool(LPCWSTR lpFilePath, LPCWSTR lpSectionName, LPCWSTR lpKeyName, bool bValue);
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
|
|
#endif //_NP3_CONFIG_H_
|