Tokens.h#

Fully qualified name: carb/extras/Tokens.h

File members: carb/extras/Tokens.h

// SPDX-FileCopyrightText: Copyright (c) 2020-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
//
// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
// property and proprietary rights in and to this material, related
// documentation and any modifications thereto. Any use, reproduction,
// disclosure or distribution of this material and related documentation
// without an express license agreement from NVIDIA CORPORATION or
// its affiliates is strictly prohibited.
#pragma once

#include "../tokens/TokensUtils.h"
#include "../cpp/StringView.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, carb::cpp::string_view(carb::cpp::unsafe_length, srcBuf));
}

} // namespace extras
} // namespace carb