[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/kfile-chemical/STRIGI/src/mdl-molfile
From: Egon Willighagen <e.willighagen () science ! ru ! nl>
Date: 2007-06-02 8:44:25
Message-ID: 1180773865.627313.26758.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 670632 by egonw:
Store atom and bond counts.
M +12 -1 mdlmolfilelineanalyzer.cpp
M +5 -0 mdlmolfilelineanalyzer.h
--- trunk/playground/utils/kfile-chemical/STRIGI/src/mdl-molfile/mdlmolfilelineanalyzer.cpp \
#670631:670632 @@ -36,11 +36,15 @@
const string MdlMolfileLineAnalyzerFactory::nameFieldName("Name");
const string MdlMolfileLineAnalyzerFactory::formulaFieldName("chemistry.molecular_formula");
+const string MdlMolfileLineAnalyzerFactory::atomCountFieldName("chemistry.atom_count");
+const string MdlMolfileLineAnalyzerFactory::bondCountFieldName("chemistry.bond_count");
void
MdlMolfileLineAnalyzerFactory::registerFields(FieldRegister& reg) {
nameField = reg.registerField(nameFieldName, FieldRegister::stringType, 1, 0);
formulaField = reg.registerField(formulaFieldName, FieldRegister::stringType, 1, \
0); + atomCountField = reg.registerField(atomCountFieldName, \
FieldRegister::integerType, 1, 0); + bondCountField = \
reg.registerField(bondCountFieldName, FieldRegister::integerType, 1, 0); }
void
@@ -50,6 +54,7 @@
finished = 0;
linecount = 0;
atomcount = 0;
+ bondcount = 0;
}
void
@@ -67,8 +72,14 @@
}
}
else if (linecount == 4) {
+ // extract atom count
atomcount = atoi(line.substr(0,2).c_str());
- //extract atomcount
+ // extract bond count
+ bondcount = atoi(line.substr(3,2).c_str());
+
+ // store them
+ result->addValue(factory->atomCountField, atomcount);
+ result->addValue(factory->bondCountField, bondcount);
}
else if ((linecount > 4) && (linecount <= atomcount)) {
string element = line.substr(31,33);
--- trunk/playground/utils/kfile-chemical/STRIGI/src/mdl-molfile/mdlmolfilelineanalyzer.h \
#670631:670632 @@ -41,6 +41,7 @@
void trim(std::string& str);
unsigned int linecount;
unsigned int atomcount;
+ unsigned int bondcount;
std::map<std::string, unsigned int> m_formula;
public:
/**
@@ -53,8 +54,12 @@
public:
static const std::string nameFieldName;
static const std::string formulaFieldName;
+ static const std::string atomCountFieldName;
+ static const std::string bondCountFieldName;
const Strigi::RegisteredField* nameField;
const Strigi::RegisteredField* formulaField;
+ const Strigi::RegisteredField* atomCountField;
+ const Strigi::RegisteredField* bondCountField;
const char* name() const {
return "MdlMolfileLineAnalyzer";
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic