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 //     http://www.apache.org/licenses/LICENSE-2.0
16 //
17 // Unless required by applicable law or agreed to in writing, software
18 // distributed under the Apache License with the above modification is
19 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 // KIND, either express or implied. See the Apache License for the specific
21 // language governing permissions and limitations under the Apache License.
22 //
23 
24 #include "pxr/usd/ndr/parserPlugin.h"
25 #include "pxr/usd/ndr/node.h"
26 #include "pxr/usd/ndr/nodeDiscoveryResult.h"
27 
28 PXR_NAMESPACE_OPEN_SCOPE
29 
30 // Register this plugin type with Tf
TF_REGISTRY_FUNCTION(TfType)31 TF_REGISTRY_FUNCTION(TfType)
32 {
33     TfType::Define<NdrParserPlugin>();
34 }
35 
NdrParserPlugin()36 NdrParserPlugin::NdrParserPlugin()
37 {
38     // nothing yet
39 }
40 
~NdrParserPlugin()41 NdrParserPlugin::~NdrParserPlugin()
42 {
43     // nothing yet
44 }
45 
46 NdrNodeUniquePtr
GetInvalidNode(const NdrNodeDiscoveryResult & dr)47 NdrParserPlugin::GetInvalidNode(const NdrNodeDiscoveryResult& dr)
48 {
49     // Although the discovery result's "discovery type" could be used as the
50     // node's type, that would expose an internal type that is not intended to
51     // be visible to the outside. Instead, just use the generic "unknown" type.
52     return NdrNodeUniquePtr(
53         new NdrNode(
54             dr.identifier,
55             dr.version,
56             dr.name,
57             dr.family,
58             TfToken("unknown discovery type"),
59             TfToken("unknown source type"),
60             dr.resolvedUri,
61             dr.resolvedUri,
62             /* properties = */ NdrPropertyUniquePtrVec()
63         )
64     );
65 }
66 
67 PXR_NAMESPACE_CLOSE_SCOPE
68