Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
sese Namespace Reference

Namespaces

namespace  _windows
 
namespace  archive
 
namespace  concurrent
 
namespace  db
 
namespace  event
 
namespace  ini
 
namespace  internal
 
namespace  io
 
namespace  iocp
 
namespace  net
 
namespace  plugin
 
namespace  record
 
namespace  res
 
namespace  security
 
namespace  service
 
namespace  system
 
namespace  text
 
namespace  xml
 

Classes

class  ArgParser
 Command line argument parsing class. More...
 
class  Base64Converter
 BASE64 converter. More...
 
class  Bimap
 Bidirectional map. More...
 
struct  Bitset32
 Endian-independent 32-bit. More...
 
class  BufferedQueue11
 Cache queue (single producer-single consumer) More...
 
class  BufferedQueueNn
 Cache queue (multi producer-multi consumer) More...
 
class  Compressor
 Compressor class. More...
 
class  ConfigObject
 Traditional configuration file class. More...
 
class  ConfigUtil
 Traditional configuration file utility. More...
 
class  CSVReader
 CSV stream reader. More...
 
class  CSVWriter
 CSV stream writer. More...
 
class  DateTime
 Date time class. More...
 
class  Decompressor
 Decompressor class. More...
 
class  EncodingConverter
 String encoding conversion. More...
 
class  ErrorCode
 Error code class. More...
 
class  Exception
 Exception class. More...
 
class  GlobalThreadPool
 Global thread pools, which use system thread pools on Windows, and slacker singleton thread pools on UNIX platforms. More...
 
class  GZipFileInputStream
 GZip file input stream (decompression) More...
 
class  GZipFileOutputStream
 GZip file output stream (compression) More...
 
struct  has_begin
 
struct  has_begin< T, void_t< decltype(std::declval< T >().begin())> >
 
struct  has_end
 
struct  has_end< T, void_t< decltype(std::declval< T >().begin())> >
 
class  Initializer
 Initializer. More...
 
class  InitiateTask
 Initialization task base class. More...
 
struct  is_iterable
 
struct  is_pair
 
struct  is_pair< std::pair< T1, T2 > >
 
class  Json
 JSON parser. More...
 
class  Locker
 std::mutex wrapper More...
 
struct  LongLongSplitter
 Structure for data splitting. More...
 
class  MD5Util
 MD5 Algorithm Class. More...
 
class  MemoryViewer
 Memory viewer tool. More...
 
class  MessageDigest
 Message digest utility class. More...
 
class  Noncopyable
 Non-copyable class. More...
 
class  NotInstantiable
 Non-instantiable class. More...
 
class  ObjectPool
 Object pool. More...
 
class  PercentConverter
 Percent sign encoding converter. More...
 
class  RandomUtil
 Random utility class. More...
 
class  Range
 Range class. More...
 
class  Result
 Result Class. More...
 
class  Result< T, E, std::enable_if_t< std::is_same_v< T, E > &&!std::is_void_v< T > &&!std::is_void_v< E > > >
 
class  Result< T, E, std::enable_if_t<!std::is_same_v< T, E > &&!std::is_void_v< T > &&!std::is_void_v< E > > >
 
class  Result< T, void >
 
class  Result< void, E >
 
class  Result< void, void >
 
class  RingQueue
 Ring queue. More...
 
struct  SHA1Context
 SHA1 context. More...
 
class  SHA1Util
 SHA1 algorithm tool. More...
 
class  SHA256Util
 SHA256 digest algorithm without hardware instruction acceleration, do not use this utility class if performance is a concern. More...
 
class  Singleton
 Raw Pointer Singleton Template Class. More...
 
class  SingletonPtr
 Smart Pointer Singleton Template Class. More...
 
class  SpinLock
 Spin Lock. More...
 
class  StopWatch
 Stopwatch Class. More...
 
struct  StrCaseMapComparer
 StrCaseMap Comparator. More...
 
struct  StrCaseUnorderedMapComparer
 StrCaseUnorderedMap Comparator. More...
 
struct  StrCmp
 Character comparator. More...
 
struct  StrCmpI
 Character comparator (case-insensitive) More...
 
class  SymbolConverter
 
