spb/forge Public MIT
Forge — LLM training from scratch in pure C++20 + Metal on Apple Silicon.
C++ 61.2%
C 23%
Python 7.6%
TeX 7.2%
CMake 1.1%
1//-------------------------------------------------------------------------------------------------------------------------------------------------------------2//3// Foundation/NSURL.hpp4//5// Copyright 2020-2024 Apple Inc.6//7// Licensed under the Apache License, Version 2.0 (the "License");8// you may not use this file except in compliance with the License.9// You may obtain a copy of the License at10//11// http://www.apache.org/licenses/LICENSE-2.012//13// Unless required by applicable law or agreed to in writing, software14// distributed under the License is distributed on an "AS IS" BASIS,15// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.16// See the License for the specific language governing permissions and17// limitations under the License.18//19//-------------------------------------------------------------------------------------------------------------------------------------------------------------2021#pragma once2223//-------------------------------------------------------------------------------------------------------------------------------------------------------------2425#include "NSDefines.hpp"26#include "NSObject.hpp"27#include "NSPrivate.hpp"28#include "NSTypes.hpp"2930//-------------------------------------------------------------------------------------------------------------------------------------------------------------3132namespace NS33{34class URL : public Copying<URL>35{36public:37 static URL* fileURLWithPath(const class String* pPath);3839 static URL* alloc();40 URL* init();41 URL* init(const class String* pString);42 URL* initFileURLWithPath(const class String* pPath);4344 const char* fileSystemRepresentation() const;45};46}4748//-------------------------------------------------------------------------------------------------------------------------------------------------------------4950_NS_INLINE NS::URL* NS::URL::fileURLWithPath(const String* pPath)51{52 return Object::sendMessage<URL*>(_NS_PRIVATE_CLS(NSURL), _NS_PRIVATE_SEL(fileURLWithPath_), pPath);53}5455//-------------------------------------------------------------------------------------------------------------------------------------------------------------5657_NS_INLINE NS::URL* NS::URL::alloc()58{59 return Object::alloc<URL>(_NS_PRIVATE_CLS(NSURL));60}6162//-------------------------------------------------------------------------------------------------------------------------------------------------------------6364_NS_INLINE NS::URL* NS::URL::init()65{66 return Object::init<URL>();67}6869//-------------------------------------------------------------------------------------------------------------------------------------------------------------7071_NS_INLINE NS::URL* NS::URL::init(const String* pString)72{73 return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(initWithString_), pString);74}7576//-------------------------------------------------------------------------------------------------------------------------------------------------------------7778_NS_INLINE NS::URL* NS::URL::initFileURLWithPath(const String* pPath)79{80 return Object::sendMessage<URL*>(this, _NS_PRIVATE_SEL(initFileURLWithPath_), pPath);81}8283//-------------------------------------------------------------------------------------------------------------------------------------------------------------8485_NS_INLINE const char* NS::URL::fileSystemRepresentation() const86{87 return Object::sendMessage<const char*>(this, _NS_PRIVATE_SEL(fileSystemRepresentation));88}8990//-------------------------------------------------------------------------------------------------------------------------------------------------------------91