1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>LibOFX: file_preproc.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">LibOFX
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('fx-0_89_810_2lib_2file__preproc_8cpp_source.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">fx-0.9.10/lib/file_preproc.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="fx-0_89_810_2lib_2file__preproc_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/***************************************************************************</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> file_preproc.cpp</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> -------------------</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> copyright : (C) 2004 by Benoit GrĂ©goire</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> email : benoitg@coeus.ca</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment">***************************************************************************/</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment">/***************************************************************************</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * *</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * This program is free software; you can redistribute it and/or modify *</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * it under the terms of the GNU General Public License as published by *</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> * the Free Software Foundation; either version 2 of the License, or *</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * (at your option) any later version. *</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * *</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> ***************************************************************************/</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="preprocessor">#include <iostream></span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <fstream></span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include <stdlib.h></span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="preprocessor">#include <stdio.h></span></div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span> <span class="preprocessor">#include <string></span></div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> <span class="preprocessor">#include "libofx.h"</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="preprocessor">#include "<a class="code" href="fx-0_89_810_2lib_2messages_8hh.html">messages.hh</a>"</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> <span class="preprocessor">#include "<a class="code" href="fx-0_89_810_2lib_2ofx__preproc_8hh.html">ofx_preproc.hh</a>"</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> <span class="preprocessor">#include "context.hh"</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> <span class="preprocessor">#include "<a class="code" href="fx-0_89_810_2lib_2file__preproc_8hh.html">file_preproc.hh</a>"</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span> </div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keyword">using namespace </span>std;</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> READ_BUFFER_SIZE = 1024;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span> </div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span> <span class="comment">/* get_file_type_description returns a string description of a LibofxFileType</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span> <span class="comment"> * suitable for debugging output or user communication.</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a01e232aea6806e09e048c98c94a49b66"> 37</a></span> <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a01e232aea6806e09e048c98c94a49b66">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#a954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> file_format)</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span> {</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="keyword">const</span> <span class="keywordtype">char</span> * retval = <span class="stringliteral">"UNKNOWN (File format couldn't be successfully identified)"</span>;</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; LibofxImportFormatList[i].<a class="code" href="structLibofxFileFormatInfo.html#ae4b1aa0050ffdc43ce68f07e6330d2f7">format</a> != <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea990cd45e93be2b4661f3499e0a658a33">LAST</a>; i++)</div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  {</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordflow">if</span> (LibofxImportFormatList[i].format == file_format)</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  {</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  retval = LibofxImportFormatList[i].<a class="code" href="structLibofxFileFormatInfo.html#a8bebf92cbc4c75c7488b9cf8515ea68a">description</a>;</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  }</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  }</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordflow">return</span> retval;</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span> };</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span> </div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> <span class="comment">/*</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> <span class="comment">libofx_get_file_type returns a proper enum from a file type string.</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span> <span class="comment">*/</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a3bf84ecbf6ca512ea73d204c64972dbc"> 54</a></span> <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> <a class="code" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a3bf84ecbf6ca512ea73d204c64972dbc">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)</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span> {</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> retval = <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea6ce26a62afab55d7606ad4e92428b30c">UNKNOWN</a>;</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; LibofxImportFormatList[i].<a class="code" href="structLibofxFileFormatInfo.html#ae4b1aa0050ffdc43ce68f07e6330d2f7">format</a> != <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea990cd45e93be2b4661f3499e0a658a33">LAST</a>; i++)</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  {</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordflow">if</span> (strcmp(LibofxImportFormatList[i].format_name, file_type_string) == 0)</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  {</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  retval = LibofxImportFormatList[i].<a class="code" href="structLibofxFileFormatInfo.html#ae4b1aa0050ffdc43ce68f07e6330d2f7">format</a>;</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  }</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  }</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">return</span> retval;</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span> }</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span> </div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a7d14db73e2f828250874b6311c3d85ed"> 67</a></span> <span class="keywordtype">int</span> <a class="code" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a7d14db73e2f828250874b6311c3d85ed">libofx_proc_file</a>(LibofxContextPtr p_libofx_context, <span class="keyword">const</span> <span class="keywordtype">char</span> * p_filename, <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> p_file_type)</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span> {</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <a class="code" href="classLibofxContext.html">LibofxContext</a> * libofx_context = (<a class="code" href="classLibofxContext.html">LibofxContext</a> *) p_libofx_context;</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">if</span> (p_file_type == <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea9e87dd56d47acdcc5f86eedf6ae0f7a0">AUTODETECT</a>)</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  {</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a748005382152808a72b1a9177d9dc806">INFO</a>, <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_proc_file(): File format not specified, autodetecting..."</span>));</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  libofx_context->setCurrentFileType(<a class="code" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a34e14069654b16390599d24154b1f8d0">libofx_detect_file_type</a>(p_filename));</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a748005382152808a72b1a9177d9dc806">INFO</a>, <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_proc_file(): Detected file format: "</span>) +</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <a class="code" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a01e232aea6806e09e048c98c94a49b66">libofx_get_file_format_description</a>(LibofxImportFormatList,</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  libofx_context->currentFileType() ));</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  }</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  {</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  libofx_context->setCurrentFileType(<a class="code" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a34e14069654b16390599d24154b1f8d0">libofx_detect_file_type</a>(p_filename));</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a748005382152808a72b1a9177d9dc806">INFO</a>,</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_proc_file(): File format forced to: "</span>) +</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <a class="code" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a01e232aea6806e09e048c98c94a49b66">libofx_get_file_format_description</a>(LibofxImportFormatList,</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  libofx_context->currentFileType() ));</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  }</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span> </div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordflow">switch</span> (libofx_context->currentFileType())</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  {</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="keywordflow">case</span> <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea08ab55dc6141faaa0b67a401e9a8801d">OFX</a>:</div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <a class="code" href="ofx__preproc_8cpp.html#af1f5bbdc804d79403fc544e2829b3e0f">ofx_proc_file</a>(libofx_context, p_filename);</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="keywordflow">case</span> <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736deabd42446b99427483c7f3bee70bb217f7">OFC</a>:</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <a class="code" href="ofx__preproc_8cpp.html#af1f5bbdc804d79403fc544e2829b3e0f">ofx_proc_file</a>(libofx_context, p_filename);</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a2fd6f336d08340583bd620a7f5694c90">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>));</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  }</div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span> }</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a34e14069654b16390599d24154b1f8d0"> 102</a></span> <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> <a class="code" href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a34e14069654b16390599d24154b1f8d0">libofx_detect_file_type</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> * p_filename)</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> {</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keyword">enum</span> <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a> retval = <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea6ce26a62afab55d7606ad4e92428b30c">UNKNOWN</a>;</div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  ifstream input_file;</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordtype">char</span> buffer[READ_BUFFER_SIZE];</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordtype">string</span> s_buffer;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordtype">bool</span> type_found = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span> </div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordflow">if</span> (p_filename != NULL && strcmp(p_filename, <span class="stringliteral">""</span>) != 0)</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  {</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a0593585da9181e972974c1274d8f2b4f">DEBUG</a>, <span class="keywordtype">string</span>(<span class="stringliteral">"libofx_detect_file_type():Opening file: "</span>) + p_filename);</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  input_file.open(p_filename);</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> </div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">if</span> (!input_file)</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  {</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a2fd6f336d08340583bd620a7f5694c90">ERROR</a>, <span class="stringliteral">"libofx_detect_file_type():Unable to open the input file "</span> + <span class="keywordtype">string</span>(p_filename));</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">return</span> retval;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  }</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  {</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="keywordflow">do</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  {</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  input_file.getline(buffer, <span class="keyword">sizeof</span>(buffer), <span class="charliteral">'\n'</span>);</div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="comment">//cout<<buffer<<"\n";</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  s_buffer.assign(buffer);</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="comment">//cout<<"input_file.gcount(): "<<input_file.gcount()<<" sizeof(buffer): "<<sizeof(buffer)<<endl;</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordflow">if</span> (input_file.gcount() < (<span class="keyword">sizeof</span>(buffer) - 1))</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  {</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  s_buffer.append(<span class="stringliteral">"\n"</span>);<span class="comment">//Just in case...</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  }</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( !input_file.eof() && input_file.fail())</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  {</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  input_file.clear();</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  }</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> </div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordflow">if</span> (s_buffer.find(<span class="stringliteral">"<OFX>"</span>) != string::npos || s_buffer.find(<span class="stringliteral">"<ofx>"</span>) != string::npos)</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  {</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a0593585da9181e972974c1274d8f2b4f">DEBUG</a>, <span class="stringliteral">"libofx_detect_file_type():<OFX> tag has been found"</span>);</div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  retval = <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea08ab55dc6141faaa0b67a401e9a8801d">OFX</a>;</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  type_found = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  }</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (s_buffer.find(<span class="stringliteral">"<OFC>"</span>) != string::npos || s_buffer.find(<span class="stringliteral">"<ofc>"</span>) != string::npos)</div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  {</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a0593585da9181e972974c1274d8f2b4f">DEBUG</a>, <span class="stringliteral">"libofx_detect_file_type():<OFC> tag has been found"</span>);</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  retval = <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736deabd42446b99427483c7f3bee70bb217f7">OFC</a>;</div>
<div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  type_found = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  }</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span> </div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  }</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <span class="keywordflow">while</span> (type_found == <span class="keyword">false</span> && !input_file.eof() && !input_file.bad());</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  }</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  input_file.close();</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  }</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="keywordflow">else</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  {</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a2fd6f336d08340583bd620a7f5694c90">ERROR</a>, <span class="stringliteral">"libofx_detect_file_type(): No input file specified"</span>);</div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  }</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordflow">if</span> (retval == <a class="code" href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea6ce26a62afab55d7606ad4e92428b30c">UNKNOWN</a>)</div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <a class="code" href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a>(<a class="code" href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a2fd6f336d08340583bd620a7f5694c90">ERROR</a>, <span class="stringliteral">"libofx_detect_file_type(): Failed to identify input file format"</span>);</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="keywordflow">return</span> retval;</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span> }</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span> </div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span> </div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span> </div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span> </div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span> </div>
<div class="ttc" id="inc_2libofx_8h_html_a954c5e33f48105c5d932d4842e7736dea9e87dd56d47acdcc5f86eedf6ae0f7a0"><div class="ttname"><a href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea9e87dd56d47acdcc5f86eedf6ae0f7a0">AUTODETECT</a></div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00124">inc/libofx.h:124</a></div></div>
<div class="ttc" id="structLibofxFileFormatInfo_html"><div class="ttname"><a href="structLibofxFileFormatInfo.html">LibofxFileFormatInfo</a></div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00132">inc/libofx.h:132</a></div></div>
<div class="ttc" id="structLibofxFileFormatInfo_html_ae4b1aa0050ffdc43ce68f07e6330d2f7"><div class="ttname"><a href="structLibofxFileFormatInfo.html#ae4b1aa0050ffdc43ce68f07e6330d2f7">LibofxFileFormatInfo::format</a></div><div class="ttdeci">enum LibofxFileFormat format</div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00134">inc/libofx.h:134</a></div></div>
<div class="ttc" id="messages_8hh_html_a7cd03dafa59895bc306bf220b7b85f69a748005382152808a72b1a9177d9dc806"><div class="ttname"><a href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a748005382152808a72b1a9177d9dc806">INFO</a></div><div class="ttdef"><b>Definition:</b> <a href="messages_8hh_source.html#l00032">messages.hh:32</a></div></div>
<div class="ttc" id="structLibofxFileFormatInfo_html_a8bebf92cbc4c75c7488b9cf8515ea68a"><div class="ttname"><a href="structLibofxFileFormatInfo.html#a8bebf92cbc4c75c7488b9cf8515ea68a">LibofxFileFormatInfo::description</a></div><div class="ttdeci">const char * description</div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00136">inc/libofx.h:136</a></div></div>
<div class="ttc" id="ofx__preproc_8cpp_html_af1f5bbdc804d79403fc544e2829b3e0f"><div class="ttname"><a href="ofx__preproc_8cpp.html#af1f5bbdc804d79403fc544e2829b3e0f">ofx_proc_file</a></div><div class="ttdeci">int ofx_proc_file(LibofxContextPtr ctx, const char *p_filename)</div><div class="ttdoc">File pre-processing of OFX AND for OFC files. </div><div class="ttdef"><b>Definition:</b> <a href="ofx__preproc_8cpp_source.html#l00081">ofx_preproc.cpp:81</a></div></div>
<div class="ttc" id="inc_2libofx_8h_html_a954c5e33f48105c5d932d4842e7736dea08ab55dc6141faaa0b67a401e9a8801d"><div class="ttname"><a href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea08ab55dc6141faaa0b67a401e9a8801d">OFX</a></div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00125">inc/libofx.h:125</a></div></div>
<div class="ttc" id="classLibofxContext_html"><div class="ttname"><a href="classLibofxContext.html">LibofxContext</a></div><div class="ttdef"><b>Definition:</b> <a href="context_8hh_source.html#l00025">context.hh:25</a></div></div>
<div class="ttc" id="fx-0_89_810_2lib_2file__preproc_8cpp_html_a7d14db73e2f828250874b6311c3d85ed"><div class="ttname"><a href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a7d14db73e2f828250874b6311c3d85ed">libofx_proc_file</a></div><div class="ttdeci">int libofx_proc_file(LibofxContextPtr p_libofx_context, const char *p_filename, LibofxFileFormat p_file_type)</div><div class="ttdoc">libofx_proc_file is the entry point of the library. </div><div class="ttdef"><b>Definition:</b> <a href="fx-0_89_810_2lib_2file__preproc_8cpp_source.html#l00067">fx-0.9.10/lib/file_preproc.cpp:67</a></div></div>
<div class="ttc" id="fx-0_89_810_2lib_2messages_8hh_html"><div class="ttname"><a href="fx-0_89_810_2lib_2messages_8hh.html">messages.hh</a></div><div class="ttdoc">Message IO functionality. </div></div>
<div class="ttc" id="inc_2libofx_8h_html_a954c5e33f48105c5d932d4842e7736dea990cd45e93be2b4661f3499e0a658a33"><div class="ttname"><a href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea990cd45e93be2b4661f3499e0a658a33">LAST</a></div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00129">inc/libofx.h:129</a></div></div>
<div class="ttc" id="inc_2libofx_8h_html_a954c5e33f48105c5d932d4842e7736dea6ce26a62afab55d7606ad4e92428b30c"><div class="ttname"><a href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736dea6ce26a62afab55d7606ad4e92428b30c">UNKNOWN</a></div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00128">inc/libofx.h:128</a></div></div>
<div class="ttc" id="fx-0_89_810_2lib_2file__preproc_8cpp_html_a3bf84ecbf6ca512ea73d204c64972dbc"><div class="ttname"><a href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a3bf84ecbf6ca512ea73d204c64972dbc">libofx_get_file_format_from_str</a></div><div class="ttdeci">enum LibofxFileFormat libofx_get_file_format_from_str(const struct LibofxFileFormatInfo format_list[], const char *file_type_string)</div><div class="ttdoc">libofx_get_file_type returns a proper enum from a file type string. </div><div class="ttdef"><b>Definition:</b> <a href="fx-0_89_810_2lib_2file__preproc_8cpp_source.html#l00054">fx-0.9.10/lib/file_preproc.cpp:54</a></div></div>
<div class="ttc" id="messages_8cpp_html_a6af6947c1ec6fcbefd793f80c26d90fa"><div class="ttname"><a href="messages_8cpp.html#a6af6947c1ec6fcbefd793f80c26d90fa">message_out</a></div><div class="ttdeci">int message_out(OfxMsgType error_type, const string message)</div><div class="ttdoc">Message output function. </div><div class="ttdef"><b>Definition:</b> <a href="messages_8cpp_source.html#l00060">messages.cpp:60</a></div></div>
<div class="ttc" id="fx-0_89_810_2lib_2file__preproc_8cpp_html_a01e232aea6806e09e048c98c94a49b66"><div class="ttname"><a href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a01e232aea6806e09e048c98c94a49b66">libofx_get_file_format_description</a></div><div class="ttdeci">const char * libofx_get_file_format_description(const struct LibofxFileFormatInfo format_list[], enum LibofxFileFormat file_format)</div><div class="ttdoc">get_file_format_description returns a string description of a LibofxFileType. </div><div class="ttdef"><b>Definition:</b> <a href="fx-0_89_810_2lib_2file__preproc_8cpp_source.html#l00037">fx-0.9.10/lib/file_preproc.cpp:37</a></div></div>
<div class="ttc" id="messages_8hh_html_a7cd03dafa59895bc306bf220b7b85f69a0593585da9181e972974c1274d8f2b4f"><div class="ttname"><a href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a0593585da9181e972974c1274d8f2b4f">DEBUG</a></div><div class="ttdef"><b>Definition:</b> <a href="messages_8hh_source.html#l00025">messages.hh:25</a></div></div>
<div class="ttc" id="fx-0_89_810_2lib_2file__preproc_8hh_html"><div class="ttname"><a href="fx-0_89_810_2lib_2file__preproc_8hh.html">file_preproc.hh</a></div><div class="ttdoc">Preprocessing of the OFX files before parsing. </div></div>
<div class="ttc" id="messages_8hh_html_a7cd03dafa59895bc306bf220b7b85f69a2fd6f336d08340583bd620a7f5694c90"><div class="ttname"><a href="messages_8hh.html#a7cd03dafa59895bc306bf220b7b85f69a2fd6f336d08340583bd620a7f5694c90">ERROR</a></div><div class="ttdef"><b>Definition:</b> <a href="messages_8hh_source.html#l00034">messages.hh:34</a></div></div>
<div class="ttc" id="inc_2libofx_8h_html_a954c5e33f48105c5d932d4842e7736deabd42446b99427483c7f3bee70bb217f7"><div class="ttname"><a href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736deabd42446b99427483c7f3bee70bb217f7">OFC</a></div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00126">inc/libofx.h:126</a></div></div>
<div class="ttc" id="fx-0_89_810_2lib_2file__preproc_8cpp_html_a34e14069654b16390599d24154b1f8d0"><div class="ttname"><a href="fx-0_89_810_2lib_2file__preproc_8cpp.html#a34e14069654b16390599d24154b1f8d0">libofx_detect_file_type</a></div><div class="ttdeci">enum LibofxFileFormat libofx_detect_file_type(const char *p_filename)</div><div class="ttdoc">libofx_detect_file_type tries to analyze a file to determine it's format. </div><div class="ttdef"><b>Definition:</b> <a href="fx-0_89_810_2lib_2file__preproc_8cpp_source.html#l00102">fx-0.9.10/lib/file_preproc.cpp:102</a></div></div>
<div class="ttc" id="inc_2libofx_8h_html_a954c5e33f48105c5d932d4842e7736de"><div class="ttname"><a href="inc_2libofx_8h.html#a954c5e33f48105c5d932d4842e7736de">LibofxFileFormat</a></div><div class="ttdeci">LibofxFileFormat</div><div class="ttdef"><b>Definition:</b> <a href="inc_2libofx_8h_source.html#l00122">inc/libofx.h:122</a></div></div>
<div class="ttc" id="fx-0_89_810_2lib_2ofx__preproc_8hh_html"><div class="ttname"><a href="fx-0_89_810_2lib_2ofx__preproc_8hh.html">ofx_preproc.hh</a></div><div class="ttdoc">Preprocessing of the OFX files before parsing. </div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_2dabe2c45d94ff6afd4ea031fd8e0e92.html">libofx-0.9.10</a></li><li class="navelem"><a class="el" href="dir_4173102e197cd33c0b2a8d4b2328250f.html">lib</a></li><li class="navelem"><a class="el" href="fx-0_89_810_2lib_2file__preproc_8cpp.html">file_preproc.cpp</a></li>
<li class="footer">Generated on Fri Sep 12 2014 15:59:20 for LibOFX by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.6 </li>
</ul>
</div>
</body>
</html>
|