Switch to unified view

a/src/smallut.h b/src/smallut.h
...
...
216
    class Internal;
216
    class Internal;
217
private:
217
private:
218
    Internal *m;
218
    Internal *m;
219
};
219
};
220
220
221
/// Utilities for printing names for defined values (Ex: O_RDONLY->"O_RDONLY")
222
223
/// Entries for the descriptive table
224
struct CharFlags {
225
    unsigned int value; // Flag or value
226
    const char *yesname;// String to print if flag set or equal
227
    const char *noname; // String to print if flag not set (unused for values)
228
};
229
230
/// Helper macro for the common case where we want to print the
231
/// flag/value defined name
232
#define CHARFLAGENTRY(NM) {NM, #NM}
233
234
/// Translate a bitfield into string description
235
extern std::string flagsToString(const std::vector<CharFlags>&,
236
                                 unsigned int flags);
237
238
/// Translate a value into a name
239
extern std::string valToString(const std::vector<CharFlags>&, unsigned int val);
240
241
/// Reverse operation: translate string into bitfield
242
extern unsigned int
243
stringToFlags(const std::vector<CharFlags>&, const std::string& input,
244
              const char *sep = "|");
245
221
#endif /* _SMALLUT_H_INCLUDED_ */
246
#endif /* _SMALLUT_H_INCLUDED_ */