mirror of
https://github.com/tribufu/sdk-cpp
synced 2025-06-16 18:54:18 +00:00
Use mintaka shared libraries (#1)
* Add libhv and test http client * Remove cpp-httplib * Update premake5.lua * Update client.cpp * Update premake5.lua * Add more windows libs * Use mintaka http client
This commit is contained in:
12
.cargo/config.toml
Normal file
12
.cargo/config.toml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Shared
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
lto = "off"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = "thin"
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
|
||||||
|
[target.'cfg(target_os = "windows")']
|
||||||
|
rustflags = ["-C", "target-feature=+crt-static"]
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
|
.metals/
|
||||||
.vs/
|
.vs/
|
||||||
.vscode/
|
.vscode/
|
||||||
bin/
|
bin/
|
||||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "vendor/Mintaka"]
|
||||||
|
path = vendor/Mintaka
|
||||||
|
url = https://github.com/Tribufu/Mintaka
|
17
Cargo.toml
Normal file
17
Cargo.toml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[package]
|
||||||
|
name = "tribufu-native"
|
||||||
|
version = "0.0.4"
|
||||||
|
description = "Tribufu Native"
|
||||||
|
repository = "https://github.com/Tribufu/TribufuNative"
|
||||||
|
authors = ["Tribufu <contact@tribufu.com>"]
|
||||||
|
license = "Apache-2.0"
|
||||||
|
edition = "2021"
|
||||||
|
publish = false
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "tribufu_native"
|
||||||
|
crate-type = ["staticlib"]
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
mintaka-native = { path = "./vendor/Mintaka/src/native" }
|
@ -2,13 +2,10 @@
|
|||||||
|
|
||||||
if ($IsWindows)
|
if ($IsWindows)
|
||||||
{
|
{
|
||||||
& "./vendor/premake/windows/premake5.exe" "vs2022"
|
|
||||||
}
|
}
|
||||||
elseif ($IsMacOS)
|
elseif ($IsMacOS)
|
||||||
{
|
{
|
||||||
& "./vendor/premake/mac/premake5" "xcode4"
|
|
||||||
}
|
}
|
||||||
elseif ($IsLinux)
|
elseif ($IsLinux)
|
||||||
{
|
{
|
||||||
& "./vendor/premake/linux/premake5" "gmake2"
|
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
if [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]
|
if [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]
|
||||||
then
|
then
|
||||||
./vendor/premake/linux/premake5 gmake2
|
|
||||||
|
|
||||||
elif [ "$(uname)" = "Darwin" ]
|
elif [ "$(uname)" = "Darwin" ]
|
||||||
then
|
then
|
||||||
./vendor/premake/mac/premake5 xcode4
|
|
||||||
fi
|
fi
|
||||||
|
653
config/cbindgen.toml
Normal file
653
config/cbindgen.toml
Normal file
@ -0,0 +1,653 @@
|
|||||||
|
# The language to output bindings in
|
||||||
|
#
|
||||||
|
# possible values: "C", "C++", "Cython"
|
||||||
|
#
|
||||||
|
# default: "C++"
|
||||||
|
language = "C"
|
||||||
|
|
||||||
|
# Options for wrapping the contents of the header:
|
||||||
|
|
||||||
|
# An optional string of text to output at the beginning of the generated file
|
||||||
|
# default: doesn't emit anything
|
||||||
|
header = "// Copyright (c) Tribufu. All Rights Reserved."
|
||||||
|
|
||||||
|
# An optional string of text to output at the end of the generated file
|
||||||
|
# default: doesn't emit anything
|
||||||
|
#trailer = "/* Text to put at the end of the generated file */"
|
||||||
|
|
||||||
|
# An optional name to use as an include guard
|
||||||
|
# default: doesn't emit an include guard
|
||||||
|
#include_guard = "DEVKIT_H"
|
||||||
|
|
||||||
|
# Whether to add a `#pragma once` guard
|
||||||
|
# default: doesn't emit a `#pragma once`
|
||||||
|
pragma_once = true
|
||||||
|
|
||||||
|
# An optional string of text to output between major sections of the generated
|
||||||
|
# file as a warning against manual editing
|
||||||
|
#
|
||||||
|
# default: doesn't emit anything
|
||||||
|
#autogen_warning = "// Warning, this file is autogenerated. Don't modify it manually."
|
||||||
|
|
||||||
|
# Whether to include a comment with the version of cbindgen used to generate the file
|
||||||
|
# default: false
|
||||||
|
include_version = false
|
||||||
|
|
||||||
|
# An optional namespace to output around the generated bindings
|
||||||
|
# default: doesn't emit a namespace
|
||||||
|
#namespace = "Tribufu"
|
||||||
|
|
||||||
|
# An optional list of namespaces to output around the generated bindings
|
||||||
|
# default: []
|
||||||
|
namespaces = []
|
||||||
|
|
||||||
|
# An optional list of namespaces to declare as using with "using namespace"
|
||||||
|
# default: []
|
||||||
|
using_namespaces = []
|
||||||
|
|
||||||
|
# A list of sys headers to #include (with angle brackets)
|
||||||
|
# default: []
|
||||||
|
sys_includes = ["tribufu/prelude.h"]
|
||||||
|
|
||||||
|
# A list of headers to #include (with quotes)
|
||||||
|
# default: []
|
||||||
|
includes = []
|
||||||
|
|
||||||
|
# Whether cbindgen's default C/C++ standard imports should be suppressed. These
|
||||||
|
# imports are included by default because our generated headers tend to require
|
||||||
|
# them (e.g. for uint32_t). Currently, the generated imports are:
|
||||||
|
#
|
||||||
|
# * for C: <stdarg.h>, <stdbool.h>, <stdint.h>, <stdlib.h>, <uchar.h>
|
||||||
|
#
|
||||||
|
# * for C++: <cstdarg>, <cstdint>, <cstdlib>, <new>, <cassert> (depending on config)
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
no_includes = true
|
||||||
|
|
||||||
|
# Whether to make a C header C++ compatible.
|
||||||
|
# These will wrap generated functions into a `extern "C"` block, e.g.
|
||||||
|
#
|
||||||
|
# #ifdef __cplusplus
|
||||||
|
# extern "C" {
|
||||||
|
# #endif // __cplusplus
|
||||||
|
#
|
||||||
|
# // Generated functions.
|
||||||
|
#
|
||||||
|
# #ifdef __cplusplus
|
||||||
|
# } // extern "C"
|
||||||
|
# #endif // __cplusplus
|
||||||
|
#
|
||||||
|
# If the language is not C this option won't have any effect.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
cpp_compat = false
|
||||||
|
|
||||||
|
# A list of lines to add verbatim after the includes block
|
||||||
|
#after_includes = "\n#include \"Base.h\""
|
||||||
|
|
||||||
|
# Code Style Options
|
||||||
|
|
||||||
|
# The style to use for curly braces
|
||||||
|
#
|
||||||
|
# possible values: "SameLine", "NextLine"
|
||||||
|
#
|
||||||
|
# default: "SameLine"
|
||||||
|
braces = "NextLine"
|
||||||
|
|
||||||
|
# The desired length of a line to use when formatting lines
|
||||||
|
# default: 100
|
||||||
|
line_length = 100
|
||||||
|
|
||||||
|
# The amount of spaces to indent by
|
||||||
|
# default: 2
|
||||||
|
tab_width = 4
|
||||||
|
|
||||||
|
# Include doc comments from Rust as documentation
|
||||||
|
documentation = true
|
||||||
|
|
||||||
|
# How the generated documentation should be commented.
|
||||||
|
#
|
||||||
|
# possible values:
|
||||||
|
# * "c": /* like this */
|
||||||
|
# * "c99": // like this
|
||||||
|
# * "c++": /// like this
|
||||||
|
# * "doxy": like C, but with leading *'s on each line
|
||||||
|
# * "auto": "c++" if that's the language, "doxy" otherwise
|
||||||
|
#
|
||||||
|
# default: "auto"
|
||||||
|
documentation_style = "doxy"
|
||||||
|
|
||||||
|
# Codegen Options
|
||||||
|
|
||||||
|
# When generating a C header, the kind of declaration style to use for structs
|
||||||
|
# or enums.
|
||||||
|
#
|
||||||
|
# possible values:
|
||||||
|
# * "type": typedef struct { ... } MyType;
|
||||||
|
# * "tag": struct MyType { ... };
|
||||||
|
# * "both": typedef struct MyType { ... } MyType;
|
||||||
|
#
|
||||||
|
# default: "both"
|
||||||
|
style = "tag"
|
||||||
|
|
||||||
|
# A list of substitutions for converting cfg's to ifdefs. cfgs which aren't
|
||||||
|
# defined here will just be discarded.
|
||||||
|
#
|
||||||
|
# e.g.
|
||||||
|
# `#[cfg(target = "freebsd")] ...`
|
||||||
|
# becomes
|
||||||
|
# `#if defined(DEFINE_FREEBSD) ... #endif`
|
||||||
|
[defines]
|
||||||
|
"debug_assertions" = "TRIBUFU_DEVEL"
|
||||||
|
"not(debug_assertions)" = "TRIBUFU_RETAIL"
|
||||||
|
"panic = abort" = "TRIBUFU_PANIC_ABORT"
|
||||||
|
"panic = unwind" = "TRIBUFU_PANIC_UNWIND"
|
||||||
|
"proc_macro" = "TRIBUFU_PROC_MACRO"
|
||||||
|
"target_arch = aarch64" = "TRIBUFU_AARCH64"
|
||||||
|
"target_arch = arm" = "TRIBUFU_ARM"
|
||||||
|
"target_arch = armV7" = "TRIBUFU_ARMV7"
|
||||||
|
"target_arch = armv4t" = "TRIBUFU_ARMV4T"
|
||||||
|
"target_arch = armv6" = "TRIBUFU_ARMV6"
|
||||||
|
"target_arch = armv7a" = "TRIBUFU_ARMV7A"
|
||||||
|
"target_arch = armv7s" = "TRIBUFU_ARMV7S"
|
||||||
|
"target_arch = avr" = "TRIBUFU_AVR"
|
||||||
|
"target_arch = bpfeb" = "TRIBUFU_BPFEB"
|
||||||
|
"target_arch = bpfel" = "TRIBUFU_BPFEL"
|
||||||
|
"target_arch = hexagon" = "TRIBUFU_HEXAGON"
|
||||||
|
"target_arch = i386" = "TRIBUFU_I386"
|
||||||
|
"target_arch = i586" = "TRIBUFU_I586"
|
||||||
|
"target_arch = i686" = "TRIBUFU_I686"
|
||||||
|
"target_arch = m68k" = "TRIBUFU_M68K"
|
||||||
|
"target_arch = mips" = "TRIBUFU_MIPS"
|
||||||
|
"target_arch = mipsel" = "TRIBUFU_MIPSEL"
|
||||||
|
"target_arch = msp430" = "TRIBUFU_MSP430"
|
||||||
|
"target_arch = powerpc" = "TRIBUFU_POWERPC"
|
||||||
|
"target_arch = powerpc64" = "TRIBUFU_POWERPC64"
|
||||||
|
"target_arch = powerpc64l" = "TRIBUFU_POWERPC64L"
|
||||||
|
"target_arch = riscv32gc" = "TRIBUFU_RISCV32GC"
|
||||||
|
"target_arch = s390x" = "TRIBUFU_S390X"
|
||||||
|
"target_arch = sparc" = "TRIBUFU_SPARC"
|
||||||
|
"target_arch = sparc64" = "TRIBUFU_SPARC64"
|
||||||
|
"target_arch = thumbv4t" = "TRIBUFU_THUMBV4T"
|
||||||
|
"target_arch = thumbv7a" = "TRIBUFU_THUMBV7A"
|
||||||
|
"target_arch = thumbv7neon" = "TRIBUFU_THUMBV7NEON"
|
||||||
|
"target_arch = wasm32" = "TRIBUFU_WASM32"
|
||||||
|
"target_arch = wasm64" = "TRIBUFU_WASM64"
|
||||||
|
"target_arch = x86" = "TRIBUFU_X86"
|
||||||
|
"target_arch = x86_64" = "TRIBUFU_X86_64"
|
||||||
|
"target_endian = big" = "TRIBUFU_BIG_ENDIAN"
|
||||||
|
"target_endian = little" = "TRIBUFU_LITTLE_ENDIAN"
|
||||||
|
"target_env = gnu" = "TRIBUFU_GNU"
|
||||||
|
"target_env = msvc" = "TRIBUFU_MSVC"
|
||||||
|
"target_env = musl" = "TRIBUFU_MUSL"
|
||||||
|
"target_env = sgx" = "TRIBUFU_SGX"
|
||||||
|
"target_family = unix" = "TRIBUFU_UNIX"
|
||||||
|
"target_family = wasm" = "TRIBUFU_WASM"
|
||||||
|
"target_family = windows" = "TRIBUFU_MICROSOFT"
|
||||||
|
"target_feature = avx" = "TRIBUFU_AVX"
|
||||||
|
"target_feature = avx2" = "TRIBUFU_AVX2"
|
||||||
|
"target_feature = crt-static" = "TRIBUFU_CRTSTATIC"
|
||||||
|
"target_feature = rdrand" = "TRIBUFU_RDRAND"
|
||||||
|
"target_feature = sse" = "TRIBUFU_SSE"
|
||||||
|
"target_feature = sse2" = "TRIBUFU_SSE2"
|
||||||
|
"target_feature = sse4.1" = "TRIBUFU_SSE41"
|
||||||
|
"target_has_atomic = 128" = "TRIBUFU_ATOMIC_128"
|
||||||
|
"target_has_atomic = 16" = "TRIBUFU_ATOMIC_16"
|
||||||
|
"target_has_atomic = 32" = "TRIBUFU_ATOMIC_32"
|
||||||
|
"target_has_atomic = 64" = "TRIBUFU_ATOMIC_64"
|
||||||
|
"target_has_atomic = 8" = "TRIBUFU_ATOMIC_8"
|
||||||
|
"target_has_atomic = ptr" = "TRIBUFU_ATOMIC_PTR"
|
||||||
|
"target_os = android" = "TRIBUFU_ANDROID"
|
||||||
|
"target_os = dragonfly" = "TRIBUFU_DRAGONFLY"
|
||||||
|
"target_os = freebsd" = "TRIBUFU_FREEBSD"
|
||||||
|
"target_os = ios" = "TRIBUFU_IOS"
|
||||||
|
"target_os = linux" = "TRIBUFU_LINUX"
|
||||||
|
"target_os = macos" = "TRIBUFU_MACOS"
|
||||||
|
"target_os = netbsd" = "TRIBUFU_NETBSD"
|
||||||
|
"target_os = openbsd" = "TRIBUFU_OPENBSD"
|
||||||
|
"target_os = windows" = "TRIBUFU_WINDOWS"
|
||||||
|
"target_pointer_width = 16" = "TRIBUFU_POINTER_16"
|
||||||
|
"target_pointer_width = 32" = "TRIBUFU_POINTER_32"
|
||||||
|
"target_pointer_width = 64" = "TRIBUFU_POINTER_64"
|
||||||
|
"target_vendor = apple" = "TRIBUFU_APPLE"
|
||||||
|
"target_vendor = fortanix" = "TRIBUFU_FORTANIX"
|
||||||
|
"target_vendor = pc" = "TRIBUFU_MICROSOFT"
|
||||||
|
"target_vendor = unknown" = "TRIBUFU_UNKNOWN"
|
||||||
|
|
||||||
|
[export]
|
||||||
|
# A list of additional items to always include in the generated bindings if they're
|
||||||
|
# found but otherwise don't appear to be used by the public API.
|
||||||
|
#
|
||||||
|
# default: []
|
||||||
|
include = []
|
||||||
|
|
||||||
|
# A list of items to not include in the generated bindings
|
||||||
|
# default: []
|
||||||
|
exclude = []
|
||||||
|
|
||||||
|
# A prefix to add before the name of every item
|
||||||
|
# default: no prefix is added
|
||||||
|
#prefix = "ALN_"
|
||||||
|
|
||||||
|
# Types of items that we'll generate. If empty, then all types of item are emitted.
|
||||||
|
#
|
||||||
|
# possible items: (TODO: explain these in detail)
|
||||||
|
# * "constants":
|
||||||
|
# * "globals":
|
||||||
|
# * "enums":
|
||||||
|
# * "structs":
|
||||||
|
# * "unions":
|
||||||
|
# * "typedefs":
|
||||||
|
# * "opaque":
|
||||||
|
# * "functions":
|
||||||
|
#
|
||||||
|
# default: []
|
||||||
|
item_types = ["enums", "structs", "typedefs", "functions"]
|
||||||
|
|
||||||
|
# Whether applying rules in export.rename prevents export.prefix from applying.
|
||||||
|
#
|
||||||
|
# e.g. given this toml:
|
||||||
|
#
|
||||||
|
# [export]
|
||||||
|
# prefix = "capi_"
|
||||||
|
# [export.rename]
|
||||||
|
# "MyType" = "my_cool_type"
|
||||||
|
#
|
||||||
|
# You get the following results:
|
||||||
|
#
|
||||||
|
# renaming_overrides_prefixing = true:
|
||||||
|
# "MyType" => "my_cool_type"
|
||||||
|
#
|
||||||
|
# renaming_overrides_prefixing = false:
|
||||||
|
# "MyType => capi_my_cool_type"
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
renaming_overrides_prefixing = false
|
||||||
|
|
||||||
|
# Table of name conversions to apply to item names (lhs becomes rhs)
|
||||||
|
[export.rename]
|
||||||
|
"CPluginManager" = "PluginManager"
|
||||||
|
"my_function" = "BetterFunctionName"
|
||||||
|
|
||||||
|
# Table of things to prepend to the body of any struct, union, or enum that has the
|
||||||
|
# given name. This can be used to add things like methods which don't change ABI,
|
||||||
|
# mark fields private, etc
|
||||||
|
[export.pre_body]
|
||||||
|
"MyType" = """
|
||||||
|
MyType() = delete;
|
||||||
|
private:
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Table of things to append to the body of any struct, union, or enum that has the
|
||||||
|
# given name. This can be used to add things like methods which don't change ABI.
|
||||||
|
[export.body]
|
||||||
|
"MyType" = """
|
||||||
|
void cppMethod() const;
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Configuration for name mangling
|
||||||
|
[export.mangle]
|
||||||
|
# Whether the types should be renamed during mangling, for example
|
||||||
|
# c_char -> CChar, etc.
|
||||||
|
rename_types = "None"
|
||||||
|
# Whether the underscores from the mangled name should be omitted.
|
||||||
|
remove_underscores = false
|
||||||
|
|
||||||
|
[layout]
|
||||||
|
# A string that should come before the name of any type which has been marked
|
||||||
|
# as `#[repr(packed)]`. For instance, "__attribute__((packed))" would be a
|
||||||
|
# reasonable value if targeting gcc/clang. A more portable solution would
|
||||||
|
# involve emitting the name of a macro which you define in a platform-specific
|
||||||
|
# way. e.g. "PACKED"
|
||||||
|
#
|
||||||
|
# default: `#[repr(packed)]` types will be treated as opaque, since it would
|
||||||
|
# be unsafe for C callers to use a incorrectly laid-out union.
|
||||||
|
packed = "PACKED"
|
||||||
|
|
||||||
|
# A string that should come before the name of any type which has been marked
|
||||||
|
# as `#[repr(align(n))]`. This string must be a function-like macro which takes
|
||||||
|
# a single argument (the requested alignment, `n`). For instance, a macro
|
||||||
|
# `#define`d as `ALIGNED(n)` in `header` which translates to
|
||||||
|
# `__attribute__((aligned(n)))` would be a reasonable value if targeting
|
||||||
|
# gcc/clang.
|
||||||
|
#
|
||||||
|
# default: `#[repr(align(n))]` types will be treated as opaque, since it
|
||||||
|
# could be unsafe for C callers to use a incorrectly-aligned union.
|
||||||
|
aligned_n = "ALIGNED"
|
||||||
|
|
||||||
|
[fn]
|
||||||
|
# An optional prefix to put before every function declaration
|
||||||
|
# default: no prefix added
|
||||||
|
prefix = "NATIVE_API"
|
||||||
|
|
||||||
|
# An optional postfix to put after any function declaration
|
||||||
|
# default: no postix added
|
||||||
|
#postfix = "WR_END_FUNC"
|
||||||
|
|
||||||
|
# How to format function arguments
|
||||||
|
#
|
||||||
|
# possible values:
|
||||||
|
# * "horizontal": place all arguments on the same line
|
||||||
|
# * "vertical": place each argument on its own line
|
||||||
|
# * "auto": only use vertical if horizontal would exceed line_length
|
||||||
|
#
|
||||||
|
# default: "auto"
|
||||||
|
args = "horizontal"
|
||||||
|
|
||||||
|
# An optional string that should prefix function declarations which have been
|
||||||
|
# marked as `#[must_use]`. For instance, "__attribute__((warn_unused_result))"
|
||||||
|
# would be a reasonable value if targeting gcc/clang. A more portable solution
|
||||||
|
# would involve emitting the name of a macro which you define in a
|
||||||
|
# platform-specific way. e.g. "MUST_USE_FUNC"
|
||||||
|
# default: nothing is emitted for must_use functions
|
||||||
|
must_use = "MUST_USE_FUNC"
|
||||||
|
|
||||||
|
# An optional string that will be used in the attribute position for functions
|
||||||
|
# that don't return (that return `!` in Rust).
|
||||||
|
#
|
||||||
|
# For instance, `__attribute__((noreturn))` would be a reasonable value if
|
||||||
|
# targeting gcc/clang.
|
||||||
|
no_return = "NO_RETURN"
|
||||||
|
|
||||||
|
# An optional string that, if present, will be used to generate Swift function
|
||||||
|
# and method signatures for generated functions, for example "CF_SWIFT_NAME".
|
||||||
|
# If no such macro is available in your toolchain, you can define one using the
|
||||||
|
# `header` option in cbindgen.toml
|
||||||
|
# default: no swift_name function attributes are generated
|
||||||
|
#swift_name_macro = "CF_SWIFT_NAME"
|
||||||
|
|
||||||
|
# A rule to use to rename function argument names. The renaming assumes the input
|
||||||
|
# is the Rust standard snake_case, however it accepts all the different rename_args
|
||||||
|
# inputs. This means many options here are no-ops or redundant.
|
||||||
|
#
|
||||||
|
# possible values (that actually do something):
|
||||||
|
# * "CamelCase": my_arg => myArg
|
||||||
|
# * "PascalCase": my_arg => MyArg
|
||||||
|
# * "GeckoCase": my_arg => aMyArg
|
||||||
|
# * "ScreamingSnakeCase": my_arg => MY_ARG
|
||||||
|
# * "None": apply no renaming
|
||||||
|
#
|
||||||
|
# technically possible values (that shouldn't have a purpose here):
|
||||||
|
# * "SnakeCase": apply no renaming
|
||||||
|
# * "LowerCase": apply no renaming (actually applies to_lowercase, is this bug?)
|
||||||
|
# * "UpperCase": same as ScreamingSnakeCase in this context
|
||||||
|
# * "QualifiedScreamingSnakeCase" => same as ScreamingSnakeCase in this context
|
||||||
|
#
|
||||||
|
# default: "None"
|
||||||
|
rename_args = "None"
|
||||||
|
|
||||||
|
# This rule specifies the order in which functions will be sorted.
|
||||||
|
#
|
||||||
|
# "Name": sort by the name of the function
|
||||||
|
# "None": keep order in which the functions have been parsed
|
||||||
|
#
|
||||||
|
# default: "None"
|
||||||
|
sort_by = "Name"
|
||||||
|
|
||||||
|
# If this option is true `usize` and `isize` will be converted into `size_t` and `ptrdiff_t`
|
||||||
|
# instead of `uintptr_t` and `intptr_t` respectively.
|
||||||
|
#usize_is_size_t = true
|
||||||
|
|
||||||
|
[struct]
|
||||||
|
# A rule to use to rename struct field names. The renaming assumes the input is
|
||||||
|
# the Rust standard snake_case, however it acccepts all the different rename_args
|
||||||
|
# inputs. This means many options here are no-ops or redundant.
|
||||||
|
#
|
||||||
|
# possible values (that actually do something):
|
||||||
|
# * "CamelCase": my_arg => myArg
|
||||||
|
# * "PascalCase": my_arg => MyArg
|
||||||
|
# * "GeckoCase": my_arg => mMyArg
|
||||||
|
# * "ScreamingSnakeCase": my_arg => MY_ARG
|
||||||
|
# * "None": apply no renaming
|
||||||
|
#
|
||||||
|
# technically possible values (that shouldn't have a purpose here):
|
||||||
|
# * "SnakeCase": apply no renaming
|
||||||
|
# * "LowerCase": apply no renaming (actually applies to_lowercase, is this bug?)
|
||||||
|
# * "UpperCase": same as ScreamingSnakeCase in this context
|
||||||
|
# * "QualifiedScreamingSnakeCase" => same as ScreamingSnakeCase in this context
|
||||||
|
#
|
||||||
|
# default: "None"
|
||||||
|
rename_fields = "None"
|
||||||
|
|
||||||
|
# An optional string that should come before the name of any struct which has been
|
||||||
|
# marked as `#[must_use]`. For instance, "__attribute__((warn_unused))"
|
||||||
|
# would be a reasonable value if targeting gcc/clang. A more portable solution
|
||||||
|
# would involve emitting the name of a macro which you define in a
|
||||||
|
# platform-specific way. e.g. "MUST_USE_STRUCT"
|
||||||
|
#
|
||||||
|
# default: nothing is emitted for must_use structs
|
||||||
|
must_use = "MUST_USE_STRUCT"
|
||||||
|
|
||||||
|
# Whether a Rust type with associated consts should emit those consts inside the
|
||||||
|
# type's body. Otherwise they will be emitted trailing and with the type's name
|
||||||
|
# prefixed. This does nothing if the target is C, or if
|
||||||
|
# [const]allow_static_const = false
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
# associated_constants_in_body: false
|
||||||
|
|
||||||
|
# Whether to derive a simple constructor that takes a value for every field.
|
||||||
|
# default: false
|
||||||
|
derive_constructor = true
|
||||||
|
|
||||||
|
# Whether to derive an operator== for all structs
|
||||||
|
# default: false
|
||||||
|
derive_eq = false
|
||||||
|
|
||||||
|
# Whether to derive an operator!= for all structs
|
||||||
|
# default: false
|
||||||
|
derive_neq = false
|
||||||
|
|
||||||
|
# Whether to derive an operator< for all structs
|
||||||
|
# default: false
|
||||||
|
derive_lt = false
|
||||||
|
|
||||||
|
# Whether to derive an operator<= for all structs
|
||||||
|
# default: false
|
||||||
|
derive_lte = false
|
||||||
|
|
||||||
|
# Whether to derive an operator> for all structs
|
||||||
|
# default: false
|
||||||
|
derive_gt = false
|
||||||
|
|
||||||
|
# Whether to derive an operator>= for all structs
|
||||||
|
# default: false
|
||||||
|
derive_gte = false
|
||||||
|
|
||||||
|
[enum]
|
||||||
|
# A rule to use to rename enum variants, and the names of any fields those
|
||||||
|
# variants have. This should probably be split up into two separate options, but
|
||||||
|
# for now, they're the same! See the documentation for `[struct]rename_fields`
|
||||||
|
# for how this applies to fields. Renaming of the variant assumes that the input
|
||||||
|
# is the Rust standard PascalCase. In the case of QualifiedScreamingSnakeCase,
|
||||||
|
# it also assumed that the enum's name is PascalCase.
|
||||||
|
#
|
||||||
|
# possible values (that actually do something):
|
||||||
|
# * "CamelCase": MyVariant => myVariant
|
||||||
|
# * "SnakeCase": MyVariant => my_variant
|
||||||
|
# * "ScreamingSnakeCase": MyVariant => MY_VARIANT
|
||||||
|
# * "QualifiedScreamingSnakeCase": MyVariant => ENUM_NAME_MY_VARIANT
|
||||||
|
# * "LowerCase": MyVariant => myvariant
|
||||||
|
# * "UpperCase": MyVariant => MYVARIANT
|
||||||
|
# * "None": apply no renaming
|
||||||
|
#
|
||||||
|
# technically possible values (that shouldn't have a purpose for the variants):
|
||||||
|
# * "PascalCase": apply no renaming
|
||||||
|
# * "GeckoCase": apply no renaming
|
||||||
|
#
|
||||||
|
# default: "None"
|
||||||
|
rename_variants = "None"
|
||||||
|
|
||||||
|
# Whether an extra "sentinel" enum variant should be added to all generated enums.
|
||||||
|
# Firefox uses this for their IPC serialization library.
|
||||||
|
#
|
||||||
|
# WARNING: if the sentinel is ever passed into Rust, behaviour will be Undefined.
|
||||||
|
# Rust does not know about this value, and will assume it cannot happen.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
add_sentinel = false
|
||||||
|
|
||||||
|
# Whether enum variant names should be prefixed with the name of the enum.
|
||||||
|
# default: false
|
||||||
|
prefix_with_name = false
|
||||||
|
|
||||||
|
# Whether to emit enums using "enum class" when targeting C++.
|
||||||
|
# default: true
|
||||||
|
enum_class = false
|
||||||
|
|
||||||
|
# Whether to generate static `::MyVariant(..)` constructors and `bool IsMyVariant()`
|
||||||
|
# methods for enums with fields.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
derive_helper_methods = false
|
||||||
|
|
||||||
|
# Whether to generate `const MyVariant& AsMyVariant() const` methods for enums with fields.
|
||||||
|
# default: false
|
||||||
|
derive_const_casts = false
|
||||||
|
|
||||||
|
# Whether to generate `MyVariant& AsMyVariant()` methods for enums with fields
|
||||||
|
# default: false
|
||||||
|
derive_mut_casts = false
|
||||||
|
|
||||||
|
# The name of the macro/function to use for asserting `IsMyVariant()` in the body of
|
||||||
|
# derived `AsMyVariant()` cast methods.
|
||||||
|
#
|
||||||
|
# default: "assert" (but also causes `<cassert>` to be included by default)
|
||||||
|
#cast_assert_name = "MOZ_RELEASE_ASSERT"
|
||||||
|
|
||||||
|
# An optional string that should come before the name of any enum which has been
|
||||||
|
# marked as `#[must_use]`. For instance, "__attribute__((warn_unused))"
|
||||||
|
# would be a reasonable value if targeting gcc/clang. A more portable solution
|
||||||
|
# would involve emitting the name of a macro which you define in a
|
||||||
|
# platform-specific way. e.g. "MUST_USE_ENUM"
|
||||||
|
#
|
||||||
|
# Note that this refers to the *output* type. That means this will not apply to an enum
|
||||||
|
# with fields, as it will be emitted as a struct. `[struct]must_use` will apply there.
|
||||||
|
#
|
||||||
|
# default: nothing is emitted for must_use enums
|
||||||
|
must_use = "MUST_USE_ENUM"
|
||||||
|
|
||||||
|
# Whether enums with fields should generate destructors. This exists so that generic
|
||||||
|
# enums can be properly instantiated with payloads that are C++ types with
|
||||||
|
# destructors. This isn't necessary for structs because C++ has rules to
|
||||||
|
# automatically derive the correct constructors and destructors for those types.
|
||||||
|
#
|
||||||
|
# Care should be taken with this option, as Rust and C++ cannot
|
||||||
|
# properly interoperate with eachother's notions of destructors. Also, this may
|
||||||
|
# change the ABI for the type. Either your destructor-full enums must live
|
||||||
|
# exclusively within C++, or they must only be passed by-reference between
|
||||||
|
# C++ and Rust.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
derive_tagged_enum_destructor = false
|
||||||
|
|
||||||
|
# Whether enums with fields should generate copy-constructor. See the discussion on
|
||||||
|
# derive_tagged_enum_destructor for why this is both useful and very dangerous.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
derive_tagged_enum_copy_constructor = false
|
||||||
|
# Whether enums with fields should generate copy-assignment operators.
|
||||||
|
#
|
||||||
|
# This depends on also deriving copy-constructors, and it is highly encouraged
|
||||||
|
# for this to be set to true.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
derive_tagged_enum_copy_assignment = false
|
||||||
|
|
||||||
|
# Whether enums with fields should generate an empty, private destructor.
|
||||||
|
# This allows the auto-generated constructor functions to compile, if there are
|
||||||
|
# non-trivially constructible members. This falls in the same family of
|
||||||
|
# dangerousness as `derive_tagged_enum_copy_constructor` and co.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
private_default_tagged_enum_constructor = false
|
||||||
|
|
||||||
|
[const]
|
||||||
|
# Whether a generated constant can be a static const in C++ mode. I have no
|
||||||
|
# idea why you would turn this off.
|
||||||
|
#
|
||||||
|
# default: true
|
||||||
|
allow_static_const = true
|
||||||
|
|
||||||
|
# Whether a generated constant can be constexpr in C++ mode.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
allow_constexpr = false
|
||||||
|
|
||||||
|
# This rule specifies the order in which constants will be sorted.
|
||||||
|
#
|
||||||
|
# "Name": sort by the name of the constant
|
||||||
|
# "None": keep order in which the constants have been parsed
|
||||||
|
#
|
||||||
|
# default: "None"
|
||||||
|
sort_by = "Name"
|
||||||
|
|
||||||
|
[macro_expansion]
|
||||||
|
# Whether bindings should be generated for instances of the bitflags! macro.
|
||||||
|
# default: false
|
||||||
|
bitflags = true
|
||||||
|
|
||||||
|
# Options for how your Rust library should be parsed
|
||||||
|
|
||||||
|
[parse]
|
||||||
|
# Whether to parse dependent crates and include their types in the output
|
||||||
|
# default: false
|
||||||
|
parse_deps = true
|
||||||
|
|
||||||
|
# A white list of crate names that are allowed to be parsed. If this is defined,
|
||||||
|
# only crates found in this list will ever be parsed.
|
||||||
|
#
|
||||||
|
# default: there is no whitelist (NOTE: this is the opposite of [])
|
||||||
|
include = []
|
||||||
|
|
||||||
|
# A black list of crate names that are not allowed to be parsed.
|
||||||
|
# default: []
|
||||||
|
exclude = []
|
||||||
|
|
||||||
|
# Whether to use a new temporary target directory when running `rustc --pretty=expanded`.
|
||||||
|
# This may be required for some build processes.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
clean = false
|
||||||
|
|
||||||
|
# Which crates other than the top-level binding crate we should generate
|
||||||
|
# bindings for.
|
||||||
|
#
|
||||||
|
# default: []
|
||||||
|
extra_bindings = []
|
||||||
|
|
||||||
|
[parse.expand]
|
||||||
|
# A list of crate names that should be run through `cargo expand` before
|
||||||
|
# parsing to expand any macros. Note that if a crate is named here, it
|
||||||
|
# will always be parsed, even if the blacklist/whitelist says it shouldn't be.
|
||||||
|
#
|
||||||
|
# default: []
|
||||||
|
crates = []
|
||||||
|
|
||||||
|
# If enabled, use the `--all-features` option when expanding. Ignored when
|
||||||
|
# `features` is set. For backwards-compatibility, this is forced on if
|
||||||
|
# `expand = ["euclid"]` shorthand is used.
|
||||||
|
#
|
||||||
|
# default: false
|
||||||
|
all_features = true
|
||||||
|
|
||||||
|
# When `all_features` is disabled and this is also disabled, use the
|
||||||
|
# `--no-default-features` option when expanding.
|
||||||
|
#
|
||||||
|
# default: true
|
||||||
|
default_features = true
|
||||||
|
|
||||||
|
# A list of feature names that should be used when running `cargo expand`. This
|
||||||
|
# combines with `default_features` like in your `Cargo.toml`. Note that the features
|
||||||
|
# listed here are features for the current crate being built, *not* the crates
|
||||||
|
# being expanded. The crate's `Cargo.toml` must take care of enabling the
|
||||||
|
# appropriate features in its dependencies
|
||||||
|
#
|
||||||
|
# default: []
|
||||||
|
features = []
|
||||||
|
|
||||||
|
[ptr]
|
||||||
|
# An optional string to decorate all pointers that are
|
||||||
|
# required to be non null. Nullability is inferred from the Rust type: `&T`,
|
||||||
|
# `&mut T` and `NonNull<T>` all require a valid pointer value.
|
||||||
|
#non_null_attribute = "_Nonnull"
|
@ -10,5 +10,17 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
auto client = new TribufuClient(0, "client_secret");
|
auto client = new TribufuClient(0, "client_secret");
|
||||||
std::cout << "client_id: " << client->get_id() << std::endl;
|
std::cout << "client_id: " << client->get_id() << std::endl;
|
||||||
|
|
||||||
|
json json_obj = {
|
||||||
|
{"nome", "John"},
|
||||||
|
{"idade", 25},
|
||||||
|
{"cidade", "Exemplo"}};
|
||||||
|
|
||||||
|
std::string json_str = json_obj.dump(4);
|
||||||
|
|
||||||
|
std::cout << json_str << std::endl;
|
||||||
|
|
||||||
|
client->get_token();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ project "example"
|
|||||||
includedirs
|
includedirs
|
||||||
{
|
{
|
||||||
"../include",
|
"../include",
|
||||||
"../vendor",
|
"../vendor/*/include",
|
||||||
}
|
}
|
||||||
|
|
||||||
libdirs
|
libdirs
|
||||||
@ -75,6 +75,10 @@ project "example"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
filter { "platforms:mac-*" }
|
filter { "platforms:mac-*" }
|
||||||
system "macosx"
|
system "macosx"
|
||||||
systemversion "10.15"
|
systemversion "10.15"
|
||||||
@ -97,6 +101,10 @@ project "example"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
filter { "platforms:linux-*" }
|
filter { "platforms:linux-*" }
|
||||||
system "linux"
|
system "linux"
|
||||||
|
|
||||||
@ -118,6 +126,10 @@ project "example"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
filter { "platforms:android-*" }
|
filter { "platforms:android-*" }
|
||||||
system "android"
|
system "android"
|
||||||
|
|
||||||
@ -139,6 +151,10 @@ project "example"
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
filter { "platforms:ios-*" }
|
filter { "platforms:ios-*" }
|
||||||
system "ios"
|
system "ios"
|
||||||
systemversion "13.0"
|
systemversion "13.0"
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/unix/unix_platform.h>
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_ANDROID
|
|
||||||
#define TRIBUFU_ANDROID
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_MOBILE
|
|
||||||
#define TRIBUFU_MOBILE
|
|
||||||
#endif
|
|
@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_APPLE
|
|
||||||
#define TRIBUFU_APPLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DLLEXPORT __attribute__((visibility("default")))
|
|
||||||
#define DLLIMPORT __attribute__((visibility("default")))
|
|
@ -1,7 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/defines.h>
|
|
||||||
#include <tribufu/platform.h>
|
|
||||||
#include <tribufu/std.h>
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <tribufu/base.h>
|
#include <tribufu/prelude.h>
|
||||||
|
|
||||||
const char *VERSION = "0.0.4";
|
const char *VERSION = "0.0.4";
|
||||||
|
|
||||||
@ -13,6 +13,7 @@ namespace tribufu
|
|||||||
private:
|
private:
|
||||||
uint64_t id;
|
uint64_t id;
|
||||||
std::string secret;
|
std::string secret;
|
||||||
|
HttpClient http;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TribufuClient(uint64_t id, const std::string &secret);
|
TribufuClient(uint64_t id, const std::string &secret);
|
||||||
@ -22,5 +23,7 @@ namespace tribufu
|
|||||||
{
|
{
|
||||||
return this->id;
|
return this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_token();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,61 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef EXTERN_C
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define EXTERN_C extern "C"
|
|
||||||
#define TRIBUFU_CPP
|
|
||||||
#else
|
|
||||||
#define EXTERN_C
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Declare Enum
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
|
|
||||||
#define TRIBUFU_ENUM_START(name) enum class name {
|
|
||||||
#define TRIBUFU_ENUM_END(name) }
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define TRIBUFU_ENUM_START(name) typedef enum name {
|
|
||||||
#define TRIBUFU_ENUM_END } name
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define TRIBUFU_DECLARE_ENUM(name, ...) TRIBUFU_ENUM_START(name) __VA_ARGS__ TRIBUFU_ENUM_END
|
|
||||||
|
|
||||||
// Declare Struct
|
|
||||||
|
|
||||||
#define TRIBUFU_PASTE(...) __VA_ARGS__
|
|
||||||
|
|
||||||
#define TRIBUFU_DECLARE_STRUCT(name, body) \
|
|
||||||
EXTERN_C typedef struct name \
|
|
||||||
{ \
|
|
||||||
TRIBUFU_PASTE body \
|
|
||||||
} name
|
|
||||||
|
|
||||||
// Experimental
|
|
||||||
|
|
||||||
#define TRIBUFU_CLASS(...)
|
|
||||||
#define TRIBUFU_STRUCT(...)
|
|
||||||
#define TRIBUFU_ENUM(...)
|
|
||||||
#define TRIBUFU_FUNCTION(...)
|
|
||||||
#define TRIBUFU_PROPERTY(...)
|
|
||||||
|
|
||||||
// Import/Export API
|
|
||||||
|
|
||||||
#define NATIVE_API EXTERN_C
|
|
||||||
|
|
||||||
#ifdef TRIBUFU_LIBRARY
|
|
||||||
#define TRIBUFU_API DLLEXPORT
|
|
||||||
#else
|
|
||||||
#define TRIBUFU_API DLLIMPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Macros Utils
|
|
||||||
|
|
||||||
#define TRIBUFU_EXPAND_MACRO(x) x
|
|
||||||
#define TRIBUFU_STRINGIFY_MACRO(x) #x
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/unix/unix_platform.h>
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_FREEBSD
|
|
||||||
#define TRIBUFU_FREEBSD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_DESKTOP
|
|
||||||
#define TRIBUFU_DESKTOP
|
|
||||||
#endif
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/apple/apple_platform.h>
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_IOS
|
|
||||||
#define TRIBUFU_IOS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_MOBILE
|
|
||||||
#define TRIBUFU_MOBILE
|
|
||||||
#endif
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/unix/unix_platform.h>
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_LINUX
|
|
||||||
#define TRIBUFU_LINUX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_DESKTOP
|
|
||||||
#define TRIBUFU_DESKTOP
|
|
||||||
#endif
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/apple/apple_platform.h>
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_MAC
|
|
||||||
#define TRIBUFU_MAC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_DESKTOP
|
|
||||||
#define TRIBUFU_DESKTOP
|
|
||||||
#endif
|
|
18
include/tribufu/macros.h
Normal file
18
include/tribufu/macros.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define TRIBUFU_CPP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TRIBUFU_LIBRARY
|
||||||
|
#define TRIBUFU_API DLLEXPORT
|
||||||
|
#else
|
||||||
|
#define TRIBUFU_API DLLIMPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Macros Utils
|
||||||
|
|
||||||
|
#define TRIBUFU_EXPAND_MACRO(x) x
|
||||||
|
#define TRIBUFU_STRINGIFY_MACRO(x) #x
|
@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_MSVC
|
|
||||||
#define TRIBUFU_MSVC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_MICROSOFT
|
|
||||||
#define TRIBUFU_MICROSOFT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DLLEXPORT __declspec(dllexport)
|
|
||||||
#define DLLIMPORT __declspec(dllimport)
|
|
5
include/tribufu/native.h
Normal file
5
include/tribufu/native.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <tribufu/prelude.h>
|
127
include/tribufu/oauth2.h
Normal file
127
include/tribufu/oauth2.h
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <tribufu/prelude.h>
|
||||||
|
|
||||||
|
namespace tribufu
|
||||||
|
{
|
||||||
|
enum class TRIBUFU_API OAuth2ResponseType
|
||||||
|
{
|
||||||
|
Code,
|
||||||
|
Token,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class TRIBUFU_API OAuth2ClientType
|
||||||
|
{
|
||||||
|
Confidential,
|
||||||
|
Public,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class TRIBUFU_API OAuth2TokenHintType
|
||||||
|
{
|
||||||
|
AccessToken,
|
||||||
|
RefreshToken,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class TRIBUFU_API OAuth2GrantType
|
||||||
|
{
|
||||||
|
AuthorizationCode,
|
||||||
|
ClientCredentials,
|
||||||
|
DeviceCode,
|
||||||
|
Password,
|
||||||
|
RefreshToken,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class TRIBUFU_API OAuth2AuthorizeError
|
||||||
|
{
|
||||||
|
AccessDenied,
|
||||||
|
InvalidRequest,
|
||||||
|
InvalidScope,
|
||||||
|
ServerError,
|
||||||
|
TemporarilyUnavailable,
|
||||||
|
UnauthorizedClient,
|
||||||
|
UnsupportedResponseType,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class TRIBUFU_API OAuth2TokenType
|
||||||
|
{
|
||||||
|
Bearer,
|
||||||
|
};
|
||||||
|
|
||||||
|
class TRIBUFU_API OAuth2AuthorizeRequest
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
OAuth2ResponseType response_type;
|
||||||
|
uint64_t client_id;
|
||||||
|
std::string client_secret;
|
||||||
|
std::string redirect_uri;
|
||||||
|
std::string scope;
|
||||||
|
std::string state;
|
||||||
|
|
||||||
|
public:
|
||||||
|
OAuth2AuthorizeRequest();
|
||||||
|
OAuth2AuthorizeRequest(OAuth2ResponseType response_type, uint64_t client_id, const std::string &client_secret, const std::string &redirect_uri, const std::string &scope, const std::string &state);
|
||||||
|
~OAuth2AuthorizeRequest();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TRIBUFU_API OAuth2CodeResponse
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::string code;
|
||||||
|
std::string state;
|
||||||
|
|
||||||
|
public:
|
||||||
|
OAuth2CodeResponse();
|
||||||
|
OAuth2CodeResponse(const std::string &code, const std::string &state);
|
||||||
|
~OAuth2CodeResponse();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TRIBUFU_API OAuth2ErrorResponse
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
OAuth2AuthorizeError error;
|
||||||
|
std::string error_description;
|
||||||
|
std::string error_uri;
|
||||||
|
std::string state;
|
||||||
|
|
||||||
|
public:
|
||||||
|
OAuth2ErrorResponse();
|
||||||
|
OAuth2ErrorResponse(OAuth2AuthorizeError error, const std::string &error_description, const std::string &error_uri, const std::string &state);
|
||||||
|
~OAuth2ErrorResponse();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TRIBUFU_API OAuth2TokenRequest
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
OAuth2GrantType grant_type;
|
||||||
|
uint64_t client_id;
|
||||||
|
std::string client_secret;
|
||||||
|
std::string redirect_uri;
|
||||||
|
std::string code;
|
||||||
|
std::string refresh_token;
|
||||||
|
std::string username;
|
||||||
|
std::string password;
|
||||||
|
|
||||||
|
public:
|
||||||
|
OAuth2TokenRequest();
|
||||||
|
OAuth2TokenRequest(OAuth2GrantType grant_type, uint64_t client_id, const std::string &client_secret, const std::string &redirect_uri, const std::string &code, const std::string &refresh_token, const std::string &username, const std::string &password);
|
||||||
|
~OAuth2TokenRequest();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TRIBUFU_API OAuth2TokenResponse
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
OAuth2TokenType token_type;
|
||||||
|
std::string access_token;
|
||||||
|
std::string refresh_token;
|
||||||
|
std::string scope;
|
||||||
|
std::string state;
|
||||||
|
uint64_t expires_in;
|
||||||
|
|
||||||
|
public:
|
||||||
|
OAuth2TokenResponse();
|
||||||
|
OAuth2TokenResponse(OAuth2TokenType token_type, const std::string &access_token, const std::string &refresh_token, const std::string &scope, const std::string &state, uint64_t expires_in);
|
||||||
|
~OAuth2TokenResponse();
|
||||||
|
};
|
||||||
|
}
|
@ -1,30 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <tribufu/windows/windows_platform.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __MACH__
|
|
||||||
#include <tribufu/mac/mac_platform.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
#include <tribufu/linux/linux_platform.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#include <tribufu/freebsd/freebsd_platform.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
|
||||||
#include <tribufu/android/android_platform.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
// #include <TargetConditionals.h>
|
|
||||||
#ifdef TARGET_OS_IPHONE
|
|
||||||
#include <tribufu/ios/ios_platform.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
13
include/tribufu/prelude.h
Normal file
13
include/tribufu/prelude.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <mintaka/framework.h>
|
||||||
|
#include <tribufu/macros.h>
|
||||||
|
#include <tribufu/native.h>
|
||||||
|
|
||||||
|
#ifdef TRIBUFU_CPP
|
||||||
|
|
||||||
|
using namespace mintaka;
|
||||||
|
|
||||||
|
#endif
|
27
include/tribufu/servers/server.h
Normal file
27
include/tribufu/servers/server.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <tribufu/prelude.h>
|
||||||
|
|
||||||
|
namespace tribufu
|
||||||
|
{
|
||||||
|
class TRIBUFU_API Server
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
uint64_t id;
|
||||||
|
std::string name;
|
||||||
|
std::string description;
|
||||||
|
std::string address;
|
||||||
|
uint16_t game_port;
|
||||||
|
uint16_t query_port;
|
||||||
|
uint64_t package_id;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Server();
|
||||||
|
Server(json data);
|
||||||
|
~Server();
|
||||||
|
|
||||||
|
json to_json();
|
||||||
|
};
|
||||||
|
}
|
@ -1,26 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#ifdef TRIBUFU_CPP
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cstdarg>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <functional>
|
|
||||||
#include <iostream>
|
|
||||||
#include <memory>
|
|
||||||
#include <new>
|
|
||||||
#include <ostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,10 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_UNIX
|
|
||||||
#define TRIBUFU_UNIX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DLLEXPORT __attribute__((visibility("default")))
|
|
||||||
#define DLLIMPORT __attribute__((visibility("default")))
|
|
46
include/tribufu/users/profile.h
Normal file
46
include/tribufu/users/profile.h
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <tribufu/prelude.h>
|
||||||
|
|
||||||
|
namespace tribufu
|
||||||
|
{
|
||||||
|
enum class UserType
|
||||||
|
{
|
||||||
|
User,
|
||||||
|
Bot,
|
||||||
|
Org,
|
||||||
|
};
|
||||||
|
|
||||||
|
class TRIBUFU_API Profile
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
uint64_t id;
|
||||||
|
std::string uuid;
|
||||||
|
std::string name;
|
||||||
|
std::string display_name;
|
||||||
|
UserType type;
|
||||||
|
uint64_t public_flags;
|
||||||
|
bool verified;
|
||||||
|
uint32_t level;
|
||||||
|
double experience;
|
||||||
|
bool public_birthday;
|
||||||
|
double points;
|
||||||
|
std::string location;
|
||||||
|
std::string photo_url;
|
||||||
|
std::string banner_url;
|
||||||
|
std::string last_online;
|
||||||
|
std::string biography;
|
||||||
|
uint32_t view_count;
|
||||||
|
std::string created;
|
||||||
|
std::string updated;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Profile();
|
||||||
|
Profile(json data);
|
||||||
|
~Profile();
|
||||||
|
|
||||||
|
json to_json();
|
||||||
|
};
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/msvc/msvc_platform.h>
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_UWP
|
|
||||||
#define TRIBUFU_UWP
|
|
||||||
#endif
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) Tribufu. All Rights Reserved.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <tribufu/msvc/msvc_platform.h>
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_WINDOWS
|
|
||||||
#define TRIBUFU_WINDOWS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRIBUFU_DESKTOP
|
|
||||||
#define TRIBUFU_DESKTOP
|
|
||||||
#endif
|
|
@ -1,8 +1,7 @@
|
|||||||
--- @diagnostic disable: undefined-global
|
--- @diagnostic disable: undefined-global
|
||||||
|
|
||||||
workspace "tribufu_cpp"
|
workspace "tribufu"
|
||||||
location "."
|
location "."
|
||||||
|
|
||||||
configurations { "debug", "release" }
|
configurations { "debug", "release" }
|
||||||
|
|
||||||
if _ACTION == "vs2022" then
|
if _ACTION == "vs2022" then
|
||||||
|
3
scripts/cbindgen.ps1
Normal file
3
scripts/cbindgen.ps1
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
cbindgen --config ./config/cbindgen.toml --crate tribufu-native --output ./include/tribufu/native.h
|
@ -1,10 +1,11 @@
|
|||||||
#!/usr/bin/env pwsh
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
# Windows (x86_64)
|
echo "Building for windows-x86_64"
|
||||||
|
cargo build --package tribufu-native --target x86_64-pc-windows-msvc
|
||||||
|
New-Item "bin/windows/x86_64" -ItemType Directory -Force
|
||||||
|
Remove-Item -Path "bin/windows/x86_64/*" -Force
|
||||||
|
Copy-Item -Path "target/x86_64-pc-windows-msvc/debug/deps/mintaka_native.dll" -Destination "bin/windows/x86_64" -Force
|
||||||
|
Copy-Item -Path "target/x86_64-pc-windows-msvc/debug/deps/mintaka_native.dll.lib" -Destination "bin/windows/x86_64" -Force
|
||||||
|
Copy-Item -Path "target/x86_64-pc-windows-msvc/debug/deps/mintaka_native.lib" -Destination "bin/windows/x86_64" -Force
|
||||||
|
Copy-Item -Path "target/x86_64-pc-windows-msvc/debug/tribufu_native.lib" -Destination "bin/windows/x86_64" -Force
|
||||||
msbuild /p:Configuration="debug" /p:Platform="windows-x86_64"
|
msbuild /p:Configuration="debug" /p:Platform="windows-x86_64"
|
||||||
|
|
||||||
# Windows (i686)
|
|
||||||
msbuild /p:Configuration="debug" /p:Platform="windows-i686"
|
|
||||||
|
|
||||||
# Windows (aarch64)
|
|
||||||
msbuild /p:Configuration="debug" /p:Platform="windows-aarch64"
|
|
||||||
|
3
scripts/premake.bat
Normal file
3
scripts/premake.bat
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
call .\vendor\premake\windows\premake5.exe vs2022
|
10
scripts/premake.sh
Normal file
10
scripts/premake.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
if [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]
|
||||||
|
then
|
||||||
|
./vendor/premake/linux/premake5 gmake2
|
||||||
|
|
||||||
|
elif [ "$(uname)" = "Darwin" ]
|
||||||
|
then
|
||||||
|
./vendor/premake/mac/premake5 xcode4
|
||||||
|
fi
|
@ -8,9 +8,33 @@ namespace tribufu
|
|||||||
{
|
{
|
||||||
this->id = id;
|
this->id = id;
|
||||||
this->secret = secret;
|
this->secret = secret;
|
||||||
|
this->http = HttpClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
TribufuClient::~TribufuClient()
|
TribufuClient::~TribufuClient()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TribufuClient::get_token()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::string url = "https://api.tribufu.com/v1/servers";
|
||||||
|
FHttpResponse response = this->http.get(url);
|
||||||
|
std::cout << "status_code: " << response.status_code << std::endl;
|
||||||
|
|
||||||
|
if (response.body != nullptr)
|
||||||
|
{
|
||||||
|
json response_body = json::parse(response.body);
|
||||||
|
std::string json_str = response_body.dump(4);
|
||||||
|
std::cout << json_str << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
mintaka_http_free_response(response);
|
||||||
|
}
|
||||||
|
catch (std::exception &e)
|
||||||
|
{
|
||||||
|
std::cout << "exception: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
1
src/lib.rs
Normal file
1
src/lib.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
92
src/oauth2.cpp
Normal file
92
src/oauth2.cpp
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#include <tribufu/oauth2.h>
|
||||||
|
|
||||||
|
namespace tribufu
|
||||||
|
{
|
||||||
|
OAuth2AuthorizeRequest::OAuth2AuthorizeRequest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2AuthorizeRequest::OAuth2AuthorizeRequest(OAuth2ResponseType response_type, uint64_t client_id, const std::string &client_secret, const std::string &redirect_uri, const std::string &scope, const std::string &state)
|
||||||
|
{
|
||||||
|
this->response_type = response_type;
|
||||||
|
this->client_id = client_id;
|
||||||
|
this->client_secret = client_secret;
|
||||||
|
this->redirect_uri = redirect_uri;
|
||||||
|
this->scope = scope;
|
||||||
|
this->state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2AuthorizeRequest::~OAuth2AuthorizeRequest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2CodeResponse::OAuth2CodeResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2CodeResponse::OAuth2CodeResponse(const std::string &code, const std::string &state)
|
||||||
|
{
|
||||||
|
this->code = code;
|
||||||
|
this->state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2CodeResponse::~OAuth2CodeResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2ErrorResponse::OAuth2ErrorResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2ErrorResponse::OAuth2ErrorResponse(OAuth2AuthorizeError error, const std::string &error_description, const std::string &error_uri, const std::string &state)
|
||||||
|
{
|
||||||
|
this->error = error;
|
||||||
|
this->error_description = error_description;
|
||||||
|
this->error_uri = error_uri;
|
||||||
|
this->state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2ErrorResponse::~OAuth2ErrorResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2TokenRequest::OAuth2TokenRequest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2TokenRequest::OAuth2TokenRequest(OAuth2GrantType grant_type, uint64_t client_id, const std::string &client_secret, const std::string &redirect_uri, const std::string &code, const std::string &refresh_token, const std::string &username, const std::string &password)
|
||||||
|
{
|
||||||
|
this->grant_type = grant_type;
|
||||||
|
this->client_id = client_id;
|
||||||
|
this->client_secret = client_secret;
|
||||||
|
this->redirect_uri = redirect_uri;
|
||||||
|
this->code = code;
|
||||||
|
this->refresh_token = refresh_token;
|
||||||
|
this->username = username;
|
||||||
|
this->password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2TokenRequest::~OAuth2TokenRequest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2TokenResponse::OAuth2TokenResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2TokenResponse::OAuth2TokenResponse(OAuth2TokenType token_type, const std::string &access_token, const std::string &refresh_token, const std::string &scope, const std::string &state, uint64_t expires_in)
|
||||||
|
{
|
||||||
|
this->token_type = token_type;
|
||||||
|
this->access_token = access_token;
|
||||||
|
this->refresh_token = refresh_token;
|
||||||
|
this->scope = scope;
|
||||||
|
this->state = state;
|
||||||
|
this->expires_in = expires_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
OAuth2TokenResponse::~OAuth2TokenResponse()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -25,12 +25,13 @@ project "tribufu_cpp"
|
|||||||
includedirs
|
includedirs
|
||||||
{
|
{
|
||||||
"../include",
|
"../include",
|
||||||
"../vendor",
|
"../vendor/*/include",
|
||||||
}
|
}
|
||||||
|
|
||||||
libdirs
|
libdirs
|
||||||
{
|
{
|
||||||
"../bin/%{cfg.platform:gsub('-', '/')}",
|
"../bin/%{cfg.platform:gsub('-', '/')}",
|
||||||
|
"../vendor/*/lib/%{cfg.platform:gsub('-', '/')}",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Profile
|
-- Profile
|
||||||
@ -77,12 +78,19 @@ project "tribufu_cpp"
|
|||||||
|
|
||||||
links
|
links
|
||||||
{
|
{
|
||||||
|
"tribufu_native.lib",
|
||||||
|
"mintaka_native.dll.lib",
|
||||||
}
|
}
|
||||||
|
|
||||||
prelinkcommands
|
prelinkcommands
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
"{COPYFILE} ../target/%{cfg.buildcfg}/deps/mintaka_native.dll %{cfg.targetdir}/mintaka_native.dll",
|
||||||
|
}
|
||||||
|
|
||||||
filter { "platforms:mac-*" }
|
filter { "platforms:mac-*" }
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
system "macosx"
|
system "macosx"
|
||||||
@ -101,12 +109,18 @@ project "tribufu_cpp"
|
|||||||
|
|
||||||
links
|
links
|
||||||
{
|
{
|
||||||
|
"tribufu_native",
|
||||||
|
"mintaka_native",
|
||||||
}
|
}
|
||||||
|
|
||||||
prelinkcommands
|
prelinkcommands
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
filter { "platforms:linux-*" }
|
filter { "platforms:linux-*" }
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
system "linux"
|
system "linux"
|
||||||
@ -124,12 +138,18 @@ project "tribufu_cpp"
|
|||||||
|
|
||||||
links
|
links
|
||||||
{
|
{
|
||||||
|
"tribufu_native",
|
||||||
|
"mintaka_native",
|
||||||
}
|
}
|
||||||
|
|
||||||
prelinkcommands
|
prelinkcommands
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
filter { "platforms:android-*" }
|
filter { "platforms:android-*" }
|
||||||
kind "SharedLib"
|
kind "SharedLib"
|
||||||
system "android"
|
system "android"
|
||||||
@ -147,12 +167,18 @@ project "tribufu_cpp"
|
|||||||
|
|
||||||
links
|
links
|
||||||
{
|
{
|
||||||
|
"tribufu_native",
|
||||||
|
"mintaka_native",
|
||||||
}
|
}
|
||||||
|
|
||||||
prelinkcommands
|
prelinkcommands
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
filter { "platforms:ios-*" }
|
filter { "platforms:ios-*" }
|
||||||
kind "StaticLib"
|
kind "StaticLib"
|
||||||
system "ios"
|
system "ios"
|
||||||
@ -170,6 +196,16 @@ project "tribufu_cpp"
|
|||||||
}
|
}
|
||||||
|
|
||||||
links
|
links
|
||||||
|
{
|
||||||
|
"tribufu_native",
|
||||||
|
"mintaka_native",
|
||||||
|
}
|
||||||
|
|
||||||
|
prelinkcommands
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
postbuildcommands
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
38
src/servers/server.cpp
Normal file
38
src/servers/server.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#include <tribufu/servers/server.h>
|
||||||
|
|
||||||
|
namespace tribufu
|
||||||
|
{
|
||||||
|
Server::Server()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Server::Server(json data)
|
||||||
|
{
|
||||||
|
this->id = data["id"];
|
||||||
|
this->name = data["name"];
|
||||||
|
this->description = data["description"];
|
||||||
|
this->address = data["address"];
|
||||||
|
this->game_port = data["game_port"];
|
||||||
|
this->query_port = data["query_port"];
|
||||||
|
this->package_id = data["package_id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
Server::~Server()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
json Server::to_json()
|
||||||
|
{
|
||||||
|
json data;
|
||||||
|
data["id"] = this->id;
|
||||||
|
data["name"] = this->name;
|
||||||
|
data["description"] = this->description;
|
||||||
|
data["address"] = this->address;
|
||||||
|
data["game_port"] = this->game_port;
|
||||||
|
data["query_port"] = this->query_port;
|
||||||
|
data["package_id"] = this->package_id;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
62
src/users/profile.cpp
Normal file
62
src/users/profile.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// Copyright (c) Tribufu. All Rights Reserved.
|
||||||
|
|
||||||
|
#include <tribufu/users/profile.h>
|
||||||
|
|
||||||
|
namespace tribufu
|
||||||
|
{
|
||||||
|
Profile::Profile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Profile::Profile(json data)
|
||||||
|
{
|
||||||
|
this->id = data["id"];
|
||||||
|
this->uuid = data["uuid"];
|
||||||
|
this->name = data["name"];
|
||||||
|
this->display_name = data["display_name"];
|
||||||
|
this->type = data["type"];
|
||||||
|
this->public_flags = data["public_flags"];
|
||||||
|
this->verified = data["verified"];
|
||||||
|
this->level = data["level"];
|
||||||
|
this->experience = data["experience"];
|
||||||
|
this->public_birthday = data["public_birthday"];
|
||||||
|
this->points = data["points"];
|
||||||
|
this->location = data["location"];
|
||||||
|
this->photo_url = data["photo_url"];
|
||||||
|
this->banner_url = data["banner_url"];
|
||||||
|
this->last_online = data["last_online"];
|
||||||
|
this->biography = data["biography"];
|
||||||
|
this->view_count = data["view_count"];
|
||||||
|
this->created = data["created"];
|
||||||
|
this->updated = data["updated"];
|
||||||
|
}
|
||||||
|
|
||||||
|
Profile::~Profile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
json Profile::to_json()
|
||||||
|
{
|
||||||
|
json data;
|
||||||
|
data["id"] = this->id;
|
||||||
|
data["uuid"] = this->uuid;
|
||||||
|
data["name"] = this->name;
|
||||||
|
data["display_name"] = this->display_name;
|
||||||
|
data["type"] = this->type;
|
||||||
|
data["public_flags"] = this->public_flags;
|
||||||
|
data["verified"] = this->verified;
|
||||||
|
data["level"] = this->level;
|
||||||
|
data["experience"] = this->experience;
|
||||||
|
data["public_birthday"] = this->public_birthday;
|
||||||
|
data["points"] = this->points;
|
||||||
|
data["location"] = this->location;
|
||||||
|
data["photo_url"] = this->photo_url;
|
||||||
|
data["banner_url"] = this->banner_url;
|
||||||
|
data["last_online"] = this->last_online;
|
||||||
|
data["biography"] = this->biography;
|
||||||
|
data["view_count"] = this->view_count;
|
||||||
|
data["created"] = this->created;
|
||||||
|
data["updated"] = this->updated;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
0
vendor/.gitkeep
vendored
0
vendor/.gitkeep
vendored
1
vendor/Mintaka
vendored
Submodule
1
vendor/Mintaka
vendored
Submodule
Submodule vendor/Mintaka added at ea2230d1e3
9258
vendor/cpp-httplib/httplib.h
vendored
9258
vendor/cpp-httplib/httplib.h
vendored
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2017 yhirose
|
Copyright (c) 2013-2022 Niels Lohmann
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
24765
vendor/nlohmann/include/nlohmann/json.hpp
vendored
Normal file
24765
vendor/nlohmann/include/nlohmann/json.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user