HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PDG_ValuePattern Class Reference

#include <PDG_ValuePattern.h>

+ Inheritance diagram for PDG_ValuePattern:

Public Types

using StringMap = UT_ArrayMap< exint, UT_StringArray >
 
using FloatMap = UT_ArrayMap< exint, UT_FprealArray >
 
using IntMap = UT_ArrayMap< exint, UT_ExintArray >
 

Public Member Functions

 PDG_ValuePattern (char delimiter=' ')
 
 PDG_ValuePattern (const UT_StringHolder &pattern, char delimiter=' ')
 Parses a pattern into a PDG_ValuePattern instance. More...
 
bool contains (const UT_StringHolder &value, bool inclusive) const
 Checks if the specified string value is in the pattern. More...
 
bool contains (fpreal value, bool inclusive) const
 Checks if the specified float value is in the pattern. More...
 
bool contains (exint value, bool inclusive) const
 Checks if the specified integer value is in the pattern. More...
 
bool containsRange (UT_FprealArray &range, fpreal value, bool inclusive) const
 
bool containsRange (UT_FprealArray &range, exint value, bool inclusive) const
 
void array (UT_StringArray &values, bool sorted, bool inclusive) const
 Returns the array of string values that match the pattern. More...
 
void array (UT_FprealArray &values, bool sorted, bool inclusive) const
 Returns the array of float values that match the pattern. More...
 
void array (UT_ExintArray &values, bool sorted, bool inclusive) const
 Returns the array of integer values that match the pattern. More...
 
void arrayMap (StringMap &values, bool sorted, bool inclusive) const
 
void arrayMap (FloatMap &values, bool sorted, bool inclusive) const
 
void arrayMap (IntMap &values, bool sorted, bool inclusive) const
 
bool componentRange (UT_FprealArray &range, exint index, bool inclusive) const
 Returns the value range for the specified component number. More...
 
fpreal componentStep (exint index) const
 Returns the step value for the specified component number. More...
 
bool isNumeric () const
 
bool hasVariableStep () const
 Returns true if the pattern has segments with different step sizes. More...
 
fpreal minimumStep () const
 Returns the minimum step size from all components in the pattern. More...
 
bool reset (const UT_StringHolder &pattern, char delimiter=' ')
 Resets the pattern to an unparsed state. More...
 
bool tryReset (const UT_StringHolder &pattern, char delimiter= ' ')
 
bool parse (const UT_StringView &pattern)
 
- Public Member Functions inherited from PDG_BasePattern
 PDG_BasePattern (const UT_StringHolder &pattern)
 Constructs a default-initialized, invalid pattern. More...
 
bool isValid () const
 
const UT_WorkBuffererrors () const
 If the pattern is invalid, contains parse errors. More...
 
const UT_StringHolderpattern () const
 Returns the pattern used to construct this object. More...
 
bool hasPattern () const
 Returns true if there is a pattern set. More...
 
void reset (const UT_StringHolder &pattern)
 Resets the pattern. More...
 

Additional Inherited Members

- Protected Types inherited from PDG_BasePattern
enum  ParseTokens : uint8 {
  eStarToken = '*', eExcludeToken = '^', eSeparatorToken = ':', eRangeToken = '-',
  eQuoteToken = '"', eEscapeToken = '\\', eRangeBeginToken = '[', eRangeEndToken = ']',
  eAttributeToken = '@', eComponentToken = '.'
}
 Special tokens, in addition to alphanumeric and whitespace. More...
 
- Protected Attributes inherited from PDG_BasePattern
UT_WorkBuffer myErrors
 Parse errors. More...
 
UT_StringHolder myPattern
 The pattern used to construct this object. More...
 
bool myIsValid
 Whether or not the pattern is valid. More...
 

Detailed Description

Createss a queryable representation of a sequence of values, but does not generated the sequence itself unless requested. For example:

1-10 20 30 40 1-10:2 !3

