Metal-CPP: extend NS:Data* & NS::Bundle* methods

Add:
NS::String* NS::Bundle::pathForResource(const class String* pName, const class String* pExt) const;
NS::Data *NS::Data::dataWithContentsOfFile(const String* path);
const void* NS::Data::bytes() const;
This commit is contained in:
Jake Turner
2023-04-12 10:50:09 +01:00
committed by Baldur Karlsson
parent 946c6fef11
commit 57f9ac6fed
+29 -2
View File
@@ -90,6 +90,7 @@ namespace Private
_NS_PRIVATE_DEF_CLS(NSAutoreleasePool);
_NS_PRIVATE_DEF_CLS(NSBundle);
_NS_PRIVATE_DEF_CLS(NSCondition);
_NS_PRIVATE_DEF_CLS(NSData);
_NS_PRIVATE_DEF_CLS(NSDate);
_NS_PRIVATE_DEF_CLS(NSDictionary);
_NS_PRIVATE_DEF_CLS(NSError);
@@ -172,6 +173,8 @@ namespace Private
"bundleWithPath:");
_NS_PRIVATE_DEF_SEL(bundleWithURL_,
"bundleWithURL:");
_NS_PRIVATE_DEF_SEL(bytes,
"bytes");
_NS_PRIVATE_DEF_SEL(caseInsensitiveCompare_,
"caseInsensitiveCompare:");
_NS_PRIVATE_DEF_SEL(characterAtIndex_,
@@ -192,6 +195,8 @@ namespace Private
"count");
_NS_PRIVATE_DEF_SEL(dateWithTimeIntervalSinceNow_,
"dateWithTimeIntervalSinceNow:");
_NS_PRIVATE_DEF_SEL(dataWithContentsOfFile_,
"dataWithContentsOfFile:");
_NS_PRIVATE_DEF_SEL(defaultCenter,
"defaultCenter");
_NS_PRIVATE_DEF_SEL(descriptionWithLocale_,
@@ -200,6 +205,8 @@ namespace Private
"disableAutomaticTermination:");
_NS_PRIVATE_DEF_SEL(disableSuddenTermination,
"disableSuddenTermination");
_NS_PRIVATE_DEF_SEL(distantPast,
"distantPast");
_NS_PRIVATE_DEF_SEL(debugDescription,
"debugDescription");
_NS_PRIVATE_DEF_SEL(description,
@@ -406,6 +413,8 @@ namespace Private
"operatingSystemVersionString");
_NS_PRIVATE_DEF_SEL(pathForAuxiliaryExecutable_,
"pathForAuxiliaryExecutable:");
_NS_PRIVATE_DEF_SEL(pathForResource_ofType_,
"pathForResource:ofType:");
_NS_PRIVATE_DEF_SEL(performActivityWithOptions_reason_usingBlock_,
"performActivityWithOptions:reason:usingBlock:");
_NS_PRIVATE_DEF_SEL(performExpiringActivityWithReason_usingBlock_,
@@ -1344,6 +1353,7 @@ public:
class String* resourcePath() const;
class String* executablePath() const;
class String* pathForAuxiliaryExecutable(const class String* pExecutableName) const;
class String* pathForResource(const class String* pName, const class String* pExt) const;
class String* privateFrameworksPath() const;
class String* sharedFrameworksPath() const;
@@ -1512,6 +1522,11 @@ _NS_INLINE NS::String* NS::Bundle::pathForAuxiliaryExecutable(const String* pExe
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(pathForAuxiliaryExecutable_), pExecutableName);
}
_NS_INLINE NS::String* NS::Bundle::pathForResource(const class String* pName, const class String* pExt) const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(pathForResource_ofType_), pName, pExt);
}
_NS_INLINE NS::String* NS::Bundle::privateFrameworksPath() const
{
return Object::sendMessage<String*>(this, _NS_PRIVATE_SEL(privateFrameworksPath));
@@ -1562,11 +1577,18 @@ namespace NS
class Data : public Copying<Data>
{
public:
void* mutableBytes() const;
UInteger length() const;
static NS::Data* dataWithContentsOfFile(const String* path);
void* mutableBytes() const;
const void* bytes() const;
UInteger length() const;
};
}
_NS_INLINE NS::Data* NS::Data::dataWithContentsOfFile(const String* path)
{
return Object::sendMessage<NS::Data*>(_NS_PRIVATE_CLS(NSData), _NS_PRIVATE_SEL(dataWithContentsOfFile_), path);
}
_NS_INLINE void* NS::Data::mutableBytes() const
{
return Object::sendMessage<void*>(this, _NS_PRIVATE_SEL(mutableBytes));
@@ -1577,6 +1599,11 @@ _NS_INLINE NS::UInteger NS::Data::length() const
return Object::sendMessage<UInteger>(this, _NS_PRIVATE_SEL(length));
}
_NS_INLINE const void* NS::Data::bytes() const
{
return Object::sendMessage<const void*>(this, _NS_PRIVATE_SEL(bytes));
}
namespace NS
{