UT_String Class Reference

#include <UT_String.h>

Inheritance diagram for UT_String:

UT_DeepString

List of all members.

Public Types

enum  UT_AlwaysDeepType { ALWAYS_DEEP }

Public Member Functions

 UT_String (const char *str=0, int deepCopy=0, int len=-1)
 Construct UT_String from a C string, using shallow semantics.
 UT_String (const std::string &str)
 Construct UT_String from a std::string using ALWAYS_DEEP semantics.
 UT_String (UT_AlwaysDeepType, const char *str=0)
 Construct UT_String from a C string, using ALWAYS_DEEP semantics.
 UT_String (UT_AlwaysDeepType, const std::string &str)
 Construct UT_String from a std::string, using ALWAYS_DEEP semantics.
 UT_String (const UT_String &str)
 ~UT_String ()
void setAlwaysDeep (bool deep)
 Make a string always deep.
bool isAlwaysDeep () const
void swap (UT_String &other)
bool isHard () const
 Returns whether this string is hardened already.
char * steal (void)
void saveBinary (ostream &os) const
 Save string to binary stream.
void saveAscii (ostream &os) const
void save (ostream &os, int binary) const
 Save string to stream. Saves as binary if binary is true.
bool load (UT_IStream &is)
 Load string from stream. Use is.eof() to check eof status.
void clear ()
 Reset the string to the default constructor.
void append (char ch)
 Append a character.
UT_Stringoperator= (const UT_String &str)
UT_Stringoperator= (const char *str)
UT_Stringoperator= (const std::string &str)
UT_Stringoperator+= (const char *str)
UT_Stringoperator+= (const UT_String &str)
unsigned operator== (const char *str) const
unsigned operator== (const UT_String &str) const
unsigned operator!= (const char *str) const
unsigned operator!= (const UT_String &str) const
unsigned operator< (const char *str) const
unsigned operator< (const UT_String &str) const
unsigned operator<= (const char *str) const
unsigned operator<= (const UT_String &str) const
unsigned operator> (const char *str) const
unsigned operator> (const UT_String &str) const
unsigned operator>= (const char *str) const
unsigned operator>= (const UT_String &str) const
 operator const char * () const
 operator char * ()
const char * buffer () const
const char * nonNullBuffer () const
char operator() (unsigned i) const
char & operator() (unsigned i)
int toInt () const
fpreal toFloat () const
std::string toStdString () const
unsigned length (void) const
 Return length of string.
int64 getMemoryUsage () const
 Return memory usage in bytes.
char * findChar (int c) const
 Find first occurrance of character. Returns NULL upon failure.
char * lastChar (int c) const
 Find last occurance of character.
int countChar (int c) const
 Return the number of occurrences of the specified character.
char * findNonSpace () const
const char * findWord (const char *word) const
bool findString (const char *str, bool fullword, bool usewildcards) const
int changeWord (const char *from, const char *to, int all=1)
int changeString (const char *from, const char *to, bool fullword)
int changeQuotedWord (const char *from, const char *to, int quote= '`', int all=1)
int findLongestCommonSuffix (const char *with)
int substr (UT_String &buf, int index, int len=0) const
unsigned isFloat (int skip_spaces=0, int loose=0) const
 Determine if string can be seen as a single floating point number.
unsigned isInteger (int skip_spaces=0) const
 Determine if string can be seen as a single integer number.
void toUpper ()
void toLower ()
const char * fileName () const
const char * fileExtension () const
 Return the extension of a file path string.
