.reserve(s.size());
157 for(
size_t i= 0;
i< s.size();) {
158 if(s[
i] !=
'&') {
162 if(s.substr(
i, 4) == string_view(
"<", 4)) {
165}
else if(s.substr(
i, 4) == string_view(
">", 4)) {
168}
else if(s.substr(
i, 5) == string_view(
"&", 5)) {
171}
else if(s.substr(
i, 6) == string_view(
"'", 6)) {
174}
else if(s.substr(
i, 6) == string_view(
""", 6)) {
190 returnmake_unique<string>();
199 for(
const auto& xip : xil)
209 return(
config.ffbuf.start !=
nullptr);
215 if(*
config.ffbuf.current ==
'\0') {
218 return*(
config.ffbuf.current++);
230TXmlIndexList::iterator xip;
246 autotibnp = ibl.before_begin();
250 boolwithin =
false;
254 for(
count= 0, line = 1;;) {
260 if((
Char)c ==
'\n')
267 for(
i= 1;
i< 50;
i++) {
276 if(ch ==
'<'|| ch ==
'>')
293xip = ibp->
xip.before_begin();
295tibnp = ibl.emplace_after(tibnp, ibp);
310p = s + ((s[1] ==
'/') ? 2 : 1);
311 for(xkbp =
xmkwl; xkbp->
str; xkbp++)
316 if(ibp->
xip.empty() || xip->tag != xkbp->
tag) {
317xip = ibp->
xip.emplace_after(xip);
318xip->tag = xkbp->
tag;
319xip->order = xkbp->
order;
322xip->end_line = line;
325xip->start_line = line;
331xip = ibp->
xip.emplace_after(xip);
332xip->tag = xkbp->
tag;
333xip->order = xkbp->
order;
336xip->end_line = line;
338 if(xip->start != 0) {
339xip = ibp->
xip.emplace_after(xip);
340xip->tag = xkbp->
tag;
341xip->order = xkbp->
order;
344xip->start_line = line;
349 for(
auto& it : ibl) {
363 for(
charc : *line) {
364 if(c ==
' '|| c ==
'\t') {
371 autoq = line->rfind(
'.');
372 if(q == string::npos) {
377 if(ibp->
acnum!= line->substr(0, q)) {
384 for(
autop = line->begin() + q; p < line->end(); ++p) {
386 if(! (ch >=
'0'&& ch <=
'9')) {
403 if(! ibp || ibp->
xip.empty() || ! entry)
410ibp->
acnum[0] =
'\0';
411 for(
const auto& xip : ibp->
xip) {
413 if(xip.start == 0 || xip.end == 0 || xip.start >= xip.end ||
419 size_timax = xip.end - xip.start;
420 if(imax > (
int)
sizeof(ibp->
locusname) - 1)
426 if(xip.start == 0 || xip.end == 0 || xip.start >= xip.end) {
430 size_timax = xip.end - xip.start;
431 if(imax > (
int)
sizeof(ibp->
acnum) - 1)
432imax =
sizeof(ibp->
acnum) - 1;
434ibp->
acnum[imax] =
'\0';
441 if(ibp->
acnum[0] ==
'\0')
447 for(
const auto& xip : ibp->
xip) {
460ibp->
date=
nullptr;
462 for(
const auto& xip : ibp->
xip) {
474 if(xip.start == 0 || xip.end == 0 || xip.start >= xip.end ||
475xip.end - xip.start < 3)
500 for(; xkbp->
str; xkbp++)
505 return(xkbp->
str);
512 for(
autotxip = xil.begin(); txip != xil.end(); ++txip) {
513 if(txip->start == 0) {
517 if(txip->end == 0) {
521 if(
auto constnxt =
next(txip); nxt != xil.end() && txip->order >= nxt->order) {
534 for(
const auto& txip : xil) {
535 if(txip.start == 0) {
551 autotxipsub = xipsub.before_begin();
569c = entry + xip.
start;
574 if(*c ==
'\0'||
count> xip.
end)
582 for(s[0] =
'<',
i= 1;
i< 50;
i++) {
585 if(*c ==
'\0'||
count> xip.
end)
590 if(*c ==
'<'|| *c ==
'>')
593 if(*c ==
'\0'||
count> xip.
end)
598p = s + ((s[1] ==
'/') ? 2 : 1);
602 if(xipsub.empty()) {
603txipsub = xipsub.emplace_after(txipsub);
604}
else if((s[1] !=
'/'&& txipsub->start != 0) ||
605(s[1] ==
'/'&& txipsub->end != 0)) {
606txipsub = xipsub.emplace_after(txipsub);
609txipsub->end =
count-
i;
610txipsub->end_line = line;
612txipsub->start =
count;
613txipsub->start_line = line;
632 autoxip = ibp->
xip.begin();
633 for(; xip != ibp->
xip.end(); ++xip)
637 if(xip == ibp->
xip.end()) {
646 if(xip->subtags.empty()) {
653 for(
const auto& xipsec : xip->subtags)
654 len+= (xipsec.end - xipsec.start + 1);
659 for(
const auto& xipsec : xip->subtags) {
675 if(! entry || ! ibp || ibp->
xip.empty())
678 autoxip = ibp->
xip.begin();
679 for(; xip != ibp->
xip.end(); ++xip)
682 if(xip == ibp->
xip.end())
686 if(xip->subtags.empty()) {
694 for(
const auto& xipkwd : xip->subtags)
695 len+= (xipkwd.end - xipkwd.start + 2);
699 for(
const auto& xipkwd : xip->subtags) {
723 boolgot_locus =
false;
724 boolgot_length =
false;
725 boolgot_moltype =
false;
726 boolgot_division =
false;
727 boolgot_update_date =
false;
728 boolgot_definition =
false;
729 boolgot_accession =
false;
730 boolgot_version =
false;
731 boolgot_source =
false;
732 boolgot_organism =
false;
733 boolgot_reference =
false;
734 boolgot_primary =
false;
735 boolgot_features =
false;
740 for(
const auto& xip : ibp->
xip) {
748got_division =
true;
750got_update_date =
true;
752got_definition =
true;
754got_accession =
true;
760got_organism =
true;
762got_reference =
true;
766got_features =
true;
775 if(got_length ==
false)
777 if(got_moltype ==
false)
779 if(got_division ==
false)
783 if(got_definition ==
false)
785 if(got_accession ==
false) {
789 if(got_version ==
false) {
790 if(pp->
accver!=
false)
796 if(got_source ==
false)
798 if(got_organism ==
false)
808 if(got_features ==
false)
830 if(! ibp || ibp->
len== 0)
837 for(p = entry,
i= 0;
i< ibp->
len;
i++) {
844 if(c > 126 || (c < 32 && c != 10)) {
851 if(
i!= ibp->
len) {
865 autoxipsub = xip.
subtags.before_begin();
878c = entry + xip.
start;
883 if(*c ==
'\0'||
count> xip.
end)
891 for(s[0] =
'<',
i= 1;
i< 50;
i++) {
894 if(*c ==
'\0'||
count> xip.
end)
899 if(*c ==
'<'|| *c ==
'>')
902 if(*c ==
'\0'||
count> xip.
end)
907p = s + ((s[1] ==
'/') ? 2 : 1);
908 for(txkbp = xkbp; txkbp->
str; txkbp++)
913 if(xip.
subtags.empty() || xipsub->tag != txkbp->
tag) {
914xipsub = xip.
subtags.emplace_after(xipsub);
915xipsub->tag = txkbp->
tag;
916xipsub->order = txkbp->
order;
919xipsub->end_line = line;
921xipsub->start =
count;
922xipsub->start_line = line;
927 if(xipsub->end != 0) {
928xipsub = xip.
subtags.emplace_after(xipsub);
929xipsub->tag = txkbp->
tag;
930xipsub->order = txkbp->
order;
933xipsub->end_line = line;
935 if(xipsub->start != 0) {
936xipsub = xip.
subtags.emplace_after(xipsub);
937xipsub->tag = txkbp->
tag;
938xipsub->order = txkbp->
order;
940xipsub->start =
count;
941xipsub->start_line = line;
954 boolgot_key =
false;
955 boolgot_location =
false;
958 for(
const auto& xip : xil) {
962got_location =
true;
970 if(! got_location) {
980 boolgot_from =
false;
981 boolgot_to =
false;
982 boolgot_point =
false;
983 boolgot_accession =
false;
986 for(
const auto& xip : xil) {
994got_accession =
true;
997 if(! got_accession) {
1003 if(got_from || got_to) {
1007}
else if(got_from ==
false|| got_to ==
false) {
1008 FtaErrPost(
SEV_ERROR,
ERR_FORMAT_XMLInvalidINSDInterval,
"{} must contain either both of {} and {}, or {}.",
XMLStringByTag(
xmsubkwl,
INSDINTERVAL),
XMLStringByTag(
xmintkwl,
INSDINTERVAL_FROM),
XMLStringByTag(
xmintkwl,
INSDINTERVAL_TO),
XMLStringByTag(
xmintkwl,
INSDINTERVAL_POINT));
1018 for(
const auto& xip : xil) {
1030 if(! entry || xil.empty())
1033 autoxip = xil.begin();
1034 for(; xip != xil.end(); ++xip) {
1039 if(xip == xil.end())
1043 if(xip->subtags.empty()) {
1048 autoxipfeat = xip->subtags.begin();
1049 for(; xipfeat != xip->subtags.end(); ++xipfeat) {
1053 autotxip = xipfeat->subtags.begin();
1054 for(; txip != xipfeat->subtags.end(); ++txip) {
1057 if(txip->subtags.empty())
1059 for(
auto& xipsub : txip->subtags)
1065 if(txip->subtags.empty())
1067 for(
auto& xipsub : txip->subtags)
1073 if(txip != xipfeat->subtags.end())
1077 if(xipfeat == xip->subtags.end())
1087 boolgot_reference =
false;
1088 boolgot_journal =
false;
1091 for(
const auto& xip : xil) {
1093got_reference =
true;
1095got_journal =
true;
1098 if(! got_reference) {
1103 if(! got_journal) {
1113 if(! reftag || *reftag ==
'\0')
1116 const string str=
"1.."+ to_string(bases);
1132 for(p = reftag; *p !=
'\0'&& *p !=
'(';)
1137 const string str=
"(bases 1 to "+ to_string(bases) +
")";
1138 const stringstr1 =
"(bases 1 to "+ to_string(bases) +
";";
1150 boolgot_dbname =
false;
1151 boolgot_id =
false;
1154 for(
const auto& xip : xil) {
1176 if(! entry || xil.empty())
1179 autoxip = xil.begin();
1180 for(; xip != xil.end(); ++xip) {
1184 if(xip == xil.end())
1188 if(xip->subtags.empty()) {
1193 autoxipref = xip->subtags.begin();
1194 for(; xipref != xip->subtags.end(); ++xipref) {
1199unique_ptr<string> reftagref;
1200unique_ptr<string> reftagpos;
1201 autotxip = xipref->subtags.begin();
1202 for(; txip != xipref->subtags.end(); ++txip) {
1213 if(txip->subtags.empty())
1217 if(txip->subtags.empty())
1219 for(
auto& xipsub : txip->subtags)
1229}
else if(reftagref) {
1236 if(txip != xipref->subtags.end())
1239 if(xipref == xip->subtags.end())
1249 for(
const auto& xip : ibp->
xip) {
1271 if(ibp->
len== 0) {
1338 if(! entry || xil.empty())
1341 autoxip = xil.begin();
1344 if(xip == xil.end() || xip->subtags.empty())
1347 autotdbp = ret.before_begin();
1348 for(
const auto& txip : xip->subtags) {
1349 if(txip.type !=
type|| txip.subtags.empty())
1351tdbp = ret.emplace_after(tdbp, txip.type, entry);
1352tdbp->SetXmlData(txip.subtags);
1362 if(! entry || xil.empty())
1365 autoxip = xil.begin();
1366 for(; xip != xil.end(); ++xip)
1369 if(xip == xil.end())
1372 for(
const auto& xipkwd : xip->subtags) {
1375keywords.push_back(*p);
1382 if(! entry || xil.empty())
1385 autoxip = xil.begin();
1386 while(xip != xil.end() && xip->tag !=
tag)
1389 if(xip == xil.end() || xip->subtags.empty())
1393 for(
const auto& txip : xip->subtags)
1394 i+= (txip.end - txip.start + 2);
1398 for(
const auto& txip : xip->subtags) {
1399 if(txip.start >= txip.end)
1401 if(!
buf.empty()) {
1405 buf.append(entry + txip.start, txip.end - txip.start);
#define ERR_FORMAT_LineTypeOrder
#define ERR_FORMAT_MissingEnd
#define INSDSEQ_ACCESSION_VERSION
#define INSDSEQ_OTHER_SEQIDS
#define INSDREFERENCE_REMARK
#define INSDSEQ_PRIMARY_ACCESSION
#define INSDSEQ_UPDATE_RELEASE
#define INSDINTERVAL_POINT
#define INSDSEQ_DEFINITION
#define INSDINTERVAL_FROM
#define INSDQUALIFIER_NAME
#define INSDSEQ_CREATE_RELEASE
#define INSDSEQ_STRANDEDNESS
#define INSDREFERENCE_PUBMED
#define INSDSEQ_FEATURE_TABLE
#define INSDFEATURE_LOCATION
#define INSDREFERENCE_AUTHORS
#define INSDREFERENCE_XREF
#define INSDQUALIFIER_VALUE
#define INSDSEQ_REFERENCES
#define INSDSEQ_SECONDARY_ACCESSIONS
#define INSDREFERENCE_POSITION
#define INSDSEQ_SOURCE_DB
#define INSDREFERENCE_TITLE
#define INSDSECONDARY_ACCN
#define INSDFEATURE_QUALS
#define INSDINTERVAL_ACCESSION
#define INSDSEQ_DATABASE_REFERENCE
#define INSDSEQ_ENTRY_VERSION
#define INSDSEQ_CREATE_DATE
#define INSDFEATURE_INTERVALS
#define INSDREFERENCE_JOURNAL
#define INSDSEQ_UPDATE_DATE
#define INSDREFERENCE_MEDLINE
#define INSDREFERENCE_CONSORTIUM
#define INSDREFERENCE_REFERENCE
DataBlk::TList TDataBlkList
std::list< std::string > TKeywordList
forward_list< XmlIndex > TXmlIndexList
int fta_atoi(string_view sv)
bool fta_StartsWith(const char *s1, string_view s2)
bool StringEqu(const char *s1, const char *s2)
void StringCpy(char *d, const char *s)
void StringNCpy(char *d, const char *s, size_t n)
size_t StringLen(const char *s)
char * StringNew(size_t sz)
void FtaInstallPrefix(int prefix, string_view name, string_view location)
#define FtaErrPost(sev, level,...)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
static const char * str(char *buf, int n)
int16_t Int2
2-byte (16-bit) signed integer
int32_t Int4
4-byte (32-bit) signed integer
char Char
Alias for char.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
@ fConvErr_NoThrow
Do not throw an exception on error.
CRef< CDate_std > GetUpdateDate(string_view str, Parser::ESource source)
forward_list< unique_ptr< Indexblk > > TIndBlkList
#define ERR_FORMAT_XMLMissingStartTag
#define ERR_VERSION_NonDigitVerNum
#define ERR_FORMAT_XMLInvalidINSDInterval
#define ERR_VERSION_MissingVerNum
#define ERR_ACCESSION_NoAccessNum
#define ERR_FORMAT_XMLFormatError
#define ERR_FORMAT_UnexpectedEnd
#define ERR_INPUT_CannotReadEntry
#define ERR_FORMAT_XMLMissingEndTag
#define ERR_VERSION_BadVersionLine
#define ERR_VERSION_InvalidVersion
#define ERR_FORMAT_MissingField
#define ERR_FORMAT_NonAsciiChar
#define ERR_ENTRY_InvalidLineType
#define ERR_VERSION_AccessionsDontMatch
const CharType(& source)[N]
const CConstRef< CSeq_id > GetAccession(const CSeq_id_Handle &id_handle)
CRef< objects::CDate_std > date
vector< IndexblkPtr > entrylist
forward_list< XmlIndex > subtags
void check_est_sts_gss_tpa_kwds(const TKeywordList &kwds, size_t len, IndexblkPtr entry, bool tpa_check, bool &specialist_db, bool &inferential, bool &experimental, bool &assembly)
static bool XMLIndexFeatures(const char *entry, TXmlIndexList &xil)
static bool XMLKeywordsCheck(const char *entry, IndexblkPtr ibp, Parser::ESource source)
static bool XMLCheckRequiredXrefTags(const TXmlIndexList &xil)
unique_ptr< string > XMLFindTagValue(const char *entry, const TXmlIndexList &xil, Int4 tag)
static bool XMLIndexSubTags(const char *entry, XmlIndex &xip, XmlKwordBlkPtr xkbp)
static TXmlIndexList XMLIndexSameSubTags(const char *entry, const XmlIndex &xip, Int4 tag)
TDataBlkList XMLBuildRefDataBlk(char *entry, const TXmlIndexList &xil, int type)
static const char * XMLStringByTag(XmlKwordBlkPtr xkbp, Int4 tag)
static bool XMLIndexReferences(const char *entry, TXmlIndexList &xil, size_t bases)
unique_ptr< string > XMLGetTagValue(const char *entry, const XmlIndex &xip)
static bool XMLCheckRequiredRefTags(const TXmlIndexList &xil)
bool XMLIndex(ParserPtr pp)
static bool XMLTagCheck(const TXmlIndexList &xil, XmlKwordBlkPtr xkbp)
static int s_GetCharAndAdvance(Parser &config)
static Int2 XMLGetRefType(const char *reftag, size_t bases)
static bool XMLCheckRequiredIntTags(const TXmlIndexList &xil)
static bool XMLCheckRequiredTags(ParserPtr pp, IndexblkPtr ibp)
static bool XMLAccessionsCheck(ParserPtr pp, IndexblkPtr ibp, const char *entry)
static void XMLPerformIndex(ParserPtr pp)
static bool XMLCheckRequiredQualTags(const TXmlIndexList &xil)
char * XMLLoadEntry(ParserPtr pp, bool err)
static Int2 XMLGetRefTypePos(const char *reftag, size_t bases)
unique_ptr< string > XMLConcatSubTags(const char *entry, const TXmlIndexList &xil, Int4 tag, Char sep)
static bool s_IsSegment(const IndexblkPtr &ibp)
static bool XMLSameTagsCheck(const TXmlIndexList &xil, const char *name)
static string XMLRestoreSpecialCharacters(string_view s)
void XMLGetKeywords(const char *entry, const TXmlIndexList &xil, TKeywordList &keywords)
static void XMLParseVersion(IndexblkPtr ibp, const string *line)
void s_SetPointer(Parser &config, size_t offset)
static void XMLInitialEntry(IndexblkPtr ibp, const char *entry, bool accver, Parser::ESource source)
static bool s_HasInput(const Parser &config)
static bool XMLErrField(Int4 tag)
static bool XMLCheckRequiredFeatTags(const TXmlIndexList &xil)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4