DD::Image::Knob::Script_List Class Reference

Public Member Functions

 Script_List (const char *arg)
 
 ~Script_List ()
 
const char * operator[] (size_t n) const
 
const char ** argv () const
 
size_t size () const
 
bool error () const
 

Friends

class _Script_List
 

Detailed Description

Splits an argument passed to Knob::from_script() into an array of const char* words, allowing a parser to use the words as individual parts of the value of the knob. This encapsulates a common tcl function so that the scripting language can be replaced.

The inverse Knob::to_script() function should print the same words with spaces between them. If the words may have punctuation or spaces in them then you should use a cstring object to "quote" them. If the quote argument to to_script() is on you should also add a '{' before and a '}' after the list.

Constructor & Destructor Documentation

Knob::Script_List::Script_List ( const char *  arg)

The constructor allocates any temporary storage, and splits the argument according to the scripting language's rules (at spaces for tcl). You can then get at the individual words as C string values. These values may be used as an argument to to_double(), or as an argument to a constructor to an internal Script_List to make a nested list.

Knob::Script_List::~Script_List ( )

The destructor frees the temporary storage for the split list.

Member Function Documentation

char * DD::Image::Knob::Script_List::operator[] ( size_t  n) const
inline

Returns word n of the split list. n must between 0 and size()-1.

int DD::Image::Knob::Script_List::size ( ) const
inline

Returns the size of the array.

bool DD::Image::Knob::Script_List::error ( ) const
inline

Returns true if the constructor encountered an error. If so the only legal operation on the list is to delete it. Knob::error() will have been called to print an appropriate message.



©2022 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk