1、删除部分三方库

2、整合ylib为一个lib库
This commit is contained in:
xx
2024-05-26 12:51:32 +08:00
parent 4391d84402
commit ef63cfd6aa
9264 changed files with 24373 additions and 1648659 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include <string>
#include <vector>
#include "ybase/define.h"
#include "base/define.h"
namespace ylib
{
class mem_pool

View File

@@ -1,7 +1,7 @@
#pragma once
#include <string>
#include "define.h"
#include "ybase/buffer.h"
#include "base/buffer.h"
namespace ylib
{

View File

@@ -2,8 +2,8 @@
#include <map>
#include <string>
#include <mutex>
#include "ybase/define.h"
#include "ybase/log4.h"
#include "base/define.h"
#include "base/log4.h"
namespace ylib
{
class environment

View File

@@ -3,7 +3,7 @@
#include <string>
#include <exception>
#include "ybase/define.h"
#include "base/define.h"
/**
* @brief

View File

@@ -6,10 +6,10 @@
#ifndef _WIN32
#include <stddef.h>
#endif
#include "ybase/define.h"
#include "ybase/error.h"
#include "yutil/json.h"
#include "yutil/pool.hpp"
#include "base/define.h"
#include "base/error.h"
#include "util/json.h"
#include "util/pool.hpp"
namespace ylib::mssql
{

View File

@@ -6,10 +6,10 @@
#ifndef _WIN32
#include <stddef.h>
#endif
#include "ybase/define.h"
#include "ybase/error.h"
#include "yutil/json.h"
#include "yutil/pool.hpp"
#include "base/define.h"
#include "base/error.h"
#include "util/json.h"
#include "util/pool.hpp"
namespace ylib::mysql
{

View File

@@ -1,5 +1,5 @@
#pragma once
#include "ybase/error.h"
#include "base/error.h"
#include "mysql.h"
#include <any>
namespace ylib

View File

@@ -1,8 +1,8 @@
#pragma once
#include "ybase/define.h"
#include "ybase/error.h"
#include "ybase/buffer.h"
#include "yutil/json.h"
#include "base/define.h"
#include "base/error.h"
#include "base/buffer.h"
#include "util/json.h"
// HTTP

View File

@@ -1,8 +1,8 @@
#pragma once
#include "define.h"
#include "yutil/file.h"
#include "yutil/thread.h"
#include "ybase/error.h"
#include "util/file.h"
#include "util/thread.h"
#include "base/error.h"
#if USE_NET_FTP
namespace ylib
{

View File

@@ -1,6 +1,6 @@
#pragma once
#include "http_define.h"
#include "yutil/cache.h"
#include "util/cache.h"
#if USE_NET_HTTP_WEBSITE
class http_agent_listener;
class http_agent_extra;

View File

@@ -2,7 +2,7 @@
#include "http_define.h"
#include "http_reqpack.h"
#include "http_interface.h"
#include "yutil/map.hpp"
#include "util/map.hpp"
namespace ylib
{
namespace network

View File

@@ -4,7 +4,7 @@
#include "http_interface.h"
#include "http_client_plus.h"
#include "yutil/thread.h"
#include "util/thread.h"
namespace ylib
{
namespace network

View File

@@ -3,8 +3,8 @@
#if USE_NET_HTTP_WEBSITE
#include <functional>
#include <vector>
#include "yutil/map.hpp"
#include "yutil/json.h"
#include "util/map.hpp"
#include "util/json.h"
namespace ylib

View File

@@ -4,9 +4,9 @@
#include <regex>
#include "define.h"
#include "yutil/file.h"
#include "ybase/buffer.h"
#include "ybase/environment.h"
#include "util/file.h"
#include "base/buffer.h"
#include "base/environment.h"
#define POINT_QUEUE_REQUEST_CLEAR_MAX 1000
#define POINT_QUEUE_REQUEST_CLEAR_SEC 60

View File

@@ -1,7 +1,7 @@
#pragma once
#include "define.h"
#if USE_NET_HTTP_WEBSITE
#include "ynet/http_interface.h"
#include "net/http_interface.h"
namespace ylib
{
namespace network

View File

@@ -3,8 +3,8 @@
#if USE_NET_HTTP_WEBSITE
#include <regex>
#include <functional>
#include "ynet/http_interface.h"
#include "yutil/array.hpp"
#include "net/http_interface.h"
#include "util/array.hpp"
namespace ylib
{

View File

@@ -2,8 +2,8 @@
#include "http_define.h"
#if USE_NET_HTTP_WEBSITE
#include "http_server.h"
#include "yutil/strutils.h"
#include "yutil/time.h"
#include "util/strutils.h"
#include "util/time.h"
namespace ylib
{
namespace network

View File

@@ -5,9 +5,9 @@
#include <functional>
#include <map>
#include <regex>
#include "yutil/array.hpp"
#include "yutil/queue.hpp"
#include "yutil/thread.h"
#include "util/array.hpp"
#include "util/queue.hpp"
#include "util/thread.h"
//#include "sol/sol.hpp"
class IHPThreadPool;
namespace ylib

View File

@@ -4,7 +4,7 @@
#include <map>
#include <string>
#include <vector>
#include "yutil/counter.hpp"
#include "util/counter.hpp"
namespace ylib
{
namespace network

View File

@@ -5,8 +5,8 @@
#include <map>
#include <regex>
#include "http_interface.h"
#include "yutil/array.hpp"
#include "yutil/localstorage.h"
#include "util/array.hpp"
#include "util/localstorage.h"
namespace ylib
{
namespace network

View File

@@ -2,7 +2,7 @@
#include "http_define.h"
#if USE_NET_HTTP_UTIL
#include "yutil/vector.hpp"
#include "util/vector.hpp"
namespace ylib
{
namespace network

View File

@@ -1,7 +1,7 @@
#pragma once
#include <mutex>
#include "ybase/define.h"
#include "yutil/system.h"
#include "base/define.h"
#include "util/system.h"
namespace ylib
{

View File

@@ -1,9 +1,9 @@
#pragma once
#include <string>
#include "ybase/define.h"
#include "ybase/buffer.h"
#include "ybase/error.h"
#include "yutil/map.hpp"
#include "base/define.h"
#include "base/buffer.h"
#include "base/error.h"
#include "util/map.hpp"
namespace ylib
{

View File

@@ -1,10 +1,10 @@
#pragma once
#include <string>
#include "ybase/define.h"
#include "ybase/buffer.h"
#include "ybase/error.h"
#include "yutil/map.hpp"
#include "ynet/http_define.h"
#include "base/define.h"
#include "base/buffer.h"
#include "base/error.h"
#include "util/map.hpp"
#include "net/http_define.h"
class ITcpAgent;
namespace ylib
{

View File

@@ -3,8 +3,8 @@
#ifdef USE_NET_TCP_CLIENT
#include <string>
#include <functional>
#include "ybase/buffer.h"
#include "ybase/error.h"
#include "base/buffer.h"
#include "base/error.h"
class ITcpClient;
namespace ylib
{

View File

@@ -1,6 +1,6 @@
#pragma once
#include "ynet/tcp2tcp.h"
#include "yutil/map.hpp"
#include "net/tcp2tcp.h"
#include "util/map.hpp"
namespace ylib
{
namespace network

View File

@@ -1,7 +1,7 @@
#pragma once
#include <functional>
#include "ynet/define.h"
#include "ybase/error.h"
#include "net/define.h"
#include "base/error.h"
#ifdef USE_NET_TCP_SERVER
class ITcpServer;
namespace ylib

View File

@@ -1,5 +1,5 @@
#pragma once
#include "ynet/define.h"
#include "net/define.h"
#ifdef USE_NET_TCP_SERVER
#include "HPSocket/HPSocket.h"
namespace ylib

View File

@@ -1,8 +1,8 @@
#pragma once
#include <string>
#include "ybase/define.h"
#include "ybase/buffer.h"
#include "yutil/map.hpp"
#include "base/define.h"
#include "base/buffer.h"
#include "util/map.hpp"
namespace ylib::network::tcp { class server; }
class UdpClientListener;
namespace ylib

View File

@@ -1,8 +1,8 @@
#pragma once
#include "ynet/define.h"
#include "net/define.h"
#if USE_NET_UDP_NODE
#include <functional>
#include "ybase/error.h"
#include "base/error.h"
class IUdpNode;
namespace ylib
{

View File

@@ -1,5 +1,5 @@
#pragma once
#include "ynet/define.h"
#include "net/define.h"
#if USE_NET_UDP_NODE
#include "HPSocket/HPSocket.h"
#include <string>

View File

@@ -1,7 +1,7 @@
#pragma once
#include "ybase/define.h"
#include "ybase/buffer.h"
#include "yutil/map.hpp"
#include "base/define.h"
#include "base/buffer.h"
#include "util/map.hpp"
class ITcpAgent;
class TcpAgentListener;
class UdpServerListener;

View File

@@ -0,0 +1,539 @@
///*
// * Copyright 2001-2004 Unicode, Inc.
// *
// * Disclaimer
// *
// * This source code is provided as is by Unicode, Inc. No claims are
// * made as to fitness for any particular purpose. No warranties of any
// * kind are expressed or implied. The recipient agrees to determine
// * applicability of information provided. If this file has been
// * purchased on magnetic or optical media from Unicode, Inc., the
// * sole remedy for any claim will be exchange of defective media
// * within 90 days of receipt.
// *
// * Limitations on Rights to Redistribute This Code
// *
// * Unicode, Inc. hereby grants the right to freely use the information
// * supplied in this file in the creation of products supporting the
// * Unicode Standard, and to make copies of this file in any form
// * for internal or external distribution as long as this notice
// * remains attached.
// */
//
///* ---------------------------------------------------------------------
//
// Conversions between UTF32, UTF-16, and UTF-8. Source code file.
// Author: Mark E. Davis, 1994.
// Rev History: Rick McGowan, fixes & updates May 2001.
// Sept 2001: fixed const & error conditions per
// mods suggested by S. Parent & A. Lillich.
// June 2002: Tim Dodd added detection and handling of incomplete
// source sequences, enhanced error detection, added casts
// to eliminate compiler warnings.
// July 2003: slight mods to back out aggressive FFFE detection.
// Jan 2004: updated switches in from-UTF8 conversions.
// Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
//
// See the header file "ConvertUTF.h" for complete documentation.
//
//------------------------------------------------------------------------ */
//
//
//#include "simpleini/ConvertUTF.h"
//#ifdef CVTUTF_DEBUG
//#include <stdio.h>
//#endif
//
//static const int halfShift = 10; /* used for shifting by 10 bits */
//
//static const UTF32 halfBase = 0x0010000UL;
//static const UTF32 halfMask = 0x3FFUL;
//
//#define UNI_SUR_HIGH_START (UTF32)0xD800
//#define UNI_SUR_HIGH_END (UTF32)0xDBFF
//#define UNI_SUR_LOW_START (UTF32)0xDC00
//#define UNI_SUR_LOW_END (UTF32)0xDFFF
//#define false 0
//#define true 1
//
///* --------------------------------------------------------------------- */
//
//ConversionResult ConvertUTF32toUTF16 (
// const UTF32** sourceStart, const UTF32* sourceEnd,
// UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
// ConversionResult result = conversionOK;
// const UTF32* source = *sourceStart;
// UTF16* target = *targetStart;
// while (source < sourceEnd) {
// UTF32 ch;
// if (target >= targetEnd) {
// result = targetExhausted; break;
// }
// ch = *source++;
// if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
// /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
// if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
// if (flags == strictConversion) {
// --source; /* return to the illegal value itself */
// result = sourceIllegal;
// break;
// } else {
// *target++ = UNI_REPLACEMENT_CHAR;
// }
// } else {
// *target++ = (UTF16)ch; /* normal case */
// }
// } else if (ch > UNI_MAX_LEGAL_UTF32) {
// if (flags == strictConversion) {
// result = sourceIllegal;
// } else {
// *target++ = UNI_REPLACEMENT_CHAR;
// }
// } else {
// /* target is a character in range 0xFFFF - 0x10FFFF. */
// if (target + 1 >= targetEnd) {
// --source; /* Back up source pointer! */
// result = targetExhausted; break;
// }
// ch -= halfBase;
// *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
// *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
// }
// }
// *sourceStart = source;
// *targetStart = target;
// return result;
//}
//
///* --------------------------------------------------------------------- */
//
//ConversionResult ConvertUTF16toUTF32 (
// const UTF16** sourceStart, const UTF16* sourceEnd,
// UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
// ConversionResult result = conversionOK;
// const UTF16* source = *sourceStart;
// UTF32* target = *targetStart;
// UTF32 ch, ch2;
// while (source < sourceEnd) {
// const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
// ch = *source++;
// /* If we have a surrogate pair, convert to UTF32 first. */
// if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
// /* If the 16 bits following the high surrogate are in the source buffer... */
// if (source < sourceEnd) {
// ch2 = *source;
// /* If it's a low surrogate, convert to UTF32. */
// if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
// ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
// + (ch2 - UNI_SUR_LOW_START) + halfBase;
// ++source;
// } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
// --source; /* return to the illegal value itself */
// result = sourceIllegal;
// break;
// }
// } else { /* We don't have the 16 bits following the high surrogate. */
// --source; /* return to the high surrogate */
// result = sourceExhausted;
// break;
// }
// } else if (flags == strictConversion) {
// /* UTF-16 surrogate values are illegal in UTF-32 */
// if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
// --source; /* return to the illegal value itself */
// result = sourceIllegal;
// break;
// }
// }
// if (target >= targetEnd) {
// source = oldSource; /* Back up source pointer! */
// result = targetExhausted; break;
// }
// *target++ = ch;
// }
// *sourceStart = source;
// *targetStart = target;
//#ifdef CVTUTF_DEBUG
//if (result == sourceIllegal) {
// fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2);
// fflush(stderr);
//}
//#endif
// return result;
//}
//
///* --------------------------------------------------------------------- */
//
///*
// * Index into the table below with the first byte of a UTF-8 sequence to
// * get the number of trailing bytes that are supposed to follow it.
// * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
// * left as-is for anyone who may want to do such conversion, which was
// * allowed in earlier algorithms.
// */
//static const char trailingBytesForUTF8[256] = {
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
// 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
// 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
//};
//
///*
// * Magic values subtracted from a buffer value during UTF8 conversion.
// * This table contains as many values as there might be trailing bytes
// * in a UTF-8 sequence.
// */
//static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
// 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
//
///*
// * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
// * into the first byte, depending on how many bytes follow. There are
// * as many entries in this table as there are UTF-8 sequence types.
// * (I.e., one byte sequence, two byte... etc.). Remember that sequences
// * for *legal* UTF-8 will be 4 or fewer bytes total.
// */
//static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
//
///* --------------------------------------------------------------------- */
//
///* The interface converts a whole buffer to avoid function-call overhead.
// * Constants have been gathered. Loops & conditionals have been removed as
// * much as possible for efficiency, in favor of drop-through switches.
// * (See "Note A" at the bottom of the file for equivalent code.)
// * If your compiler supports it, the "isLegalUTF8" call can be turned
// * into an inline function.
// */
//
///* --------------------------------------------------------------------- */
//
//ConversionResult ConvertUTF16toUTF8 (
// const UTF16** sourceStart, const UTF16* sourceEnd,
// UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
// ConversionResult result = conversionOK;
// const UTF16* source = *sourceStart;
// UTF8* target = *targetStart;
// while (source < sourceEnd) {
// UTF32 ch;
// unsigned short bytesToWrite = 0;
// const UTF32 byteMask = 0xBF;
// const UTF32 byteMark = 0x80;
// const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
// ch = *source++;
// /* If we have a surrogate pair, convert to UTF32 first. */
// if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
// /* If the 16 bits following the high surrogate are in the source buffer... */
// if (source < sourceEnd) {
// UTF32 ch2 = *source;
// /* If it's a low surrogate, convert to UTF32. */
// if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
// ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
// + (ch2 - UNI_SUR_LOW_START) + halfBase;
// ++source;
// } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
// --source; /* return to the illegal value itself */
// result = sourceIllegal;
// break;
// }
// } else { /* We don't have the 16 bits following the high surrogate. */
// --source; /* return to the high surrogate */
// result = sourceExhausted;
// break;
// }
// } else if (flags == strictConversion) {
// /* UTF-16 surrogate values are illegal in UTF-32 */
// if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
// --source; /* return to the illegal value itself */
// result = sourceIllegal;
// break;
// }
// }
// /* Figure out how many bytes the result will require */
// if (ch < (UTF32)0x80) { bytesToWrite = 1;
// } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
// } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
// } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
// } else { bytesToWrite = 3;
// ch = UNI_REPLACEMENT_CHAR;
// }
//
// target += bytesToWrite;
// if (target > targetEnd) {
// source = oldSource; /* Back up source pointer! */
// target -= bytesToWrite; result = targetExhausted; break;
// }
// switch (bytesToWrite) { /* note: everything falls through. */
// case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
// case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
// case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
// case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
// }
// target += bytesToWrite;
// }
// *sourceStart = source;
// *targetStart = target;
// return result;
//}
//
///* --------------------------------------------------------------------- */
//
///*
// * Utility routine to tell whether a sequence of bytes is legal UTF-8.
// * This must be called with the length pre-determined by the first byte.
// * If not calling this from ConvertUTF8to*, then the length can be set by:
// * length = trailingBytesForUTF8[*source]+1;
// * and the sequence is illegal right away if there aren't that many bytes
// * available.
// * If presented with a length > 4, this returns false. The Unicode
// * definition of UTF-8 goes up to 4-byte sequences.
// */
//
//static Boolean isLegalUTF8(const UTF8 *source, int length) {
// UTF8 a;
// const UTF8 *srcptr = source+length;
// switch (length) {
// default: return false;
// /* Everything else falls through when "true"... */
// case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
// case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
// case 2: if ((a = (*--srcptr)) > 0xBF) return false;
//
// switch (*source) {
// /* no fall-through in this inner switch */
// case 0xE0: if (a < 0xA0) return false; break;
// case 0xED: if (a > 0x9F) return false; break;
// case 0xF0: if (a < 0x90) return false; break;
// case 0xF4: if (a > 0x8F) return false; break;
// default: if (a < 0x80) return false;
// }
//
// case 1: if (*source >= 0x80 && *source < 0xC2) return false;
// }
// if (*source > 0xF4) return false;
// return true;
//}
//
///* --------------------------------------------------------------------- */
//
///*
// * Exported function to return whether a UTF-8 sequence is legal or not.
// * This is not used here; it's just exported.
// */
//Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
// int length = trailingBytesForUTF8[*source]+1;
// if (source+length > sourceEnd) {
// return false;
// }
// return isLegalUTF8(source, length);
//}
//
///* --------------------------------------------------------------------- */
//
//ConversionResult ConvertUTF8toUTF16 (
// const UTF8** sourceStart, const UTF8* sourceEnd,
// UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
// ConversionResult result = conversionOK;
// const UTF8* source = *sourceStart;
// UTF16* target = *targetStart;
// while (source < sourceEnd) {
// UTF32 ch = 0;
// unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
// if (source + extraBytesToRead >= sourceEnd) {
// result = sourceExhausted; break;
// }
// /* Do this check whether lenient or strict */
// if (! isLegalUTF8(source, extraBytesToRead+1)) {
// result = sourceIllegal;
// break;
// }
// /*
// * The cases all fall through. See "Note A" below.
// */
// switch (extraBytesToRead) {
// case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
// case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
// case 3: ch += *source++; ch <<= 6;
// case 2: ch += *source++; ch <<= 6;
// case 1: ch += *source++; ch <<= 6;
// case 0: ch += *source++;
// }
// ch -= offsetsFromUTF8[extraBytesToRead];
//
// if (target >= targetEnd) {
// source -= (extraBytesToRead+1); /* Back up source pointer! */
// result = targetExhausted; break;
// }
// if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
// /* UTF-16 surrogate values are illegal in UTF-32 */
// if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
// if (flags == strictConversion) {
// source -= (extraBytesToRead+1); /* return to the illegal value itself */
// result = sourceIllegal;
// break;
// } else {
// *target++ = UNI_REPLACEMENT_CHAR;
// }
// } else {
// *target++ = (UTF16)ch; /* normal case */
// }
// } else if (ch > UNI_MAX_UTF16) {
// if (flags == strictConversion) {
// result = sourceIllegal;
// source -= (extraBytesToRead+1); /* return to the start */
// break; /* Bail out; shouldn't continue */
// } else {
// *target++ = UNI_REPLACEMENT_CHAR;
// }
// } else {
// /* target is a character in range 0xFFFF - 0x10FFFF. */
// if (target + 1 >= targetEnd) {
// source -= (extraBytesToRead+1); /* Back up source pointer! */
// result = targetExhausted; break;
// }
// ch -= halfBase;
// *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
// *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
// }
// }
// *sourceStart = source;
// *targetStart = target;
// return result;
//}
//
///* --------------------------------------------------------------------- */
//
//ConversionResult ConvertUTF32toUTF8 (
// const UTF32** sourceStart, const UTF32* sourceEnd,
// UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
// ConversionResult result = conversionOK;
// const UTF32* source = *sourceStart;
// UTF8* target = *targetStart;
// while (source < sourceEnd) {
// UTF32 ch;
// unsigned short bytesToWrite = 0;
// const UTF32 byteMask = 0xBF;
// const UTF32 byteMark = 0x80;
// ch = *source++;
// if (flags == strictConversion ) {
// /* UTF-16 surrogate values are illegal in UTF-32 */
// if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
// --source; /* return to the illegal value itself */
// result = sourceIllegal;
// break;
// }
// }
// /*
// * Figure out how many bytes the result will require. Turn any
// * illegally large UTF32 things (> Plane 17) into replacement chars.
// */
// if (ch < (UTF32)0x80) { bytesToWrite = 1;
// } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
// } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
// } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
// } else { bytesToWrite = 3;
// ch = UNI_REPLACEMENT_CHAR;
// result = sourceIllegal;
// }
//
// target += bytesToWrite;
// if (target > targetEnd) {
// --source; /* Back up source pointer! */
// target -= bytesToWrite; result = targetExhausted; break;
// }
// switch (bytesToWrite) { /* note: everything falls through. */
// case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
// case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
// case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
// case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
// }
// target += bytesToWrite;
// }
// *sourceStart = source;
// *targetStart = target;
// return result;
//}
//
///* --------------------------------------------------------------------- */
//
//ConversionResult ConvertUTF8toUTF32 (
// const UTF8** sourceStart, const UTF8* sourceEnd,
// UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
// ConversionResult result = conversionOK;
// const UTF8* source = *sourceStart;
// UTF32* target = *targetStart;
// while (source < sourceEnd) {
// UTF32 ch = 0;
// unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
// if (source + extraBytesToRead >= sourceEnd) {
// result = sourceExhausted; break;
// }
// /* Do this check whether lenient or strict */
// if (! isLegalUTF8(source, extraBytesToRead+1)) {
// result = sourceIllegal;
// break;
// }
// /*
// * The cases all fall through. See "Note A" below.
// */
// switch (extraBytesToRead) {
// case 5: ch += *source++; ch <<= 6;
// case 4: ch += *source++; ch <<= 6;
// case 3: ch += *source++; ch <<= 6;
// case 2: ch += *source++; ch <<= 6;
// case 1: ch += *source++; ch <<= 6;
// case 0: ch += *source++;
// }
// ch -= offsetsFromUTF8[extraBytesToRead];
//
// if (target >= targetEnd) {
// source -= (extraBytesToRead+1); /* Back up the source pointer! */
// result = targetExhausted; break;
// }
// if (ch <= UNI_MAX_LEGAL_UTF32) {
// /*
// * UTF-16 surrogate values are illegal in UTF-32, and anything
// * over Plane 17 (> 0x10FFFF) is illegal.
// */
// if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
// if (flags == strictConversion) {
// source -= (extraBytesToRead+1); /* return to the illegal value itself */
// result = sourceIllegal;
// break;
// } else {
// *target++ = UNI_REPLACEMENT_CHAR;
// }
// } else {
// *target++ = ch;
// }
// } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
// result = sourceIllegal;
// *target++ = UNI_REPLACEMENT_CHAR;
// }
// }
// *sourceStart = source;
// *targetStart = target;
// return result;
//}
//
///* ---------------------------------------------------------------------
//
// Note A.
// The fall-through switches in UTF-8 reading code save a
// temp variable, some decrements & conditionals. The switches
// are equivalent to the following loop:
// {
// int tmpBytesToRead = extraBytesToRead+1;
// do {
// ch += *source++;
// --tmpBytesToRead;
// if (tmpBytesToRead) ch <<= 6;
// } while (tmpBytesToRead > 0);
// }
// In UTF-8 writing code, the switches on "bytesToWrite" are
// similarly unrolled loops.
//
// --------------------------------------------------------------------- */

View File

@@ -1,8 +1,8 @@
#pragma once
#include "ybase/define.h"
#include "ybase/error.h"
#include "base/define.h"
#include "base/error.h"
#include "yutil/thread.h"
#include "util/thread.h"
#include <mutex>
#include <list>
namespace ylib

View File

@@ -1,7 +1,7 @@
#pragma once
#include <string>
#include "ybase/buffer.h"
#include "base/buffer.h"
namespace ylib
{
namespace codec

View File

@@ -4,8 +4,8 @@
#include <iostream>
#include <thread>
#include <chrono>
#include "yutil/thread.h"
#include "yutil/queue.hpp"
#include "util/thread.h"
#include "util/queue.hpp"
class co_thread_pool;
namespace ylib::co
{

View File

@@ -1,9 +1,9 @@
#pragma once
#ifdef _WIN32
#include <vector>
#include "yutil/system.h"
#include "yutil/process.h"
#include "ybase/define.h"
#include "util/system.h"
#include "util/process.h"
#include "base/define.h"
namespace ylib

View File

@@ -5,9 +5,9 @@
#include <fstream>
#include <map>
#include "ybase/define.h"
#include "ybase/error.h"
#include "ybase/buffer.h"
#include "base/define.h"
#include "base/error.h"
#include "base/buffer.h"
namespace ylib
{

View File

@@ -1,7 +1,7 @@
#pragma once
#include "ybase/define.h"
#include "ybase/buffer.h"
#include "base/define.h"
#include "base/buffer.h"
namespace ylib
{
namespace img

View File

@@ -1,7 +1,7 @@
#pragma once
#include <string>
#include <vector>
#include "yutil/json.h"
#include "util/json.h"
namespace ylib
{
class ini

View File

@@ -4,8 +4,8 @@
#include <iostream>
#include <sstream>
#include <map>
#include "ybase/define.h"
#include "ybase/conversion.h"
#include "base/define.h"
#include "base/conversion.h"
/* project version */
#define CJSON_VERSION_MAJOR 1
#define CJSON_VERSION_MINOR 7

View File

@@ -1,8 +1,8 @@
#pragma once
#include <string>
#include <vector>
#include "yutil/json.h"
#include "yutil/counter.hpp"
#include "util/json.h"
#include "util/counter.hpp"
namespace leveldb
{
class DB;

2
include/util/math.h Normal file
View File

@@ -0,0 +1,2 @@
#pragma once
#include "base/define.h"

View File

@@ -1,7 +1,7 @@
#pragma once
#include <stdio.h>
#include "ybase/define.h"
#include "base/define.h"
namespace ylib
{

View File

@@ -1,6 +1,6 @@
#pragma once
#include "ybase/buffer.h"
#include "yutil/map.hpp"
#include "base/buffer.h"
#include "util/map.hpp"
namespace ylib
{
class package

View File

@@ -3,10 +3,10 @@
#include <mutex>
#include <memory>
#include "ybase/error.h"
#include "ybase/exception.h"
#include "base/error.h"
#include "base/exception.h"
#include "yutil/queue.hpp"
#include "util/queue.hpp"
namespace ylib {

View File

@@ -1,6 +1,6 @@
#pragma once
#include <string>
#include "ybase/define.h"
#include "base/define.h"
namespace ylib
{
void println(const std::string& text,ylib::ConsoleTextColor color = ylib::ConsoleTextColor::DEFAULT);

View File

@@ -3,7 +3,7 @@
#include <list>
#include <string>
#include <vector>
#include "ybase/define.h"
#include "base/define.h"
namespace ylib
{
namespace process

View File

@@ -1,7 +1,7 @@
#pragma once
#include "sqlite3/sqlite3.h"
#include "ybase/define.h"
#include "ybase/error.h"
#include "base/define.h"
#include "base/error.h"
#include <vector>
#include <map>
#define SQLITE_RESULT std::vector<std::map<std::string, std::string>>

View File

@@ -1,7 +1,7 @@
#pragma once
#include <string>
#include <vector>
#include "ybase/define.h"
#include "base/define.h"
namespace ylib
{
namespace strutils{

View File

@@ -1,6 +1,6 @@
#pragma once
#include <vector>
#include "ybase/define.h"
#include "base/define.h"
namespace ylib
{
namespace system

View File

@@ -2,7 +2,7 @@
#include <map>
#include "ybase/define.h"
#include "base/define.h"
namespace ylib
{
namespace time

View File

@@ -2,7 +2,7 @@
#ifdef _WIN32
#include <vector>
#include "ybase/define.h"
#include "base/define.h"
namespace ylib{
namespace window

View File

View File

@@ -1,22 +0,0 @@
//#pragma once
//#include <string>
//#include <Kaguya/kaguya.hpp>
//#include "ynet/http_request.h"
//#include "ynet/http_response.h"
//class HttpCenter
//{
//public:
// HttpCenter();
// ~HttpCenter();
// static void regist(kaguya::State& T);
//private:
// static bool start();
// static void stop();
// static bool create(int port);
// static std::string last_error();
//
//
//
// static void execLua(network::http::request* request,network::http::response* response);
//};
//

View File

@@ -1,28 +0,0 @@
//#pragma once
//#include <string>
//#include <functional>
//#include <Kaguya/kaguya.hpp>
//#include "ybase/buffer.h"
//#include "yutil/file.h"
//class NetLua
//{
//public:
// NetLua();
// ~NetLua();
// // 启动
// bool start(
// const std::string& dirpath,
// std::function<void(kaguya::State* L)> regist_callback,
// const std::string& init_lua_filepath,
// std::string error_filepath
//
// );
// void close();
//private:
// void addLuaPath();
//private:
// kaguya::State *L = nullptr;
// ylib::file_io m_error;
// std::string m_dirpath;
//};
//

View File

@@ -1,16 +0,0 @@
#pragma once
#include <QtWidgets/qwidget.h>
#include <string>
#include <Kaguya/kaguya.hpp>
#include "QsBuffer.h"
class QsApp
{
public:
QsApp();
~QsApp();
static void regist(kaguya::State& T);
private:
static void quit();
static QsBuffer read_res(const std::string& filepath);
};

View File

@@ -1,20 +0,0 @@
#pragma once
#include <QtWidgets/qwidget.h>
#include <string>
#include <Kaguya/kaguya.hpp>
#include "ybase/buffer.h"
class QsBuffer :public ylib::buffer
{
public:
QsBuffer();
~QsBuffer();
static void regist(kaguya::State& T);
public:
static QsBuffer fromString(const std::string& value);
void append(unsigned long long data_point,unsigned int length);
bool saveToFile(const std::string& filepath);
};

View File

@@ -1,29 +0,0 @@
#pragma once
#include <QtWidgets/qwidget.h>
#include <string>
#include <Kaguya/kaguya.hpp>
#include "QsElement.h"
#include "QsWidget.h"
#include "QsIcon.h"
#include "yqt/button.h"
class QsButton :public QsElement
{
public:
QsButton(QsWidget* parent = nullptr);
~QsButton();
static void regist(kaguya::State& T);
private:
void onMouseRelease(kaguya::LuaFunction callback);
void setText(const std::string& title);
void setImages(const std::string& img1, const std::string& img2, const std::string& img3, const std::string& img4);
void setImagesFromRes(const std::string& img1, const std::string& img2, const std::string& img3, const std::string& img4);
void setIcon(const QsIcon& icon);
private:
kaguya::LuaFunction m_onMouseRelease;
ylib::qt::Button* m_button = nullptr;
// 通过 QsElement 继承
virtual QsWidget* toQ() override{ return appQs(new QsWidget(m_button)); }
};

View File

@@ -1,26 +0,0 @@
#pragma once
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qcheckbox.h>
#include <string>
#include <Kaguya/kaguya.hpp>
#include "QsElement.h"
#include "QsWidget.h"
#include "QsIcon.h"
class QsCheckBox :public QCheckBox,public QsElement
{
public:
QsCheckBox(QsWidget* parent = nullptr);
~QsCheckBox();
static void regist(kaguya::State& T);
private:
void setText(const std::string& title);
void onStateChanged(kaguya::LuaFunction callback) { m_stateChangedCallback = callback; }
void setIcon(QsIcon icon);
void setIconSize(int width, int height);
private:
// 通过 QsElement 继承
virtual QsWidget* toQ() override{ return appQs(new QsWidget(this)); }
private:
kaguya::LuaFunction m_stateChangedCallback;
};

View File

@@ -1,21 +0,0 @@
#pragma once
#include <string>
#include <Kaguya/kaguya.hpp>
#include "QsBuffer.h"
class QsCodec
{
public:
QsCodec();
~QsCodec();
static void regist(kaguya::State& T);
private:
static std::string to_utf8(const std::string& value);
static std::string to_gbk(const std::string& value);
static QsBuffer base64_de(const std::string& value);
static std::string base64_en(const QsBuffer& value);
static QsBuffer aes_en(const QsBuffer& value,const std::string& key);
static QsBuffer aes_de(const QsBuffer& value, const std::string& key);
};

View File

@@ -1,21 +0,0 @@
#pragma once
#include <QtWidgets/qwidget.h>
#include <string>
#include <Kaguya/kaguya.hpp>
#include "QsElement.h"
#include "QsWidget.h"
#include "yqt/combobox.h"
class QsComBobox :public ylib::qt::ComboBox,public QsElement
{
public:
QsComBobox(QsWidget* parent = nullptr);
~QsComBobox();
static void regist(kaguya::State& T);
private:
void addItem(const std::string& text);
// 通过 QsElement 继承
virtual QsWidget* toQ() override{ return appQs(new QsWidget(this)); }
};

View File

@@ -1,25 +0,0 @@
#pragma once
#include <vector>
#include "QsWidget.h"
class QsElement
{
public:
QsElement() {}
~QsElement() {
for (size_t i = 0; i < m_frees.size(); i++)
delete m_frees[i];
}
virtual QsWidget* toQ() = 0;
QsWidget* appQs(QsWidget* widget) { m_frees.push_back(widget); return widget; };
void setExtra(const std::string& name, const std::string& value) {
m_extra[name] = value;
}
std::string extra(const std::string& name) {
return m_extra[name];
}
private:
std::vector<QsWidget*> m_frees;
std::map<std::string, std::string> m_extra;
};

View File

@@ -1,19 +0,0 @@
#pragma once
#include <string>
#include <Kaguya/kaguya.hpp>
#include "QsBuffer.h"
class QsFile
{
public:
QsFile();
~QsFile();
static void regist(kaguya::State& T);
private:
static bool create_dir(const std::string& dirpath);
static bool remove_dir(const std::string& dirpath);
static bool remove(const std::string& filepath);
static bool exist(const std::string& filepath);
static size_t size(const std::string& filepath);
static bool write(const std::string& filepath,const QsBuffer& data);
};

View File

@@ -1,23 +0,0 @@
#pragma once
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qlayout.h>
#include <string>
#include <Kaguya/kaguya.hpp>
#include "yqlua/QsWidget.h"
class QsHBoxLayout
{
public:
QsHBoxLayout();
~QsHBoxLayout();
QLayout* layout() { return m_layout; }
static void regist(kaguya::State& T);
private:
void addStretch();
void addWidget(QsWidget* widget);
private:
QHBoxLayout* m_layout = nullptr;
};

View File

@@ -1,22 +0,0 @@
#pragma once
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qheaderview.h>
#include <string>
#include <Kaguya/kaguya.hpp>
#include "QsElement.h"
#include "QsWidget.h"
class QsHeaderView:public QsElement
{
public:
QsHeaderView(QHeaderView* view);
~QsHeaderView();
static void regist(kaguya::State& T);
private:
void setSectionResizeMode(int logicalIndex,int mode);
// 通过 QsElement 继承
virtual QsWidget* toQ() override { return appQs(new QsWidget(m_view)); }
private:
QHeaderView* m_view = nullptr;
};

View File

@@ -1,52 +0,0 @@
#pragma once
#include "QtCore/qobject.h"
#include "QtCore/qtimer.h"
#include <string>
#include <Kaguya/kaguya.hpp>
#include "yutil/queue.hpp"
#include "ynet/http_client_plus.h"
#include "QsBuffer.h"
class QsHttpClient
{
public:
enum MsgType
{
END,
FAILED,
DOWNING
};
struct MsgInfo
{
MsgType type;
ylib::json data;
};
public:
QsHttpClient();
~QsHttpClient();
static void regist(kaguya::State& T);
private:
bool get(const std::string& url,bool wait);
bool post(const std::string& url,const std::string& json_data);
void close();
bool head(const std::string& url);
void setHeader(const std::string& name,const std::string& value);
std::string responseHeader(const std::string& name);
QsBuffer response();
void onDownEnd(kaguya::LuaFunction);
void onDownFailed(kaguya::LuaFunction);
void onDowning(kaguya::LuaFunction);
//signals:
// void sigDowning(unsigned long long alldownsize,unsigned long long allsize);
// void sigDownEnd();
// void sigDownFailed();
private:
kaguya::LuaFunction m_onDownEnd;
kaguya::LuaFunction m_onDownFailed;
kaguya::LuaFunction m_onDowning;
timestamp m_pre_onDowning_callback_msec = 0;
ylib::buffer m_response;
network::http::client_plus m_client;
ylib::queue<MsgInfo> m_msg_queue;
QTimer m_msg_timer;
};

View File

@@ -1,16 +0,0 @@
#pragma once
#include "QtGui/qicon.h"
#include <string>
#include <Kaguya/kaguya.hpp>
#include "yutil/ini.h"
class QsIcon :public QIcon
{
public:
QsIcon(const std::string& filepath);
~QsIcon();
static void regist(kaguya::State& T);
private:
void setSize(int width,int height);
};

View File

@@ -1,27 +0,0 @@
#pragma once
#include <QtWidgets/qwidget.h>
#include <string>
#include <Kaguya/kaguya.hpp>
#include "QsElement.h"
#include "QsWidget.h"
#include "QsBuffer.h"
#include "yqt/label.h"
class QsMovie;
class QsImage :public ylib::qt::Label,public QsElement
{
public:
QsImage(QsWidget* parent = nullptr);
~QsImage();
static void regist(kaguya::State& T);
private:
void setImage(const std::string& base64image);
void setImage2(const QsBuffer& data);
void onMouseRelease(kaguya::LuaFunction callback);
void setMovie(QsMovie* movie);
private:
// 通过 QsElement 继承
virtual QsWidget* toQ() override{ return appQs(new QsWidget(this)); }
private:
kaguya::LuaFunction m_onMouseRelease;
};

Some files were not shown because too many files have changed in this diff Show More