(
false,
"Unknown tooltip formatter type!");
57 const stringpmURL(
"/pubmed/");
60vector<string> tokens;
63 ITERATE(vector<string>, pmidIter, tokens) {
64 stringpmid = *pmidIter;
78 if(!pmlinks.empty()) {
80 if(isBulletColPresent) {
96 if(isBulletColPresent)
101isGoToPresent =
true;
124 if(!sBulletSrc.empty())
125 m_sTooltipText+=
"<img class=\"sv-bintrack\" src=\""+ sBulletSrc +
"\"/>";
133 if(!sBulletSrc.empty())
134 m_sTooltipText+=
"<img class=\"sv-bintrack\" src=\""+ sBulletSrc +
"\"/> ";
142 if(isNoWrap || width) {
143styleAttr =
" style=\"";
144styleAttr += isNoWrap ?
"white-space:nowrap;":
"";
171 m_sTooltipText+=
"<tr class=\"sv-bintrack\"><td class=\"sv-bintrack-tag\">";
181 m_sLinksText+=
"<tr class=\"sv-bintrack\"><td class=\"sv-bintrack-tag\">";
183 m_sLinksText+=
"</td><td class=\"sv-bintrack-value\"";
191 m_sLinksText+=
"<tr class=\"sv-bintrack\"><td class=\"sv-bintrack-tag\">";
193 m_sLinksText+=
"</td><td class=\"sv-bintrack-value\"";
203 m_sLinksText+=
"<tr class=\"sv-bintrack\"><td class=\"sv-bintrack-tag\" align=\"right\" valign=\"top\" style=\"white-space: nowrap\">[<i>"+ sTitle +
"</i>]</td><td class=\"sv-bintrack\" colspan=\"0\"/></tr>";
208 m_sTooltipText+=
"<tr class=\"sv-bintrack\"><td class=\"sv-bintrack-value\" align=\"right\" valign=\"top\" style=\"white-space: nowrap\">[<i>"+ sContents +
"</i>]</td><td class=\"sv-bintrack\" colspan=\"0\"/></tr>";
215 stringsWholeTooltip;
217sWholeTooltip +=
"<table class=\"sv-bintrack\" style=\"border-spacing:2px\">"+
m_sTooltipText+
"</table>";
221sWholeTooltip +=
"<br/> ";
222sWholeTooltip +=
"<table class=\"sv-bintrack\" style=\"border-spacing:2px\">"+
m_sLinksText+
"</table>";
226 returnsWholeTooltip;
257 if(!pCSSTableFormatter)
282 if(!sBulletSrc.empty()) {
292 if(!sBulletSrc.empty())
304 string(isNoWrap ?
" nowrap":
"") +
328 stringspacedValue(sValue);
329 if(!noSpaceInsert) {
332 m_sTooltipText+=
"<tr><td align=\"right\" valign=\"top\" nowrap><span style=\"font-weight:bold\">";
345 m_sLinksText+=
"<tr><td align=\"right\" valign=\"top\" nowrap><span style=\"font-weight:bold\">";
358 m_sLinksText+=
"<tr><td align=\"right\" valign=\"top\" nowrap><span style=\"font-weight:bold\">";
373 m_sLinksText+=
"<tr><td align=\"right\" valign=\"top\" nowrap>[<i>"+ sTitle +
"</i>]</td><td colspan=\"0\"/></tr>";
378 m_sTooltipText+=
"<tr><td align=\"right\" valign=\"top\" nowrap>[<i>"+ sContents +
"</i>]</td><td colspan=\"0\"/></tr>";
385 stringsWholeTooltip;
387sWholeTooltip +=
"<table margin=\"0\" padding=\"0\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\">"+
m_sTooltipText+
"</table>";
391sWholeTooltip +=
"<br/> ";
392sWholeTooltip +=
"<table margin=\"0\" padding=\"0\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\">"+
m_sLinksText+
"</table>";
396 returnsWholeTooltip;
416 stringsSpacedText(sText);
429 stringsUpdateURL =
NStr::Replace(sUrl,
"/projects/sviewer/",
"");
430 return CreateLink(sText,
string(
"$GENOMIC_LINK$") + sUpdateURL);
445 size_tpos =
input.find(search);
446 while(string::npos != pos) {
447occurences.push_back(pos);
448pos =
input.find(search, pos + 1);
454 size_tlength = (end <
input.length() ? end :
input.length() - 1) - start + 1;
455 unsignedfragments = (unsigned)
round(length / (
double)fragment_length);
456 unsignedinsertions(0);
457 for(
unsigned i= 1;
i<= fragments; ++
i) {
458 size_tpos = start +
i*fragment_length + insertions;
459 if(pos >
input.length())
462 input.insert(pos, 1,
' ');
470 if(
input.length() <= fragment_length)
473vector<size_t> spaces;
478 if(spaces.empty()) {
482 std::sort(spaces.begin(), spaces.end());
483spaces.push_back(
input.length() - 1);
487 unsignedinsertions = 0;
489start = end + insertions;
490end = spaces[
i++] + insertions;
491 if((end - start + 1) > fragment_length)
492insertions +=
x_InsertSpaces(
input, start + insertions, end + insertions, fragment_length);
494 while(
i< spaces.size());
521 if(!sBulletSrc.empty())
581sWholeTooltip +=
"\n";
586 returnsWholeTooltip;
tooltips using plain text formatting
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_ASSERT(expr, mess)
static string GetNcbiBaseUrl()
CCSSTableTooltipFormatter()
virtual void FinishRow()=0
finish the row (i.e. no other contents will be added to it)
virtual void AddValueCol(const string &sContents="", unsigned width=200, bool isNoWrap=false)
adds a value column to the row
virtual void AddDividerRow(unsigned colspan=2)
add a horizontal divider between sections of the table
virtual void Append(const ITooltipFormatter &tooltip)
appends another formatter to this one
virtual string CreateNcbiLink(const string &sText, const string &sUrl) const
construct the HTML code for a link from the displayed text label and supplied NCBI URL path
virtual string Render()
returns the formatted tooltip text and resets the formatter for reuse
static CIRef< ITooltipFormatter > CreateTooltipFormatter()
ETooltipFormatters
supported types of formatters
virtual string Render()
returns the formatted tooltip text and resets the formatter for reuse
virtual void AddTagCol(const string &sContents="", const string &sBulletSrc="")
adds a tag column to the row
virtual void AddPubmedLinksRow(const string &pmids, bool &isGoToPresent, bool isBulletColPresent)
add a row containing all links to specified Pubmed IDs
virtual void AddRow(const string &sContents="", unsigned colspan=2)
add a row with a cell, spanning across all columns
virtual void AddLinkRow(const string &sTag, const string &sValue, unsigned valueColWidth=200)
add a row with two columns
void x_FindAllOccurences(const string &input, char search, vector< size_t > &occurences) const
virtual void AddDividerRow(unsigned colspan=2)
add a horizontal divider between sections of the table
virtual void Append(const ITooltipFormatter &tooltip)
appends another formatter to this one
virtual void AddValueCol(const string &sContents="", unsigned width=200, bool isNoWrap=false)=0
adds a value column to the row
virtual string CreateNcbiLink(const string &sText, const string &sUrl) const
construct the HTML code for a link from the displayed text label and supplied NCBI URL path
virtual void AddBulletCol(const string &sBulletSrc="")
add a cell with an image
virtual void MaybeAddGoToRow(bool &isGoToPresent, bool isBulletColPresent)
conditionally add a Go To row
static CIRef< ITooltipFormatter > CreateTooltipFormatter(ETooltipFormatters)
factory for requested tooltip formatter creation
virtual void AddLinkRow(const string &sTag, const string &sValue, unsigned valueColWidth=200)
add a row with two columns
virtual void MaybeAddGoToRow(bool &isGoToPresent, bool isBulletColPresent)
conditionally add a Go To row
virtual void AddTagCol(const string &sContents="", const string &sBulletSrc="")=0
adds a tag column to the row
unsigned x_InsertSpaces(string &input, size_t start, size_t end, size_t fragment_length=65) const
virtual void AddLinksTitle(const string &sTitle)
add a row with the links title
virtual void AddSectionRow(const string &sContents)
add a section row
virtual string CreateNcbiLink(const string &sText, const string &sUrl) const
construct the HTML code for a link from the displayed text label and supplied NCBI URL path
virtual string CreateGenomicLink(const string &sText, const string &sUrl) const
virtual string Render()
returns the formatted tooltip text and resets the formatter for reuse
virtual void FinishRow()
finish the row (i.e. no other contents will be added to it)
virtual void FinishRow()
finish the row (i.e. no other contents will be added to it)
virtual void AddTagCol(const string &sContents="", const string &sBulletSrc="")
adds a tag column to the row
virtual void AddBulletCol(const string &sBulletSrc="")=0
add a cell with an image
virtual void AddTagCol(const string &sContents="", const string &sBulletSrc="")
adds a tag column to the row
static CIRef< ITooltipFormatter > CreateTooltipFormatter()
virtual void FinishRow()
finish the row (i.e. no other contents will be added to it)
virtual CIRef< ITooltipFormatter > CreateInstance()
creates another instance of the same tooltip formatter
virtual bool IsEmpty() const
Indicates if the tooltip is empty.
virtual void AddPubmedLinksRow(const string &pmids, bool &isGoToPresent, bool isBulletColPresent)
add a row containing all links to specified Pubmed IDs
virtual void StartRow()
start a new table row
virtual void StartRow()
start a new table row
virtual void AddLinkRow(const string &sTag, const string &sValue, unsigned valueColWidth=200)
add a row with two columns
virtual bool IsEmpty() const
Indicates if the tooltip is empty.
virtual CIRef< ITooltipFormatter > CreateInstance()
creates another instance of the same tooltip formatter
virtual void AddRow(const string &sContents="", unsigned colspan=2)
add a row with a cell, spanning across all columns
virtual void AddRow(const string &sContents="", unsigned colspan=2)
add a row with a cell, spanning across all columns
virtual CIRef< ITooltipFormatter > CreateInstance()
creates another instance of the same tooltip formatter
virtual void AddSectionRow(const string &sContents)
add a section row
virtual void AddValueCol(const string &sContents="", unsigned width=200, bool isNoWrap=false)
adds a value column to the row
virtual string CreateLink(const string &sText, const string &sUrl) const
construct the HTML code for a link from the displayed text label and supplied URL
virtual void AddSectionRow(const string &sContents)
add a section row
virtual void StartRow()=0
start a new table row
virtual void MaybeAddGoToRow(bool &isGoToPresent, bool isBulletColPresent)
conditionally add a Go To row
virtual void Append(const ITooltipFormatter &tooltip)
appends another formatter to this one
virtual void AddLinksTitle(const string &sTitle)
add a row with the links title
virtual string CreateLink(const string &sText, const string &sUrl) const
construct the HTML code for a link from the displayed text label and supplied URL
virtual void AddPubmedLinksRow(const string &pmids, bool &isGoToPresent, bool isBulletColPresent)
add a row containing all links to specified Pubmed IDs
static CIRef< ITooltipFormatter > CreateTooltipFormatter()
virtual string CreateLink(const string &sText, const string &sUrl) const
construct the HTML code for a link from the displayed text label and supplied URL
virtual string CreateNcbiLink(const string &sText, const string &sUrl) const =0
construct the HTML code for a link from the displayed text label and supplied NCBI URL path
virtual void AddValueCol(const string &sContents="", unsigned width=200, bool isNoWrap=false)
adds a value column to the row
virtual void StartRow()
start a new table row
virtual void AddBulletCol(const string &sBulletSrc="")
add a cell with an image
virtual bool IsEmpty() const
Indicates if the tooltip is empty.
virtual void AddDividerRow(unsigned colspan=2)
add a horizontal divider between sections of the table
virtual void AddLinksTitle(const string &sTitle)
add a row with the links title
virtual void AddBulletCol(const string &sBulletSrc="")
add a cell with an image
@ eTooltipFormatter_CSSTable
generated table is CSS based, generated NCBI URLs are paths (recommended for SViewer)
@ eTooltipFormatter_Html
generated table is HTML attributes (no CSS) based, generate NCBI URLs are absolute (recommended for G...
@ eTooltipFormatter_Text
plain text formatted
#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 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 string HtmlEncode(const CTempString str, THtmlEncode flags=fHtmlEnc_EncodeAll)
Encode a string for HTML.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
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.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
@ fConvErr_NoThrow
Do not throw an exception on error.
constexpr auto sort(_Init &&init)
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