Loading...
Searching...
No Matches
filesystemDiscoveryHelpers.h
Go to the documentation of this file.
1//
2// Copyright 2018 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24
25#ifndef PXR_USD_NDR_FILESYSTEM_DISCOVERY_HELPERS_H
26#define PXR_USD_NDR_FILESYSTEM_DISCOVERY_HELPERS_H
27
29
30#include "pxr/pxr.h"
31#include "pxr/usd/ndr/api.h"
32#include "pxr/usd/ndr/declare.h"
33#include "pxr/usd/ndr/nodeDiscoveryResult.h"
34
35#include <functional>
36
37PXR_NAMESPACE_OPEN_SCOPE
38
40
47
50using NdrParseIdentifierFn = std::function<
51 bool (const TfToken &identifier,
52 TfToken *family,
53 TfToken *name,
54 NdrVersion *version)>;
55
73NDR_API
74bool
76 const TfToken &identifier,
77 TfToken *family,
78 TfToken *name,
79 NdrVersion *version);
80
99NDR_API
100NdrNodeDiscoveryResultVec
102 const NdrStringVec& searchPaths,
103 const NdrStringVec& allowedExtensions,
104 bool followSymlinks = true,
105 const NdrDiscoveryPluginContext* context = nullptr,
106 const NdrParseIdentifierFn &parseIdentifierFn =
108);
109
113{
114 std::string uri;
115 std::string resolvedUri;
116};
117
119using NdrDiscoveryUriVec = std::vector<NdrDiscoveryUri>;
120
132NDR_API
135 const NdrStringVec& searchPaths,
136 const NdrStringVec& allowedExtensions,
137 bool followSymlinks = true
138);
139
140PXR_NAMESPACE_CLOSE_SCOPE
141
142#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:88
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.