uce/src/lib/types.cpp
2022-02-11 01:51:32 +00:00

54 lines
823 B
C++

#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <filesystem>
#include <ctype.h>
#include <fstream>
#include <sys/stat.h>
#include <ctime>
#include <dlfcn.h>
#include <limits.h>
#include <algorithm>
#include <sys/stat.h>
#include <iostream>
#include "types.h"
SharedUnit::~SharedUnit()
{
if(so_handle)
{
dlclose(so_handle);
}
}
String nibble(String div, String& haystack)
{
auto pos = haystack.find(div);
if(pos == String::npos)
{
auto result = haystack;
haystack.clear();
return(result);
}
else
{
auto result = haystack.substr(0, pos);
haystack.erase(0, pos+div.length());
return(result);
}
}
void Request::ob_start()
{
ob_stack.push_back(new std::ostringstream());
ob = ob_stack.back();
}
Request::~Request()
{
for(auto& sockfd : resources.sockets)
close(sockfd);
}