Definition at line 33 of file PDG_ValuePattern.h.

Member Typedef Documentation

Constructor & Destructor Documentation

PDG_ValuePattern::PDG_ValuePattern ( char  delimiter = ' ')

Creates an empty pattern instance that will have it's contents loaded later.

PDG_ValuePattern::PDG_ValuePattern ( const UT_StringHolder pattern,
char  delimiter = ' ' 
)

Parses a pattern into a PDG_ValuePattern instance.

Member Function Documentation

void PDG_ValuePattern::array ( UT_StringArray values,
bool  sorted,
bool  inclusive 
) const
inline

Returns the array of string values that match the pattern.

Definition at line 96 of file PDG_ValuePattern.h.

void PDG_ValuePattern::array ( UT_FprealArray values,
bool  sorted,
bool  inclusive 
) const
inline

Returns the array of float values that match the pattern.

Definition at line 102 of file PDG_ValuePattern.h.

void PDG_ValuePattern::array ( UT_ExintArray values,
bool  sorted,
bool  inclusive 
) const
inline

Returns the array of integer values that match the pattern.

Definition at line 108 of file PDG_ValuePattern.h.

void PDG_ValuePattern::arrayMap ( StringMap values,
bool  sorted,
bool  inclusive 
) const
inline

Returns a map of component number -> string value array, after considering exclusions

Definition at line 116 of file PDG_ValuePattern.h.

void PDG_ValuePattern::arrayMap ( FloatMap values,
bool  sorted,
bool  inclusive 
) const
inline

Returns a map of component number -> float value array, after considering exclusions

Definition at line 126 of file PDG_ValuePattern.h.

void PDG_ValuePattern::arrayMap ( IntMap values,
bool  sorted,
bool  inclusive 
) const
inline

Returns a map of component number -> int value array, after considering exclusions

Definition at line 136 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::componentRange ( UT_FprealArray range,
exint  index,
bool  inclusive 
) const
inline

Returns the value range for the specified component number.

Definition at line 146 of file PDG_ValuePattern.h.

fpreal PDG_ValuePattern::componentStep ( exint  index) const
inline

Returns the step value for the specified component number.

Definition at line 162 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::contains ( const UT_StringHolder value,
bool  inclusive 
) const
inline

Checks if the specified string value is in the pattern.

Definition at line 51 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::contains ( fpreal  value,
bool  inclusive 
) const
inline

Checks if the specified float value is in the pattern.

Definition at line 72 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::contains ( exint  value,
bool  inclusive 
) const
inline

Checks if the specified integer value is in the pattern.

Definition at line 76 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::containsRange ( UT_FprealArray range,
fpreal  value,
bool  inclusive 
) const
inline

Checks if the specified float value matches the pattern and returns the range of values from the component that matches

Definition at line 82 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::containsRange ( UT_FprealArray range,
exint  value,
bool  inclusive 
) const
inline

Checks if the specified integer value matches the pattern and returns the range of values from the component that matches

Definition at line 89 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::hasVariableStep ( ) const
inline

Returns true if the pattern has segments with different step sizes.

Definition at line 176 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::isNumeric ( ) const
inline

Returns true if the pattern is strictly numeric (has no string values in it), otherwise returns false

Definition at line 172 of file PDG_ValuePattern.h.

fpreal PDG_ValuePattern::minimumStep ( ) const
inline

Returns the minimum step size from all components in the pattern.

Definition at line 180 of file PDG_ValuePattern.h.

bool PDG_ValuePattern::parse ( const UT_StringView pattern)

Parses the input string into this pattern – only valid if no pattern has been parsed previously

bool PDG_ValuePattern::reset ( const UT_StringHolder pattern,
char  delimiter = ' ' 
)

Resets the pattern to an unparsed state.

bool PDG_ValuePattern::tryReset ( const UT_StringHolder pattern,
char  delimiter = ' ' 
)

Updates and reparses the pattern if the supplied pattern string is different than the current pattern string


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