📄 rq_fpml_expiry_date_time.c
字号:
/*** rq_fpml_expiry_date_time.c**** Written by Brett Hutley - brett@hutley.net**** Copyright (C) 2001 Brett Hutley**** This file is part of the Risk Quantify Library**** Risk Quantify is free software; you can redistribute it and/or** modify it under the terms of the GNU Library General Public** License as published by the Free Software Foundation; either** version 2 of the License, or (at your option) any later version.**** Risk Quantify 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** Library General Public License for more details.**** You should have received a copy of the GNU Library General Public** License along with Risk Quantify; if not, write to the Free** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/#include "fpml/rq_fpml_expiry_date_time.h"#include <stdlib.h>#include <string.h>
void rq_fpml_expiry_date_time_init(struct rq_fpml_expiry_date_time *expiry_date_time){ expiry_date_time->expiry_date = 0; expiry_date_time->hour_minute = 0; expiry_date_time->business_center_id = NULL; expiry_date_time->cut_name = NULL;}void rq_fpml_expiry_date_time_fill(struct rq_fpml_expiry_date_time *expiry_date_time, rq_date expiry_date, short hour_minute, const char *business_center_id, const char *cut_name){ expiry_date_time->expiry_date = expiry_date; expiry_date_time->hour_minute = hour_minute; if (expiry_date_time->business_center_id) free((char *)expiry_date_time->business_center_id); expiry_date_time->business_center_id = (const char *)strdup(business_center_id); if (expiry_date_time->cut_name) free((char *)expiry_date_time->cut_name); expiry_date_time->cut_name = (const char *)strdup(cut_name);}void rq_fpml_expiry_date_time_clear(struct rq_fpml_expiry_date_time *expiry_date_time){ expiry_date_time->expiry_date = 0; expiry_date_time->hour_minute = 0; if (expiry_date_time->business_center_id) free((char *)expiry_date_time->business_center_id); expiry_date_time->business_center_id = NULL; if (expiry_date_time->cut_name) free((char *)expiry_date_time->cut_name); expiry_date_time->cut_name = NULL;}intrq_fpml_expiry_date_time_write_xml(struct rq_fpml_expiry_date_time *p, rq_stream_t output_stream){ char buf[30]; rq_stream_write_string(output_stream, "<expiryDateTime>"); rq_stream_write_string(output_stream, "<expiryDate>"); rq_date_to_string(buf, "yyyy-mm-dd", p->expiry_date); rq_stream_write_string(output_stream, buf); rq_stream_write_string(output_stream, "</expiryDate>"); rq_stream_write_string(output_stream, "<hourMinute>"); rq_stream_write_integer_as_string(output_stream, p->hour_minute); rq_stream_write_string(output_stream, "</hourMinute>"); rq_stream_write_string(output_stream, "<businessCenterId>"); rq_stream_write_string(output_stream, p->business_center_id); rq_stream_write_string(output_stream, "</businessCenterId>"); rq_stream_write_string(output_stream, "<cutName>"); rq_stream_write_string(output_stream, p->cut_name); rq_stream_write_string(output_stream, "</cutName>"); rq_stream_write_string(output_stream, "</expiryDateTime>"); return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -