diff options
Diffstat (limited to 'linden/indra/llmedia/llmediaimplfactory.h')
-rw-r--r-- | linden/indra/llmedia/llmediaimplfactory.h | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/linden/indra/llmedia/llmediaimplfactory.h b/linden/indra/llmedia/llmediaimplfactory.h deleted file mode 100644 index 93a7cc1..0000000 --- a/linden/indra/llmedia/llmediaimplfactory.h +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | /** | ||
2 | * @file llmediaimplfactory.h | ||
3 | * @brief Creates media impls that have registered themselves with LLMediaRegster | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2007&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2007-2009, Linden Research, Inc. | ||
8 | * | ||
9 | * Second Life Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
11 | * to you under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
16 | * | ||
17 | * There are special exceptions to the terms and conditions of the GPL as | ||
18 | * it is applied to this Source Code. View the full text of the exception | ||
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
20 | * online at | ||
21 | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
22 | * | ||
23 | * By copying, modifying or distributing this software, you acknowledge | ||
24 | * that you have read and understood your obligations described above, | ||
25 | * and agree to abide by those obligations. | ||
26 | * | ||
27 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
28 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
29 | * COMPLETENESS OR PERFORMANCE. | ||
30 | * $/LicenseInfo$ | ||
31 | */ | ||
32 | |||
33 | #ifndef LLMEDIAIMPLFACTORY_H | ||
34 | #define LLMEDIAIMPLFACTORY_H | ||
35 | |||
36 | #include <algorithm> | ||
37 | #include <map> | ||
38 | #include <string> | ||
39 | #include <vector> | ||
40 | |||
41 | #include "llmediabase.h" | ||
42 | |||
43 | /////////////////////////////////////////////////////////////////////////////// | ||
44 | // | ||
45 | class LLMediaImplMakerBase | ||
46 | { | ||
47 | public: | ||
48 | virtual bool supportsScheme(std::string scheme) = 0; | ||
49 | virtual bool supportsMimeType(std::string type) = 0; | ||
50 | virtual bool supportsMimeTypeCategory(std::string category) = 0; | ||
51 | virtual LLMediaBase* create() = 0; | ||
52 | virtual ~LLMediaImplMakerBase() {}; | ||
53 | |||
54 | protected: | ||
55 | typedef std::vector <std::string> vector_impl_registry_t; | ||
56 | vector_impl_registry_t mSchema; | ||
57 | vector_impl_registry_t mMimeTypes; | ||
58 | vector_impl_registry_t mMimeTypeCategories; | ||
59 | }; | ||
60 | |||
61 | /////////////////////////////////////////////////////////////////////////////// | ||
62 | // | ||
63 | class LLMediaImplMaker : public LLMediaImplMakerBase | ||
64 | { | ||
65 | public: | ||
66 | bool supportsScheme(std::string scheme) | ||
67 | { | ||
68 | vector_impl_registry_t::iterator found = std::find(mSchema.begin(), mSchema.end(), scheme); | ||
69 | return found != mSchema.end(); | ||
70 | } | ||
71 | bool supportsMimeType(std::string type) | ||
72 | { | ||
73 | vector_impl_registry_t::iterator found = std::find(mMimeTypes.begin(), mMimeTypes.end(), type); | ||
74 | return found != mMimeTypes.end(); | ||
75 | } | ||
76 | bool supportsMimeTypeCategory(std::string category) | ||
77 | { | ||
78 | vector_impl_registry_t::iterator found = std::find(mMimeTypeCategories.begin(), mMimeTypeCategories.end(), category); | ||
79 | return found != mMimeTypeCategories.end(); | ||
80 | } | ||
81 | }; | ||
82 | |||
83 | /////////////////////////////////////////////////////////////////////////////// | ||
84 | // | ||
85 | class LLMediaImplFactory | ||
86 | { | ||
87 | public: | ||
88 | static LLMediaImplFactory* getInstance(); | ||
89 | void registerImpl( const std::string& impl_name, LLMediaImplMakerBase* impl_maker ); | ||
90 | LLMediaImplMakerBase* getImplMaker( const std::string& scheme, const std::string& type ); | ||
91 | LLMediaImplMakerBase* getImplMaker( const std::string& impl_name); | ||
92 | |||
93 | private: | ||
94 | typedef std::map< std::string, LLMediaImplMakerBase* > name_impl_maker_container_t; | ||
95 | name_impl_maker_container_t mNameImplMakerContainer; | ||
96 | |||
97 | static LLMediaImplFactory* sInstance; | ||
98 | }; | ||
99 | |||
100 | #endif // LLMEDIAIMPLFACTORY_H | ||