00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Tucker 00008 * Side Effects Software Inc 00009 * 477 Richmond Street West 00010 * Toronto, Ontario 00011 * Canada M5V 3E7 00012 * 416-504-9876 00013 * 00014 * NAME: OP_MultiparmInfo.h ( OP Library, C++) 00015 * 00016 * COMMENTS: 00017 * This class holds information usedto initialize multiparm instances 00018 * in OP_Parameters::initMultiparmInstance. 00019 */ 00020 00021 #ifndef __OP_MultiparmInfo_h__ 00022 #define __OP_MultiparmInfo_h__ 00023 00024 #include "OP_API.h" 00025 #include <UT/UT_StringArray.h> 00026 #include "OP_Parameters.h" 00027 00028 class OP_API OP_MultiparmInfo 00029 { 00030 public: 00031 OP_MultiparmInfo(OP_Parameters &owner); 00032 ~OP_MultiparmInfo(); 00033 00034 // Returns the number of multiparm links stored here. 00035 int entries() const; 00036 // Returns the specified referenced parm. 00037 const UT_String &getReferencedChannel(int index) const; 00038 // Returns the specified instance parm. 00039 const UT_String &getInstanceChannel(int index) const; 00040 00041 // Associates an instance channel with a referenced channel. If the 00042 // instance channel is already referenced, the new value replaces the 00043 // old. A null or empty reference clears that reference. A detailed 00044 // error message is returned in the error parameter. 00045 bool setReference(const char *instancechannel, 00046 const char *referencedchannel, 00047 UT_String &error); 00048 00049 // Performs pattern matching to find the instance channel that best 00050 // matches the passed in channel name. The referenced channel is returned 00051 // with appropriate replacements already done. 00052 bool getReferencedChannel(const char *instancechannel, 00053 UT_String &referencedchannel) const; 00054 00055 // Saves the opmultiparm commands required to set up the current 00056 // set of references. The "opmultiparm" and node name parts of the 00057 // command are not saved, and must be output before calling this 00058 // funtion. 00059 void saveCommands(ostream &os) const; 00060 00061 // Saves the multiparm info as into a hip file. 00062 void save(ostream &os, bool binary) const; 00063 00064 // Loads multiparm info as from a hip file. 00065 bool load(UT_IStream &is); 00066 00067 // Tries to match a specific channel name (instancechannel) with a 00068 // generic channel name containing "#"s (genericinstancechannel). 00069 // The numeric replacements required to match the channel names 00070 // are stored in the hashreplacements array. 00071 static bool matchChannels(const char *instancechannel, 00072 const char *genericinstancechannel, 00073 UT_IntArray &hashreplacements); 00074 00075 private: 00076 OP_Parameters &myOwner; 00077 UT_StringArray myInstanceChannels; 00078 UT_StringArray myReferencedChannels; 00079 }; 00080 00081 #endif 00082
1.5.9