📄 html.cpp
字号:
const char CHTML_dir::sm_TagName[] = "dir";CHTML_dir::~CHTML_dir(void){ return;}// <menu> tag.const char CHTML_menu::sm_TagName[] = "menu";CHTML_menu::~CHTML_menu(void){ return;}const char CHTML_font::sm_TagName[] = "font";CHTML_font::~CHTML_font(void){ return;}// <font> tag.CHTML_font* CHTML_font::SetTypeFace(const string& typeface){ SetAttribute("face", typeface); return this;}CHTML_font* CHTML_font::SetRelativeSize(int size){ if ( size != 0 ) SetAttribute("size", NStr::IntToString(size, true)); return this;}const char CHTML_basefont::sm_TagName[] = "basefont";CHTML_basefont::~CHTML_basefont(void){ return;}CHTML_basefont* CHTML_basefont::SetTypeFace(const string& typeface){ SetAttribute("typeface", typeface); return this;}CHTML_color::~CHTML_color(void){ return;}// <hr> tag.const char CHTML_hr::sm_TagName[] = "hr";CHTML_hr::~CHTML_hr(void){ return;}CHTML_hr* CHTML_hr::SetNoShade(void){ SetAttribute("noshade"); return this;}CNcbiOstream& CHTML_hr::PrintBegin(CNcbiOstream& out, TMode mode){ if ( mode == ePlainText ) { out << CHTMLHelper::GetNL() << CHTMLHelper::GetNL(); CHECK_STREAM_WRITE(out); } else { CParent::PrintBegin(out, mode); } return out;}// <meta> tag.const char CHTML_meta::sm_TagName[] = "meta";CHTML_meta::CHTML_meta(EType mtype, const string& var, const string& content) : CParent(sm_TagName){ SetAttribute(( mtype == eName ) ? "name" : "http-equiv", var); SetAttribute("content", content);}CHTML_meta::~CHTML_meta(void){ return;}// <script> tag.const char CHTML_script::sm_TagName[] = "script";CHTML_script::CHTML_script(const string& stype) : CParent(sm_TagName){ SetAttribute("type", stype);}CHTML_script::CHTML_script(const string& stype, const string& url) : CParent(sm_TagName){ SetAttribute("type", stype); SetAttribute("src", url);}CHTML_script::~CHTML_script(void){ return;}CHTML_script* CHTML_script::AppendScript(const string& script){ AppendChild(new CHTMLPlainText("\n<!--\n" + script + "-->\n", true)); return this;}// Other tags.#define DEFINE_HTML_ELEMENT(Tag) \CHTML_NAME(Tag)::~CHTML_NAME(Tag)(void) \{ \} \const char CHTML_NAME(Tag)::sm_TagName[] = #TagDEFINE_HTML_ELEMENT(head);DEFINE_HTML_ELEMENT(body);DEFINE_HTML_ELEMENT(base);DEFINE_HTML_ELEMENT(isindex);DEFINE_HTML_ELEMENT(link);DEFINE_HTML_ELEMENT(noscript);DEFINE_HTML_ELEMENT(object);DEFINE_HTML_ELEMENT(style);DEFINE_HTML_ELEMENT(title);DEFINE_HTML_ELEMENT(address);DEFINE_HTML_ELEMENT(blockquote);DEFINE_HTML_ELEMENT(center);DEFINE_HTML_ELEMENT(div);DEFINE_HTML_ELEMENT(h1);DEFINE_HTML_ELEMENT(h2);DEFINE_HTML_ELEMENT(h3);DEFINE_HTML_ELEMENT(h4);DEFINE_HTML_ELEMENT(h5);DEFINE_HTML_ELEMENT(h6);DEFINE_HTML_ELEMENT(p);DEFINE_HTML_ELEMENT(pnop);DEFINE_HTML_ELEMENT(pre);DEFINE_HTML_ELEMENT(dt);DEFINE_HTML_ELEMENT(dd);DEFINE_HTML_ELEMENT(li);DEFINE_HTML_ELEMENT(caption);DEFINE_HTML_ELEMENT(col);DEFINE_HTML_ELEMENT(colgroup);DEFINE_HTML_ELEMENT(thead);DEFINE_HTML_ELEMENT(tbody);DEFINE_HTML_ELEMENT(tfoot);DEFINE_HTML_ELEMENT(th);DEFINE_HTML_ELEMENT(td);DEFINE_HTML_ELEMENT(applet);DEFINE_HTML_ELEMENT(param);DEFINE_HTML_ELEMENT(cite);DEFINE_HTML_ELEMENT(code);DEFINE_HTML_ELEMENT(dfn);DEFINE_HTML_ELEMENT(em);DEFINE_HTML_ELEMENT(kbd);DEFINE_HTML_ELEMENT(samp);DEFINE_HTML_ELEMENT(strike);DEFINE_HTML_ELEMENT(strong);DEFINE_HTML_ELEMENT(var);DEFINE_HTML_ELEMENT(b);DEFINE_HTML_ELEMENT(big);DEFINE_HTML_ELEMENT(i);DEFINE_HTML_ELEMENT(s);DEFINE_HTML_ELEMENT(small);DEFINE_HTML_ELEMENT(sub);DEFINE_HTML_ELEMENT(sup);DEFINE_HTML_ELEMENT(tt);DEFINE_HTML_ELEMENT(u);DEFINE_HTML_ELEMENT(blink);DEFINE_HTML_ELEMENT(span);DEFINE_HTML_ELEMENT(map);DEFINE_HTML_ELEMENT(area);END_NCBI_SCOPE/* * =========================================================================== * $Log: html.cpp,v $ * Revision 1000.4 2004/06/01 19:15:26 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.103 * * Revision 1.103 2004/05/17 20:59:50 gorelenk * Added include of PCH ncbi_pch.hpp * * Revision 1.102 2004/04/05 16:19:57 ivanov * Added support for Sergey Kurdin's popup menu with configurations * * Revision 1.101 2004/03/10 20:11:35 ivanov * Changed message text * * Revision 1.100 2004/02/04 17:20:10 ivanov * Added s_GenerateNodeInternalName() function. * Use it insteed dummy names in the meta-tags node classes. * * Revision 1.99 2004/02/04 12:43:47 ivanov * Fixed CHTMLText::SetText() -- do not use m_Name for store HTML code. * Bind internal name for objects of the CHTMLSpecialChar class. * * Revision 1.98 2004/02/03 19:45:13 ivanov * Binded dummy names for the unnamed nodes * * Revision 1.97 2004/02/02 15:48:16 ivanov * CHTMLText::x_PrintBegin: using CHTMLHelper::StripHTML insteed StripTags * * Revision 1.96 2004/02/02 14:30:24 ivanov * CHTMLText::PrintBegin - added repeat tag support. Some cosmetic changes. * * Revision 1.95 2004/01/30 14:03:50 lavr * Print last errno along with "write failure" message * * Revision 1.94 2004/01/26 16:26:47 ivanov * Added NOWRAP attribute support * * Revision 1.93 2003/12/18 20:15:42 golikov * use HideMenu() call, CHTMLComment::PrintBegin fix * * Revision 1.92 2003/12/16 19:08:49 ivanov * CHTML_font::SetTypeFace: replaced attribute name "typeface" to "face". * * Revision 1.91 2003/12/10 19:15:14 ivanov * Move adding a string "return false;" to menues JS code call from ShowMenu() * to AttachPopupMenu() * * Revision 1.90 2003/12/02 14:25:58 ivanov * Removed obsolete functions GetCodeBodyTag[Handler|Action](). * AttachPopupMenu(): use event parameter for eKurdin menu also. * * Revision 1.89 2003/11/03 17:03:08 ivanov * Some formal code rearrangement. Move log to end. * * Revision 1.88 2003/11/03 14:49:16 ivanov * Always check if the write was successful, throw otherwise * * Revision 1.87 2003/10/01 15:57:13 ivanov * Added support for Sergey Kurdin's side menu * * Revision 1.86 2003/07/08 17:13:53 gouriano * changed thrown exceptions to CException-derived ones * * Revision 1.85 2003/05/30 18:39:33 lavr * Replace endl's with explicit '\n' to avoid premature flushing * * Revision 1.84 2003/05/15 12:33:54 ucko * s_Find: drop assertion, and just return NPOS at/past the end of s. * * Revision 1.83 2003/05/14 21:55:40 ucko * CHTMLText::PrintBegin: Use strstr() instead of string::find() when * looking for tags to replace, as the latter is much slower on some * systems. * * Revision 1.82 2003/04/22 15:04:05 ivanov * Removed HTMLEncode() for tags attributes in CHTMLOpenElement::PrintBegin() * * Revision 1.81 2003/03/11 15:28:57 kuznets * iterate -> ITERATE * * Revision 1.80 2003/02/14 16:19:32 ucko * Indent the children of CHTMLListElement in plain-text mode. * Avoid redundant newlines in CHTMLBlockElement::PrintEnd. * * Revision 1.79 2002/12/24 14:56:03 ivanov * Fix for R1.76: HTML classes for tags <h1-6>, <p>, <div>. <pre>, <blockquote> * now inherits from CHTMLBlockElement (not CHTMElement as before) * * Revision 1.78 2002/12/20 19:20:19 ivanov * Added SPAN tag support * * Revision 1.77 2002/12/18 19:46:18 ivanov * Added line break after elements of the class CHTMLElement in plain text mode * * Revision 1.76 2002/12/09 22:11:33 ivanov * Added support for Sergey Kurdin's popup menu. * Added CHTMLNode::AttachPopupMenu(). * * Revision 1.75 2002/09/25 01:24:56 dicuccio * Added CHTMLHelper::StripTags() - strips HTML comments and tags from any * string. Implemented CHTMLText::PrintBegin() for mode = ePlainText * * Revision 1.74 2002/02/13 20:16:44 ivanov * Added support of dynamic popup menus. Changed EnablePopupMenu(). * * Revision 1.73 2002/01/30 19:54:51 ivanov * CHTML_table::PrintBegin - determination length of prior table's separator * as length of first none empty table's row. Added new line at printing * table in plain text mode. * * Revision 1.72 2002/01/29 20:01:46 ivanov * (plain text) CHTML_table:: set def. medium sep. to " " instead of "\t" * * Revision 1.71 2002/01/29 19:25:55 ivanov * Typo fixed * * Revision 1.70 2002/01/29 19:20:47 ivanov * (plain text) CHTML_table:: set def. medium sep. to "" instead of "\t". * Restored functionality of CHTML_tr::PrintEnd(). * Fixed CHTML_tr::GetTextLength() -- ".put('\0')" instead of "<< '\0'". * * Revision 1.69 2002/01/28 17:54:50 vakatov * (plain text) CHTML_table:: set def. medium sep. to "\t" instead of "\t|\t" * * Revision 1.68 2002/01/17 23:40:01 ivanov * Added means to print HTML tables in plain text mode * * Revision 1.67 2001/08/14 16:51:05 ivanov * Change means for init JavaScript popup menu & add it to HTML document. * Remove early redefined classes for tags HEAD and BODY. * * Revision 1.66 2001/07/16 13:54:09 ivanov * Added support JavaScript popups menu (jsmenu.[ch]pp) * * Revision 1.65 2001/06/08 19:00:22 ivanov * Added base classes: CHTMLDualNode, CHTMLSpecialChar * (and based on it: CHTML_nbsp, _gt, _lt, _quot, _amp, _copy, _reg) * Added realization for tags <meta> (CHTML_meta) and <script> (CHTML_script) * Changed base class for tags LINK, PARAM, ISINDEX -> CHTMLOpenElement * Added tags: OBJECT, NOSCRIPT * Added attribute "alt" for CHTML_img * Added CHTMLComment::Print() for disable print html-comments in plaintext mode * * Revision 1.64 2001/06/05 15:35:48 ivanov * Added attribute "alt" to CHTML_image * * Revision 1.63 2001/05/17 15:05:42 lavr * Typos corrected * * Revision 1.62 2000/10/13 19:55:15 vasilche * Fixed error with static html node object. * * Revision 1.61 2000/09/27 14:11:17 vasilche * Newline '\n' will not be generated after tags LABEL, A, FONT, CITE, CODE, EM, * KBD, STRIKE STRONG, VAR, B, BIG, I, S, SMALL, SUB, SUP, TT, U and BLINK. * * Revision 1.60 2000/08/15 19:40:48 vasilche * Added CHTML_label::SetFor() method for setting HTML attribute FOR. * * Revision 1.59 2000/08/01 20:05:11 golikov * Removed _TRACE * * Revision 1.58 2000/07/25 15:27:38 vasilche * Added newline symbols before table and after each table row in text mode. * * Revision 1.57 2000/07/20 20:37:19 vasilche * Fixed null pointer dereference. * * Revision 1.56 2000/07/18 19:08:55 vasilche * Fixed uninitialized members. * Fixed NextCell to advance to next cell. * * Revision 1.55 2000/07/18 17:21:39 vasilche * Added possibility to force output of empty attribute value. * Added caching to CHTML_table, now large tables work much faster. * Changed algorithm of emitting EOL symbols in html output. * * Revision 1.54 2000/07/12 16:37:42 vasilche * Added new HTML4 tags: LABEL, BUTTON, FIELDSET, LEGEND. * Added methods for setting common attributes: STYLE, ID, TITLE, ACCESSKEY. * * Revision 1.53 2000/03/07 15:26:12 vasilche * Removed second definition of CRef. * * Revision 1.52 1999/12/28 21:01:08 vasilche * Fixed conflict on MS VC between bool and const string& arguments by * adding const char* argument. * * Revision 1.51 1999/12/28 18:55:45 vasilche * Reduced size of compiled object files: * 1. avoid inline or implicit virtual methods (especially destructors). * 2. avoid std::string's methods usage in inline methods. * 3. avoid string literals ("xxx") in inline methods. * * Revision 1.50 1999/10/28 13:40:35 vasilche * Added reference counters to CNCBINode. * * Revision 1.49 1999/08/20 16:14:54 golikov * 'non-<TR> tag' bug fixed * * Revision 1.48 1999/08/09 16:20:07 golikov * Table output in plaintext fixed * * Revision 1.47 1999/07/08 18:05:15 vakatov * Fixed compilation warnings * * Revision 1.46 1999/06/18 20:42:50 vakatov * Fixed tiny compilation warnings * * Revision 1.45 1999/06/11 20:30:29 vasilche * We should catch exception by reference, because catching by value * doesn't preserve comment string. * * Revision 1.44 1999/06/09 20:57:58 golikov * RowSpan fixed by Vasilche * * Revision 1.43 1999/06/07 15:21:05 vasilche * Fixed some warnings. * * Revision 1.42 1999/05/28 18:03:51 vakatov * CHTMLNode:: added attribute "CLASS" * * Revision 1.41 1999/05/27 21:43:02 vakatov * Get rid of some minor compiler warnings * * Revision 1.40 1999/05/24 13:57:55 pubmed * Save Command; MEDLINE, FASTA format changes * * Revision 1.39 1999/05/20 16:52:31 pubmed * SaveAsText action for query; minor changes in filters,labels, tabletemplate * * Revision 1.38 1999/05/17 20:09:58 vasilche * Removed generation of implicit table cells. * * Revision 1.37 1999/04/16 17:45:35 vakatov * [MSVC++] Replace the <windef.h>'s min/max macros by the hand-made templates. * * Revision 1.36 1999/04/15 22:09:26 vakatov * "max" --> "NcbiMax" * * Revision 1.35 1999/04/15 19:56:24 vasilche * More warnings fixed * * Revision 1.34 1999/04/15 19:48:23 vasilche * Fixed several warnings detected by GCC * * Revision 1.33 1999/04/08 19:00:31 vasilche * Added current cell pointer to CHTML_table * * Revision 1.32 1999/03/26 22:00:01 sandomir * checked option in Radio button fixed; minor fixes in Selection * * Revision 1.31 1999/03/01 21:03:09 vasilche * Added CHTML_file input element. * Changed CHTML_form constructors. * * Revision 1.30 1999/02/26 21:03:33 vasilche * CAsnWriteNode made simple node. Use CHTML_pre explicitly. * Fixed bug in CHTML_table::Row. * Added CHTML_table::HeaderCell & DataCell methods. * * Revision 1.29 1999/02/02 17:57:49 vasilche * Added CHTML_table::Row(int row). * Linkbar now have equal image spacing. * * Revision 1.28 1999/01/28 21:58:08 vasilche * QueryBox now inherits from CHTML_table (not CHTML_form as before). * Use 'new CHTML_form("url", queryBox)' as replacement of old QueryBox. * * Revision 1.27 1999/01/28 16:59:01 vasilche * Added several constructors for CHTML_hr. * Added CHTMLNode::SetSize method. * * Revision 1.26 1999/01/25 19:34:18 vasilche * String arguments which are added as HTML text now treated as plain text. * * Revision 1.25 1999/01/21 21:12:59 vasilche * Added/used descriptions for HTML submit/select/text. * Fixed some bugs in paging. * * Revision 1.24 1999/01/21 16:18:05 sandomir * minor changes due to NStr namespace to contain string utility functions * * Revision 1.23 1999/01/14 21:25:20 vasilche * Changed CPageList to work via form image input elements. * * Revision 1.22 1999/01/11 22:05:52 vasilche * Fixed CHTML_font size. * Added CHTML_image input element. * * Revision 1.21 1999/01/11 15:13:35 vasilche * Fixed CHTML_font size. * CHTMLHelper extracted to separate file. * * Revision 1.20 1999/01/07 16:41:56 vasilche * CHTMLHelper moved to separate file. * TagNames of CHTML classes ara available via s_GetTagName() static * method. * Input tag types ara available via s_GetInputType() static method. * Initial selected database added to CQueryBox. * Background colors added to CPagerBax & CSmallPagerBox. * * Revision 1.19 1999/01/05 20:23:29 vasilche * Fixed HTMLEncode. * * Revision 1.18 1999/01/04 20:06:14 vasilche * Redesigned CHTML_table. * Added selection support to HTML forms (via hidden values). * * Revision 1.16 1998/12/28 21:48:16 vasilche * Made Lewis's 'tool' compilable * * Revision 1.15 1998/12/28 16:48:09 vasilche * Removed creation of QueryBox in CHTMLPage::CreateView() * CQueryBox extends from CHTML_form *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -