![]() |
3DCoat
3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
|
#include <jcc.h>
Public Member Functions | |
httplib::Server & | server () |
return the reference to the httplib::Server for any advanced operations. More... | |
int | port () |
returns the port, assigned to the server More... | |
void | allowConsoleOutput (bool enable=true) |
allows logging about every network action to the to cout More... | |
void | open (const Html &page) |
opens the page in browser More... | |
void | openFile (const std::string &filepath) |
opens the page from file in browser More... | |
void | get (requestHandler f, const char *pattern=nullptr) |
assign the callback for the get request. The page may interact with the host program via the get requests. More... | |
void | post (requestHandler f, const char *pattern=nullptr) |
assign the callback for the post request. The page may interact with the host program via the post requests. More... | |
void | put (requestHandler f, const char *pattern=nullptr) |
assign the callback for the put request. More... | |
void | exchange (std::function< json::JSON(const json::JSON &)> f) |
exchange objects, you are getting object as input and should return the object as well. The call of exchange initiated on browser's side by sendObject, see the example More... | |
void | listenAsync () |
starts to listen the port. Usually, you don't need to call it manually. Any other network interaction function calls it. And if you will call it, nothing wrong will happen. If it was already called and listening thread created, then nothing happens. More... | |
void | signalToStop () |
stop the server and exit the listen cycle. This function may be called in the response body. Server will be stopped only after the sending the response. More... | |
void | stopGracefully () |
stop and wait till it will be stopped More... | |
bool | wait (int ms_amount=-1) |
Wait till the page will be closed or the connection lost. Page treated as closed when there is no ping for 500 ms. More... | |
bool | alive (int ms_max=2000) |
returns true if there sas ping from the page recently More... | |
double | msSincePing () |
returns milliseconds since the last ping or < 0 if there was no pings. More... | |
Element & | console () |
Element & | el (const std::string &domElementID) |
Element & | eval () |
Static Public Member Functions | |
static void | setServerFilesPlacement (const char *path) |
Set the path to the folder that contains /public folder The main.js should be placed into the root of that folder. If you will not specify the path, the folder that contains main.js will be taken as the root folder will be treated as the root folder for the server. More... | |
static std::string | path (const std::string &filename) |
appends filename to the server files path, returns the absolute path More... | |
static void | read (const std::string &filename, std::string &to) |
read the file to string, path is relative to server More... | |
static void | write (const std::string &filename, std::string &from) |
write the string to file, path is relative to server More... | |
static void | createPath (const std::string &path) |
create all componentes of the path, path is relative to server More... | |
static bool | pathIsRelative (const std::string &path) |
detects if the path is relative to the server More... | |
This is the main class for interaction between the c++ code and the browser. The typical pattern is:
|
inline |
returns true if there sas ping from the page recently
References msSincePing().
|
inline |
allows logging about every network action to the to cout
|
inline |
Print to the browser console.There is a little delay because changes passed to browser each time when it sends ping.
References el().
|
inlinestatic |
create all componentes of the path, path is relative to server
References path().
|
inline |
|
inline |
Evaluate on the browser's side.
References el().
|
inline |
exchange objects, you are getting object as input and should return the object as well. The call of exchange initiated on browser's side by sendObject, see the example
References listenAsync().
|
inline |
assign the callback for the get request. The page may interact with the host program via the get requests.
References listenAsync().
|
inline |
starts to listen the port. Usually, you don't need to call it manually. Any other network interaction function calls it. And if you will call it, nothing wrong will happen. If it was already called and listening thread created, then nothing happens.
Referenced by exchange(), get(), open(), post(), put(), and wait().
|
inline |
|
inline |
|
inline |
|
inlinestatic |
appends filename to the server files path, returns the absolute path
References pathIsRelative().
Referenced by createPath(), open(), openFile(), and setServerFilesPlacement().
|
inlinestatic |
detects if the path is relative to the server
Referenced by path().
|
inline |
returns the port, assigned to the server
|
inline |
assign the callback for the post request. The page may interact with the host program via the post requests.
References listenAsync().
|
inline |
assign the callback for the put request.
References listenAsync().
|
inlinestatic |
read the file to string, path is relative to server
|
inline |
return the reference to the httplib::Server for any advanced operations.
|
inlinestatic |
Set the path to the folder that contains /public folder The main.js should be placed into the root of that folder. If you will not specify the path, the folder that contains main.js will be taken as the root folder will be treated as the root folder for the server.
References path().
|
inline |
stop the server and exit the listen cycle. This function may be called in the response body. Server will be stopped only after the sending the response.
|
inline |
stop and wait till it will be stopped
|
inline |
Wait till the page will be closed or the connection lost. Page treated as closed when there is no ping for 500 ms.
ms_amout | the milliseconds to wait, -1 to wait infinitely. |
References listenAsync(), and msSincePing().
|
inlinestatic |
write the string to file, path is relative to server