add function iniGetCharValueEx
parent
1f83e66306
commit
f24c558761
4
HISTORY
4
HISTORY
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
Version 1.58 2022-05-07
|
Version 1.58 2022-05-26
|
||||||
* add function conn_pool_connect_server_ex1 to support service name
|
* add function conn_pool_connect_server_ex1 to support service name
|
||||||
|
* add function conn_pool_get_connection_ex to support service name
|
||||||
|
* add function iniGetCharValueEx
|
||||||
|
|
||||||
Version 1.57 2022-04-22
|
Version 1.57 2022-04-22
|
||||||
* add function fc_format_path
|
* add function fc_format_path
|
||||||
|
|
|
||||||
|
|
@ -2868,6 +2868,21 @@ char *iniGetStrValueEx(const char *szSectionName, const char *szItemName,
|
||||||
return pFound->value;
|
return pFound->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char iniGetCharValueEx(const char *szSectionName, const char *szItemName,
|
||||||
|
IniContext *pContext, const char cDefaultValue,
|
||||||
|
const bool bRetryGlobal)
|
||||||
|
{
|
||||||
|
char *value;
|
||||||
|
|
||||||
|
value = iniGetStrValueEx(szSectionName, szItemName,
|
||||||
|
pContext, bRetryGlobal);
|
||||||
|
if (value == NULL) {
|
||||||
|
return cDefaultValue;
|
||||||
|
} else {
|
||||||
|
return value[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define INI_FILL_SECTION_PROMPT(prompt, size, section_name) \
|
#define INI_FILL_SECTION_PROMPT(prompt, size, section_name) \
|
||||||
do { \
|
do { \
|
||||||
if (section_name != NULL && *(section_name) != '\0') { \
|
if (section_name != NULL && *(section_name) != '\0') { \
|
||||||
|
|
|
||||||
|
|
@ -117,28 +117,32 @@ extern "C" {
|
||||||
#define iniGetStrValue(szSectionName, szItemName, pContext) \
|
#define iniGetStrValue(szSectionName, szItemName, pContext) \
|
||||||
iniGetStrValueEx(szSectionName, szItemName, pContext, false)
|
iniGetStrValueEx(szSectionName, szItemName, pContext, false)
|
||||||
|
|
||||||
|
#define iniGetCharValue(szSectionName, szItemName, pContext, cDefaultValue) \
|
||||||
|
iniGetCharValueEx(szSectionName, szItemName, \
|
||||||
|
pContext, cDefaultValue, false)
|
||||||
|
|
||||||
#define iniGetIntValue(szSectionName, szItemName, pContext, nDefaultValue) \
|
#define iniGetIntValue(szSectionName, szItemName, pContext, nDefaultValue) \
|
||||||
iniGetIntValueEx(szSectionName, szItemName, pContext, \
|
iniGetIntValueEx(szSectionName, szItemName, \
|
||||||
nDefaultValue, false)
|
pContext, nDefaultValue, false)
|
||||||
|
|
||||||
#define iniGetInt64Value(szSectionName, szItemName, pContext, nDefaultValue) \
|
#define iniGetInt64Value(szSectionName, szItemName, pContext, nDefaultValue) \
|
||||||
iniGetInt64ValueEx(szSectionName, szItemName, pContext, \
|
iniGetInt64ValueEx(szSectionName, szItemName, \
|
||||||
nDefaultValue, false)
|
pContext, nDefaultValue, false)
|
||||||
|
|
||||||
#define iniGetDoubleValue(szSectionName, szItemName, pContext, dbDefaultValue) \
|
#define iniGetDoubleValue(szSectionName, szItemName, pContext, dbDefaultValue) \
|
||||||
iniGetDoubleValueEx(szSectionName, szItemName, pContext, \
|
iniGetDoubleValueEx(szSectionName, szItemName, \
|
||||||
dbDefaultValue, false)
|
pContext, dbDefaultValue, false)
|
||||||
|
|
||||||
#define iniGetBoolValue(szSectionName, szItemName, pContext, bDefaultValue) \
|
#define iniGetBoolValue(szSectionName, szItemName, pContext, bDefaultValue) \
|
||||||
iniGetBoolValueEx(szSectionName, szItemName, pContext, \
|
iniGetBoolValueEx(szSectionName, szItemName, \
|
||||||
bDefaultValue, false)
|
pContext, bDefaultValue, false)
|
||||||
|
|
||||||
#define iniGetPercentValue(ini_ctx, item_name, item_value, default_value) \
|
#define iniGetPercentValue(ini_ctx, item_name, item_value, default_value) \
|
||||||
iniGetPercentValueEx(ini_ctx, item_name, item_value, default_value, false)
|
iniGetPercentValueEx(ini_ctx, item_name, item_value, default_value, false)
|
||||||
|
|
||||||
#define iniGetByteValue(szSectionName, szItemName, pContext, nDefaultValue) \
|
#define iniGetByteValue(szSectionName, szItemName, pContext, nDefaultValue) \
|
||||||
iniGetByteValueEx(szSectionName, szItemName, pContext, \
|
iniGetByteValueEx(szSectionName, szItemName, \
|
||||||
nDefaultValue, 1, false)
|
pContext, nDefaultValue, 1, false)
|
||||||
|
|
||||||
#define iniGetIntCorrectValue(ini_ctx, item_name, \
|
#define iniGetIntCorrectValue(ini_ctx, item_name, \
|
||||||
default_value, min_value, max_value) \
|
default_value, min_value, max_value) \
|
||||||
|
|
@ -243,6 +247,20 @@ void iniFreeContext(IniContext *pContext);
|
||||||
char *iniGetStrValueEx(const char *szSectionName, const char *szItemName,
|
char *iniGetStrValueEx(const char *szSectionName, const char *szItemName,
|
||||||
IniContext *pContext, const bool bRetryGlobal);
|
IniContext *pContext, const bool bRetryGlobal);
|
||||||
|
|
||||||
|
/** get the first charactor
|
||||||
|
* parameters:
|
||||||
|
* szSectionName: the section name, NULL or empty string for
|
||||||
|
* global section
|
||||||
|
* szItemName: the item name
|
||||||
|
* pContext: the ini context
|
||||||
|
* cDefaultValue: the default value
|
||||||
|
* bRetryGlobal: if fetch from global section when the item not exist
|
||||||
|
* return: item value, return default value when the item not exist
|
||||||
|
*/
|
||||||
|
char iniGetCharValueEx(const char *szSectionName, const char *szItemName,
|
||||||
|
IniContext *pContext, const char cDefaultValue,
|
||||||
|
const bool bRetryGlobal);
|
||||||
|
|
||||||
/** get item string value
|
/** get item string value
|
||||||
* parameters:
|
* parameters:
|
||||||
* szSectionName: the section name, NULL or empty string for
|
* szSectionName: the section name, NULL or empty string for
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue