carb/extras/Tokens.h

File members: carb/extras/Tokens.h

// Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once

#include "../tokens/TokensUtils.h"

namespace carb
{
namespace extras
{

inline void registerPathAlias(const char* alias, const char* value)
{
    static carb::tokens::ITokens* tokens = carb::getFramework()->acquireInterface<carb::tokens::ITokens>();

    tokens->setValue(alias, value);
}

inline void unregisterPathAlias(const char* alias)
{
    static carb::tokens::ITokens* tokens = carb::getFramework()->acquireInterface<carb::tokens::ITokens>();

    tokens->removeToken(alias);
}

inline std::string resolvePathAliases(const char* srcBuf)
{
    static carb::tokens::ITokens* tokens = carb::getFramework()->acquireInterface<carb::tokens::ITokens>();

    return carb::tokens::resolveString(tokens, srcBuf);
}

} // namespace extras
} // namespace carb