/usr/include/avifile-0.7/avm_args.h is in libavifile-0.7-dev 1:0.7.48~20090503.ds-18.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | #ifndef AVM_ARGS_H
#define AVM_ARGS_H
#include "avm_default.h"
AVM_BEGIN_NAMESPACE;
class AVMEXPORT Args
{
public:
class Option {
public:
enum Type {
NONE = '#',
HELP = 'h', // use default help text and options
CODEC = 'c', // show available codec options (char*)
OPTIONS = 'O', // @value is pointer to another Options array
SUBOPTIONS = 'o', // @value is pointer to SubOptions array
// these options are separated by ':'
BOOL = 'b', // true flag when option is present (default is false)
DOUBLE = 'd', // double from given range (max == min -> unlimited)
INT = 'i', // integer from given range (max == min -> unlimited)
STRING = 's', // any string could be given
SELECTSTRING = 'x', // string from the list
REGBOOL = 'B',
REGDOUBLE = 'D',
REGINT = 'I',
REGSTRING = 'S'
};
Option(const char* o, const void* v = 0, int32_t mi = 0, int32_t ma = 0)
: opts(o), value(v), min(mi), max(ma) {}
Option(const char* o, const bool* b)
: opts(o), value(b) {}
const char* getLongOption() const { return opts + 1; }
const char* getShortOption() const { return findString(1); }
const char* getHelp() const { return findString(2); }
int32_t getInt() const { return (value) ? *(const int32_t*)value : 0; }
int32_t getMin() const { return min; }
int32_t getMax() const { return max; }
bool getBool() const { return (value) ? *(const bool*)value : false; }
double getDouble() const { return (value) ? *(const double*)value : 0.; }
const char* getString() const { return (const char*)value; }
const Option* getOptions() const { return (const Option*)value; }
Type getType() const { return (Type) opts[0]; }
bool is(Type t) const { return (t == getType()); }
bool isInRange(int32_t v) const { return (getMin() == getMax())
|| (getMin() <= v && v <= getMax()); }
int setBool(bool b) const { return (value) ? *(bool*)value = b, 0 : -1; }
int setDouble(double d) const { return (value) ? *(double*)value = d, 0 : -1; }
int setInt(int32_t i) const { return (value) ? *(int32_t*)value = i, 0 : -1; }
int setString(char* s) const { return (value) ? *(char**)value = s, 0 : -1; }
private:
// go through adjanced zero ended strings
const char* findString(int cnt) const {
const char* r = opts;
while (cnt--)
while (*r++)
;
return r;
}
const char* opts; // 'Type' long-option-str \0 short-option-str \0 help-str
const void* value; // storage pointer for value
// for SUB/OPTIONS contains subarray with Options
// for REG+ contains pointer to default value
union {
struct {
int32_t min; // min integer value
int32_t max; // max integer value
};
const char* defstr; // list of string options
};
};
Args(const Option* options, int* argc, char** argv,
const char* help = 0, const char* regname = 0);
~Args();
// could be used to parse CodecInfo arguments
static void ParseCodecInfo(const char* str);
protected:
int findOpt(int olong = 0);
const Option* opts;
int* argc;
char** argv;
const char* help;
const char* regname;
int idx;
};
#ifdef __GNUC__
#define ARGSOPTION(a, b, c, d, args...) \
Args::Option(a b "\0" c "\0" d, ## args)
#else
#define ARGSOPTION(a, b, c, d, ...) \
Args::Option(a b "\0" c "\0" d, __VA_ARGS__)
#endif
AVM_END_NAMESPACE;
#endif /* AVM_ARGS_H */
|