diff options
Diffstat (limited to 'linden/indra/llmedia/llmediaimplfactory.cpp')
-rw-r--r-- | linden/indra/llmedia/llmediaimplfactory.cpp | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/linden/indra/llmedia/llmediaimplfactory.cpp b/linden/indra/llmedia/llmediaimplfactory.cpp deleted file mode 100644 index c5d098f..0000000 --- a/linden/indra/llmedia/llmediaimplfactory.cpp +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /** | ||
2 | * @file llmediaimplfactory.cpp | ||
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 | #include "llmediaimplfactory.h" | ||
34 | |||
35 | #include <iostream> | ||
36 | |||
37 | LLMediaImplFactory* LLMediaImplFactory::sInstance = NULL; | ||
38 | |||
39 | /////////////////////////////////////////////////////////////////////////////// | ||
40 | // static | ||
41 | LLMediaImplFactory* LLMediaImplFactory::getInstance() | ||
42 | { | ||
43 | if ( ! sInstance ) | ||
44 | sInstance = new LLMediaImplFactory(); | ||
45 | |||
46 | return sInstance; | ||
47 | } | ||
48 | |||
49 | /////////////////////////////////////////////////////////////////////////////// | ||
50 | // | ||
51 | void LLMediaImplFactory::registerImpl( const std::string& impl_name, LLMediaImplMakerBase* impl_maker ) | ||
52 | { | ||
53 | mNameImplMakerContainer.insert( name_impl_maker_container_t::value_type( impl_name, impl_maker ) ); | ||
54 | } | ||
55 | |||
56 | /////////////////////////////////////////////////////////////////////////////// | ||
57 | // | ||
58 | LLMediaImplMakerBase* LLMediaImplFactory::getImplMaker( const std::string& scheme, const std::string& type ) | ||
59 | { | ||
60 | name_impl_maker_container_t::const_iterator iter; | ||
61 | name_impl_maker_container_t::const_iterator begin = mNameImplMakerContainer.begin(); | ||
62 | name_impl_maker_container_t::const_iterator end = mNameImplMakerContainer.end(); | ||
63 | |||
64 | for(iter = begin; iter != end; ++iter) | ||
65 | { | ||
66 | if(( *iter->second ).supportsScheme(scheme)) | ||
67 | { | ||
68 | return ( iter->second ); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | for(iter = begin; iter != end; ++iter) | ||
73 | { | ||
74 | if(( *iter->second ).supportsMimeType(type)) | ||
75 | { | ||
76 | return ( iter->second ); | ||
77 | } | ||
78 | } | ||
79 | int idx1 = type.find("/"); | ||
80 | int len = (idx1 == std::string::npos) ? 0 : idx1; | ||
81 | std::string category = type.substr(0,len); | ||
82 | for(iter = begin; iter != end; ++iter) | ||
83 | { | ||
84 | if(( *iter->second ).supportsMimeTypeCategory(category)) | ||
85 | { | ||
86 | return ( iter->second ); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | return NULL; | ||
91 | }; | ||
92 | |||
93 | /////////////////////////////////////////////////////////////////////////////// | ||
94 | // | ||
95 | LLMediaImplMakerBase* LLMediaImplFactory::getImplMaker( const std::string& impl_name ) | ||
96 | { | ||
97 | name_impl_maker_container_t::const_iterator found = mNameImplMakerContainer.find( impl_name ); | ||
98 | |||
99 | if ( found == mNameImplMakerContainer.end() ) | ||
100 | { | ||
101 | return NULL; | ||
102 | }; | ||
103 | |||
104 | return found->second; | ||
105 | } | ||