Initial version

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2023-09-15 11:18:54 +02:00
commit bcd2fd127a
15 changed files with 3414 additions and 0 deletions

39
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,39 @@
# This is a basic workflow to help you get started with Actions
name: Doxygen Action
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Doxygen Action
uses: mattnotmitt/doxygen-action@v1.1.0
with:
# Path to Doxyfile
doxyfile-path: "./Doxyfile" # default is ./Doxyfile
# Working directory
working-directory: "." # default is .
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Default Doxyfile build documentation to html directory.
# Change the directory if changes in Doxyfile
publish_dir: ./doc/html

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
xcuserdata/

2664
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

10
LICENSE Normal file
View File

@ -0,0 +1,10 @@
The MIT License (MIT)
Copyright © 1991-2023 Amebis
Copyright © 2016 GÉANT
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,412 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 55;
objects = {
/* Begin PBXBuildFile section */
F4AE3B802AB440A000464926 /* dyld.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F4AE3B7E2AB440A000464926 /* dyld.hpp */; };
F4AE3B812AB440A000464926 /* common.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F4AE3B7F2AB440A000464926 /* common.hpp */; };
F4AE3BA22AB44AC500464926 /* Tests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4AE3BA12AB44AC400464926 /* Tests.mm */; };
F4AE3BA32AB44AC500464926 /* libMacStd.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F4AE3B732AB43EB600464926 /* libMacStd.a */; platformFilters = (macos, ); };
F4AE3BD02AB4561A00464926 /* pch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4AE3BCE2AB4561A00464926 /* pch.cpp */; };
F4AE3BD12AB4561A00464926 /* pch.hpp in Headers */ = {isa = PBXBuildFile; fileRef = F4AE3BCF2AB4561A00464926 /* pch.hpp */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
F4AE3BA42AB44AC500464926 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F4AE3B6B2AB43EB600464926 /* Project object */;
proxyType = 1;
remoteGlobalIDString = F4AE3B722AB43EB600464926;
remoteInfo = MacStd;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
F4AE3B732AB43EB600464926 /* libMacStd.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMacStd.a; sourceTree = BUILT_PRODUCTS_DIR; };
F4AE3B7E2AB440A000464926 /* dyld.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = dyld.hpp; path = include/MacStd/dyld.hpp; sourceTree = "<group>"; };
F4AE3B7F2AB440A000464926 /* common.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = common.hpp; path = include/MacStd/common.hpp; sourceTree = "<group>"; };
F4AE3B9F2AB44AC400464926 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
F4AE3BA12AB44AC400464926 /* Tests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = Tests.mm; sourceTree = "<group>"; };
F4AE3BCE2AB4561A00464926 /* pch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pch.cpp; path = src/pch.cpp; sourceTree = "<group>"; };
F4AE3BCF2AB4561A00464926 /* pch.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pch.hpp; path = src/pch.hpp; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
F4AE3B712AB43EB600464926 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
F4AE3B9C2AB44AC400464926 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F4AE3BA32AB44AC500464926 /* libMacStd.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
F4AE3B6A2AB43EB600464926 = {
isa = PBXGroup;
children = (
F4AE3B7F2AB440A000464926 /* common.hpp */,
F4AE3B7E2AB440A000464926 /* dyld.hpp */,
F4AE3BCE2AB4561A00464926 /* pch.cpp */,
F4AE3BCF2AB4561A00464926 /* pch.hpp */,
F4AE3B742AB43EB600464926 /* Products */,
F4AE3BA02AB44AC400464926 /* Tests */,
);
sourceTree = "<group>";
};
F4AE3B742AB43EB600464926 /* Products */ = {
isa = PBXGroup;
children = (
F4AE3B732AB43EB600464926 /* libMacStd.a */,
F4AE3B9F2AB44AC400464926 /* Tests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
F4AE3BA02AB44AC400464926 /* Tests */ = {
isa = PBXGroup;
children = (
F4AE3BA12AB44AC400464926 /* Tests.mm */,
);
path = Tests;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
F4AE3B6F2AB43EB600464926 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
F4AE3BD12AB4561A00464926 /* pch.hpp in Headers */,
F4AE3B802AB440A000464926 /* dyld.hpp in Headers */,
F4AE3B812AB440A000464926 /* common.hpp in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
F4AE3B722AB43EB600464926 /* MacStd */ = {
isa = PBXNativeTarget;
buildConfigurationList = F4AE3B772AB43EB600464926 /* Build configuration list for PBXNativeTarget "MacStd" */;
buildPhases = (
F4AE3B6F2AB43EB600464926 /* Headers */,
F4AE3B702AB43EB600464926 /* Sources */,
F4AE3B712AB43EB600464926 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = MacStd;
productName = MacStd;
productReference = F4AE3B732AB43EB600464926 /* libMacStd.a */;
productType = "com.apple.product-type.library.static";
};
F4AE3B9E2AB44AC400464926 /* Tests */ = {
isa = PBXNativeTarget;
buildConfigurationList = F4AE3BA62AB44AC500464926 /* Build configuration list for PBXNativeTarget "Tests" */;
buildPhases = (
F4AE3B9B2AB44AC400464926 /* Sources */,
F4AE3B9C2AB44AC400464926 /* Frameworks */,
F4AE3B9D2AB44AC400464926 /* Resources */,
);
buildRules = (
);
dependencies = (
F4AE3BA52AB44AC500464926 /* PBXTargetDependency */,
);
name = Tests;
productName = Tests;
productReference = F4AE3B9F2AB44AC400464926 /* Tests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
F4AE3B6B2AB43EB600464926 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1430;
TargetAttributes = {
F4AE3B722AB43EB600464926 = {
CreatedOnToolsVersion = 14.3.1;
};
F4AE3B9E2AB44AC400464926 = {
CreatedOnToolsVersion = 14.3.1;
};
};
};
buildConfigurationList = F4AE3B6E2AB43EB600464926 /* Build configuration list for PBXProject "MacStd" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = F4AE3B6A2AB43EB600464926;
productRefGroup = F4AE3B742AB43EB600464926 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
F4AE3B722AB43EB600464926 /* MacStd */,
F4AE3B9E2AB44AC400464926 /* Tests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
F4AE3B9D2AB44AC400464926 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
F4AE3B702AB43EB600464926 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F4AE3BD02AB4561A00464926 /* pch.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F4AE3B9B2AB44AC400464926 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F4AE3BA22AB44AC500464926 /* Tests.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
F4AE3BA52AB44AC500464926 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
platformFilters = (
macos,
);
target = F4AE3B722AB43EB600464926 /* MacStd */;
targetProxy = F4AE3BA42AB44AC500464926 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
F4AE3B752AB43EB600464926 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
F4AE3B762AB43EB600464926 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
};
name = Release;
};
F4AE3B782AB43EB600464926 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
EXECUTABLE_PREFIX = lib;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
F4AE3B792AB43EB600464926 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
EXECUTABLE_PREFIX = lib;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
F4AE3BA72AB44AC500464926 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MACOSX_DEPLOYMENT_TARGET = 13.3;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = si.amebis.MacStd.Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
F4AE3BA82AB44AC500464926 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
MACOSX_DEPLOYMENT_TARGET = 13.3;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = si.amebis.MacStd.Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
F4AE3B6E2AB43EB600464926 /* Build configuration list for PBXProject "MacStd" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F4AE3B752AB43EB600464926 /* Debug */,
F4AE3B762AB43EB600464926 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F4AE3B772AB43EB600464926 /* Build configuration list for PBXNativeTarget "MacStd" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F4AE3B782AB43EB600464926 /* Debug */,
F4AE3B792AB43EB600464926 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F4AE3BA62AB44AC500464926 /* Build configuration list for PBXNativeTarget "Tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F4AE3BA72AB44AC500464926 /* Debug */,
F4AE3BA82AB44AC500464926 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = F4AE3B6B2AB43EB600464926 /* Project object */;
}

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F4AE3B722AB43EB600464926"
BuildableName = "libMacStd.a"
BlueprintName = "MacStd"
ReferencedContainer = "container:MacStd.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F4AE3B722AB43EB600464926"
BuildableName = "libMacStd.a"
BlueprintName = "MacStd"
ReferencedContainer = "container:MacStd.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F4AE3B9E2AB44AC400464926"
BuildableName = "Tests.xctest"
BlueprintName = "Tests"
ReferencedContainer = "container:MacStd.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:MacStd.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

53
README.md Normal file
View File

@ -0,0 +1,53 @@
# MacStd
Provides templates and function helpers for OS X API using Standard C++ in XCode 13+
## Features
### Portable
This project does not require building. Just `#include` individual files from this repository into your source code and get started.
### Functions and Templates
Different OS X API functions have different ways of returning variable-sized data. Getting tired of carefully studying manpages for each particular API function how to preallocate the output memory correctly? We too...
MacStd provides a subset of OS X API identically named functions (C++ polymorphism to the rescue), where one can use `std::string`, `std::wstring`, `std::vector<>` etc. as an output parameter. MacStd handles all the dirty work with memory allocation for you, so you can focus on your code.
#### Example
```C++
std::string path;
_NSGetExecutablePath(path);
std::cout << path.c_str() << std::endl;
```
## What MacStd Is Not
MacStd is not trying to be a full-fledged object-oriented framework on top of OS X API. MacStd aims at augmenting OS X API with a little bit of help from C++.
## Usage
1. Clone the repository into your solution folder.
2. Add MacStd's `include` folder to _Header Search Paths_ in your project's C/C++ settings.
3. Include `.h` files from MacStd as needed:
```C++
#include <MacStd/dyld.hpp>
#include <string>
#include <iostream>
using namespace std;
void main()
{
wstring path;
_NSGetExecutablePath(path);
wcout << path.c_str() << endl;
}
```
An auto-generated documentation is [here](https://amebis.github.io/MacStd/).
More examples can also be found in the `Tests` project.
This is a one-man project for the time being, so the OS X API support is far from complete. It is added as needed. Contributions are welcome.

34
Tests/Tests.mm Normal file
View File

@ -0,0 +1,34 @@
/*
SPDX-License-Identifier: MIT
Copyright © 2023 Amebis
*/
#import <XCTest/XCTest.h>
#include "../include/MacStd/dyld.hpp"
@interface Tests : XCTestCase
@end
@implementation Tests
- (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
- (void)test_NSGetExecutablePath {
std::string path;
XCTAssert(_NSGetExecutablePath(path) == 0);
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end

17
include/MacStd/common.hpp Normal file
View File

@ -0,0 +1,17 @@
/*
SPDX-License-Identifier: MIT
Copyright © 2023 Amebis
*/
#pragma once
#include <stddef.h>
///
/// Size of the stack buffer in bytes used for initial system function call
///
/// Some system functions with variable length output data fail for insufficient buffer sizes. The function helpers use a fixed size stack buffer first. If the stack buffer really prooved sufficient, the helper allocates the exact length output on heap and copies the data without calling the system function again. Otherwise it allocates the memory on heap and retries.
///
/// \note Decrease this value in case of stack overflow.
///
#define MACSTD_STACK_BUFFER_BYTES 1024

35
include/MacStd/dyld.hpp Normal file
View File

@ -0,0 +1,35 @@
/*
SPDX-License-Identifier: MIT
Copyright © 2023 Amebis
*/
#pragma once
#include "common.hpp"
#include <mach-o/dyld.h>
#include <string>
///
/// Copies the path of the main executable into the string path.
///
/// \sa [_NSGetExecutablePath function](https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/dyld.3.html)
///
inline int _NSGetExecutablePath(std::string& path)
{
char stack_buffer[MACSTD_STACK_BUFFER_BYTES];
uint32_t capacity = MACSTD_STACK_BUFFER_BYTES;
int result = _NSGetExecutablePath(stack_buffer, &capacity);
if (result == 0) {
path = stack_buffer;
return 0;
}
if (result == -1) {
std::unique_ptr<char[]> heap_buffer(new char[capacity]);
result = _NSGetExecutablePath(heap_buffer.get(), &capacity);
if (result == 0) {
path = heap_buffer.get();
return 0;
}
}
return result;
}

6
src/pch.cpp Normal file
View File

@ -0,0 +1,6 @@
/*
SPDX-License-Identifier: MIT
Copyright © 2023 Amebis
*/
#include "pch.hpp"

8
src/pch.hpp Normal file
View File

@ -0,0 +1,8 @@
/*
SPDX-License-Identifier: MIT
Copyright © 2023 Amebis
*/
#pragma once
#include "../include/MacStd/dyld.hpp"