/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#pragma once
#include
#include "ncm_remote_content_storage_impl.hpp"
#include "ncm_remote_content_meta_database_impl.hpp"
namespace ams::ncm {
class RemoteContentManagerImpl {
private:
/* TODO: sf::ProxyObjectAllocator */
using ObjectFactory = sf::ObjectFactory>;
public:
RemoteContentManagerImpl() { /* ... */ }
~RemoteContentManagerImpl() { /* ... */ }
public:
Result CreateContentStorage(StorageId storage_id) {
return ::ncmCreateContentStorage(static_cast(storage_id));
}
Result CreateContentMetaDatabase(StorageId storage_id) {
return ::ncmCreateContentMetaDatabase(static_cast(storage_id));
}
Result VerifyContentStorage(StorageId storage_id) {
return ::ncmVerifyContentStorage(static_cast(storage_id));
}
Result VerifyContentMetaDatabase(StorageId storage_id) {
return ::ncmVerifyContentMetaDatabase(static_cast(storage_id));
}
Result OpenContentStorage(sf::Out> out, StorageId storage_id) {
NcmContentStorage cs;
R_TRY(::ncmOpenContentStorage(std::addressof(cs), static_cast(storage_id)));
out.SetValue(ObjectFactory::CreateSharedEmplaced(cs));
return ResultSuccess();
}
Result OpenContentMetaDatabase(sf::Out> out, StorageId storage_id) {
NcmContentMetaDatabase db;
R_TRY(::ncmOpenContentMetaDatabase(std::addressof(db), static_cast(storage_id)));
out.SetValue(ObjectFactory::CreateSharedEmplaced(db));
return ResultSuccess();
}
Result CloseContentStorageForcibly(StorageId storage_id) {
return ::ncmCloseContentStorageForcibly(static_cast(storage_id));
}
Result CloseContentMetaDatabaseForcibly(StorageId storage_id) {
return ::ncmCloseContentMetaDatabaseForcibly(static_cast(storage_id));
}
Result CleanupContentMetaDatabase(StorageId storage_id) {
return ::ncmCleanupContentMetaDatabase(static_cast(storage_id));
}
Result ActivateContentStorage(StorageId storage_id) {
return ::ncmActivateContentStorage(static_cast(storage_id));
}
Result InactivateContentStorage(StorageId storage_id) {
return ::ncmInactivateContentStorage(static_cast(storage_id));
}
Result ActivateContentMetaDatabase(StorageId storage_id) {
return ::ncmActivateContentMetaDatabase(static_cast(storage_id));
}
Result InactivateContentMetaDatabase(StorageId storage_id) {
return ::ncmInactivateContentMetaDatabase(static_cast(storage_id));
}
Result InvalidateRightsIdCache() {
return ::ncmInvalidateRightsIdCache();
}
Result GetMemoryReport(sf::Out out) {
/* TODO: libnx bindings */
AMS_ABORT();
}
};
static_assert(ncm::IsIContentManager);
}