A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/cuBookRefUtils_8cpp_source.html below:

NCBI C++ ToolKit: src/algo/structure/cd_utils/cuBookRefUtils.cpp Source File

50  return

(bookRef.GetBookname().substr(0, 3) ==

"NBK"

);

75  static const string

section(

"section"

);

76  static const string

slash(

"/"

), suffix(

"/pmc[rid]"

), orString(

"%20OR%20"

), dummyElement(

"DUMMY_ELEMENT"

);

78  bool

distinctSubelement;

81  string

bookname, elementType, elementId, subelementId;

82

bookname = elementType = elementId = subelementId =

kEmptyStr

;

91  CRegexp

regexpSection(

"(.*)&part=(.*)$"

);

92  CRegexp

regexpSectionWithSubelement(

"(.*)&part=(.*)#(.*)"

);

93  CRegexp

regexpRendertype(

"(.*)&part=(.*)&rendertype=(.*)&id=(.*)"

);

96

bookname = regexpRendertype.

GetSub

(brfcgiBookTerm, 1);

97

elementType = regexpRendertype.

GetSub

(brfcgiBookTerm, 3);

98

elementId = regexpRendertype.

GetSub

(brfcgiBookTerm, 2);

99

subelementId = regexpRendertype.

GetSub

(brfcgiBookTerm, 4);

100

}

else if

(regexpSectionWithSubelement.

GetMatch

(brfcgiBookTerm).

length

() > 0) {

101

bookname = regexpSectionWithSubelement.

GetSub

(brfcgiBookTerm, 1);

102

elementType = section;

103

elementId = regexpSectionWithSubelement.

GetSub

(brfcgiBookTerm, 2);

104

subelementId = regexpSectionWithSubelement.

GetSub

(brfcgiBookTerm, 3);

105

}

else if

