mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-29 16:47:28 +01:00
line endings and compile
This commit is contained in:
parent
f466636958
commit
23bfd4eaac
@ -1,41 +1,41 @@
|
||||
// @file html.h
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Things in the mongoutils namespace
|
||||
(1) are not database specific, rather, true utilities
|
||||
(2) are cross platform
|
||||
(3) may require boost headers, but not libs
|
||||
(4) are clean and easy to use in any c++ project without pulling in lots of other stuff
|
||||
*/
|
||||
|
||||
#include <strstream>
|
||||
|
||||
namespace mongoutils {
|
||||
|
||||
namespace html {
|
||||
|
||||
using namespace std;
|
||||
|
||||
inline string p(string contentHtml) {
|
||||
stringstream ss;
|
||||
ss << "<p>" << contentHtml << "</p>\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/* does NOT escape the strings. */
|
||||
inline string a(string href, string title="", string contentHtml = "") {
|
||||
stringstream ss;
|
||||
ss << "<a";
|
||||
if( !href.empty() ) ss << " href=\"" << href << '"';
|
||||
if( !title.empty() ) ss << " title=\"" << title << '"';
|
||||
ss << '>';
|
||||
if( !contentHtml.empty() ) {
|
||||
ss << contentHtml << "</a>";
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// @file html.h
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Things in the mongoutils namespace
|
||||
(1) are not database specific, rather, true utilities
|
||||
(2) are cross platform
|
||||
(3) may require boost headers, but not libs
|
||||
(4) are clean and easy to use in any c++ project without pulling in lots of other stuff
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace mongoutils {
|
||||
|
||||
namespace html {
|
||||
|
||||
using namespace std;
|
||||
|
||||
inline string p(string contentHtml) {
|
||||
stringstream ss;
|
||||
ss << "<p>" << contentHtml << "</p>\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/* does NOT escape the strings. */
|
||||
inline string a(string href, string title="", string contentHtml = "") {
|
||||
stringstream ss;
|
||||
ss << "<a";
|
||||
if( !href.empty() ) ss << " href=\"" << href << '"';
|
||||
if( !title.empty() ) ss << " title=\"" << title << '"';
|
||||
ss << '>';
|
||||
if( !contentHtml.empty() ) {
|
||||
ss << contentHtml << "</a>";
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user