forked from janneku/rtmpserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.h
More file actions
38 lines (30 loc) · 912 Bytes
/
utils.h
File metadata and controls
38 lines (30 loc) · 912 Bytes
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
#ifndef __utils_h
#define __utils_h
#include <map>
#include <string>
#include <stdio.h>
#include <stdint.h>
#define FOR_EACH(type, i, where) \
for (typename type::iterator i = (where).begin(); i != (where).end(); ++i)
#define FOR_EACH_CONST(type, i, where) \
for (typename type::const_iterator i = (where).begin(); \
i != (where).end(); ++i)
#define debug(fmt...) \
fprintf(stderr, fmt)
template<class Key, class Value>
Value get(const std::map<Key, Value> &map, const Key &k,
const Value &def = Value())
{
typename std::map<Key, Value>::const_iterator i = map.find(k);
if (i == map.end())
return def;
return i->second;
}
uint32_t load_be32(const void *p);
uint16_t load_be16(const void *p);
uint32_t load_be24(const void *p);
uint32_t load_le32(const void *p);
void set_be24(void *p, uint32_t val);
void set_le32(void *p, uint32_t val);
const std::string strf(const char *fmt, ...);
#endif