1 /* queryfeature.h 2 Feature querying functions 3 Initial version by Joost Nieuwenhuijse - joost@newhouse.nl 4 GPL etc.. 5 6 These functions can be used to determine properties of this specific pano13 library. 7 Features are name/value pairs. The name is string and the value can be either an 8 integer, double or string. Boolean values are encoded as integers (0=false, 1=true) 9 10 Functions queryFeatureCount() and queryFeatures() can be used to obtain a list 11 of features. Use queryFeatureInt(), queryFeatureDouble() and queryFeatureString() 12 to determine the value of a specific feature. If the feature is known, 13 queryFeatureXxx() returns nonzero and sets the *result value. 14 15 queryFeatureString returns the string length of the feature value. The string will 16 be copied to the result buffer. Caller should allocate and free the result buffer. 17 Value is always NULL terminated (except if bufsize=0). Use 18 queryFeatureString(name,NULL,0) to determine the strlen of the feature value. 19 In addition to string values, queryFeatureString also returns the int and double 20 features converted into a string. 21 22 Usage: 23 int i,bufsize,numfeatures; 24 char *name; 25 char *value; 26 Tp12FeatureType type; 27 28 numfeatures=queryFeatureCount(); 29 for(i=0; i < numfeatures;i++) 30 { 31 queryFeatures(i,&name,&type); 32 bufsize=queryFeatureString(name,NULL,0)+1; 33 value=(char*)malloc(bufsize); 34 queryFeatureString(name,value,bufsize); 35 // ... do something with the value ... 36 free(value); 37 } 38 */ 39 40 #ifndef _QUERYFEATURE_H 41 #define _QUERYFEATURE_H 42 #include "panorama.h" 43 44 typedef enum {p12FeatureUnknown=0,p12FeatureInt=1,p12FeatureDouble=2,p12FeatureString=3} Tp12FeatureType; 45 46 PANO13_IMPEX int queryFeatureCount(); 47 PANO13_IMPEX void queryFeatures(int index,char** name,Tp12FeatureType* type); 48 PANO13_IMPEX int queryFeatureInt(const char *name, int *result); 49 PANO13_IMPEX int queryFeatureDouble(const char *name, double *result); 50 PANO13_IMPEX int queryFeatureString(const char *name,char *result, const int bufsize); 51 52 /** defined if progress and output dialogs can be overridden by using 53 * setProgressFcn, setInfoDlgFcn and setErrorFcn 54 */ 55 #define PANO12_FEATURE_DLG_FCN 1 56 57 #endif 58