UT_String pathUpToExtension () const
void splitPath (UT_String &dir_name, UT_String &file_name) const
int parseNumberedFilename (UT_String &prefix, UT_String &frame, UT_String &suff, bool negative=true, bool fractional=false) const
int isstring () const
int trimSpace (bool leaveSingleSpaceBetweenWords=false)
int trimBoundingSpace ()
int strip (const char *chars)
void protectString ()
bool isQuotedString (char delimiter='\'') const
UT_String makeQuotedString (char delimiter='\'') const
UT_String makeSmartQuotedString (char default_delimiter='\'') const
void expandControlSequences ()
bool hasWhiteSpace () const
void removeTrailingSpace ()
void removeTrailingDigits ()
int cshParse (char *argv[], int maxArgs, void(*vlookup)(const char *, UT_String &)=UTvarLookup, void(*elookup)(const char *, UT_String &)=UTexprLookup, int *error=0, UT_StringCshIO *io=0)
int cshParse (UT_WorkArgs &argv, void(*vlookup)(const char *, UT_String &)=UTvarLookup, void(*elookup)(const char *, UT_String &)=UTexprLookup, int *error=0, UT_StringCshIO *io=0)
int dosParse (UT_WorkArgs &argv)
int dosParse (char *argv[], int maxArgs)
int parse (char *argv[], int maxArgs)
int parseInPlace (char *argv[], int maxArgs)
int parse (UT_WorkArgs &argv)
int parseInPlace (UT_WorkArgs &argv)
int tokenize (char *argv[], int maxArgs, char separator)
int tokenizeInPlace (char *argv[], int maxArgs, char separator)
int tokenize (UT_WorkArgs &argv, char separator)
int tokenizeInPlace (UT_WorkArgs &argv, char separator)
int tokenize (char *argv[], int maxArgs, const char *separators=" \t\n")
int tokenizeInPlace (char *argv[], int maxArgs, const char *separators=" \t\n")
int tokenize (UT_WorkArgs &argv, const char *separators=" \t\n")
int tokenizeInPlace (UT_WorkArgs &argv, const char *separators=" \t\n")
void expandVariables ()
unsigned hash () const
unsigned match (const char *pattern, int caseSensitive=1) const
unsigned multiMatch (const char *pattern, int caseSensitive, char separator) const
unsigned multiMatch (const char *pattern, int caseSensitive=1, const char *separators=", ", bool *explicitlyExcluded=0, int *matchIndex=0, ut_PatternRecord *pattern_record=NULL) const
unsigned multiMatchRecord (const char *pattern, int maxpatterns, char *singles, int &nsingles, char **words, int &nwords, int case_sensitive=1, const char *separators=", ") const
bool matchPattern (const UT_WorkArgs &pattern_args, bool assume_match=false)
unsigned contains (const char *pattern, int caseSensitive=1) const
bool startsWith (const char *prefix) const
bool endsWith (const char *suffix) const
bool endsWith (const char *suffix, bool case_sensitive) const
int traversePattern (int max, void *data, int(*func)(int num, int sec, void *data), unsigned int(*secfunc)(int num, void *data)=0, int offset=0) const
const char * fcontain (const char *pattern) const
bool patternRename (const char *match_pattern, const char *replace)
UT_Stringbase (void) const
const char * suffix (void) const
void incrementNumberedName ()
ostream & setFormat (ostream &os)
int replacePrefix (const char *oldpref, const char *newpref)
int replaceSuffix (const char *oldsuffix, const char *newsuffix)
int expandArrays (char *names[], int max)
int format (int cols)
int substitute (const char *find, const char *replacement, bool all=true)
int replace (int pos, int len, const char *str)
int insert (int pos, const char *str)
void itoa (int i)
void utoa (int i)
void itoa_pretty (int64 val)
int sprintf (const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
int int forceValidVariableName (const char *safechars=NULL)
bool forceAlphaNumeric ()
void getRelativePath (const char *src_fullpath, const char *dest_fullpath)
bool isAbsolutePath (bool file_path=false) const
bool collapseAbsolutePath (bool file_path=false)
bool truncateMiddle (int max_length)
void extractModifiers (UT_String &modifiers)
bool applyModifiers (const UT_String &modifiers)
bool applyNextModifier (const char *mod, bool all)
UT_String removeRange ()
void harden ()
 Take shallow copy and make it deep.
void harden (const char *s, int len=-1)
 Take shallow copy and make it deep.
void hardenIfNeeded ()
 Take shallow copy and make it deep.
void hardenIfNeeded (const char *s)
 Take shallow copy and make it deep.
void adopt (char *s)
void adopt (UT_String &str)
void prepend (const char *prefix)
 Prepend a string (or character).
void prepend (char ch)
 Prepend a string (or character).
char * findChar (const char *str) const
 Find first occurrance of any character in str.
char * findChar (const UT_String &str) const
 Find first occurrance of any character in str.

Static Public Member Functions

static unsigned hash (const char *str, unsigned code=0)
static int multiMatchCheck (const char *pattern)
static int wildcardMatchCheck (const char *pattern)
static ostream & setFormat (ostream &os, const char *fmt)
static int compareNumberedString (const char *s1, const char *s2, bool case_sensitive=true)
static int qsortCmpNumberedString (const void *v1, const void *v2)
static int qsortCmpNumberedString (char *const *v1, char *const *v2)
static int compareNumberedFilename (const char *s1, const char *s2, bool case_sensitive=false)
static int qsortCmpNumberedFilename (const void *v1, const void *v2)
static int qsortCmpNumberedFilename (char *const *v1, char *const *v2)
static int itoa (char *str, int i)
static int utoa (char *str, unsigned i)
static int findLongestCommonPathPrefix (const char *fullpath1, int len1, const char *fullpath2, int len2)
static const UT_StringgetEmptyString ()
static bool isValidModifier (const char c, bool have_subst)
static int findModifiers (const char *src)

Friends

UT_API ostream & operator<< (ostream &os, const UT_String &d)


Detailed Description

UT_String is a string class that support two different types of assignment semantics:

If UT_String::harden() is called, or any other UT_String method that requires modifying the string, it will make a copy of its reference pointer (and take ownership) first.

Examples:

CHOP/CHOP_Stair.C, CHOP/CHOP_Stair.h, DOP/DOP_GroupAndApply.C, DOP/DOP_GroupAndApply.h, FS/FS_Background.C, FS/FS_HomeHelper.C, OBJ/OBJ_WorldAlign.C, POP/POP_CircleForce.C, POP/POP_CircleForce.h, POP/POP_LocalForce.C, POP/POP_LocalForce.h, POP/POP_RadialBirth.C, POP/POP_RadialBirth.h, POP/POP_SpotLight.C, POP/POP_SpotLight.h, ROP/ROP_Dumper.C, ROP/ROP_Dumper.h, SIM/SNOW_Solver.C, SOP/MSS_BrushHairLen.C, SOP/MSS_BrushHairLen.h, SOP/MSS_CustomBrushState.C, SOP/SOP_BlindData.C, SOP/SOP_BrushHairLen.h, SOP/SOP_CopRaster.C, SOP/SOP_CopRaster.h, SOP/SOP_DetailAttrib.C, SOP/SOP_DetailAttrib.h, SOP/SOP_Flatten.C, SOP/SOP_Flatten.h, SOP/SOP_GroupRename.C, SOP/SOP_GroupRename.h, SOP/SOP_HDKObject.C, SOP/SOP_HDKObject.h, SOP/SOP_PointWave.h, SOP/SOP_PrimVOP.C, SOP/SOP_PrimVOP.h, SOP/SOP_TimeCompare.C, SOP/SOP_TimeCompare.h, standalone/geo2voxel.C, VOP/VOP_CustomContext.C, VOP/VOP_CustomContext.h, VOP/VOP_Switch.C, VOP/VOP_Switch.h, VRAY/VRAY_DemoFile.h, and VRAY/VRAY_DemoSprite.C.

Definition at line 74 of file UT_String.h.


Member Enumeration Documentation

UT_String can be constructed with UT_String::ALWAYS_DEEP to create an object that will always perform deep copies when assigned to.

Enumerator:
ALWAYS_DEEP 

Definition at line 80 of file UT_String.h.


Constructor & Destructor Documentation

UT_String::UT_String ( const char *  str = 0,
int  deepCopy = 0,
int  len = -1 
)

Construct UT_String from a C string, using shallow semantics.

Parameters:
str The initial string.
deepCopy If true, a copy of str will be used.
len Number of characters to use from str. Use -1 to use the entire string. If len is non-negative, then deepCopy will be implicitly set to true. If str is NULL and len is non-negative, then it will be initialized with "".

UT_String::UT_String ( const std::string str  )  [inline, explicit]

Construct UT_String from a std::string using ALWAYS_DEEP semantics.

It provides an shortcut for constructing a UT_String from a function that returns a std::string by value. For example, it lets you write

     UT_String str(func());
instead of
     UT_String str(func().c_str(), /*harden=*/true);

Definition at line 105 of file UT_String.h.

UT_String::UT_String ( UT_AlwaysDeepType  ,
const char *  str = 0 
) [inline]

Construct UT_String from a C string, using ALWAYS_DEEP semantics.

Definition at line 111 of file UT_String.h.

UT_String::UT_String ( UT_AlwaysDeepType  ,
const std::string str 
) [inline]

Construct UT_String from a std::string, using ALWAYS_DEEP semantics.

Definition at line 118 of file UT_String.h.

UT_String::UT_String ( const UT_String str  ) 

Copy constructor

If the string we're copying from is ALWAYS_DEEP, then this object will also become ALWAYS_DEEP. This way, you can pass/return a string by value.

UT_String::~UT_String (  ) 


Member Function Documentation

void UT_String::adopt ( UT_String str  )  [inline]

Take ownership of given string

adopt() is the opposite of steal(). Basically, you're giving the UT_String ownership of the string.

Definition at line 208 of file UT_String.h.

void UT_String::adopt ( char *  s  )  [inline]

Take ownership of given string

adopt() is the opposite of steal(). Basically, you're giving the UT_String ownership of the string.

Definition at line 198 of file UT_String.h.

void UT_String::append ( char  ch  ) 

Append a character.

bool UT_String::applyModifiers ( const UT_String modifiers  ) 

loops through a modifier string created by extractModifiers

Parameters:
[in] modifiers The modifiers to apply to this string; must start with a colon
Returns:
whether any modification was performed

bool UT_String::applyNextModifier ( const char *  mod,
bool  all 
)

implements a few csh-style modifiers.

Parameters:
mod pointer to a string starting with the modifier to apply. so, to apply a global substitute modifier :gs/l/r/ mod should be: s/l/r
all True if all possible modifications should be (recursively) performed. Otherwise, at most one modification is applied.
Returns:
whether any modification was performed

UT_String* UT_String::base ( void   )  const

const char* UT_String::buffer (  )  const [inline]

Definition at line 399 of file UT_String.h.

int UT_String::changeQuotedWord ( const char *  from,
const char *  to,
int  quote = '`',
int  all = 1 
)

int UT_String::changeString ( const char *  from,
const char *  to,
bool  fullword 
)

int UT_String::changeWord ( const char *  from,
const char *  to,
int  all = 1 
)

void UT_String::clear ( void   )  [inline]

Reset the string to the default constructor.

Definition at line 228 of file UT_String.h.

bool UT_String::collapseAbsolutePath ( bool  file_path = false  ) 

static int UT_String::compareNumberedFilename ( const char *  s1,
const char *  s2,
bool  case_sensitive = false 
) [static]

static int UT_String::compareNumberedString ( const char *  s1,
const char *  s2,
bool  case_sensitive = true 
) [static]

unsigned UT_String::contains ( const char *  pattern,
int  caseSensitive = 1 
) const

int UT_String::countChar ( int  c  )  const

Return the number of occurrences of the specified character.

int UT_String::cshParse ( UT_WorkArgs argv,
void(*)(const char *, UT_String &)  vlookup = UTvarLookup,
void(*)(const char *, UT_String &)  elookup = UTexprLookup,
int *  error = 0,
UT_StringCshIO io = 0 
)

int UT_String::cshParse ( char *  argv[],
int  maxArgs,
void(*)(const char *, UT_String &)  vlookup = UTvarLookup,
void(*)(const char *, UT_String &)  elookup = UTexprLookup,
int *  error = 0,
UT_StringCshIO io = 0 
)

int UT_String::dosParse ( char *  argv[],
int  maxArgs 
)

int UT_String::dosParse ( UT_WorkArgs argv  ) 

bool UT_String::endsWith ( const char *  suffix,
bool  case_sensitive 
) const

bool UT_String::endsWith ( const char *  suffix  )  const

int UT_String::expandArrays ( char *  names[],
int  max 
)

void UT_String::expandControlSequences (  ) 

void UT_String::expandVariables (  ) 

void UT_String::extractModifiers ( UT_String modifiers  ) 

Finds the first colon and extracts the modifier string. this string is truncated at the first colon.

Parameters:
[out] modifiers Filled with the modifier string, which is everything after the first colon.

const char* UT_String::fcontain ( const char *  pattern  )  const [inline]

Definition at line 776 of file UT_String.h.

const char* UT_String::fileExtension (  )  const [inline]

Return the extension of a file path string.

Examples:
standalone/geo2voxel.C.

Definition at line 515 of file UT_String.h.

const char* UT_String::fileName (  )  const [inline]

Return last component of forward slash separated path string

If there is a slash in the string, fileName() returns the string starting after the slash. Otherwise, it returns the contents of this string. Note that it returns a pointer into this string.

Definition at line 501 of file UT_String.h.

char* UT_String::findChar ( const UT_String str  )  const [inline]

Find first occurrance of any character in str.

Definition at line 446 of file UT_String.h.

char* UT_String::findChar ( const char *  str  )  const [inline]

Find first occurrance of any character in str.

Definition at line 444 of file UT_String.h.

char* UT_String::findChar ( int  c  )  const [inline]

Find first occurrance of character. Returns NULL upon failure.

Definition at line 439 of file UT_String.h.

static int UT_String::findLongestCommonPathPrefix ( const char *  fullpath1,
int  len1,
const char *  fullpath2,
int  len2 
) [static]

int UT_String::findLongestCommonSuffix ( const char *  with  ) 

static int UT_String::findModifiers ( const char *  src  )  [static]

will find all valid characters including modifiers and their preceding text

Returns:
: number of modifier chars found, ie, for ":ras/foo/bar", 12

char* UT_String::findNonSpace (  )  const

bool UT_String::findString ( const char *  str,
bool  fullword,
bool  usewildcards 
) const

const char* UT_String::findWord ( const char *  word  )  const

bool UT_String::forceAlphaNumeric (  ) 

int int UT_String::forceValidVariableName ( const char *  safechars = NULL  ) 

int UT_String::format ( int  cols  ) 

static const UT_String& UT_String::getEmptyString (  )  [static]

int64 UT_String::getMemoryUsage ( void   )  const [inline]

Return memory usage in bytes.

Definition at line 431 of file UT_String.h.

void UT_String::getRelativePath ( const char *  src_fullpath,
const char *  dest_fullpath 
)

Examples:
SOP/SOP_CopRaster.C.

void UT_String::harden ( const char *  s,
int  len = -1 
)

Take shallow copy and make it deep.

void UT_String::harden (  ) 

void UT_String::hardenIfNeeded ( const char *  s  ) 

Take shallow copy and make it deep.

void UT_String::hardenIfNeeded (  ) 

Take shallow copy and make it deep.

static unsigned UT_String::hash ( const char *  str,
unsigned  code = 0 
) [inline, static]

Definition at line 687 of file UT_String.h.

unsigned UT_String::hash (  )  const [inline]

Definition at line 682 of file UT_String.h.

bool UT_String::hasWhiteSpace (  )  const

void UT_String::incrementNumberedName (  ) 

int UT_String::insert ( int  pos,
const char *  str 
) [inline]

Definition at line 849 of file UT_String.h.

bool UT_String::isAbsolutePath ( bool  file_path = false  )  const

bool UT_String::isAlwaysDeep (  )  const [inline]

Definition at line 149 of file UT_String.h.

unsigned UT_String::isFloat ( int  skip_spaces = 0,
int  loose = 0 
) const

Determine if string can be seen as a single floating point number.

bool UT_String::isHard (  )  const [inline]

Returns whether this string is hardened already.

Definition at line 165 of file UT_String.h.

unsigned UT_String::isInteger ( int  skip_spaces = 0  )  const

Determine if string can be seen as a single integer number.

bool UT_String::isQuotedString ( char  delimiter = '\''  )  const

returns true if the string begins and ends with a (non-escaped) quote 'delimiter'.

int UT_String::isstring (  )  const [inline]

static bool UT_String::isValidModifier ( const char  c,
bool  have_subst 
) [static]

void UT_String::itoa ( int  i  ) 

static int UT_String::itoa ( char *  str,
int  i 
) [static]

void UT_String::itoa_pretty ( int64  val  ) 

char* UT_String::lastChar ( int  c  )  const [inline]

Find last occurance of character.

Definition at line 451 of file UT_String.h.

unsigned UT_String::length ( void   )  const [inline]

Return length of string.

Examples:
VOP/VOP_CustomContext.C.

Definition at line 427 of file UT_String.h.

bool UT_String::load ( UT_IStream is  ) 

Load string from stream. Use is.eof() to check eof status.

Examples:
SOP/SOP_BlindData.C.

UT_String UT_String::makeQuotedString ( char  delimiter = '\''  )  const

makeQuotedString() is similar to protectString() except it returns a new string instead of changing this string, it does wrap the string in quotes, and it lets you use either ' or " as the delimiter. The string that's returned is UT_String::ALWAYS_DEEP.

UT_String UT_String::makeSmartQuotedString ( char  default_delimiter = '\''  )  const

makeSmartQuotedString() will use either ' or " as the delimiter to avoid escaped quotes, using the default delimiter if it doesn't matter. The string that's returned is UT_String::ALWAYS_DEEP.

unsigned UT_String::match ( const char *  pattern,
int  caseSensitive = 1 
) const

bool UT_String::matchPattern ( const UT_WorkArgs pattern_args,
bool  assume_match = false 
)

matchPattern(UT_WorkArgs &) assumes that the arguments contain the components of a pattern to be matched against. The method returns true if the pattern matches, false if it doesn't. This matching process handles ^ expansion properly (and efficiently). If the string doesn't match any components of the pattern, then the assumed value is returned.

unsigned UT_String::multiMatch ( const char *  pattern,
int  caseSensitive = 1,
const char *  separators = ", ",
bool *  explicitlyExcluded = 0,
int *  matchIndex = 0,
ut_PatternRecord *  pattern_record = NULL 
) const

unsigned UT_String::multiMatch ( const char *  pattern,
int  caseSensitive,
char  separator 
) const

static int UT_String::multiMatchCheck ( const char *  pattern  )  [static]

unsigned UT_String::multiMatchRecord ( const char *  pattern,
int  maxpatterns,
char *  singles,
int &  nsingles,
char **  words,
int &  nwords,
int  case_sensitive = 1,
const char *  separators = ", " 
) const

const char* UT_String::nonNullBuffer (  )  const [inline]

Definition at line 401 of file UT_String.h.

UT_String::operator char * (  )  [inline]

Definition at line 396 of file UT_String.h.

UT_String::operator const char * (  )  const [inline]

Definition at line 394 of file UT_String.h.

unsigned UT_String::operator!= ( const UT_String str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 302 of file UT_String.h.

unsigned UT_String::operator!= ( const char *  str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 292 of file UT_String.h.

char& UT_String::operator() ( unsigned  i  )  [inline]

Definition at line 409 of file UT_String.h.

char UT_String::operator() ( unsigned  i  )  const [inline]

Definition at line 403 of file UT_String.h.

UT_String& UT_String::operator+= ( const UT_String str  )  [inline]

Definition at line 275 of file UT_String.h.

UT_String& UT_String::operator+= ( const char *  str  )  [inline]

Definition at line 243 of file UT_String.h.

unsigned UT_String::operator< ( const UT_String str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 325 of file UT_String.h.

unsigned UT_String::operator< ( const char *  str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 306 of file UT_String.h.

unsigned UT_String::operator<= ( const UT_String str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 344 of file UT_String.h.

unsigned UT_String::operator<= ( const char *  str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 330 of file UT_String.h.

UT_String& UT_String::operator= ( const std::string str  ) 

UT_String& UT_String::operator= ( const char *  str  ) 

Reimplemented in UT_DeepString.

UT_String& UT_String::operator= ( const UT_String str  ) 

Reimplemented in UT_DeepString.

unsigned UT_String::operator== ( const UT_String str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 286 of file UT_String.h.

unsigned UT_String::operator== ( const char *  str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 280 of file UT_String.h.

unsigned UT_String::operator> ( const UT_String str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 362 of file UT_String.h.

unsigned UT_String::operator> ( const char *  str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 348 of file UT_String.h.

unsigned UT_String::operator>= ( const UT_String str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 385 of file UT_String.h.

unsigned UT_String::operator>= ( const char *  str  )  const [inline]

Reimplemented in UT_DeepString.

Definition at line 366 of file UT_String.h.

int UT_String::parse ( UT_WorkArgs argv  )  [inline]

Definition at line 643 of file UT_String.h.

int UT_String::parse ( char *  argv[],
int  maxArgs 
) [inline]

Examples:
SOP/SOP_PrimVOP.C.

Definition at line 635 of file UT_String.h.

int UT_String::parseInPlace ( UT_WorkArgs argv  ) 

int UT_String::parseInPlace ( char *  argv[],
int  maxArgs 
)

int UT_String::parseNumberedFilename ( UT_String prefix,
UT_String frame,
UT_String suff,
bool  negative = true,
bool  fractional = false 
) const

Decompose a filename into various parts

parseNumberedFileName will breakup a filename into its various parts: file = prefix$Fsuffix (note: suffix is not the same as file extension.) 0 is returned if there is no frame number. 'negative' allows -[frame] to be interpreted as a negative number. 'fractional' allows [frame].[number] to be interpreted as a fractional frame.

UT_String UT_String::pathUpToExtension (  )  const

Return path terminated just before the extension. If the filename starts with '.' and no path is provided, returns NULL

bool UT_String::patternRename ( const char *  match_pattern,
const char *  replace 
)

void UT_String::prepend ( char  ch  ) 

Prepend a string (or character).

void UT_String::prepend ( const char *  prefix  ) 

Prepend a string (or character).

void UT_String::protectString (  ) 

protectString() will modify the existing string to escape double quotes and backslashes. It will not wrap the string in double quotes.

static int UT_String::qsortCmpNumberedFilename ( char *const *  v1,
char *const *  v2 
) [static]

static int UT_String::qsortCmpNumberedFilename ( const void *  v1,
const void *  v2 
) [static]

static int UT_String::qsortCmpNumberedString ( char *const *  v1,
char *const *  v2 
) [static]

static int UT_String::qsortCmpNumberedString ( const void *  v1,
const void *  v2 
) [static]

UT_String UT_String::removeRange (  ) 

This will remove the range from a string of the form foo$Fbar.ext (#-#) and return the first number from the range. If there is only 1 range number, it will be returned. If there is no range, 0 is returned. The returned string is hardened.

void UT_String::removeTrailingDigits (  ) 

void UT_String::removeTrailingSpace (  ) 

int UT_String::replace ( int  pos,
int  len,
const char *  str 
)

int UT_String::replacePrefix ( const char *  oldpref,
const char *  newpref 
)

int UT_String::replaceSuffix ( const char *  oldsuffix,
const char *  newsuffix 
)

void UT_String::save ( ostream &  os,
int  binary 
) const

Save string to stream. Saves as binary if binary is true.

Examples:
SOP/SOP_BlindData.C.

void UT_String::saveAscii ( ostream &  os  )  const [inline]

Save string to ASCII stream. This will add double quotes and escape to the stream if necessary (empty string or contains spaces).

Definition at line 219 of file UT_String.h.

void UT_String::saveBinary ( ostream &  os  )  const [inline]

Save string to binary stream.

Definition at line 215 of file UT_String.h.

void UT_String::setAlwaysDeep ( bool  deep  )  [inline]

Make a string always deep.

Definition at line 133 of file UT_String.h.

ostream& UT_String::setFormat ( ostream &  os  ) 

static ostream& UT_String::setFormat ( ostream &  os,
const char *  fmt 
) [static]

void UT_String::splitPath ( UT_String dir_name,
UT_String file_name 
) const

Split a path into dir_name and file_name, where file_name is everything after the final slash (i.e. the same as fileName()). Either part may be empty. Note that if the string starts with / and only contains that one slash, the dir_name will be / and not blank. dir_name and file_name will either be set to hardened strings or an empty string.

int UT_String::sprintf ( const char *  fmt,
  ... 
)

bool UT_String::startsWith ( const char *  prefix  )  const

char* UT_String::steal ( void   )  [inline]

Give up ownership of string

Take a hard reference and make it shallow. This method makes sure it gives back something you can delete, because this UT_String is taking its hands off the data. Use it with care since it may lead to memory leaks if, for example, you harden it again later.

In the case of ALWAYS_DEEP strings, this is disallowed so it will just return a copy of the data.

Definition at line 176 of file UT_String.h.

int UT_String::strip ( const char *  chars  ) 

strips out all characters found in 'chars'. The string length will be reduced by the number of characters removed. The number of characters removed is returned.

int UT_String::substitute ( const char *  find,
const char *  replacement,
bool  all = true 
)

int UT_String::substr ( UT_String buf,
int  index,
int  len = 0 
) const

Perform deep copy of the substring starting from index for len characters into the specified UT_String. If len is too long, then a substring starting from index to the end of the string is copied. Returns the length of the copied substring.

const char* UT_String::suffix ( void   )  const

void UT_String::swap ( UT_String other  ) 

fpreal UT_String::toFloat (  )  const

int UT_String::toInt (  )  const

int UT_String::tokenize ( UT_WorkArgs argv,
const char *  separators = " \t\n" 
) [inline]

Definition at line 670 of file UT_String.h.

int UT_String::tokenize ( char *  argv[],
int  maxArgs,
const char *  separators = " \t\n" 
) [inline]

Definition at line 662 of file UT_String.h.

int UT_String::tokenize ( UT_WorkArgs argv,
char  separator 
) [inline]

Definition at line 656 of file UT_String.h.

int UT_String::tokenize ( char *  argv[],
int  maxArgs,
char  separator 
) [inline]

Definition at line 650 of file UT_String.h.

int UT_String::tokenizeInPlace ( UT_WorkArgs argv,
const char *  separators = " \t\n" 
)

int UT_String::tokenizeInPlace ( char *  argv[],
int  maxArgs,
const char *  separators = " \t\n" 
)

int UT_String::tokenizeInPlace ( UT_WorkArgs argv,
char  separator 
)

int UT_String::tokenizeInPlace ( char *  argv[],
int  maxArgs,
char  separator 
)

void UT_String::toLower (  )  [inline]

Definition at line 487 of file UT_String.h.

std::string UT_String::toStdString (  )  const

Converts the contents of this UT_String to a std::string. Note that std::string can't be constructed with a null pointer, so you can't just write std::string s = ut_string.buffer();

void UT_String::toUpper (  )  [inline]

Definition at line 480 of file UT_String.h.

int UT_String::traversePattern ( int  max,
void *  data,
int(*)(int num, int sec, void *data func,
unsigned int(*)(int num, void *data secfunc = 0,
int  offset = 0 
) const

int UT_String::trimBoundingSpace (  ) 

A version of trimSpace() that only removes leading and following spaces from a string, leaving any between words intact.

int UT_String::trimSpace ( bool  leaveSingleSpaceBetweenWords = false  ) 

trimSpace() will remove all space characters (leading and following) from a string. If the string consists of multiple words, the words will be collapsed. The function returns 1 if space was trimmed.

bool UT_String::truncateMiddle ( int  max_length  ) 

void UT_String::utoa ( int  i  ) 

static int UT_String::utoa ( char *  str,
unsigned  i 
) [static]

static int UT_String::wildcardMatchCheck ( const char *  pattern  )  [static]


Friends And Related Function Documentation

UT_API ostream& operator<< ( ostream &  os,
const UT_String d 
) [friend]

This operator saves the string to the stream via the string's saveAscii() method, protecting any whitespace (by adding quotes), backslashes or quotes in the string.


The documentation for this class was generated from the following file:

Generated on Mon Jan 28 00:30:21 2013 for HDK by  doxygen 1.5.9