File: queryfeature.h

package info (click to toggle)
libpano13 2.9.12.dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 8,616 kB
  • ctags: 3,403
  • sloc: ansic: 31,169; sh: 8,383; cpp: 1,714; makefile: 236; perl: 202
file content (56 lines) | stat: -rw-r--r-- 2,157 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* queryfeature.h
   Feature querying functions
   Initial version by Joost Nieuwenhuijse - joost@newhouse.nl
   GPL etc..

   These functions can be used to determine properties of this specific pano12 library.
   Features are name/value pairs. The name is string and the value can be either an
   integer, double or string. Boolean values are encoded as integers (0=false, 1=true)

   Functions queryFeatureCount() and queryFeatures() can be used to obtain a list
   of features. Use queryFeatureInt(), queryFeatureDouble() and queryFeatureString()
   to determine the value of a specific feature. If the feature is known,
   queryFeatureXxx() returns nonzero and sets the *result value.

   queryFeatureString returns the string length of the feature value. The string will
   be copied to the result buffer. Caller should allocate and free the result buffer.
   Value is always NULL terminated (except if bufsize=0). Use
   queryFeatureString(name,NULL,0) to determine the strlen of the feature value.
   In addition to string values, queryFeatureString also returns the int and double
   features converted into a string.

   Usage:
     int i,bufsize,numfeatures;
     char *name;
     char *value;
     Tp12FeatureType type;

     numfeatures=queryFeatureCount();
     for(i=0; i < numfeatures;i++)
     {
       queryFeatures(i,&name,&type);
       bufsize=queryFeatureString(name,NULL,0)+1;
       value=(char*)malloc(bufsize);
       queryFeatureString(name,value,bufsize);
       // ... do something with the value ...
       free(value);
     }
*/

#ifndef _QUERYFEATURE_H
#define _QUERYFEATURE_H

typedef enum {p12FeatureUnknown=0,p12FeatureInt=1,p12FeatureDouble=2,p12FeatureString=3} Tp12FeatureType;

int queryFeatureCount();
void queryFeatures(int index,char** name,Tp12FeatureType* type);
int queryFeatureInt(const char *name, int *result);
int queryFeatureDouble(const char *name, double *result);
int queryFeatureString(const char *name,char *result, const int bufsize);

/** defined if progress and output dialogs can be overridden by using
 *  setProgressFcn, setInfoDlgFcn and setErrorFcn
 */
#define PANO12_FEATURE_DLG_FCN 1

#endif