HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_text.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  * COMMENTS:
7  */
8 
9 #ifndef __HOM_text_h__
10 #define __HOM_text_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include <SYS/SYS_Types.h>
15 #include <vector>
16 #include <map>
17 
18 SWIGOUT(%rename(text) HOM_text;)
19 
21 {
22 public:
23  virtual ~HOM_text()
24  { }
25 
26  virtual std::string __repr__() = 0;
27 
28  virtual std::string expandString(const char *str,
29  bool expand_tilde = true) = 0;
30  virtual std::string expandStringAtFrame(const char *str, double frame,
31  bool expand_tilde = true) = 0;
32  virtual std::string expandHuskFilePath(const char *str,
33  double frame_start = 1.0,
34  double frame_inc = 1.0,
35  int frame_idx = 0) = 0;
36  virtual std::string incrementNumberedString(const char *str) = 0;
37 
38  // Use Punycode-like scheme to encode and decode strings with special
39  // characters into a form that can be used as a variable, attribute, or
40  // parameter name.
41  virtual std::string encode(const char *varname) = 0;
42  virtual std::string decode(const char *varname) = 0;
43  virtual std::string encodeAttrib(const char *attribname) = 0;
44  virtual std::string decodeAttrib(const char *attribname) = 0;
45  virtual std::string encodeParm(const char *parmname) = 0;
46  virtual std::string decodeParm(const char *parmname) = 0;
47 
48  virtual std::string _obfuscate(const char *text) = 0;
49  virtual std::string _deobfuscate(const char *text) = 0;
50 
51  // Expose the UT_String forceAlphaNumeric method.
52  virtual std::string alphaNumeric(const char *str) = 0;
53 
54  // parse strings like 1-10:2,3 to return
55  // an array of all the integers comprised within that pattern
56  virtual std::vector<int> parseNumericPattern(const char *str,
57  int max=SYS_INT32_MAX) = 0;
58 
59  // Expose the UT_String forceValidVariableName method.
60  SWIGOUT(%kwargs variableName;)
61  virtual std::string variableName(
62  const char *str,
63  const char *safe_chars = nullptr) = 0;
64 
65  SWIGOUT(%kwargs isValidVariableName;)
66  virtual bool isValidVariableName(
67  const char *str,
68  const char *safe_chars = nullptr) = 0;
69 
70  // Expose the GU_PackedFolder forceValidPathName method.
71  virtual std::string packedFolderName(
72  const char *str) = 0;
73 
74  virtual bool isValidPackedFolderName(
75  const char *str) = 0;
76 
77  // Expose the UT_String compareVersionString method.
78  virtual int compareVersionString(const char *str1, const char *str2) = 0;
79 
80  // Convert paths from relative to absolute, or vice versa.
81  SWIGOUT(%kwargs abspath;)
82  virtual std::string abspath(const char *path,
83  const char *anchor_path = nullptr) = 0;
84  SWIGOUT(%kwargs relpath;)
85  virtual std::string relpath(const char *path,
86  const char *anchor_path = nullptr,
87  bool allow_relative_path_from_root = true) = 0;
88  virtual std::string normpath(const char *path) = 0;
89 
90  // Collapse a file path if it starts with the expanded form of one of our
91  // standard env vars (HIP, JOB).
92  SWIGOUT(%kwargs collapseCommonVars;)
93  virtual std::string collapseCommonVars(const char *path,
94  const std::vector<std::string> &vars =
95  std::vector<std::string>()) = 0;
96 
97  // Access to CE_Snippet, allows processing of opencl snippets.
98  /// Returns set of bindings specified with #bind commands.
99  virtual std::vector<std::map<std::string,hboost::any> > oclExtractBindings(const char *code) = 0;
100  /// Returns the value specified with #runover
101  virtual std::string oclExtractRunOver(const char *code) = 0;
102 
103  virtual std::string patternRename(const char *str, const char* find, const char* replace) = 0;
104  SWIGOUT(%kwargs patternMatch;)
105  virtual bool patternMatch(const char *pattern, const char* str, bool ignore_case=false, bool path_match=false) = 0;
106 };
107 
108 #endif
std::string ignore_case(std::string item)
Helper function to allow ignore_case to be passed to IsMember or Transform.
Definition: CLI11.h:3456
#define SYS_INT32_MAX
Definition: SYS_Types.h:171
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:312
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2138
#define HOM_API
Definition: HOM_API.h:13
std::string OIIO_UTIL_API replace(string_view str, string_view pattern, string_view replacement, bool global=false)
GLushort pattern
Definition: glad.h:2583
OIIO_UTIL_API bool rename(string_view from, string_view to, std::string &err)
virtual ~HOM_text()
Definition: HOM_text.h:23
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)