All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
filesystemDiscoveryHelpers.h
Go to the documentation of this file.
1//
2// Copyright 2018 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7
8#ifndef PXR_USD_NDR_FILESYSTEM_DISCOVERY_HELPERS_H
9#define PXR_USD_NDR_FILESYSTEM_DISCOVERY_HELPERS_H
10
12
13#include "pxr/pxr.h"
14#include "pxr/usd/ndr/api.h"
15#include "pxr/usd/ndr/declare.h"
16#include "pxr/usd/ndr/nodeDiscoveryResult.h"
17
18#include <functional>
19
20PXR_NAMESPACE_OPEN_SCOPE
21
23
30
33using NdrParseIdentifierFn = std::function<
34 bool (const TfToken &identifier,
35 TfToken *family,
36 TfToken *name,
37 NdrVersion *version)>;
38
56NDR_API
57bool
59 const TfToken &identifier,
60 TfToken *family,
61 TfToken *name,
62 NdrVersion *version);
63
82NDR_API
83NdrNodeDiscoveryResultVec
85 const NdrStringVec& searchPaths,
86 const NdrStringVec& allowedExtensions,
87 bool followSymlinks = true,
88 const NdrDiscoveryPluginContext* context = nullptr,
89 const NdrParseIdentifierFn &parseIdentifierFn =
91);
92
96{
97 std::string uri;
98 std::string resolvedUri;
99};
100
102using NdrDiscoveryUriVec = std::vector<NdrDiscoveryUri>;
103
115NDR_API
118 const NdrStringVec& searchPaths,
119 const NdrStringVec& allowedExtensions,
120 bool followSymlinks = true
121);
122
123PXR_NAMESPACE_CLOSE_SCOPE
124
125#endif // PXR_USD_NDR_FILESYSTEM_DISCOVERY_HELPERS_H
A context for discovery.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
NDR_API NdrNodeDiscoveryResultVec NdrFsHelpersDiscoverNodes(const NdrStringVec &searchPaths, const NdrStringVec &allowedExtensions, bool followSymlinks=true, const NdrDiscoveryPluginContext *context=nullptr, const NdrParseIdentifierFn &parseIdentifierFn=NdrFsHelpersSplitShaderIdentifier)
Returns a vector of discovery results that have been found while walking the given search paths.
std::vector< NdrDiscoveryUri > NdrDiscoveryUriVec
A vector of URI/resolved URI structs.
std::function< bool(const TfToken &identifier, TfToken *family, TfToken *name, NdrVersion *version)> NdrParseIdentifierFn
Type of a function that can be used to parse a discovery result's identifier into its family,...
NDR_API bool NdrFsHelpersSplitShaderIdentifier(const TfToken &identifier, TfToken *family, TfToken *name, NdrVersion *version)
Given a shader's identifier token, computes the corresponding NdrNode's family name,...
NDR_API NdrDiscoveryUriVec NdrFsHelpersDiscoverFiles(const NdrStringVec &searchPaths, const NdrStringVec &allowedExtensions, bool followSymlinks=true)
Returns a vector of discovered URIs (as both the unresolved URI and the resolved URI) that are found ...
Struct for holding a URI and its resolved URI for a file discovered by NdrFsHelpersDiscoverFiles.
Common typedefs that are used throughout the NDR library.