flatten 20260225

This commit is contained in:
Timothy Prepscius
2026-02-25 12:39:24 -05:00
commit fa54be052a
315 changed files with 49791 additions and 0 deletions

89
tjp/core/internet/Queue.hpp Executable file
View File

@@ -0,0 +1,89 @@
// TJP COPYRIGHT HEADER
#pragma once
#include "Internet.hpp"
#include "Internet+Internal.hpp"
#include <tjp/core/ptr/Ptr.hpp>
#include <tjp/core/threads/ThreadSafe.hpp>
#include <tjp/core/future/Future.hpp>
#include <tjp/core/string/String.hpp>
#include <tjp/core/containers/Optional.hpp>
#include <queue>
namespace tjp::core::internet {
struct Queue
{
struct Internal;
StrongPtr<Internal> i;
Queue();
~Queue();
void prepare();
Future<FileContents> execute(internal::RequestType, const String &url, Data &&data, const HttpOptions &o = makeEmptyOptions());
Future<FileContents> get(const String &url, const HttpOptions &o = makeEmptyOptions())
{
return execute(internal::RequestType::GET, url, {}, o);
}
Future<FileContents> post(const std::string &url, Data &&data, const HttpOptions &o = makeEmptyOptions())
{
return execute(internal::RequestType::POST, url, std::move(data), o);
}
Future<FileContents> put(const std::string &url, Data &&data, const HttpOptions &o = makeEmptyOptions())
{
return execute(internal::RequestType::PUT, url, std::move(data), o);
}
Future<FileContents> head(const std::string &url, const HttpOptions &o = makeEmptyOptions())
{
return execute(internal::RequestType::HEAD, url, {}, o);
}
} ;
struct MainQueue {};
template<typename T>
struct Queues {
static Queue queue;
static Future<FileContents> get(const String &url, const HttpOptions &o = makeEmptyOptions())
{
return queue.execute(internal::RequestType::GET, url, {}, o);
}
static Future<FileContents> post(const std::string &url, Data &&data, const HttpOptions &o = makeEmptyOptions())
{
return queue.execute(internal::RequestType::POST, url, std::move(data), o);
}
static Future<FileContents> put(const std::string &url, Data &&data, const HttpOptions &o = makeEmptyOptions())
{
return queue.execute(internal::RequestType::PUT, url, std::move(data), o);
}
static Future<FileContents> head(const std::string &url, const HttpOptions &o = makeEmptyOptions())
{
return queue.execute(internal::RequestType::HEAD, url, {}, o);
}
} ;
template<typename T>
Queue Queues<T>::queue;
} // namespace
#ifdef TJP_CORE_HEADER_ONLY
#if defined(SYS_IOS)
#include "ios/Queue.hpp"
#else
#include "curl/Queue.hpp"
#endif
#endif