Flatten src into model, edit and ui, with .h headers

Resources and utilities sit directly in src. The ImGui windows, wizards, popups and helpers are in ui.
Headers that would shadow system ones are renamed: math_util, timestamp, subprocess, localization.
Includes are written from src.
This commit is contained in:
shweet committed 2026-11-22 17:12:05 -05:00
1 parent a515267e26
commit 7fb2c607c2
175 files changed
+537 -537

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
#pragma once
#include <cstddef>
#include <string>
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
using socket_handle = SOCKET;
constexpr socket_handle SOCKET_INVALID = INVALID_SOCKET;
#else
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
using socket_handle = int;
constexpr socket_handle SOCKET_INVALID = -1;
#endif
namespace anm2ed
{
enum SocketRole
{
SERVER,
CLIENT
};
struct SocketAddress
{
std::string host{};
unsigned short port{};
};
class Socket
{
private:
socket_handle handle;
SocketRole role{};
int lastError{};
public:
Socket();
~Socket();
Socket(const Socket&) = delete;
Socket& operator=(const Socket&) = delete;
Socket(Socket&& other) noexcept;
Socket& operator=(Socket&& other) noexcept;
bool open(SocketRole role);
bool bind(const SocketAddress&);
bool listen();
Socket accept();
bool connect(const SocketAddress&);
bool send(const void*, size_t);
bool receive(void*, size_t);
void close();
bool is_valid() const;
int last_error() const;
};
}