pianod2
multisource multiuser scriptable networked music player
parsnip_helpers.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 namespace Parsnip {
12 
14  extern const char hex_digits[];
15 
17  static inline char hexdigit (int digit) {
18  assert (digit >= 0 && digit <= 15);
19  return hex_digits[digit];
20  }
21 
26  static inline void do_indent (std::ostream &target, int amount) {
27  for (int i = 0; i < amount; i++) {
28  target << ' ';
29  }
30  }
31 
36  static inline void do_newline (std::ostream &target, int amount) {
37  if (amount >= 0) {
38  target << std::endl;
39  }
40  }
41 
42 } // namespace Parsnip
Serialization and parsing library.
Definition: mediaunit.h:26
const char hex_digits[]
Digits used for encoding/decoding hexadecimal.
Definition: parsnip_types.cpp:19
static void do_newline(std::ostream &target, int amount)
Write a newline to a stream.
Definition: parsnip_helpers.h:36
static void do_indent(std::ostream &target, int amount)
Generate some indentation.
Definition: parsnip_helpers.h:26
static char hexdigit(int digit)
Helper function: Retrieve a hexadecimal digit.
Definition: parsnip_helpers.h:17