class  Thread
 Thread class. More...
 
class  ThreadInitiateTask
 Initialization task for the built-in thread class. More...
 
class  ThreadPool
 Thread pool class. More...
 
struct  TimeoutEvent
 Timeout Event. More...
 
struct  TimeoutEventSlot
 Timeout Event Slot (Time Wheel Slice) More...
 
class  Timer
 Low-Precision Timer Class. More...
 
class  TimerTask
 Timer Task. More...
 
class  TimeSpan
 Time Interval Class. More...
 
class  TimestampHandler
 Timestamp Handler. More...
 
class  TimeWheel
 Time Wheel. More...
 
class  UniReader
 Cross-platform file reader, primarily adapted for Windows, supports UTF-8. More...
 
class  UnixException
 Unix exception wrapper class. More...
 
class  Uuid
 Uuid Class. More...
 
class  UuidBuilder
 Uuid Builder. More...
 
class  Value
 Value Container Class. More...
 
class  Version
 Version Class. More...
 
class  Yaml
 YAML parser. More...
 

Typedefs

template<class T >
using BufferedQueueN1 = BufferedQueueNn<T>
 Cache queue (multi producer-single consumer)
 
template<class T >
using BufferedQueue1N = BufferedQueueNn<T>
 Cache queue (single producer-multi consumer)
 
template<typename VALUE , typename ALLOCATOR = std::allocator<std::pair<const std::string, VALUE>>>
using StrCaseMap = std::map<std::string, VALUE, StrCaseMapComparer, ALLOCATOR>
 Dictionary class that ignores case of string keys.
 
template<typename VALUE , typename ALLOCATOR = std::allocator<std::pair<const std::string, VALUE>>>
using StrCaseUnorderedMap = std::unordered_map<std::string, VALUE, StrCaseUnorderedMapComparer, StrCaseUnorderedMapComparer, ALLOCATOR>
 Dictionary class that ignores case of string keys.
 
using socket_t = int32_t
 Native Socket type.
 
using tid_t = uint32_t
 Thread ID identifier.
 
using pid_t = ::pid_t
 Process ID identifier.
 
template<typename... >
using void_t = void
 
using NativeException = UnixException
 
template<typename T >
using SharedType = std::shared_ptr<T>
 
template<typename T >
using UniqueType = std::unique_ptr<T>
 
template<typename T >
using WeakType = std::weak_ptr<T>
 

Enumerations

enum class  CompressionType { RAW = -30 , ZLIB = 0 , GZIP = 16 }
 

Functions

const char * getLevelString (record::Level level) noexcept
 
template<class RETURN_TYPE >
std::shared_future< RETURN_TYPE > async (const std::function< RETURN_TYPE()> &task) noexcept
 Launch an anonymous thread to execute a task.
 
template<class RETURN_TYPE >
std::shared_future< RETURN_TYPE > async (ThreadPool &pool, const std::function< RETURN_TYPE()> &task) noexcept
 Submit a task to an existing thread pool.
 
template<class RETURN_TYPE >
std::shared_future< RETURN_TYPE > asyncWithGlobalPool (const std::function< RETURN_TYPE()> &task) noexcept
 Submit a task to the global thread pool.
 
void initCore (int argc, const char *const *argv) noexcept
 Initialize sese-core.
 
template<typename RETURN_TYPE , typename... ARGS>
SharedType< RETURN_TYPE > makeShared (ARGS &&...args)
 
template<typename RETURN_TYPE , typename... ARGS>
SharedType< RETURN_TYPE > makeUnique (ARGS &&...args)
 
template<typename RETURN_TYPE , typename INIT_TYPE >
SharedType< RETURN_TYPE > makeSharedFromList (std::initializer_list< INIT_TYPE > list)
 
template<typename RETURN_TYPE , typename INIT_TYPE >
UniqueType< RETURN_TYPE > makeUniqueFromList (std::initializer_list< INIT_TYPE > list)
 
template<typename RETURN_TYPE , typename RAW_TYPE >
SharedType< RETURN_TYPE > dynamicPointerCast (SharedType< RAW_TYPE > raw_type)
 
template<typename RETURN_TYPE , typename RAW_TYPE >
UniqueType< RETURN_TYPE > dynamicPointerCast (UniqueType< RAW_TYPE > &raw_type)
 
