44 #ifndef __process_eutils__hpp__
45 #define __process_eutils__hpp__
59 for (
int attempt = 0; attempt < 5; ++attempt) {
84 int sleep_secs = ::sqrt((
double)attempt);
112 string::size_type pos =
m_Path.rfind(suffix);
113 return (pos != string::npos && pos ==
m_Path.size() - strlen(suffix));
147 string::size_type pos =
m_Path.find_last_of(
"/");
148 if (pos != string::npos) {
157 bool text(
const string& contents)
159 if (contents.empty()) {
163 bool empty_text =
true;
165 for (
i = 0;
i < contents.length();
i++) {
166 if (contents [
i] !=
' ' &&
167 contents [
i] !=
'\n' &&
168 contents [
i] !=
'\r' &&
169 contents [
i] !=
'\t') {
177 if (!
Text(contents)) {
196 m_Host =
"eutils.ncbi.nlm.nih.gov";
197 m_Url =
"/entrez/eutils/esearch.fcgi";
201 bool Text (
const string& contents)
211 if (
m_Uids.size() > 0)
return true;
225 m_Host =
"eutils.ncbi.nlm.nih.gov";
226 m_Url =
"/entrez/eutils/esummary.fcgi";
244 if (
m_Iso.empty())
return true;
248 }
else if (!
m_Title.empty()) {
250 }
else if (!
m_Issn.empty()) {
259 bool Text (
const string& contents)
281 if (
m_Strs.size() > 0)
return true;
295 0x00, 0x01, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
297 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
299 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
301 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x1F,
303 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x27,
305 0x20, 0x20, 0x20, 0x20, 0x2C, 0x20, 0x20, 0x2F,
307 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
309 0x38, 0x39, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
311 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
313 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,
315 0x70, 0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 0xFF
368 bool DoOneESearch (
string db,
string term,
string field, vector<int>& uids)
376 query +=
"&retmode=xml&retmax=200";
390 query +=
"&retmax=200&version=2.0&id=";
391 for (
size_t i = 0;
i < uids.size();
i++) {
407 if (
str.length() != 9)
return false;
410 if (ch !=
'-' && ch !=
' ' && ch !=
'+')
return false;
412 for (
int i = 0;
i < 9;
i++) {
414 if (ch >=
'0' && ch <=
'9')
continue;
416 if (ch ==
'-' || ch ==
'+' || ch ==
' ')
continue;
419 if (ch ==
'X' || ch ==
'x')
continue;
495 m_out = args[
"o"] ? &(args[
"o"].AsOutputFile()) : &cout;
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
bool LooksLikeISSN(string str)
bool DoOneESummary(string db, vector< int > &uids, vector< string > &strs)
bool DoJournalSearch(string journal, vector< int > &uids)
bool DoOneESearch(string db, string term, string field, vector< int > &uids)
bool DoJournalSummary(vector< int > &uids, vector< string > &strs)
bool Text(const string &contents)
CESearchGeneric(vector< int > &uids)
vector< string > & m_Strs
bool Text(const string &contents)
bool EndElement(const string &name)
bool StartElement(const string &name)
CESummaryGeneric(vector< string > &strs)
virtual bool EndElement(const std::string &name)
bool error(const string &message)
bool start_element(const string &name, const attrs_type &attrs)
bool PathSuffixIs(const char *suffix)
bool TryQuery(string query)
virtual bool StartElement(const std::string &name)
bool warning(const string &message)
bool end_element(const string &name)
virtual bool Text(const std::string &contents)
bool text(const string &contents)
virtual void SeqEntryInitialize(CRef< CSeq_entry > &se)
void ProcessInitialize(const CArgs &args)
void ProcessInitialize(const CArgs &args)
virtual void SeqEntryInitialize(CRef< CSeq_entry > &se)
The xml::error_messages class is used to store all the error message which are collected while parsin...
bool has_fatal_errors(void) const
Check if there are fatal errors in the error messages.
bool has_errors(void) const
Check if there are errors in the error messages.
std::string print(void) const
Convert error messages into a single printable string.
The xml::event_parser is used to parse an XML document by calling member functions when certain thing...
std::map< std::string, std::string > attrs_type
a type for holding XML node attributes
bool parse_stream(std::istream &stream, error_messages *messages, warnings_as_errors_type how=type_warnings_not_errors)
Parse what ever data that can be read from the given stream.
Include a standard set of the NCBI C++ Toolkit most basic headers.
This file contains the definition of the xml::event_parser class.
static const char * str(char *buf, int n)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string URLEncode(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
URL-encode string.
unsigned int
A callback function used to compare two keys in a database.
void SleepSec(unsigned long sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Sleep.
static unsigned char _ToKey[256]
CRef< CPub > journal(ParserPtr pp, char *bptr, char *eptr, CRef< CAuth_list > &auth_list, CRef< CTitle::C_E > &title, bool has_muid, CRef< CCit_art > &cit_art, Int4 er)