Go to the documentation of this file.00001 #ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00002 #define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
00003
00004 #if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
00005 #pragma once
00006 #endif
00007
00008
00009 #include <vector>
00010 #include <list>
00011 #include <set>
00012 #include <map>
00013
00014 namespace YAML_PM
00015 {
00016 template<typename Seq>
00017 inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
00018 emitter << BeginSeq;
00019 for(typename Seq::const_iterator it=seq.begin();it!=seq.end();++it)
00020 emitter << *it;
00021 emitter << EndSeq;
00022 return emitter;
00023 }
00024
00025 template<typename T>
00026 inline Emitter& operator << (Emitter& emitter, const std::vector<T>& v) {
00027 return EmitSeq(emitter, v);
00028 }
00029
00030 template<typename T>
00031 inline Emitter& operator << (Emitter& emitter, const std::list<T>& v) {
00032 return EmitSeq(emitter, v);
00033 }
00034
00035 template<typename T>
00036 inline Emitter& operator << (Emitter& emitter, const std::set<T>& v) {
00037 return EmitSeq(emitter, v);
00038 }
00039
00040 template <typename K, typename V>
00041 inline Emitter& operator << (Emitter& emitter, const std::map<K, V>& m) {
00042 typedef typename std::map <K, V> map;
00043 emitter << BeginMap;
00044 for(typename map::const_iterator it=m.begin();it!=m.end();++it)
00045 emitter << Key << it->first << Value << it->second;
00046 emitter << EndMap;
00047 return emitter;
00048 }
00049 }
00050
00051 #endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66