int64_t toInteger (const std::string &string, int radix=10)
 
std::string getClassName (const std::type_info *type)
 
bool strcmp (char const *lv, char const *rv) noexcept
 
bool strcmpDoNotCase (char const *lv, char const *rv) noexcept
 
bool isSpace (char ch) noexcept
 
const char * getLevelString (Level level) noexcept
 
int32_t findFirstAt (const char *str, char ch)
 
void sleep (uint32_t second)
 
template<class REP , class PERIOD >
void sleep (const std::chrono::duration< REP, PERIOD > &duration)
 
std::string getErrorString (int64_t error=errno)
 
int32_t getErrorCode ()
 
size_t streamMove (sese::io::OutputStream *out, sese::io::InputStream *in, size_t size) noexcept
 
template<class T >
size_t number2StringLength (T num, size_t radix=10)
 
template<class T >
size_t floating2StringLength (T num, uint16_t placeholder)
 
template<typename TP >
std::time_t to_time_t (TP tp)
 
template<typename T >
bool isAdditionOverflow (T a, T b)
 Additive spill detection.
 
template<typename T >
bool isSubtractionOverflow (T a, T b)
 Subtractive spill detection.
 

Variables

thread_local std::shared_ptr< sese::Thread::RuntimeDatacurrent_data = nullptr
 
template<typename T >
constexpr bool is_iterable_v = is_iterable<T>::value
 

Typedef Documentation

◆ BufferedQueue1N

template<class T >
using sese::BufferedQueue1N = BufferedQueueNn<T>

Cache queue (single producer-multi consumer)

◆ BufferedQueueN1

template<class T >
using sese::BufferedQueueN1 = BufferedQueueNn<T>

Cache queue (multi producer-single consumer)

◆ NativeException

◆ pid_t

typedef DWORD sese::pid_t = ::pid_t

Process ID identifier.

◆ SharedType

template<typename T >
using sese::SharedType = std::shared_ptr<T>

◆ socket_t

typedef SOCKET sese::socket_t = int32_t

Native Socket type.

◆ StrCaseMap

template<typename VALUE , typename ALLOCATOR = std::allocator<std::pair<const std::string, VALUE>>>
using sese::StrCaseMap = std::map<std::string, VALUE, StrCaseMapComparer, ALLOCATOR>

Dictionary class that ignores case of string keys.

Template Parameters
VALUEDictionary value type
ALLOCATORMemory allocator

◆ StrCaseUnorderedMap

template<typename VALUE , typename ALLOCATOR = std::allocator<std::pair<const std::string, VALUE>>>
using sese::StrCaseUnorderedMap = std::unordered_map<std::string, VALUE, StrCaseUnorderedMapComparer, StrCaseUnorderedMapComparer, ALLOCATOR>

Dictionary class that ignores case of string keys.

Template Parameters
VALUEDictionary value type
ALLOCATORMemory allocator

◆ tid_t

typedef uint32_t sese::tid_t = uint32_t

Thread ID identifier.

◆ UniqueType

template<typename T >
using sese::UniqueType = std::unique_ptr<T>

◆ void_t

template<typename... >
using sese::void_t = void

◆ WeakType

template<typename T >
using sese::WeakType = std::weak_ptr<T>

Enumeration Type Documentation

◆ CompressionType

enum class sese::CompressionType
strong
Enumerator
RAW 
ZLIB 
GZIP 

Function Documentation

◆ async() [1/2]

template<class RETURN_TYPE >
std::shared_future< RETURN_TYPE > sese::async ( const std::function< RETURN_TYPE()> & task)
noexcept

Launch an anonymous thread to execute a task.

Template Parameters
RETURN_TYPEReturn type
Parameters
taskTask
Returns
std::shared_future object

◆ async() [2/2]

template<class RETURN_TYPE >
std::shared_future< RETURN_TYPE > sese::async ( ThreadPool & pool,
const std::function< RETURN_TYPE()> & task )
noexcept

Submit a task to an existing thread pool.

Template Parameters
RETURN_TYPEReturn type
Parameters
poolExisting thread pool
taskTask
Returns
std::shared_future object

