00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __PI_ImportUtils_h__
00023 #define __PI_ImportUtils_h__
00024
00025 #include "PI_API.h"
00026
00027 class UT_String;
00028 class UT_SymbolTable;
00029 class UT_WorkBuffer;
00030 class OP_Node;
00031 class PRM_ScriptPage;
00032 class PRM_Parm;
00033 class PRM_Template;
00034
00035 #define PI_IMPORTBLOCK_TOKEN "importblock"
00036
00037 enum PI_ImportType
00038 {
00039 PI_IMPORT_TYPE_UNKNOWN,
00040 PI_IMPORT_TYPE_OP,
00041 PI_IMPORT_TYPE_FILE
00042 };
00043
00044 class PI_API PI_ImportUtils
00045 {
00046 public:
00047
00048 static PI_ImportType queryImportType(const char *source);
00049
00050 static void buildFolderToken(UT_WorkBuffer &buffer,
00051 const char *switcher,
00052 const char *folder);
00053
00054
00055
00056
00057 static OP_Node *parseOpSource(const char *source,
00058 const OP_Node *relative_to,
00059 UT_String &src_node_path);
00060
00061
00062 static void buildOpSource(UT_WorkBuffer &buffer,
00063 const char *rel_node_path);
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 static bool validateOpSource(const char *source, const char *token,
00074 bool is_folder, bool is_multiparm,
00075 const char *src_node_rel_path,
00076 const UT_SymbolTable &parm_table);
00077
00078
00079
00080
00081 static bool isAvailableForImport(const PRM_Template *templ,
00082 int subindex = -1);
00083 static bool isAvailableForImport(const PRM_Parm *parm,
00084 int subindex = -1);
00085
00086
00087
00088 static bool parseFileSource(const char *source, UT_String &file);
00089
00090
00091 static void buildFileSource(UT_WorkBuffer &buffer,
00092 const char *file_path);
00093
00094 static PRM_ScriptPage *parseImportFile(const char *file);
00095
00096
00097
00098
00099
00100
00101
00102 static bool validateFileSource(const char *source,
00103 const char *token, bool is_folder,
00104 bool is_multiparm, const char *file,
00105 const UT_SymbolTable &parm_table);
00106 };
00107
00108 #endif