1 |
cryos 08/04/21 05:52:32 |
2 |
|
3 |
Added: openbabel-2.2.0_beta4-obconversion_api_fix.diff |
4 |
Log: |
5 |
Bug 216057 - added back in missing API element. |
6 |
(Portage version: 2.1.5_rc5) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 sci-chemistry/openbabel/files/openbabel-2.2.0_beta4-obconversion_api_fix.diff |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-chemistry/openbabel/files/openbabel-2.2.0_beta4-obconversion_api_fix.diff?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sci-chemistry/openbabel/files/openbabel-2.2.0_beta4-obconversion_api_fix.diff?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: openbabel-2.2.0_beta4-obconversion_api_fix.diff |
15 |
=================================================================== |
16 |
--- include/openbabel/obconversion.h 2008-02-29 14:06:19.000000000 -0500 |
17 |
+++ include/openbabel/obconversion.h 2008-04-20 20:17:14.000000000 -0400 |
18 |
@@ -49,6 +49,9 @@ |
19 |
|
20 |
OBERROR extern OBMessageHandler obErrorLog; |
21 |
|
22 |
+ typedef std::map<const char*,OBFormat*,CharPtrLess > FMapType; |
23 |
+ typedef FMapType::iterator Formatpos; |
24 |
+ |
25 |
//************************************************* |
26 |
/// @brief Class to convert from one format to another. |
27 |
// Class introduction in obconversion.cpp |
28 |
@@ -75,7 +78,7 @@ |
29 |
static OBFormat* FormatFromMIME(const char* MIME); |
30 |
|
31 |
///Repeatedly called to recover available Formats |
32 |
-// static bool GetNextFormat(Formatpos& itr, const char*& str,OBFormat*& pFormat); |
33 |
+ static bool GetNextFormat(Formatpos& itr, const char*& str,OBFormat*& pFormat); |
34 |
//@} |
35 |
|
36 |
/// @name Information |
37 |
@@ -142,7 +145,7 @@ |
38 |
{ return &OptionsArray[opttyp];}; |
39 |
|
40 |
///@brief Set an option of specified type, with optional text |
41 |
- void AddOption(const char* opt, Option_type opttyp, const char* txt=NULL); |
42 |
+ void AddOption(const char* opt, Option_type opttyp=OUTOPTIONS, const char* txt=NULL); |
43 |
|
44 |
bool RemoveOption(const char* opt, Option_type optype); |
45 |
|
46 |
@@ -279,7 +282,7 @@ |
47 |
|
48 |
protected: |
49 |
bool SetStartAndEnd(); |
50 |
-// static FMapType& FormatsMap();///<contains ID and pointer to all OBFormat classes |
51 |
+ static FMapType& FormatsMap();///<contains ID and pointer to all OBFormat classes |
52 |
// static FMapType& FormatsMIMEMap();///<contains MIME and pointer to all OBFormat classes |
53 |
typedef std::map<std::string,int> OPAMapType; |
54 |
static OPAMapType& OptionParamArray(Option_type typ); |
55 |
|
56 |
--- src/obconversion.cpp 2008-02-29 14:06:05.000000000 -0500 |
57 |
+++ src/obconversion.cpp 2008-04-20 20:18:28.000000000 -0400 |
58 |
@@ -324,6 +324,42 @@ |
59 |
return count; |
60 |
} |
61 |
|
62 |
+ FMapType& OBConversion::FormatsMap() |
63 |
+ { |
64 |
+ static FMapType* fm = new FMapType; |
65 |
+ return *fm; |
66 |
+ } |
67 |
+ |
68 |
+ bool OBConversion::GetNextFormat(Formatpos& itr, const char*& str,OBFormat*& pFormat) |
69 |
+ { |
70 |
+ pFormat = NULL; |
71 |
+ if(str==NULL) |
72 |
+ itr = FormatsMap().begin(); |
73 |
+ else |
74 |
+ itr++; |
75 |
+ if(itr == FormatsMap().end()) |
76 |
+ { |
77 |
+ str=NULL; |
78 |
+ pFormat=NULL; |
79 |
+ return false; |
80 |
+ } |
81 |
+ static string s; |
82 |
+ s =itr->first; |
83 |
+ pFormat = itr->second; |
84 |
+ if(pFormat) |
85 |
+ { |
86 |
+ string description(pFormat->Description()); |
87 |
+ s += " -- "; |
88 |
+ s += description.substr(0,description.find('\n')); |
89 |
+ } |
90 |
+ |
91 |
+ if(pFormat->Flags() & NOTWRITABLE) s+=" [Read-only]"; |
92 |
+ if(pFormat->Flags() & NOTREADABLE) s+=" [Write-only]"; |
93 |
+ |
94 |
+ str = s.c_str(); |
95 |
+ return true; |
96 |
+ } |
97 |
+ |
98 |
////////////////////////////////////////////////////// |
99 |
/// Sets the formats from their ids, e g CML. |
100 |
/// If inID is NULL, the input format is left unchanged. Similarly for outID |
101 |
@@ -486,7 +522,7 @@ |
102 |
if(!ret) |
103 |
{ |
104 |
//error or termination request: terminate unless |
105 |
- // -e option requested and sucessfully can skip past current object |
106 |
+ // -e option requested and successfully can skip past current object |
107 |
if(!IsOption("e", GENOPTIONS) || pInFormat->SkipObjects(0,this)!=1) |
108 |
break; |
109 |
} |
110 |
@@ -1093,7 +1129,14 @@ |
111 |
|
112 |
//INPUT |
113 |
if(FileList.empty()) |
114 |
- pIs = NULL; |
115 |
+ { |
116 |
+ pIs = NULL; |
117 |
+ if(HasMultipleOutputFiles) |
118 |
+ { |
119 |
+ obErrorLog.ThrowError(__FUNCTION__,"Cannot use multiple output files without an input file", obError); |
120 |
+ return 0; |
121 |
+ } |
122 |
+ } |
123 |
else |
124 |
{ |
125 |
if(FileList.size()>1 || OutputFileName.substr(0,2)=="*.") |
126 |
|
127 |
|
128 |
|
129 |
-- |
130 |
gentoo-commits@l.g.o mailing list |