HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PI_ImportUtils.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: PI_ImportUtils.h ( PI Library, C++)
7
*
8
* COMMENTS:
9
*
10
* This class encapsulates some useful utility methods for dealing
11
* with import sources in a PI_EditScriptedParm.
12
*/
13
14
#ifndef __PI_ImportUtils_h__
15
#define __PI_ImportUtils_h__
16
17
#include "
PI_API.h
"
18
#include <
UT/UT_UniquePtr.h
>
19
20
class
UT_String
;
21
template
<
typename
T>
22
class
UT_SymbolMap
;
23
class
UT_WorkBuffer
;
24
class
OP_Node
;
25
class
PRM_ScriptPage
;
26
class
PRM_Parm
;
27
class
PRM_ScriptParm
;
28
class
PRM_Template
;
29
30
#define PI_IMPORTBLOCK_TOKEN "importblock"
31
32
enum
PI_ImportType
33
{
34
PI_IMPORT_TYPE_UNKNOWN
,
35
PI_IMPORT_TYPE_OP
,
36
PI_IMPORT_TYPE_FILE
37
};
38
39
class
PI_API
PI_ImportUtils
40
{
41
public
:
42
43
static
PI_ImportType
queryImportType(
const
char
*
source
);
44
45
static
void
buildFolderToken(
UT_WorkBuffer
&
buffer
,
46
const
char
*switcher,
47
const
char
*folder);
48
49
// Parse the given source string and extract the src node path. The
50
// caller is responsible for hardening the string. The node referenced
51
// in the source string, if found, is returned.
52
static
OP_Node
*parseOpSource(
const
char
*source,
53
const
OP_Node
*relative_to,
54
UT_String
&src_node_path);
55
56
// Build the appropriate import source string given the arguments.
57
static
void
buildOpSource(
UT_WorkBuffer
&buffer,
58
const
char
*rel_node_path);
59
60
// This method parses the given source string, and returns whether it
61
// refers to the specified relative node path and the given source token
62
// belongs to parm_table (which maps parameter names to PRM_Parm pointers).
63
// Folders are rejected as valid sources if they're flagged as not being
64
// available for import. Regular parameters not available for import
65
// should not be in the parm_table. Finally, this method will also reject
66
// any parameters that have changed either into or from a multiparm, an
67
// operation unsupported by a simple update.
68
static
bool
validateOpSource(
const
char
*source,
const
char
*token,
69
bool
is_folder,
bool
is_multiparm,
70
const
char
*src_node_rel_path,
71
const
UT_SymbolMap<PRM_Parm *>
&parm_table);
72
73
// This method checks flags on the supplied parm to determine if we can
74
// import it. The subindex is used only for switcher parms to query a
75
// specific folder.
76
static
bool
isAvailableForImport(
const
PRM_Template
*templ,
77
int
subindex = -1);
78
static
bool
isAvailableForImport(
const
PRM_Parm
*parm,
79
int
subindex = -1);
80
81
// Parse the given source string and extract the src file path. The
82
// caller is responsible for hardening the returned string.
83
static
bool
parseFileSource(
const
char
*source,
UT_String
&file);
84
85
// Build the appropriate import source string given the arguments.
86
static
void
buildFileSource(
UT_WorkBuffer
&buffer,
87
const
char
*file_path);
88
89
static
UT_UniquePtr<PRM_ScriptPage>
90
parseImportFile(
const
char
*file);
91
92
// This method parses the given source string, and returns whether it
93
// refers to the specified file and the given source token belongs to
94
// parm_table (which maps parameter names to PRM_ScriptParm pointers).
95
// Finally, this method will also reject any parameters that have
96
// changed either into or from a multiparm, an operation unsupported by
97
// a simple update.
98
static
bool
validateFileSource(
const
char
*source,
99
const
char
*token,
bool
is_folder,
100
bool
is_multiparm,
const
char
*file,
101
const
UT_SymbolMap<PRM_ScriptParm *>
&parm_table);
102
};
103
104
#endif
PI_IMPORT_TYPE_OP
Definition:
PI_ImportUtils.h:35
UT_WorkBuffer
Definition:
UT_WorkBuffer.h:74
PI_API
#define PI_API
Definition:
PI_API.h:10
PRM_Template
Definition:
PRM_Template.h:49
PRM_ScriptParm
Definition:
PRM_ScriptParm.h:87
PI_IMPORT_TYPE_FILE
Definition:
PI_ImportUtils.h:36
UT_UniquePtr
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition:
UT_UniquePtr.h:39
PRM_ScriptPage
Definition:
PRM_ScriptPage.h:29
buffer
Definition:
core.h:760
OP_Node
Definition:
OP_Node.h:503
PI_IMPORT_TYPE_UNKNOWN
Definition:
PI_ImportUtils.h:34
source
GLsizei GLsizei GLchar * source
Definition:
glcorearb.h:803
PI_ImportUtils
Definition:
PI_ImportUtils.h:39
UT_UniquePtr.h
PI_ImportType
PI_ImportType
Definition:
PI_ImportUtils.h:32
UT_String
Definition:
UT_String.h:73
UT_SymbolMap
Definition:
PI_ImportUtils.h:22
PI_API.h
PRM_Parm
Definition:
PRM_Parm.h:131
PI
PI_ImportUtils.h
Generated on Sat Nov 23 2024 02:46:41 for HDK by
1.8.6