References sese::ThreadPool::postTask().

◆ asyncWithGlobalPool()

template<class RETURN_TYPE >
std::shared_future< RETURN_TYPE > sese::asyncWithGlobalPool ( const std::function< RETURN_TYPE()> & task)
noexcept

Submit a task to the global thread pool.

Template Parameters
RETURN_TYPEReturn type
Parameters
taskTask
Returns
std::shared_future object

References sese::GlobalThreadPool::postTask().

◆ dynamicPointerCast() [1/2]

template<typename RETURN_TYPE , typename RAW_TYPE >
SharedType< RETURN_TYPE > sese::dynamicPointerCast ( SharedType< RAW_TYPE > raw_type)
inline

Type casting for std::shared_ptr

Template Parameters
RETURN_TYPETemplate parameter expected to return std::shared_ptr
RAW_TYPETemplate parameter of the original std::shared_ptr
Parameters
raw_typestd::shared_ptr to convert
Returns
std::shared_ptr<ReturnType>

◆ dynamicPointerCast() [2/2]

template<typename RETURN_TYPE , typename RAW_TYPE >
UniqueType< RETURN_TYPE > sese::dynamicPointerCast ( UniqueType< RAW_TYPE > & raw_type)

Type casting for std::unique_ptr

Template Parameters
RETURN_TYPETemplate parameter expected to return std::unique_ptr
RAW_TYPETemplate parameter of the original std::unique_ptr
Parameters
raw_typestd::unique_ptr to convert
Returns
std::unique_ptr<ReturnType>

◆ findFirstAt()

int32_t sese::findFirstAt ( const char * str,
char ch )

Find the first occurrence of a character in a string

Parameters
strThe string to search in
chThe character to find
Returns
The position of the first occurrence, or -1 if not found

References at().

◆ floating2StringLength()

template<class T >
size_t sese::floating2StringLength ( T num,
uint16_t placeholder )

Get the byte length required to convert a number to a string

Note
Only floating-point numbers can be converted
Template Parameters
TInput floating-point number type
Parameters
numNumber to be converted
placeholderPrecision
Returns
Length required for the number string

References number2StringLength().

Referenced by sese::text::FormatOption_FloatNumberFormat(), and sese::text::Number::toString().

◆ getClassName()

std::string sese::getClassName ( const std::type_info * type)

Get the name of the class

Parameters
typeClass
Returns
Name of the class

◆ getErrorCode()

◆ getErrorString()

◆ getLevelString() [1/2]

const char * sese::getLevelString ( Level level)
noexcept

Return corresponding string based on log level

Parameters
levelLog level
Returns
String

◆ getLevelString() [2/2]

const char * sese::getLevelString ( record::Level level)
noexcept

◆ initCore()

void sese::initCore ( int argc,
const char *const * argv )
noexcept

Initialize sese-core.

Parameters
argcNumber of arguments
argvArray of arguments

References sese::Initializer::addTask().

◆ isAdditionOverflow()

template<typename T >
bool sese::isAdditionOverflow ( T a,
T b )

Additive spill detection.

References a, and b.

Referenced by sese::internal::service::http::HttpConnectionEx::handleWindowUpdate().

◆ isSpace()

bool sese::isSpace ( char ch)
noexcept

Determine if a character is a whitespace

Parameters
chCharacter to be checked
Returns
Whether it is a whitespace

References SPACE_CHARS.

Referenced by sese::Json::tokenizer(), sese::xml::XmlUtil::tokenizer(), and sese::text::AbstractStringBuffer::trim().

◆ isSubtractionOverflow()

template<typename T >
bool sese::isSubtractionOverflow ( T a,
T b )

Subtractive spill detection.

References a, and b.

◆ makeShared()

template<typename RETURN_TYPE , typename... ARGS>
SharedType< RETURN_TYPE > sese::makeShared ( ARGS &&... args)
inline

Instantiate SharedType

Template Parameters
RETURN_TYPETemplate parameter for SharedType
ARGSConstructor parameter types for the template parameter
Parameters
argsConstructor parameters for the template parameter
Returns
SharedType<ReturnType>

◆ makeSharedFromList()

