mirror of
https://github.com/tribufu/sdk-cpp
synced 2025-06-15 12:24:18 +00:00
Fork alnilam headers
This commit is contained in:
@ -2,11 +2,13 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <tribufu/sdk.h>
|
||||
#include <tribufu/client.h>
|
||||
|
||||
using namespace tribufu;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
auto client = TribufuClient(0, "client_secret");
|
||||
std::cout << "client_id: " << client.get_id() << std::endl;
|
||||
auto client = new TribufuClient(0, "client_secret");
|
||||
std::cout << "client_id: " << client->get_id() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
@ -2,4 +2,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/sdk.h>
|
||||
#include <tribufu/client.h>
|
||||
|
13
include/tribufu/android/android_platform.h
Normal file
13
include/tribufu/android/android_platform.h
Normal file
@ -0,0 +1,13 @@
|
||||
// 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
|
10
include/tribufu/apple/apple_platform.h
Normal file
10
include/tribufu/apple/apple_platform.h
Normal file
@ -0,0 +1,10 @@
|
||||
// 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")))
|
7
include/tribufu/base.h
Normal file
7
include/tribufu/base.h
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/defines.h>
|
||||
#include <tribufu/platform.h>
|
||||
#include <tribufu/std.h>
|
@ -2,25 +2,25 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/pch.h>
|
||||
#include <tribufu/base.h>
|
||||
|
||||
const char *VERSION = "0.0.4";
|
||||
|
||||
class TribufuClient
|
||||
namespace tribufu
|
||||
{
|
||||
private:
|
||||
uint64_t id;
|
||||
std::string secret;
|
||||
|
||||
public:
|
||||
TribufuClient(uint64_t id, const std::string &secret)
|
||||
class TRIBUFU_API TribufuClient
|
||||
{
|
||||
this->id = id;
|
||||
this->secret = secret;
|
||||
}
|
||||
private:
|
||||
uint64_t id;
|
||||
std::string secret;
|
||||
|
||||
uint64_t get_id() const
|
||||
{
|
||||
return this->id;
|
||||
}
|
||||
};
|
||||
public:
|
||||
TribufuClient(uint64_t id, const std::string &secret);
|
||||
~TribufuClient();
|
||||
|
||||
uint64_t get_id() const
|
||||
{
|
||||
return this->id;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
61
include/tribufu/defines.h
Normal file
61
include/tribufu/defines.h
Normal file
@ -0,0 +1,61 @@
|
||||
// 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
|
13
include/tribufu/freebsd/freebsd_platform.h
Normal file
13
include/tribufu/freebsd/freebsd_platform.h
Normal file
@ -0,0 +1,13 @@
|
||||
// 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
|
13
include/tribufu/ios/ios_platform.h
Normal file
13
include/tribufu/ios/ios_platform.h
Normal file
@ -0,0 +1,13 @@
|
||||
// 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
|
13
include/tribufu/linux/linux_platform.h
Normal file
13
include/tribufu/linux/linux_platform.h
Normal file
@ -0,0 +1,13 @@
|
||||
// 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
|
13
include/tribufu/mac/mac_platform.h
Normal file
13
include/tribufu/mac/mac_platform.h
Normal file
@ -0,0 +1,13 @@
|
||||
// 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
|
14
include/tribufu/msvc/msvc_platform.h
Normal file
14
include/tribufu/msvc/msvc_platform.h
Normal file
@ -0,0 +1,14 @@
|
||||
// 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)
|
@ -1,12 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#else
|
||||
#error "C++ compiler required."
|
||||
#endif
|
30
include/tribufu/platform.h
Normal file
30
include/tribufu/platform.h
Normal file
@ -0,0 +1,30 @@
|
||||
// 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
|
@ -1,5 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/client.h>
|
24
include/tribufu/std.h
Normal file
24
include/tribufu/std.h
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef TRIBUFU_CPP
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#endif
|
10
include/tribufu/unix/unix_platform.h
Normal file
10
include/tribufu/unix/unix_platform.h
Normal file
@ -0,0 +1,10 @@
|
||||
// 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")))
|
9
include/tribufu/uwp/uwp_platform.h
Normal file
9
include/tribufu/uwp/uwp_platform.h
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tribufu/msvc/msvc_platform.h>
|
||||
|
||||
#ifndef TRIBUFU_UWP
|
||||
#define TRIBUFU_UWP
|
||||
#endif
|
13
include/tribufu/windows/windows_platform.h
Normal file
13
include/tribufu/windows/windows_platform.h
Normal file
@ -0,0 +1,13 @@
|
||||
// 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,3 +1,16 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/client.h>
|
||||
|
||||
namespace tribufu
|
||||
{
|
||||
TribufuClient::TribufuClient(uint64_t id, const std::string &secret)
|
||||
{
|
||||
this->id = id;
|
||||
this->secret = secret;
|
||||
}
|
||||
|
||||
TribufuClient::~TribufuClient()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +0,0 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
|
||||
#include <tribufu/pch.h>
|
@ -9,9 +9,6 @@ project "tribufu_cpp"
|
||||
targetdir("../bin/%{cfg.platform:gsub('-', '/')}")
|
||||
objdir("../target/%{cfg.buildcfg}/obj/%{prj.name}/%{cfg.platform:gsub('-', '/')}")
|
||||
|
||||
-- pchheader "tribufu/pch.h"
|
||||
-- pchsource "pch.cpp"
|
||||
|
||||
files
|
||||
{
|
||||
"./**.cpp",
|
||||
|
Reference in New Issue
Block a user