BRE12
stlemitter.h
1 #ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
2 #define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
3 
4 #if defined(_MSC_VER) || \
5  (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
6  (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
7 #pragma once
8 #endif
9 
10 #include <vector>
11 #include <list>
12 #include <set>
13 #include <map>
14 
15 namespace YAML {
16 template <typename Seq>
17 inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
18  emitter << BeginSeq;
19  for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it)
20  emitter << *it;
21  emitter << EndSeq;
22  return emitter;
23 }
24 
25 template <typename T>
26 inline Emitter& operator<<(Emitter& emitter, const std::vector<T>& v) {
27  return EmitSeq(emitter, v);
28 }
29 
30 template <typename T>
31 inline Emitter& operator<<(Emitter& emitter, const std::list<T>& v) {
32  return EmitSeq(emitter, v);
33 }
34 
35 template <typename T>
36 inline Emitter& operator<<(Emitter& emitter, const std::set<T>& v) {
37  return EmitSeq(emitter, v);
38 }
39 
40 template <typename K, typename V>
41 inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
42  typedef typename std::map<K, V> map;
43  emitter << BeginMap;
44  for (typename map::const_iterator it = m.begin(); it != m.end(); ++it)
45  emitter << Key << it->first << Value << it->second;
46  emitter << EndMap;
47  return emitter;
48 }
49 }
50 
51 #endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
Definition: DrawableObjectLoader.h:10