You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.7 KiB
C

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/****************************************************************************/
/* Copyright (c) 2007,许继集团有限公司 */
/* All rights reserved. */
/* */
/* 模块描述: */
/** 字符串与对象值转换功能
* @file ai_valstr.h */
/* */
/* 日期 作者 注释 */
/* 2007/08/07 ZYZ 创建文件 */
/****************************************************************************/
#ifndef AI_VALSTR_INCLUDE
#define AI_VALSTR_INCLUDE
#include "glbtypes.h"
#include "ai_def.h"
#include "mvl_defs.h"
#include "ai_objid.h"
#define MAX_DAT_VALUE_STR_LEN 512
#define MAX_TYPE_STR_LEN 20
#ifdef __cplusplus
extern "C" {
#endif
/**
* 由基本类型数据转换为字符串
* @param type 对象数据类型
* @param val 对象数据指针
* @param str 字符串指针,输出
* @retval SD_SUCCESS 成功
* @retval SD_FAILURE 失败
*/
ST_RET ai_prim_value_to_str(AI_VAL_TYPE type, ST_VOID *val, ST_CHAR *str);
/**
* 由字符串转换为基本类型数据值
* @param type 对象数据类型
* @param str 字符串指针
* @param val 对象数据指针,输出
* @retval SD_SUCCESS 成功
* @retval SD_FAILURE 失败
*/
ST_RET ai_prim_str_to_value(AI_VAL_TYPE type, ST_CHAR *str, ST_VOID *val);
/**
* 打印obj_id对应的对象的名称及值,支持ld,ln,do,da,基本类型
* @param ied 服务器对象空间
* @param obj_id 对象ID
* @retval ST_VOID
*/
ST_VOID ai_log_obj_value(AI_IED_CTRL *ied, AI_OBJ_ID obj_id);
/**
* 由基本类型标示转化为类型字符串
* @param type 对象数据类型
* @param str 字符串指针,输出
* @retval SD_SUCCESS 成功
* @retval SD_FAILURE 失败
* @author guoqiangm@xjgc.com
*/
ST_RET ai_type_to_str(AI_VAL_TYPE type, ST_CHAR *str);
/**
* 由基本类型字符串转化为类型标示
* @param str 数据类型字符串指针
* @retval 返回-1表示出错否则返回基本类型标示
* @author guoqiangm@xjgc.com
*/
AI_VAL_TYPE ai_str_to_type(ST_CHAR *str);
/**
*
* 用新子串newstr替换源字符串src中的前len个字符内所包含的oldstr子串
* @param const char* src 源字符串,被替换的字符串
* @param const char* oldstr 旧的子串,将被替换的子串
* @param const char* newstr 新的子串
* @param int len 将要被替换的前len个字符
*
* @retval char* dest 返回新串的地址
*
*/
char *strreplace(char *src, const char *oldstr, const char *newstr, int len);
#ifdef __cplusplus
}
#endif
#endif // AI_VALSTR_INCLUDE