template<typename RETURN_TYPE , typename INIT_TYPE >
SharedType< RETURN_TYPE > sese::makeSharedFromList ( std::initializer_list< INIT_TYPE > list)

Using std::make_shared with std::initializer_list

Template Parameters
RETURN_TYPETemplate type expected to return std::shared_ptr
INIT_TYPETemplate parameter for std::initializer_list
Parameters
listInitialization list
Returns
std::shared_ptr<ReturnType>

◆ makeUnique()

template<typename RETURN_TYPE , typename... ARGS>
SharedType< RETURN_TYPE > sese::makeUnique ( ARGS &&... args)
inline

Instantiate UniqueType

Template Parameters
RETURN_TYPETemplate parameter for UniqueType
ARGSConstructor parameter types for the template parameter
Parameters
argsConstructor parameters for the template parameter
Returns
Unique

◆ makeUniqueFromList()

template<typename RETURN_TYPE , typename INIT_TYPE >
UniqueType< RETURN_TYPE > sese::makeUniqueFromList ( std::initializer_list< INIT_TYPE > list)

Using std::make_unique with std::initializer_list

Template Parameters
RETURN_TYPETemplate parameter expected to return std::unique_ptr
INIT_TYPETemplate parameter for std::initializer_list
Parameters
listInitialization list
Returns
std::unique_ptr<ReturnType>

◆ number2StringLength()

template<class T >
size_t sese::number2StringLength ( T num,
size_t radix = 10 )

Get the byte length required to convert a number to a string

Note
Only integers can be converted
Template Parameters
TInput integer type
Parameters
numNumber to be converted
radixBase
Returns
Length required for the number string

Referenced by floating2StringLength(), sese::text::FormatOption_NumberFormatAlgin(), sese::text::Number::toHex(), sese::text::Number::toHex(), sese::text::Number::toOct(), sese::text::Number::toOct(), sese::text::Number::toString(), and sese::net::http::Range::toStringLength().

◆ sleep() [1/2]

template<class REP , class PERIOD >
void sese::sleep ( const std::chrono::duration< REP, PERIOD > & duration)

Make the current thread sleep for a while, implemented using std::this_thread::sleep_for

Parameters
durationThe duration to sleep

◆ sleep() [2/2]

void sese::sleep ( uint32_t second)

Make the current thread sleep for a while, implemented using NATIVE API

Parameters
secondSeconds

References sleep().

Referenced by sese::net::Socket::connect(), sese::security::SecuritySocket::connect(), sese::Timer::loop(), sese::internal::service::http::HttpServiceImpl::shutdown(), and sleep().

◆ strcmp()

bool sese::strcmp ( char const * lv,
char const * rv )
noexcept

Compare two strings for equality

Parameters
lvString 1
rvString 2
Returns
Comparison result

Referenced by sese::net::ws::WebsocketAuthenticator::verify().

◆ strcmpDoNotCase()

◆ streamMove()

size_t sese::streamMove ( sese::io::OutputStream * out,
sese::io::InputStream * in,
size_t size )
noexcept

Move stream data

Parameters
outOutput stream
inInput stream
sizeSize to move
Returns
Actual size moved

References in().

Referenced by sese::internal::service::http::HttpConnection::readBody(), and sese::internal::service::http::HttpConnection::readHeader().

◆ to_time_t()

template<typename TP >
std::time_t sese::to_time_t ( TP tp)

Time type conversion

See also
https://stackoverflow.com/questions/61030383/how-to-convert-stdfilesystemfile-time-type-to-time-t
Template Parameters
TPType of the object to convert
Parameters
tpObject to convert
Returns
Time in std::time_t type

Referenced by sese::internal::service::http::HttpServiceImpl::handleRequest().

◆ toInteger()

int64_t sese::toInteger ( const std::string & string,
int radix = 10 )

Integer conversion function that ignores errors

Parameters
stringString representing the integer
radixBase
Returns
Integer

Referenced by sese::internal::service::http::HttpConnectionEx::handleDataFrame(), and sese::internal::service::http::HttpConnection::readHeader().

Variable Documentation

◆ current_data

◆ is_iterable_v

template<typename T >
bool sese::is_iterable_v = is_iterable<T>::value
constexpr