3
3
<title>LibOFX: ofx_container_security.cpp Source File</title>
4
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
6
<!-- Generated by Doxygen 1.3.7 -->
6
<!-- Generated by Doxygen 1.3.9.1 -->
7
7
<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
8
<h1>ofx_container_security.cpp</h1><a href="ofx__container__security_8cpp.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/***************************************************************************</span>
9
<a class="el" href="dir_000002.html">lib</a></div>
10
<h1>ofx_container_security.cpp</h1><a href="ofx__container__security_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/***************************************************************************</span>
9
11
00002 <span class="comment"> ofx_container_security.cpp </span>
10
12
00003 <span class="comment"> -------------------</span>
11
13
00004 <span class="comment"> copyright : (C) 2002 by Benoit Gr�goire</span>
48
50
<a name="l00045"></a><a class="code" href="classOfxSecurityContainer.html#a2">00045</a> <span class="keywordtype">void</span> <a class="code" href="classOfxSecurityContainer.html#a2">OfxSecurityContainer::add_attribute</a>(<span class="keyword">const</span> string identifier, <span class="keyword">const</span> string value)
50
52
00047 <span class="keywordflow">if</span>(identifier==<span class="stringliteral">"UNIQUEID"</span>){
51
00048 strncpy(data.<a class="code" href="structOfxSecurityData.html#z4_0">unique_id</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z4_0">unique_id</a>));
52
00049 data.<a class="code" href="structOfxSecurityData.html#z4_1">unique_id_valid</a> = <span class="keyword">true</span>;
53
00048 strncpy(data.<a class="code" href="structOfxSecurityData.html#z12_0">unique_id</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z12_0">unique_id</a>));
54
00049 data.<a class="code" href="structOfxSecurityData.html#z12_1">unique_id_valid</a> = <span class="keyword">true</span>;
54
56
00051 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(identifier==<span class="stringliteral">"UNIQUEIDTYPE"</span>){
55
00052 strncpy(data.<a class="code" href="structOfxSecurityData.html#z4_2">unique_id_type</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z4_2">unique_id_type</a>));
56
00053 data.<a class="code" href="structOfxSecurityData.html#z4_3">unique_id_type_valid</a> = <span class="keyword">true</span>;
57
00052 strncpy(data.<a class="code" href="structOfxSecurityData.html#z12_2">unique_id_type</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z12_2">unique_id_type</a>));
58
00053 data.<a class="code" href="structOfxSecurityData.html#z12_3">unique_id_type_valid</a> = <span class="keyword">true</span>;
58
60
00055 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(identifier==<span class="stringliteral">"SECNAME"</span>){
59
00056 strncpy(data.<a class="code" href="structOfxSecurityData.html#z4_4">secname</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z4_4">secname</a>));
60
00057 data.<a class="code" href="structOfxSecurityData.html#z4_5">secname_valid</a> = <span class="keyword">true</span>;
61
00056 strncpy(data.<a class="code" href="structOfxSecurityData.html#z12_4">secname</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z12_4">secname</a>));
62
00057 data.<a class="code" href="structOfxSecurityData.html#z12_5">secname_valid</a> = <span class="keyword">true</span>;
62
64
00059 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(identifier==<span class="stringliteral">"TICKER"</span>){
63
00060 strncpy(data.<a class="code" href="structOfxSecurityData.html#z5_0">ticker</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z5_0">ticker</a>));
64
00061 data.<a class="code" href="structOfxSecurityData.html#z5_1">ticker_valid</a> = <span class="keyword">true</span>;
65
00060 strncpy(data.<a class="code" href="structOfxSecurityData.html#z13_0">ticker</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z13_0">ticker</a>));
66
00061 data.<a class="code" href="structOfxSecurityData.html#z13_1">ticker_valid</a> = <span class="keyword">true</span>;
66
68
00063 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(identifier==<span class="stringliteral">"UNITPRICE"</span>){
67
00064 data.<a class="code" href="structOfxSecurityData.html#z5_2">unitprice</a>=<a class="code" href="fx-0_87_80_2lib_2ofx__utilities_8hh.html#a5">ofxamount_to_double</a>(value);
68
00065 data.<a class="code" href="structOfxSecurityData.html#z5_3">unitprice_valid</a> = <span class="keyword">true</span>;
69
00064 data.<a class="code" href="structOfxSecurityData.html#z13_2">unitprice</a>=<a class="code" href="fx-0_88_80_2lib_2ofx__utilities_8hh.html#a5">ofxamount_to_double</a>(value);
70
00065 data.<a class="code" href="structOfxSecurityData.html#z13_3">unitprice_valid</a> = <span class="keyword">true</span>;
70
72
00067 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(identifier==<span class="stringliteral">"DTASOF"</span>){
71
00068 data.<a class="code" href="structOfxSecurityData.html#z5_4">date_unitprice</a> = <a class="code" href="fx-0_87_80_2lib_2ofx__utilities_8hh.html#a4">ofxdate_to_time_t</a>(value);
72
00069 data.<a class="code" href="structOfxSecurityData.html#z5_5">date_unitprice_valid</a> = <span class="keyword">true</span>;
73
00068 data.<a class="code" href="structOfxSecurityData.html#z13_4">date_unitprice</a> = <a class="code" href="fx-0_88_80_2lib_2ofx__utilities_8hh.html#a4">ofxdate_to_time_t</a>(value);
74
00069 data.<a class="code" href="structOfxSecurityData.html#z13_5">date_unitprice_valid</a> = <span class="keyword">true</span>;
74
76
00071 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(identifier==<span class="stringliteral">"CURDEF"</span>){
75
00072 strncpy(data.<a class="code" href="structOfxSecurityData.html#z5_6">currency</a>,value.c_str(),OFX_CURRENCY_LENGTH);
76
00073 data.<a class="code" href="structOfxSecurityData.html#z5_7">currency_valid</a>=<span class="keyword">true</span>;
77
00072 strncpy(data.<a class="code" href="structOfxSecurityData.html#z13_6">currency</a>,value.c_str(),OFX_CURRENCY_LENGTH);
78
00073 data.<a class="code" href="structOfxSecurityData.html#z13_7">currency_valid</a>=<span class="keyword">true</span>;
78
80
00075 <span class="keywordflow">else</span> <span class="keywordflow">if</span>(identifier==<span class="stringliteral">"MEMO"</span> || identifier==<span class="stringliteral">"MEMO2"</span>){
79
00076 strncpy(data.<a class="code" href="structOfxSecurityData.html#z5_8">memo</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z5_8">memo</a>));
80
00077 data.<a class="code" href="structOfxSecurityData.html#z5_9">memo_valid</a> = <span class="keyword">true</span>;
81
00076 strncpy(data.<a class="code" href="structOfxSecurityData.html#z13_8">memo</a>,value.c_str(), <span class="keyword">sizeof</span>(data.<a class="code" href="structOfxSecurityData.html#z13_8">memo</a>));
82
00077 data.<a class="code" href="structOfxSecurityData.html#z13_9">memo_valid</a> = <span class="keyword">true</span>;
82
84
00079 <span class="keywordflow">else</span>{
83
85
00080 <span class="comment">/* Redirect unknown identifiers to the base class */</span>
84
00081 OfxGenericContainer::add_attribute(identifier, value);
86
00081 <a class="code" href="classOfxGenericContainer.html#a4">OfxGenericContainer::add_attribute</a>(identifier, value);
87
89
<a name="l00084"></a><a class="code" href="classOfxSecurityContainer.html#a3">00084</a> <span class="keywordtype">int</span> <a class="code" href="classOfxSecurityContainer.html#a3">OfxSecurityContainer::gen_event</a>()