webem_demo.zip
code_project
examples
webemCalendar
calendar.dat
sqlite3.dll
webemCalendar.vcproj.CORVIS.james.user
webemHello
webemHello.vcproj.CORVIS.james.user
webemHelloForm
webemHelloForm.vcproj.CORVIS.james.user
webemMT
webemMT.vcproj.CORVIS.james.user
src
sqlite
sqlite3.lib
webem
server
Jamfile
Jamfile.v2
webem_src.zip
_FOSSIL_
doc
DoxyFile
html
doxygen.png
tab_b.gif
tab_l.gif
tab_r.gif
examples
webemCalendar
calendar.dat
sqlite3.dll
sqlite3.lib
WebemHello
webemHelloForm
manifest
manifest.uuid
server
webem.fossil
|
// webemMT.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include "../../cWebem.h"
/// An application class which says hello
class cHello
{
public:
char * DisplayHTML()
{
return "<em>Hello World</em>";
}
/**
Hello to the wide world, returning a wide character UTF-32 encoded string with chinese characters
*/
wchar_t * DisplayWWHello()
{
return L"Hello Wide World. Here are some chinese characters: \x751f\x4ea7\x8bbe\x7f6e";
}
};
int _tmain(int argc, _TCHAR* argv[])
{
// Initialize application code
cHello hello;
// Initialise web server.
http::server::cWebem theServer(
"0.0.0.0", // address
"1570", // port
".\\"); // document root
// register application method
// Whenever server sees <!--#webem hello -->
// call cHello::DisplayHTML() and include the HTML returned
theServer.RegisterIncludeCode( "hello",
boost::bind(
&cHello::DisplayHTML, // member function
&hello ) ); // instance of class
// register wide character application method
// Whenever server sees <!--#webem wwwhello -->
// call cHello::DisplayWWHello() and include the HTML returned, converted to UTF-8
theServer.RegisterIncludeCodeW( "wwwhello",
boost::bind(
&cHello::DisplayWWHello, // member function
&hello ) ); // instance of class
// Tell user where to find the cWebem GUI
printf("%s",theServer.Splash().c_str());
// run the server
theServer.Run();
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.