summaryrefslogtreecommitdiff
path: root/include/tools.h
blob: 8bb7865968bc7dbff5283b93cf5c4e15d2bba428 (plain)
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
/*
 * tools.h
 *
 *  Created on: 03.08.2012
 *      Author: savop
 */

#ifndef TOOLS_H_
#define TOOLS_H_

#include <vector>
#include <string>
#include <iostream>
#include <string.h>
#include <vdr/tools.h>
#include <map>
#include <list>

using namespace std;

#define KB(s)         (s * 1024)
#define MB(s)         (s * 1024 * 1024)

#define ARRAY_SIZE(a)  (sizeof(a)/sizeof(a[0]))

#define CRLF          "\r\n"

#define NL            "\n"

#define MAX_METADATA_LENGTH_L     1024
#define MAX_METADATA_LENGTH_S     256

#define _unused(x) ((void)x)

#ifdef DEBUG

#if __STDC_VERSION__ < 199901L
  #if __GNUC__ >= 2
  #define __func__ __PRETTY_FUNCTION__
  #else
  #define __func__ "<unknown>"
  #endif
#endif

#define LOG(level, msg...) upnp::log_debug_msg(__FILE__, __func__, __LINE__, level, msg);

namespace upnp {
  void log_debug_msg(const char* file, const char* func, int line, int level, const char* msg, ...) __attribute__ ((format (printf, 5, 6)));
}
#else
#define LOG(level, msg...)
#endif

namespace upnp {

  typedef std::list<std::string> StringList;
  typedef std::vector<std::string> StringVector;
  typedef std::map<std::string, std::string> StringMap;
  typedef std::map<std::string, uint32_t> IdList;

}

#include "tools/error.h"
#include "tools/ixml.h"
#include "tools/net.h"
#include "tools/string.h"
#include "tools/uuid.h"

#endif /* TOOLS_H_ */