(regexpSection.

GetMatch

(brfcgiBookTerm).

length

() > 0) {

106

bookname = regexpSection.

GetSub

(brfcgiBookTerm, 1);

107

elementType = section;

108

elementId = regexpSection.

GetSub

(brfcgiBookTerm, 2);

111

distinctSubelement = (subelementId.length() > 0 && subelementId != elementId);

113  if

(elementType ==

"glossary"

) {

114

elementType =

"def-item"

;

115

}

else if

(elementType.substr(0, 3) ==

"app"

) {

116

elementType =

"appendix"

;

117

}

else if

(elementType.substr(0, 3) ==

"box"

) {

118

elementType =

"box"

;

119

}

else if

(elementType.substr(0, 3) ==

"fig"

) {

120

elementType =

"figgrp"

;

121

}

else if

(elementType.substr(0, 3) ==

"sec"

|| elementType ==

"unassigned"

) {

122

elementType =

"sec"

;

123

}

else if

(elementType.substr(0, 5) ==

"table"

) {

124

elementType =

"table"

;

128  if

(elementType.length() > 0) {

130  if

(distinctSubelement) {

131

baseTerm = bookname + slash + elementId + slash + dummyElement + slash + subelementId + suffix;

133

baseTerm = bookname + slash + dummyElement + slash + elementId + suffix;

138  if

(forceOR || elementType ==

"book-part"

) {

139

term =

NStr::Replace

(baseTerm, dummyElement,

"sec"

) + orString;

140

term +=

NStr::Replace

(baseTerm, dummyElement,

"chapter"

) + orString;

141

term +=

NStr::Replace

(baseTerm, dummyElement,

"figgrp"

) + orString;

142

term +=

NStr::Replace

(baseTerm, dummyElement,

"table"

) + orString;

170  string

elementid, subelementid, typeString;

174  result

=

"unexpected book_ref format: neither elementid nor celementid is set"

;

177  result

=

"unexpected book_ref format: both elementid and celementid are set"

;

180  result

=

"unexpected book_ref format: both subelementid and csubelementid are set"

;

193

typeString = (allowedElements) ? allowedElements->

FindName

(bookRef.

GetTextelement

(),

true

) :

"unassigned"

;

198  _ASSERT

(bookname.length() + elementid.length() + subelementid.length() + 15 < 2048);

200  if

(subelementid.size() > 0)

201

sprintf(

buf

,

"%s.%s.%s#%s"

, bookname.c_str(), typeString.c_str(), elementid.c_str(), subelementid.c_str());

203

sprintf(

buf

,

"%s.%s.%s"

, bookname.c_str(), typeString.c_str(), elementid.c_str());

214  string

elementid, subelementid, renderType;

218  result

=

"unexpected book_ref format: neither elementid nor celementid is set"

;

221  result

=

"unexpected book_ref format: both elementid and celementid are set"

;

224  result

=

"unexpected book_ref format: both subelementid and csubelementid are set"

;

255  result

= bookname +

"&part="

+ part;

264

renderType =

"figure"

;

267

renderType =

"def-item"

;

268

}

else if

(allowedElements) {

269

renderType = allowedElements->

FindName

(elementType,

true

);

271  if

(renderType.length() == 0) {

272

renderType =

"unassigned"

;

275  if

(

id

.length() == 0) {

278  result

= bookname +

"&part="

+ part +

"&rendertype="

+ renderType +

"&id="

+ id;

281  result

= bookname +

"&part="

+ part;

282  if

(

id

.

size

() > 0)

298  string

idStr, renderType;

316

renderType =

"figure"

;

318

renderType =

"def-item"

;

320

renderType = allowedElements->

FindName

(elementType,

true

);

322  if

(renderType.length() > 0)

323  result

+=

"/"

+ renderType +

"/"

+ idStr;

324  else if

(idStr.length() > 0)

327

}

else if

(idStr.length() > 0) {

337  string

bookname, address, subaddress, typeStr, firstTokenStr;

338

list<string> sharpTokens;

339  CRegexp

regexpCommon(

"book=(.*)&part=(.*)"

);

340  CRegexp

regexpRendertype(

"&part=(.*)&rendertype=(.*)&id=(.*)"

);

346  if

(sharpTokens.size() == 1 || sharpTokens.size() == 2) {

347  bool

haveSubaddr = (sharpTokens.size() == 2);

350

firstTokenStr = sharpTokens.front();

352  if

(regexpCommon.

NumFound

() == 3) {

354

bookname = regexpCommon.

GetSub

(firstTokenStr, 1);

357  if

(regexpRendertype.

NumFound

() == 4) {

358

address = regexpRendertype.

GetSub

(firstTokenStr, 1);

359

typeStr = regexpRendertype.

GetSub

(firstTokenStr, 2);

363  if

(typeStr ==

"figure"

)

365  else if

(typeStr ==

"def-item"

)

366

typeStr =

"glossary"

;

368  if

(allowedElements && !allowedElements->

IsValidName

(typeStr)) {

371

subaddress = regexpRendertype.

GetSub

(firstTokenStr, 3);

374

address = regexpCommon.

GetSub

(firstTokenStr, 2);

380

subaddress = sharpTokens.back();

382

subaddress =

"A"

+ subaddress;

388  if

(typeStr.length() > 0 && allowedElements) {

392

bookRef->SetBookname(bookname);

393

bookRef->SetTextelement(typeEnum);

394

bookRef->SetCelementid(address);

395  if

(subaddress.length() > 0) {

396

bookRef->SetCsubelementid(subaddress);

420  string

baseStr, nbkCode, idStr;

422  CRegexp

regexpBase(

"/books/(NBK.+)"

);

423  CRegexp

regexpNBK(

"^(NBK[^/]+)"

);

424  CRegexp

regexpRendertype(

"^NBK[^/]+/(.+)/(.+)"

);

428  string

urlPath = url.

GetPath

();

433

urlPath = urlPath.substr(0, urlPath.length() - 1);

439

baseStr = regexpBase.

GetSub

(urlPath, 1);

440

nbkCode = regexpNBK.

GetMatch

(baseStr);

443  if

(regexpRendertype.

NumFound

() == 3) {

444

typeStr = regexpRendertype.

GetSub

(baseStr, 1);

445

idStr = regexpRendertype.

GetSub

(baseStr, 2);

448

typeStr = urlArgs.

GetValue

(

"rendertype"

);

450

}

else if

(urlFrag.length() > 0) {

452

typeStr =

"section"

;

454

}

else if

(urlFrag.length() == 0) {

457

typeStr =

"chapter"

;

462  if

(nbkCode.length() > 0) {

467  if

(typeStr ==

"figure"

)

469  else if

(typeStr ==

"def-item"

)

470

typeStr =

"glossary"

;

476  if

(allowedElements && allowedElements->

IsValidName

(typeStr)) {

485

bookRef->SetBookname(nbkCode);

486

bookRef->SetTextelement(typeEnum);

487

bookRef->SetCelementid(idStr);

User-defined methods of the data storage class.

string CCddBookRefToEsearchTerm(const CCdd_book_ref &bookRef)

string CCddBookRefToString(const CCdd_book_ref &bookRef)

bool BrBookURLToCCddBookRef(const string &brBookUrl, CRef< CCdd_book_ref > &bookRef)

string CCddBookRefToBvString(const CCdd_book_ref &bookRef)

bool IsPortalDerivedBookRef(const CCdd_book_ref &bookRef)

bool PortalBookURLToCCddBookRef(const string &portalBookUrl, CRef< CCdd_book_ref > &bookRef)

string BrFcgiBookTermToEutilsTerm(const string &brfcgiBookTerm, bool forceOR)

string CCddBookRefToPortalString(const CCdd_book_ref &bookRef)

string CCddBookRefToBrString(const CCdd_book_ref &bookRef)

const string & FindName(TEnumValueType value, bool allowBadValue) const

Find name of the enum by its numeric value.

bool IsValidName(const CTempString &name) const

Check whether enum with this name is defined.

TEnumValueType FindValue(const CTempString &name) const

Find numeric value by the name of the enum.

void Reset(void)

Reset reference object.

bool Empty(void) const THROWS_NONE

Check if CRef is empty – not pointing to any object, which means having a null value.

CTempString GetSub(CTempString str, size_t idx=0) const

Get pattern/subpattern from previous GetMatch().

CTempString GetMatch(CTempString str, size_t offset=0, size_t idx=0, TMatch flags=fMatch_default, bool noreturn=false)

Get matching pattern and subpatterns.

int NumFound() const

Get number of patterns + subpatterns.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define END_SCOPE(ns)

End the previously defined scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

#define BEGIN_SCOPE(ns)

Define a new scope.

static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)

Split a string using specified delimiters.

static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)

Check if a string ends with a specified suffix value.

static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)

Truncate whitespace in a string (in-place)

static string IntToString(int value, TNumToStringFlags flags=0, int base=10)

Convert int to string.

static unsigned long StringToULong(const CTempString str, TStringToNumFlags flags=0, int base=10)

Convert string to unsigned long.

static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)

Replace occurrences of a substring within a string.

size_type length(void) const

Return the length of the represented array.

static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)

Truncate whitespace in a string.

@ fConvErr_NoThrow

Do not throw an exception on error.

const CUrlArgs & GetArgs(void) const

Get const list of arguments.

const string & GetFragment(void) const

bool IsSetValue(const string &name) const

Check if an argument with the given name exists.

const string & GetPath(void) const

const string & GetValue(const string &name, bool *is_found=0) const

Get value for the given name.

const TBookname & GetBookname(void) const

Get the Bookname member data.

bool IsSetCsubelementid(void) const

exact address, if character string Check if a value has been assigned to Csubelementid data member.

bool IsSetCelementid(void) const

address of the text element, if character string Check if a value has been assigned to Celementid dat...

bool IsSetElementid(void) const

numerical address of the text-element Check if a value has been assigned to Elementid data member.

const TCelementid & GetCelementid(void) const

Get the Celementid member data.

TTextelement GetTextelement(void) const

Get the Textelement member data.

bool IsSetSubelementid(void) const

exact address, used with section Check if a value has been assigned to Subelementid data member.

TElementid GetElementid(void) const

Get the Elementid member data.

const TCsubelementid & GetCsubelementid(void) const

Get the Csubelementid member data.

TSubelementid GetSubelementid(void) const

Get the Subelementid member data.

@ eTextelement_figgrp

a figure or set of figures

@ eTextelement_unassigned

type of element

@ eTextelement_section

a section or paragraph

@ eTextelement_chapter

a whole chapter

@ eTextelement_glossary

glossary

const struct ncbi::grid::netcache::search::fields::SIZE size

C++ wrappers for the Perl-compatible regular expression (PCRE) library.


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