YSTest: ContentType.h 源文件

YSTest PreAlpha_b500_20140530 The YSLib Test Project

- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件

- 文件列表
- 文件成员

全部 类 命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义 组 页
ContentType.h
浏览该文件的文档.
1 /*
2 © 2013 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_Service_ContentType_h_
29 #define YSL_INC_Service_ContentType_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_Core_ValueNode
33 #include <ystdex/path.hpp>
34 #include YFM_YSLib_Adaptor_YContainer
35
36 namespace YSLib
37 {
38
45 class YF_API MIMEBiMapping
46 {
47 public:
48 using ExtensionType = string;
49 using MIMEType = ystdex::path<vector<string>>;
50 using ExtensionMap = multimap<ExtensionType, MIMEType>;
51 using MIMEMap = multimap<MIMEType, ExtensionType>;
52
53 private:
54 ExtensionMap ext_map;
55 MIMEMap inv_map;
56
57 public:
58 DefDeCtor(MIMEBiMapping)
59 template<typename _tIn>
60 MIMEBiMapping(_tIn first, _tIn last)
61 {
62 std::for_each(first, last, [this](decltype(*first)& pr){
63 *this += pr;
64 });
65 }
66 template<typename _type>
67 MIMEBiMapping(std::initializer_list<_type> il)
68 : MIMEBiMapping(il.begin(), il.end())
69 {}
70
71 DefDeMoveCtor(MIMEBiMapping)
72
73 void
74 operator+=(const pair<ExtensionType, MIMEType>&);
75 void
76 operator+=(const pair<MIMEType, ExtensionType>&);
77
78 void
79 operator-=(const pair<ExtensionType, MIMEType>&);
80 void
81 operator-=(const pair<MIMEType, ExtensionType>&);
82
83 DefGetter(const ynothrow, const ExtensionMap&, ExtensionMap, ext_map)
84 DefGetter(const ynothrow, const MIMEMap&, MIMEMap, inv_map)
85 };
86
87
92 YF_API void
93 AddMIMEItems(MIMEBiMapping&, const ValueNode&, MIMEBiMapping::MIMEType&& = {});
94
95 } // namespace YSLib;
96
97 #endif
98
YSLib::MIMEBiMapping::ext_map
ExtensionMap ext_map
Definition: ContentType.h:54
YSLib::MIMEBiMapping::inv_map
MIMEMap inv_map
Definition: ContentType.h:55
YSLib::MIMEBiMapping::ExtensionMap
multimap< ExtensionType, MIMEType > ExtensionMap
Definition: ContentType.h:50
ystdex::iterator_transformation::first
static auto first(const _tIterator &i) -> decltype((i->first))
Definition: iterator.hpp:759
DefDeCtor
#define DefDeCtor(_t)
Definition: YBaseMacro.h:131
ystdex::path
一般路径模板。
Definition: path.hpp:149
path.hpp
抽象路径模板。
YF_API
#define YF_API
Definition: Platform.h:64
YSLib::MIMEBiMapping::MIMEBiMapping
MIMEBiMapping(std::initializer_list< _type > il)
Definition: ContentType.h:67
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:180
YSLib::MIMEBiMapping
MIME 和文件扩展名双向映射。
Definition: ContentType.h:45
DefDeMoveCtor
#define DefDeMoveCtor(_t)
Definition: YBaseMacro.h:141
YSLib::MIMEBiMapping::ExtensionType
string ExtensionType
Definition: ContentType.h:48
ynothrow
#define ynothrow
YSLib 无异常抛出保证：若支持 noexcept 关键字， 指定特定的 noexcept 异常规范。
Definition: ydef.h:514
YSLib::string
GSStringTemplate< char >::basic_string string
Definition: ycont.h:164
YSLib::ValueNode
值类型节点。
Definition: ValueNode.h:45
YSLib::MIMEBiMapping::MIMEMap
multimap< MIMEType, ExtensionType > MIMEMap
Definition: ContentType.h:51
YSLib::AddMIMEItems
YF_API void AddMIMEItems(MIMEBiMapping &, const ValueNode &, MIMEBiMapping::MIMEType &&={})
根据 NPLA1 节点内容增加 MIME 映射。
Definition: ContentType.cpp:62
YModules.h