File: inchiformat_8h_source.shtml

package info (click to toggle)
openbabel 2.3.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 75,308 kB
  • ctags: 41,952
  • sloc: cpp: 321,252; ansic: 89,228; python: 7,262; perl: 6,418; pascal: 793; sh: 194; xml: 97; ruby: 55; makefile: 47; java: 23
file content (300 lines) | stat: -rw-r--r-- 29,682 bytes parent folder | download | duplicates (3)
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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Open Babel: inchiformat.h Source File</title>
<link href="/site.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="search/search.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
</head>

<body>

<!--#include file="header.html" -->
<!-- Generated by Doxygen 1.7.2 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.shtml"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.shtml"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.shtml"><span>Modules</span></a></li>
      <li><a href="namespaces.shtml"><span>Namespaces</span></a></li>
      <li><a href="annotated.shtml"><span>Classes</span></a></li>
      <li class="current"><a href="files.shtml"><span>Files</span></a></li>
      <li><a href="examples.shtml"><span>Examples</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.shtml"><span>File&#160;List</span></a></li>
      <li><a href="globals.shtml"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>inchiformat.h</h1>  </div>
</div>
<div class="contents">
<a href="inchiformat_8h.shtml">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/**********************************************************************</span>
<a name="l00002"></a>00002 <span class="comment">Copyright (C) 2005,2006,2007 Chris Morley</span>
<a name="l00003"></a>00003 <span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">Based on the IUPAC InChI reference software, which is distributed</span>
<a name="l00005"></a>00005 <span class="comment">under the GNU LGPL:</span>
<a name="l00006"></a>00006 <span class="comment">Copyright (C) 2005 The International Union of Pure and Applied Chemistry</span>
<a name="l00007"></a>00007 <span class="comment">IUPAC International Chemical Identifier (InChI) (contact:secretariat@iupac.org)</span>
<a name="l00008"></a>00008 <span class="comment"></span>
<a name="l00009"></a>00009 <span class="comment">This program is free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment">it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment">the Free Software Foundation version 2 of the License.</span>
<a name="l00012"></a>00012 <span class="comment"></span>
<a name="l00013"></a>00013 <span class="comment">This program is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment">but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00016"></a>00016 <span class="comment">GNU General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment">***********************************************************************/</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;openbabel/babelconfig.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;<a class="code" href="mol_8h.shtml" title="Handle molecules. Declarations of OBMol, OBAtom, OBBond, OBResidue. (the main header for Open Babel)...">openbabel/mol.h</a>&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;<a class="code" href="obconversion_8h.shtml" title="Handle file conversions. Declaration of OBFormat, OBConversion.">openbabel/obconversion.h</a>&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;<a class="code" href="obmolecformat_8h.shtml" title="Subclass of OBFormat for conversion of OBMol.">openbabel/obmolecformat.h</a>&gt;</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;inchi_api.h&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#ifdef HAVE_SSTREAM</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sstream&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#else</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#include &lt;strstream&gt;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#endif</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#include &lt;set&gt;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;<a class="code" href="chiral_8h.shtml" title="Detect chiral atoms and molecules.">openbabel/chiral.h</a>&quot;</span>
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="keyword">using namespace </span>std;
<a name="l00034"></a>00034 <span class="keyword">namespace </span>OpenBabel
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 <span class="keyword">extern</span> <span class="keywordtype">string</span> <a class="code" href="namespaceOpenBabel.shtml#a2125d19f69be16ee30183e9fa65c05d1">GetInChI</a>(istream&amp; is);
<a name="l00037"></a>00037 
<a name="l00038"></a><a class="code" href="classOpenBabel_1_1InChIFormat.shtml">00038</a> <span class="keyword">class </span><a class="code" href="classOpenBabel_1_1InChIFormat.shtml">InChIFormat</a> : <span class="keyword">public</span> <a class="code" href="classOpenBabel_1_1OBMoleculeFormat.shtml" title="An OBFormat convenience subclass for conversion to/from OBMol data.">OBMoleculeFormat</a>
<a name="l00039"></a>00039 {
<a name="l00040"></a>00040 <span class="keyword">public</span>:
<a name="l00041"></a><a class="code" href="classOpenBabel_1_1InChIFormat.shtml#ab067ea3126693da85fb6a5b158447d01">00041</a>   <a class="code" href="classOpenBabel_1_1InChIFormat.shtml">InChIFormat</a>()
<a name="l00042"></a>00042   {
<a name="l00043"></a>00043     OBConversion::RegisterFormat(<span class="stringliteral">&quot;inchi&quot;</span>,<span class="keyword">this</span>);
<a name="l00044"></a>00044     OBConversion::RegisterOptionParam(<span class="stringliteral">&quot;n&quot;</span>, <span class="keyword">this</span>, 0, OBConversion::INOPTIONS);
<a name="l00045"></a>00045     OBConversion::RegisterOptionParam(<span class="stringliteral">&quot;t&quot;</span>, <span class="keyword">this</span>);
<a name="l00046"></a>00046     OBConversion::RegisterOptionParam(<span class="stringliteral">&quot;l&quot;</span>, <span class="keyword">this</span>);
<a name="l00047"></a>00047     OBConversion::RegisterOptionParam(<span class="stringliteral">&quot;X&quot;</span>, <span class="keyword">this</span>, 1, OBConversion::OUTOPTIONS);
<a name="l00048"></a>00048     OBConversion::RegisterOptionParam(<span class="stringliteral">&quot;K&quot;</span>, <span class="keyword">this</span>, 0, OBConversion::OUTOPTIONS);
<a name="l00049"></a>00049     OBConversion::RegisterOptionParam(<span class="stringliteral">&quot;F&quot;</span>, <span class="keyword">this</span>, 0, OBConversion::OUTOPTIONS);
<a name="l00050"></a>00050     OBConversion::RegisterOptionParam(<span class="stringliteral">&quot;X&quot;</span>, <span class="keyword">this</span>, 1, OBConversion::INOPTIONS);
<a name="l00051"></a>00051     OBConversion::RegisterOptionParam(<span class="stringliteral">&quot;T&quot;</span>, <span class="keyword">this</span>, 1, OBConversion::OUTOPTIONS);
<a name="l00052"></a>00052   }
<a name="l00053"></a>00053 
<a name="l00054"></a><a class="code" href="classOpenBabel_1_1InChIFormat.shtml#a4a6b8d1611d5d963fc29982cc1ebcbf7">00054</a>   <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* Description()
<a name="l00055"></a>00055   {
<a name="l00056"></a>00056     <span class="keywordflow">return</span>
<a name="l00057"></a>00057     <span class="stringliteral">&quot;InChI format\n&quot;</span>
<a name="l00058"></a>00058     <span class="stringliteral">&quot;IUPAC/NIST molecular identifier\n\n&quot;</span>
<a name="l00059"></a>00059 
<a name="l00060"></a>00060     <span class="stringliteral">&quot;Write Options, e.g. -xat\n&quot;</span>
<a name="l00061"></a>00061     <span class="stringliteral">&quot;    Standard InChI is written unless certain InChI options are used\n&quot;</span>
<a name="l00062"></a>00062     <span class="stringliteral">&quot; K output InChIKey only\n&quot;</span>
<a name="l00063"></a>00063     <span class="stringliteral">&quot; t add molecule name after InChI\n&quot;</span>
<a name="l00064"></a>00064     <span class="stringliteral">&quot; w ignore less important warnings\n&quot;</span>
<a name="l00065"></a>00065     <span class="stringliteral">&quot;    These are:\n&quot;</span>
<a name="l00066"></a>00066     <span class="stringliteral">&quot;    \&#39;Omitted undefined stereo\&#39;\n&quot;</span>
<a name="l00067"></a>00067     <span class="stringliteral">&quot;    \&#39;Charges were rearranged\&#39;\n&quot;</span>
<a name="l00068"></a>00068     <span class="stringliteral">&quot;    \&#39;Proton(s) added/removed\&#39;\n&quot;</span>
<a name="l00069"></a>00069     <span class="stringliteral">&quot;    \&#39;Metal was disconnected\&#39;\n&quot;</span>
<a name="l00070"></a>00070     <span class="stringliteral">&quot; a output auxilliary information\n&quot;</span>
<a name="l00071"></a>00071     <span class="stringliteral">&quot; l display InChI log\n&quot;</span>
<a name="l00072"></a>00072     <span class="stringliteral">&quot; s recalculate wedge and hash bonds(2D structures only)\n&quot;</span>
<a name="l00073"></a>00073     <span class="stringliteral">&quot;    **Uniqueness options** (see also ``--unique`` and ``--sort`` which are more versatile)\n&quot;</span>
<a name="l00074"></a>00074     <span class="stringliteral">&quot; u output only unique molecules\n&quot;</span>
<a name="l00075"></a>00075     <span class="stringliteral">&quot; U output only unique molecules and sort them\n&quot;</span>
<a name="l00076"></a>00076     <span class="stringliteral">&quot; e compare first molecule to others\n&quot;</span>
<a name="l00077"></a>00077     <span class="stringliteral">&quot;    This can also be done with :ref:`InChICompare format &lt;Compare_molecules_using_InChI&gt;`::\n\n&quot;</span>
<a name="l00078"></a>00078     <span class="stringliteral">&quot;      babel first.smi second.mol third.cml -ok\n\n&quot;</span>
<a name="l00079"></a>00079     <span class="stringliteral">&quot; T &lt;param&gt; truncate InChI according to various parameters\n&quot;</span>
<a name="l00080"></a>00080     <span class="stringliteral">&quot;    See below for possible truncation parameters.\n&quot;</span>
<a name="l00081"></a>00081     <span class="stringliteral">&quot;    These can be combined, e.g. ``/nochg/noiso``\n&quot;</span>
<a name="l00082"></a>00082     <span class="stringliteral">&quot; X &lt;Option string&gt; Additional InChI options\n&quot;</span>
<a name="l00083"></a>00083     <span class="stringliteral">&quot;    See InChI documentation.\n&quot;</span>
<a name="l00084"></a>00084     <span class="stringliteral">&quot;    These options should be space delimited in a single quoted string.\n\n&quot;</span>
<a name="l00085"></a>00085     <span class="stringliteral">&quot;    - Structure perception (compatible with stdInChI): ``NEWPSOFF``, ``DoNotAddH``, ``SNon``\n&quot;</span>
<a name="l00086"></a>00086     <span class="stringliteral">&quot;    - Stereo interpretation (produces non-standard InChI): ``SRel``, ``SRac``,\n&quot;</span>
<a name="l00087"></a>00087     <span class="stringliteral">&quot;      ``SUCF``, ``ChiralFlagON``, ``ChiralFlagOFF``\n&quot;</span>
<a name="l00088"></a>00088     <span class="stringliteral">&quot;    - InChI creation options (produces non-standard InChI): ``SUU``, ``SLUUD``,\n&quot;</span>
<a name="l00089"></a>00089     <span class="stringliteral">&quot;      ``FixedH``, ``RecMet``, ``KET``, ``15T``\n&quot;</span>
<a name="l00090"></a>00090     <span class="stringliteral">&quot;    The following options are for convenience, e.g. ``-xF``\n&quot;</span>
<a name="l00091"></a>00091     <span class="stringliteral">&quot;    but produce non-standard InChI.\n&quot;</span>
<a name="l00092"></a>00092     <span class="stringliteral">&quot; F include fixed hydrogen layer\n&quot;</span>
<a name="l00093"></a>00093     <span class="stringliteral">&quot; M include bonds to metal\n\n&quot;</span>
<a name="l00094"></a>00094 
<a name="l00095"></a>00095     <span class="stringliteral">&quot;Read Options, e.g. -an\n&quot;</span>
<a name="l00096"></a>00096     <span class="stringliteral">&quot; X &lt;Option string&gt; List of InChI options\n&quot;</span>
<a name="l00097"></a>00097     <span class="stringliteral">&quot; n molecule name follows InChI on same line\n&quot;</span>
<a name="l00098"></a>00098     <span class="stringliteral">&quot; a add InChI string to molecule name\n\n&quot;</span>
<a name="l00099"></a>00099 
<a name="l00100"></a>00100     <span class="stringliteral">&quot;Truncation parameters used with ``-xT``:\n\n&quot;</span>
<a name="l00101"></a>00101     <span class="stringliteral">&quot;/formula   formula only\n&quot;</span>
<a name="l00102"></a>00102     <span class="stringliteral">&quot;/connect   formula and connectivity only\n&quot;</span>
<a name="l00103"></a>00103     <span class="stringliteral">&quot;/nostereo  ignore E/Z and sp3 stereochemistry\n&quot;</span>
<a name="l00104"></a>00104     <span class="stringliteral">&quot;/sp3       ignore sp3 stereochemistry\n&quot;</span>
<a name="l00105"></a>00105     <span class="stringliteral">&quot;/noEZ      ignore E/Z steroeochemistry\n&quot;</span>
<a name="l00106"></a>00106     <span class="stringliteral">&quot;/nochg     ignore charge and protonation\n&quot;</span>
<a name="l00107"></a>00107     <span class="stringliteral">&quot;/noiso     ignore isotopes\n\n&quot;</span>
<a name="l00108"></a>00108 ;
<a name="l00109"></a>00109   };
<a name="l00110"></a>00110 
<a name="l00111"></a><a class="code" href="classOpenBabel_1_1InChIFormat.shtml#a1d3a8785a0ad0c85b98fa3406a64d50f">00111</a>   <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* SpecificationURL()
<a name="l00112"></a>00112   { <span class="keywordflow">return</span> <span class="stringliteral">&quot;http://www.iupac.org/inchi/&quot;</span>;};
<a name="l00113"></a>00113 
<a name="l00114"></a>00114   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> ReadMolecule(<a class="code" href="classOpenBabel_1_1OBBase.shtml" title="Base Class.">OBBase</a>* pOb, <a class="code" href="classOpenBabel_1_1OBConversion.shtml" title="Class to convert from one format to another.">OBConversion</a>* pConv);
<a name="l00115"></a>00115   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> WriteMolecule(<a class="code" href="classOpenBabel_1_1OBBase.shtml" title="Base Class.">OBBase</a>* pOb, <a class="code" href="classOpenBabel_1_1OBConversion.shtml" title="Class to convert from one format to another.">OBConversion</a>* pConv);
<a name="l00116"></a>00116   <span class="keyword">virtual</span> <span class="keywordtype">int</span>  SkipObjects(<span class="keywordtype">int</span> n, <a class="code" href="classOpenBabel_1_1OBConversion.shtml" title="Class to convert from one format to another.">OBConversion</a>* pConv);
<a name="l00117"></a>00117 
<a name="l00118"></a>00118   <span class="keyword">static</span> <span class="keywordtype">char</span>   CompareInchi(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; Inchi1, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; Inchi2);
<a name="l00119"></a>00119   <span class="keyword">static</span> <span class="keywordtype">string</span> InChIErrorMessage(<span class="keyword">const</span> <span class="keywordtype">char</span> ch);
<a name="l00120"></a>00120 
<a name="l00124"></a>00124   <span class="keyword">static</span> <span class="keywordtype">bool</span> EditInchi(std::string&amp; inchi, std::string&amp; spec);
<a name="l00125"></a>00125 
<a name="l00127"></a>00127   <span class="comment">// &quot;a6b&quot; (or &quot;a06b&quot;) is less than &quot;a15b&quot;</span>
<a name="l00128"></a>00128   <span class="comment">// and &quot;CH4&quot; is less than &quot;C2H6&quot;</span>
<a name="l00129"></a>00129   <span class="comment">// and &quot;CH4&quot; is less than &quot;ClH&quot; (hydrogen chloride)</span>
<a name="l00130"></a><a class="code" href="structOpenBabel_1_1InChIFormat_1_1InchiLess.shtml">00130</a>   <span class="keyword">struct </span><a class="code" href="structOpenBabel_1_1InChIFormat_1_1InchiLess.shtml" title="Compare std::strings with embedded numbers so that.">InchiLess</a>
<a name="l00131"></a>00131     : <span class="keyword">public</span> binary_function&lt;const string&amp;, const string&amp;, bool&gt;
<a name="l00132"></a>00132   {
<a name="l00133"></a><a class="code" href="structOpenBabel_1_1InChIFormat_1_1InchiLess.shtml#ac080de4e2075e98c095fc770829157f1">00133</a>     <span class="keywordtype">bool</span> operator()(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; s1, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; s2)<span class="keyword"> const</span>
<a name="l00134"></a>00134 <span class="keyword">    </span>{
<a name="l00135"></a>00135       <span class="comment">//stop at the first space or the end of the strings</span>
<a name="l00136"></a>00136       string::const_iterator p1=s1.begin(), p2=s2.begin(),
<a name="l00137"></a>00137         p1end=find(s1.begin(), s1.end(), <span class="charliteral">&#39; &#39;</span>), p2end=find(s2.begin(), s2.end(), <span class="charliteral">&#39; &#39;</span>);
<a name="l00138"></a>00138 
<a name="l00139"></a>00139       <span class="keywordflow">while</span>( p1&lt;p1end &amp;&amp; p2&lt;p2end)
<a name="l00140"></a>00140       {
<a name="l00141"></a>00141         <span class="keywordtype">int</span> n1=-1,n2=-1;
<a name="l00142"></a>00142         <span class="keywordflow">if</span>(isdigit(*p1))
<a name="l00143"></a>00143           {
<a name="l00144"></a>00144             n1 = atoi(&amp;*p1);
<a name="l00145"></a>00145             <span class="comment">//skip over number</span>
<a name="l00146"></a>00146             <span class="keywordflow">while</span>(p1!=s1.end() &amp;&amp; isdigit(*p1++)); --p1;
<a name="l00147"></a>00147           }
<a name="l00148"></a>00148         <span class="keywordflow">if</span>(isdigit(*p2))
<a name="l00149"></a>00149           {
<a name="l00150"></a>00150             n2 = atoi(&amp;*p2);
<a name="l00151"></a>00151             <span class="keywordflow">while</span>(p2!=s2.end() &amp;&amp; isdigit(*p2++)); --p2;
<a name="l00152"></a>00152           }
<a name="l00153"></a>00153         <span class="keywordflow">if</span>(n1&lt;0 &amp;&amp; n2 &lt; 0)
<a name="l00154"></a>00154           {
<a name="l00155"></a>00155             <span class="comment">//neither numbers</span>
<a name="l00156"></a>00156             <span class="keywordflow">if</span>(*p1 != *p2)
<a name="l00157"></a>00157         <span class="keywordflow">return</span> *p1 &lt; *p2;
<a name="l00158"></a>00158           }
<a name="l00159"></a>00159         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(n1&gt;=0 &amp;&amp; n2&gt;0)
<a name="l00160"></a>00160           {
<a name="l00161"></a>00161             <span class="comment">//both numbers</span>
<a name="l00162"></a>00162             <span class="keywordflow">if</span>(n1!=n2)
<a name="l00163"></a>00163         <span class="keywordflow">return</span> n1 &lt; n2;
<a name="l00164"></a>00164           }
<a name="l00165"></a>00165         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(n1&gt;0)
<a name="l00166"></a>00166           <span class="keywordflow">return</span> islower(*p2)!=0;
<a name="l00167"></a>00167         <span class="keywordflow">else</span> <span class="keywordflow">if</span>(n2&gt;0)
<a name="l00168"></a>00168           <span class="keywordflow">return</span> !islower(*p1);
<a name="l00169"></a>00169 
<a name="l00170"></a>00170         ++p1; ++p2; <span class="comment">// iterate</span>
<a name="l00171"></a>00171       } <span class="comment">// while loop</span>
<a name="l00172"></a>00172       <span class="keywordflow">return</span> <span class="keyword">false</span>; <span class="comment">//identical</span>
<a name="l00173"></a>00173     }
<a name="l00174"></a>00174   };
<a name="l00175"></a>00175 
<a name="l00176"></a>00176 <span class="keyword">private</span>:
<a name="l00178"></a>00178   <span class="keyword">static</span> <span class="keywordtype">void</span> RemoveLayer (std::string&amp; inchi, <span class="keyword">const</span> std::string&amp; str, <span class="keywordtype">bool</span> all=<span class="keyword">false</span>);
<a name="l00179"></a>00179 
<a name="l00180"></a>00180 <span class="keyword">private</span>:
<a name="l00181"></a>00181   <a class="code" href="classOpenBabel_1_1OBAtom.shtml" title="Atom class.">OBAtom</a>* GetCommonAtom(<a class="code" href="classOpenBabel_1_1OBBond.shtml" title="Bond class.">OBBond</a>* pb1, <a class="code" href="classOpenBabel_1_1OBBond.shtml" title="Bond class.">OBBond</a>* pb2);
<a name="l00182"></a>00182   <span class="keywordtype">char</span>* GetInChIOptions(<a class="code" href="classOpenBabel_1_1OBConversion.shtml" title="Class to convert from one format to another.">OBConversion</a>* pConv, <span class="keywordtype">bool</span> Reading);
<a name="l00183"></a>00183 
<a name="l00184"></a>00184   <span class="keyword">typedef</span>       set&lt;string, InchiLess&gt; nSet;
<a name="l00185"></a>00185   nSet allInchi;
<a name="l00186"></a>00186   <span class="keywordtype">string</span> firstInchi;
<a name="l00187"></a>00187   <span class="keywordtype">string</span> firstID;
<a name="l00188"></a>00188 };
<a name="l00189"></a>00189 
<a name="l00190"></a>00190 <span class="comment">//*****************************************************</span>
<a name="l00191"></a><a class="code" href="classOpenBabel_1_1InChICompareFormat.shtml">00191</a> <span class="keyword">class </span><a class="code" href="classOpenBabel_1_1InChICompareFormat.shtml">InChICompareFormat</a> : <span class="keyword">public</span> <a class="code" href="classOpenBabel_1_1OBMoleculeFormat.shtml" title="An OBFormat convenience subclass for conversion to/from OBMol data.">OBMoleculeFormat</a>
<a name="l00192"></a>00192 {
<a name="l00193"></a>00193 <span class="keyword">public</span>:
<a name="l00194"></a><a class="code" href="classOpenBabel_1_1InChICompareFormat.shtml#a256efa233c5249eedc0945e49256720b">00194</a>   <a class="code" href="classOpenBabel_1_1InChICompareFormat.shtml">InChICompareFormat</a>()
<a name="l00195"></a>00195   {
<a name="l00196"></a>00196       OBConversion::RegisterFormat(<span class="stringliteral">&quot;k&quot;</span>,<span class="keyword">this</span>);
<a name="l00197"></a>00197   }
<a name="l00198"></a><a class="code" href="classOpenBabel_1_1InChICompareFormat.shtml#a4a6b8d1611d5d963fc29982cc1ebcbf7">00198</a>   <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* Description() <span class="comment">//required</span>
<a name="l00199"></a>00199   {
<a name="l00200"></a>00200     <span class="keywordflow">return</span>
<a name="l00201"></a>00201       <span class="stringliteral">&quot;Compare molecules using InChI\n&quot;</span>
<a name="l00202"></a>00202       <span class="stringliteral">&quot;A utility format that allows you to compare molecules using their InChIs\n&quot;</span>
<a name="l00203"></a>00203       <span class="stringliteral">&quot;The first molecule is compared with the rest, e.g.::\n\n&quot;</span>
<a name="l00204"></a>00204 
<a name="l00205"></a>00205       <span class="stringliteral">&quot;  babel first.smi second.mol third.cml -ok\n\n&quot;</span>
<a name="l00206"></a>00206 
<a name="l00207"></a>00207       <span class="stringliteral">&quot;This is the same as using ``-oinchi -xet`` and can take the same options as InChI format\n&quot;</span>
<a name="l00208"></a>00208       <span class="stringliteral">&quot;(see :ref:`InChI_format`).\n&quot;</span>;
<a name="l00209"></a>00209   }
<a name="l00210"></a>00210   <span class="keyword">virtual</span> <span class="keywordtype">bool</span> WriteMolecule(<a class="code" href="classOpenBabel_1_1OBBase.shtml" title="Base Class.">OBBase</a>* pOb, <a class="code" href="classOpenBabel_1_1OBConversion.shtml" title="Class to convert from one format to another.">OBConversion</a>* pConv);
<a name="l00211"></a><a class="code" href="classOpenBabel_1_1InChICompareFormat.shtml#a94a94537cc5ba96b1876db1b612b91a3">00211</a>   <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classOpenBabel_1_1InChICompareFormat.shtml#a94a94537cc5ba96b1876db1b612b91a3" title="Decribes the capabilities of the format (Read only etc.)">Flags</a>() { <span class="keywordflow">return</span> <a class="code" href="format_8h.shtml#a5d766d529e097f852406cf0c434e54e0" title="For OBFormat::Flags()">NOTREADABLE</a>;};
<a name="l00212"></a>00212 };
<a name="l00213"></a>00213 
<a name="l00214"></a>00214 }<span class="comment">//namespace OpenBabel</span>
</pre></div></div>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- end content -->

<!--#include file="footer.html" -->

<div id="footer">
<hr size="1">
<img src="http://openbabel.org/babel256.png" width="136" height="127" alt="" style="float: left;" />
<p>This file is part of the documentation for <a href="http://openbabel.org/wiki/">Open Babel</a>, version 2.3.</p>
<div class="bottom">
Documentation copyright &copy; 1998-2007, the <a href="http://openbabel.org/wiki/THANKS">Open Babel Developers</a>.<br>
Open Babel is hosted by: <a href="http://sourceforge.net">
<img src="http://sourceforge.net/sflogo.php?group_id=40728" 
width="88" height="31" border="0" alt="SourceForge Logo"></a><br>
Generated on Fri Oct 22 2010 14:36:01 by&nbsp;<a href="http://www.doxygen.org/"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.7.2.
</div>

</body>
</html>