36
32
<a name="l00022"></a>00022 <span class="preprocessor">#include <stdlib.h></span>
37
33
<a name="l00023"></a>00023 <span class="preprocessor">#include <stdio.h></span>
38
34
<a name="l00024"></a>00024 <span class="preprocessor">#include <string></span>
39
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="libofx-0_88_82_2inc_2libofx_8h.html">libofx.h</a>"</span>
40
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="fx-0_88_82_2lib_2messages_8hh.html">messages.hh</a>"</span>
41
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="fx-0_88_82_2lib_2ofx__preproc_8hh.html">ofx_preproc.hh</a>"</span>
35
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="libofx-0_89_80_2inc_2libofx_8h.html" title="Main header file containing the LibOfx API.">libofx.h</a>"</span>
36
<a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="fx-0_88_82_2lib_2messages_8hh.html" title="Message IO functionality.">messages.hh</a>"</span>
37
<a name="l00027"></a>00027 <span class="preprocessor">#include "<a class="code" href="fx-0_88_82_2lib_2ofx__preproc_8hh.html" title="Preprocessing of the OFX files before parsing.">ofx_preproc.hh</a>"</span>
42
38
<a name="l00028"></a>00028 <span class="preprocessor">#include "context.hh"</span>
43
<a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="fx-0_88_82_2lib_2file__preproc_8hh.html">file_preproc.hh</a>"</span>
39
<a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="fx-0_88_82_2lib_2file__preproc_8hh.html" title="Preprocessing of the OFX files before parsing.">file_preproc.hh</a>"</span>
44
40
<a name="l00030"></a>00030
45
41
<a name="l00031"></a>00031 <span class="keyword">using namespace </span>std;
46
<a name="l00032"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#9eee3543dcaefab6e13ffd2868c07aaa">00032</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="file__preproc_8cpp.html#9eee3543dcaefab6e13ffd2868c07aaa">READ_BUFFER_SIZE</a> = 1024;
42
<a name="l00032"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#3a4f15870bd5573d14fceb17c65162ee">00032</a> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="file__preproc_8cpp.html#3a4f15870bd5573d14fceb17c65162ee">READ_BUFFER_SIZE</a> = 1024;
47
43
<a name="l00033"></a>00033
48
44
<a name="l00034"></a>00034 <span class="comment">/* get_file_type_description returns a string description of a LibofxFileType </span>
49
45
<a name="l00035"></a>00035 <span class="comment"> * suitable for debugging output or user communication.</span>
50
46
<a name="l00036"></a>00036 <span class="comment"> */</span>
51
<a name="l00037"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#02f1a3ffa44b420a4c04018a7c609673">00037</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="inc_2libofx_8h.html#e6b476fc8d8fbd4e0d190601c74c951b">libofx_get_file_format_description</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structLibofxFileFormatInfo.html">LibofxFileFormatInfo</a> format_list[], <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd84">LibofxFileFormat</a> file_format)
47
<a name="l00037"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#01e232aea6806e09e048c98c94a49b66">00037</a> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="inc_2libofx_8h.html#efc89267742d989b5f17708076807b5e" title="get_file_format_description returns a string description of a LibofxFileType.">libofx_get_file_format_description</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structLibofxFileFormatInfo.html">LibofxFileFormatInfo</a> format_list[], <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> file_format)
52
48
<a name="l00038"></a>00038 {
53
49
<a name="l00039"></a>00039 <span class="keyword">const</span> <span class="keywordtype">char</span> * retval = <span class="stringliteral">"UNKNOWN (File format couldn't be sucessfully identified)"</span>;
54
50
<a name="l00040"></a>00040
55
<a name="l00041"></a>00041 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; <a class="code" href="inc_2libofx_8h.html#47340ac933be2130bdb93a9be72ed440">LibofxImportFormatList</a>[i].<a class="code" href="structLibofxFileFormatInfo.html#abd04f8817cfaf854b3dfc0ac67db61a">format</a>!=<a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd844b52ee4664b55e98b69e6f61967cabdf">LAST</a>; i++)
51
<a name="l00041"></a>00041 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; <a class="code" href="inc_2libofx_8h.html#b1ad431f1a4db406c34db2833ca80748">LibofxImportFormatList</a>[i].<a class="code" href="structLibofxFileFormatInfo.html#e4b1aa0050ffdc43ce68f07e6330d2f7">format</a>!=<a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de990cd45e93be2b4661f3499e0a658a33">LAST</a>; i++)
56
52
<a name="l00042"></a>00042 {
57
<a name="l00043"></a>00043 <span class="keywordflow">if</span>(<a class="code" href="inc_2libofx_8h.html#47340ac933be2130bdb93a9be72ed440">LibofxImportFormatList</a>[i].format==file_format)
53
<a name="l00043"></a>00043 <span class="keywordflow">if</span>(<a class="code" href="inc_2libofx_8h.html#b1ad431f1a4db406c34db2833ca80748">LibofxImportFormatList</a>[i].format==file_format)
58
54
<a name="l00044"></a>00044 {
59
<a name="l00045"></a>00045 retval = <a class="code" href="inc_2libofx_8h.html#47340ac933be2130bdb93a9be72ed440">LibofxImportFormatList</a>[i].description;
55
<a name="l00045"></a>00045 retval = <a class="code" href="inc_2libofx_8h.html#b1ad431f1a4db406c34db2833ca80748">LibofxImportFormatList</a>[i].<a class="code" href="structLibofxFileFormatInfo.html#6951dcf0a992fc8a03b721fa0f39670e">description</a>;
60
56
<a name="l00046"></a>00046 }
61
57
<a name="l00047"></a>00047 }
62
58
<a name="l00048"></a>00048 <span class="keywordflow">return</span> retval;
65
61
<a name="l00051"></a>00051 <span class="comment">/*</span>
66
62
<a name="l00052"></a>00052 <span class="comment">libofx_get_file_type returns a proper enum from a file type string. </span>
67
63
<a name="l00053"></a>00053 <span class="comment">*/</span>
68
<a name="l00054"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#ff38c12e4e1b9537d55f1ef4c4b8556d">00054</a> <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd84">LibofxFileFormat</a> <a class="code" href="inc_2libofx_8h.html#a3003a2b6fe2fdf0d3ac1843f052f443">libofx_get_file_format_from_str</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structLibofxFileFormatInfo.html">LibofxFileFormatInfo</a> format_list[], <span class="keyword">const</span> <span class="keywordtype">char</span> * file_type_string)
64
<a name="l00054"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#3bf84ecbf6ca512ea73d204c64972dbc">00054</a> <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> <a class="code" href="inc_2libofx_8h.html#5fef31e6dc9df467c269a860aa4af12a" title="libofx_get_file_type returns a proper enum from a file type string.">libofx_get_file_format_from_str</a>(<span class="keyword">const</span> <span class="keyword">struct</span> <a class="code" href="structLibofxFileFormatInfo.html">LibofxFileFormatInfo</a> format_list[], <span class="keyword">const</span> <span class="keywordtype">char</span> * file_type_string)
69
65
<a name="l00055"></a>00055 {
70
<a name="l00056"></a>00056 <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd84">LibofxFileFormat</a> retval = <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd8469d0acaac863ce22d121be6feedc3553">UNKNOWN</a>;
71
<a name="l00057"></a>00057 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; <a class="code" href="inc_2libofx_8h.html#47340ac933be2130bdb93a9be72ed440">LibofxImportFormatList</a>[i].<a class="code" href="structLibofxFileFormatInfo.html#abd04f8817cfaf854b3dfc0ac67db61a">format</a>!=<a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd844b52ee4664b55e98b69e6f61967cabdf">LAST</a>; i++)
66
<a name="l00056"></a>00056 <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> retval = <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de6ce26a62afab55d7606ad4e92428b30c">UNKNOWN</a>;
67
<a name="l00057"></a>00057 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0; <a class="code" href="inc_2libofx_8h.html#b1ad431f1a4db406c34db2833ca80748">LibofxImportFormatList</a>[i].<a class="code" href="structLibofxFileFormatInfo.html#e4b1aa0050ffdc43ce68f07e6330d2f7">format</a>!=<a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de990cd45e93be2b4661f3499e0a658a33">LAST</a>; i++)
72
68
<a name="l00058"></a>00058 {
73
<a name="l00059"></a>00059 <span class="keywordflow">if</span>(strcmp(<a class="code" href="inc_2libofx_8h.html#47340ac933be2130bdb93a9be72ed440">LibofxImportFormatList</a>[i].format_name, file_type_string)==0)
69
<a name="l00059"></a>00059 <span class="keywordflow">if</span>(strcmp(<a class="code" href="inc_2libofx_8h.html#b1ad431f1a4db406c34db2833ca80748">LibofxImportFormatList</a>[i].format_name, file_type_string)==0)
74
70
<a name="l00060"></a>00060 {
75
<a name="l00061"></a>00061 retval = <a class="code" href="inc_2libofx_8h.html#47340ac933be2130bdb93a9be72ed440">LibofxImportFormatList</a>[i].format;
71
<a name="l00061"></a>00061 retval = <a class="code" href="inc_2libofx_8h.html#b1ad431f1a4db406c34db2833ca80748">LibofxImportFormatList</a>[i].<a class="code" href="structLibofxFileFormatInfo.html#e4b1aa0050ffdc43ce68f07e6330d2f7">format</a>;
76
72
<a name="l00062"></a>00062 }
77
73
<a name="l00063"></a>00063 }
78
74
<a name="l00064"></a>00064 <span class="keywordflow">return</span> retval;
79
75
<a name="l00065"></a>00065 }
80
76
<a name="l00066"></a>00066
81
<a name="l00067"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#a89d39d1d9d75a129183026eca85c967">00067</a> <a class="code" href="inc_2libofx_8h.html#78c711cc9f71d9032ea0e2ec66b87e74">CFCT</a> <span class="keywordtype">int</span> <a class="code" href="inc_2libofx_8h.html#a45401e73484b8d562196816789dbf46">libofx_proc_file</a>(<a class="code" href="inc_2libofx_8h.html#15e5ea23015b0e379679d9e8db1057c0">LibofxContextPtr</a> p_libofx_context, <span class="keyword">const</span> <span class="keywordtype">char</span> * p_filename, <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd84">LibofxFileFormat</a> p_file_type)
77
<a name="l00067"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#29b78b5f31a8c75206a8e2b4d665099f">00067</a> <a class="code" href="inc_2libofx_8h.html#47f3130aac7543264fac840fb657cc3d">CFCT</a> <span class="keywordtype">int</span> <a class="code" href="inc_2libofx_8h.html#f5c4a0387f06b5cccd483a1fd392f805" title="libofx_proc_file is the entry point of the library.">libofx_proc_file</a>(<a class="code" href="inc_2libofx_8h.html#cb05196108aab07092d1b4931577b87c">LibofxContextPtr</a> p_libofx_context, <span class="keyword">const</span> <span class="keywordtype">char</span> * p_filename, <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> p_file_type)
82
78
<a name="l00068"></a>00068 {
83
79
<a name="l00069"></a>00069 <a class="code" href="classLibofxContext.html">LibofxContext</a> * libofx_context = (<a class="code" href="classLibofxContext.html">LibofxContext</a> *) p_libofx_context;
84
80
<a name="l00070"></a>00070
85
<a name="l00071"></a>00071 <span class="keywordflow">if</span>(p_file_type==<a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd84412e931fcf6ad79f28960811f5572056">AUTODETECT</a>)
81
<a name="l00071"></a>00071 <span class="keywordflow">if</span>(p_file_type==<a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de9e87dd56d47acdcc5f86eedf6ae0f7a0">AUTODETECT</a>)
86
82
<a name="l00072"></a>00072 {
87
<a name="l00073"></a>00073 <a class="code" href="messages_8cpp.html#99c5e187aa2ee7e5e08fb6e77d63bfe3">message_out</a>(<a class="code" href="messages_8hh.html#7a1786af43f15890c2e84ec7d6f0ea4e7847333fb3b597bfa563ccaae3ef9e65">INFO</a>, string(<span class="stringliteral">"libofx_proc_file(): File format not specified, autodecting..."</span>));
88
<a name="l00074"></a>00074 libofx_context-><a class="code" href="classLibofxContext.html#2346c06f0effbcb6de0296662de49780">setCurrentFileType</a>(<a class="code" href="file__preproc_8cpp.html#66c966ce570524cb29e39babf2f303d5">libofx_detect_file_type</a>(p_filename));
89
<a name="l00075"></a>00075 <a class="code" href="messages_8cpp.html#99c5e187aa2ee7e5e08fb6e77d63bfe3">message_out</a>(INFO, string(<span class="stringliteral">"libofx_proc_file(): Detected file format: "</span>)+
90
<a name="l00076"></a>00076 <a class="code" href="inc_2libofx_8h.html#e6b476fc8d8fbd4e0d190601c74c951b">libofx_get_file_format_description</a>(<a class="code" href="inc_2libofx_8h.html#47340ac933be2130bdb93a9be72ed440">LibofxImportFormatList</a>,
91
<a name="l00077"></a>00077 libofx_context-><a class="code" href="classLibofxContext.html#a1413e81ae62a4efd31f99e4465e4ba2">currentFileType</a>() ));
83
<a name="l00073"></a>00073 <a class="code" href="messages_8cpp.html#6af6947c1ec6fcbefd793f80c26d90fa" title="Message output function.">message_out</a>(<a class="code" href="messages_8hh.html#7cd03dafa59895bc306bf220b7b85f69748005382152808a72b1a9177d9dc806">INFO</a>, <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_proc_file(): File format not specified, autodecting..."</span>));
84
<a name="l00074"></a>00074 libofx_context-><a class="code" href="classLibofxContext.html#4d2c3cd388505cb022910f1a90add712">setCurrentFileType</a>(<a class="code" href="file__preproc_8cpp.html#34e14069654b16390599d24154b1f8d0" title="libofx_detect_file_type tries to analyze a file to determine it&#39;s format.">libofx_detect_file_type</a>(p_filename));
85
<a name="l00075"></a>00075 <a class="code" href="messages_8cpp.html#6af6947c1ec6fcbefd793f80c26d90fa" title="Message output function.">message_out</a>(<a class="code" href="messages_8hh.html#7cd03dafa59895bc306bf220b7b85f69748005382152808a72b1a9177d9dc806">INFO</a>, <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_proc_file(): Detected file format: "</span>)+
86
<a name="l00076"></a>00076 <a class="code" href="inc_2libofx_8h.html#efc89267742d989b5f17708076807b5e" title="get_file_format_description returns a string description of a LibofxFileType.">libofx_get_file_format_description</a>(<a class="code" href="inc_2libofx_8h.html#b1ad431f1a4db406c34db2833ca80748">LibofxImportFormatList</a>,
87
<a name="l00077"></a>00077 libofx_context-><a class="code" href="classLibofxContext.html#bce0e8268dfd2bf42c795cef81367388">currentFileType</a>() ));
92
88
<a name="l00078"></a>00078 }
93
89
<a name="l00079"></a>00079 <span class="keywordflow">else</span>
94
90
<a name="l00080"></a>00080 {
95
<a name="l00081"></a>00081 libofx_context-><a class="code" href="classLibofxContext.html#2346c06f0effbcb6de0296662de49780">setCurrentFileType</a>(<a class="code" href="file__preproc_8cpp.html#66c966ce570524cb29e39babf2f303d5">libofx_detect_file_type</a>(p_filename));
96
<a name="l00082"></a>00082 <a class="code" href="messages_8cpp.html#99c5e187aa2ee7e5e08fb6e77d63bfe3">message_out</a>(<a class="code" href="messages_8hh.html#7a1786af43f15890c2e84ec7d6f0ea4e7847333fb3b597bfa563ccaae3ef9e65">INFO</a>,
97
<a name="l00083"></a>00083 string(<span class="stringliteral">"libofx_proc_file(): File format forced to: "</span>)+
98
<a name="l00084"></a>00084 <a class="code" href="inc_2libofx_8h.html#e6b476fc8d8fbd4e0d190601c74c951b">libofx_get_file_format_description</a>(<a class="code" href="inc_2libofx_8h.html#47340ac933be2130bdb93a9be72ed440">LibofxImportFormatList</a>,
99
<a name="l00085"></a>00085 libofx_context-><a class="code" href="classLibofxContext.html#a1413e81ae62a4efd31f99e4465e4ba2">currentFileType</a>() ));
91
<a name="l00081"></a>00081 libofx_context-><a class="code" href="classLibofxContext.html#4d2c3cd388505cb022910f1a90add712">setCurrentFileType</a>(<a class="code" href="file__preproc_8cpp.html#34e14069654b16390599d24154b1f8d0" title="libofx_detect_file_type tries to analyze a file to determine it&#39;s format.">libofx_detect_file_type</a>(p_filename));
92
<a name="l00082"></a>00082 <a class="code" href="messages_8cpp.html#6af6947c1ec6fcbefd793f80c26d90fa" title="Message output function.">message_out</a>(<a class="code" href="messages_8hh.html#7cd03dafa59895bc306bf220b7b85f69748005382152808a72b1a9177d9dc806">INFO</a>,
93
<a name="l00083"></a>00083 <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_proc_file(): File format forced to: "</span>)+
94
<a name="l00084"></a>00084 <a class="code" href="inc_2libofx_8h.html#efc89267742d989b5f17708076807b5e" title="get_file_format_description returns a string description of a LibofxFileType.">libofx_get_file_format_description</a>(<a class="code" href="inc_2libofx_8h.html#b1ad431f1a4db406c34db2833ca80748">LibofxImportFormatList</a>,
95
<a name="l00085"></a>00085 libofx_context-><a class="code" href="classLibofxContext.html#bce0e8268dfd2bf42c795cef81367388">currentFileType</a>() ));
100
96
<a name="l00086"></a>00086 }
101
97
<a name="l00087"></a>00087
102
<a name="l00088"></a>00088 <span class="keywordflow">switch</span> (libofx_context-><a class="code" href="classLibofxContext.html#a1413e81ae62a4efd31f99e4465e4ba2">currentFileType</a>())
98
<a name="l00088"></a>00088 <span class="keywordflow">switch</span> (libofx_context-><a class="code" href="classLibofxContext.html#bce0e8268dfd2bf42c795cef81367388">currentFileType</a>())
103
99
<a name="l00089"></a>00089 {
104
<a name="l00090"></a>00090 <span class="keywordflow">case</span> <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd84fe1965b308c1707453a2f21f81fc6d57">OFX</a>: <a class="code" href="ofx__preproc_8cpp.html#7b1cf1b458173b5f65bc8d2663121202">ofx_proc_file</a>(libofx_context, p_filename);
100
<a name="l00090"></a>00090 <span class="keywordflow">case</span> <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de08ab55dc6141faaa0b67a401e9a8801d">OFX</a>: <a class="code" href="ofx__preproc_8cpp.html#f2eca18ef5a500e7f76ed180d0af8a0a" title="File pre-processing of OFX AND for OFC files.">ofx_proc_file</a>(libofx_context, p_filename);
105
101
<a name="l00091"></a>00091 <span class="keywordflow">break</span>;
106
<a name="l00092"></a>00092 <span class="keywordflow">case</span> <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd8446cd06768ae2b26e672db0177cc82712">OFC</a>: <a class="code" href="ofx__preproc_8cpp.html#7b1cf1b458173b5f65bc8d2663121202">ofx_proc_file</a>(libofx_context, p_filename);
102
<a name="l00092"></a>00092 <span class="keywordflow">case</span> <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736debd42446b99427483c7f3bee70bb217f7">OFC</a>: <a class="code" href="ofx__preproc_8cpp.html#f2eca18ef5a500e7f76ed180d0af8a0a" title="File pre-processing of OFX AND for OFC files.">ofx_proc_file</a>(libofx_context, p_filename);
107
103
<a name="l00093"></a>00093 <span class="keywordflow">break</span>;
108
<a name="l00094"></a>00094 <span class="keywordflow">default</span>: <a class="code" href="messages_8cpp.html#99c5e187aa2ee7e5e08fb6e77d63bfe3">message_out</a>(<a class="code" href="messages_8hh.html#7a1786af43f15890c2e84ec7d6f0ea4e64607d002c20e2489bd4d131ad466aa9">ERROR</a>, string(<span class="stringliteral">"libofx_proc_file(): Detected file format not yet supported ou couldn't detect file format; aborting."</span>));
104
<a name="l00094"></a>00094 <span class="keywordflow">default</span>: <a class="code" href="messages_8cpp.html#6af6947c1ec6fcbefd793f80c26d90fa" title="Message output function.">message_out</a>(<a class="code" href="messages_8hh.html#7cd03dafa59895bc306bf220b7b85f692fd6f336d08340583bd620a7f5694c90">ERROR</a>, <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_proc_file(): Detected file format not yet supported ou couldn't detect file format; aborting."</span>));
109
105
<a name="l00095"></a>00095 }
110
106
<a name="l00096"></a>00096 <span class="keywordflow">return</span> 0;
111
107
<a name="l00097"></a>00097 }
112
108
<a name="l00098"></a>00098
113
<a name="l00099"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#66c966ce570524cb29e39babf2f303d5">00099</a> <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd84">LibofxFileFormat</a> <a class="code" href="file__preproc_8cpp.html#66c966ce570524cb29e39babf2f303d5">libofx_detect_file_type</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * p_filename)
109
<a name="l00099"></a><a class="code" href="fx-0_88_82_2lib_2file__preproc_8cpp.html#34e14069654b16390599d24154b1f8d0">00099</a> <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> <a class="code" href="file__preproc_8cpp.html#34e14069654b16390599d24154b1f8d0" title="libofx_detect_file_type tries to analyze a file to determine it&#39;s format.">libofx_detect_file_type</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * p_filename)
114
110
<a name="l00100"></a>00100 {
115
<a name="l00101"></a>00101 <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd84">LibofxFileFormat</a> retval = <a class="code" href="inc_2libofx_8h.html#b13650ecdb69a39a228ec00b995ffd8469d0acaac863ce22d121be6feedc3553">UNKNOWN</a>;
111
<a name="l00101"></a>00101 <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> retval = <a class="code" href="inc_2libofx_8h.html#954c5e33f48105c5d932d4842e7736de6ce26a62afab55d7606ad4e92428b30c">UNKNOWN</a>;
116
112
<a name="l00102"></a>00102 ifstream input_file;
117
<a name="l00103"></a>00103 <span class="keywordtype">char</span> buffer[<a class="code" href="file__preproc_8cpp.html#9eee3543dcaefab6e13ffd2868c07aaa">READ_BUFFER_SIZE</a>];
118
<a name="l00104"></a>00104 string s_buffer;
113
<a name="l00103"></a>00103 <span class="keywordtype">char</span> buffer[<a class="code" href="file__preproc_8cpp.html#3a4f15870bd5573d14fceb17c65162ee">READ_BUFFER_SIZE</a>];
114
<a name="l00104"></a>00104 <span class="keywordtype">string</span> s_buffer;
119
115
<a name="l00105"></a>00105 <span class="keywordtype">bool</span> type_found=<span class="keyword">false</span>;
120
116
<a name="l00106"></a>00106
121
117
<a name="l00107"></a>00107 <span class="keywordflow">if</span>(p_filename!=NULL&&strcmp(p_filename,<span class="stringliteral">""</span>)!=0)
122
118
<a name="l00108"></a>00108 {
123
<a name="l00109"></a>00109 <a class="code" href="messages_8cpp.html#99c5e187aa2ee7e5e08fb6e77d63bfe3">message_out</a>(<a class="code" href="messages_8hh.html#7a1786af43f15890c2e84ec7d6f0ea4e099c8c241f62f143c876690f7464e786">DEBUG</a>, string(<span class="stringliteral">"libofx_detect_file_type():Opening file: "</span>)+p_filename);
119
<a name="l00109"></a>00109 <a class="code" href="messages_8cpp.html#6af6947c1ec6fcbefd793f80c26d90fa" title="Message output function.">message_out</a>(<a class="code" href="messages_8hh.html#7cd03dafa59895bc306bf220b7b85f690593585da9181e972974c1274d8f2b4f">DEBUG</a>, <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_detect_file_type():Opening file: "</span>)+p_filename);
124
120
<a name="l00110"></a>00110
125
121
<a name="l00111"></a>00111 input_file.open(p_filename);
126
122
<a name="l00112"></a>00112
127
123
<a name="l00113"></a>00113 <span class="keywordflow">if</span>(!input_file)
128
124
<a name="l00114"></a>00114 {
129
<a name="l00115"></a>00115 <a class="code" href="messages_8cpp.html#99c5e187aa2ee7e5e08fb6e77d63bfe3">message_out</a>(<a class="code" href="messages_8hh.html#7a1786af43f15890c2e84ec7d6f0ea4e64607d002c20e2489bd4d131ad466aa9">ERROR</a>,<span class="stringliteral">"libofx_detect_file_type():Unable to open the input file "</span>+string(p_filename));
125
<a name="l00115"></a>00115 <a class="code" href="messages_8cpp.html#6af6947c1ec6fcbefd793f80c26d90fa" title="Message output function.">message_out</a>(<a class="code" href="messages_8hh.html#7cd03dafa59895bc306bf220b7b85f692fd6f336d08340583bd620a7f5694c90">ERROR</a>,<span class="stringliteral">"libofx_detect_file_type():Unable to open the input file "</span>+<span class="keywordtype">string</span>(p_filename));
130
126
<a name="l00116"></a>00116 <span class="keywordflow">return</span> retval;
131
127
<a name="l00117"></a>00117 }
132
128
<a name="l00118"></a>00118 <span class="keywordflow">else</span>