00001 /* 00002 * File Name: library_impl.h 00003 */ 00004 00005 /* 00006 * This file is part of uds-plugin-plaintext. 00007 * 00008 * uds-plugin-plaintext is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation, either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * uds-plugin-plaintext is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 */ 00021 00022 /** 00023 * Copyright (C) 2008 iRex Technologies B.V. 00024 * All rights reserved. 00025 */ 00026 00027 #ifndef TEXT_PLUGIN_LIBRARY_IMPL_H 00028 #define TEXT_PLUGIN_LIBRARY_IMPL_H 00029 00030 #include <vector> 00031 #include "plugin_inc.h" 00032 #include "document_impl.h" 00033 #include "interfaces_utils.h" 00034 00035 namespace text 00036 { 00037 00038 class PluginDocImpl; 00039 00040 /// @brief Implement Plugin Library object for text plugin. 00041 class PluginLibraryImpl : public IPluginUnknown 00042 , public IPluginLibrary 00043 { 00044 public: 00045 PluginLibraryImpl(); 00046 ~PluginLibraryImpl(); 00047 00048 private: 00049 /// @brief Implement query_interface. 00050 static PluginStatus query_interface_impl( 00051 IPluginUnknown *thiz, 00052 const UDSString *id, 00053 void **ptr ); 00054 00055 static int release_impl( 00056 IPluginUnknown *thiz ); 00057 00058 /// @brief Implement is_supported_document. 00059 static PluginBool is_supported_document_impl( 00060 IPluginUnknown *thiz, 00061 const UDSString *path ); 00062 00063 static IPluginUnknown * create_document_impl( 00064 IPluginUnknown *thiz ); 00065 00066 private: 00067 void on_document_released(PluginDocImpl * doc); 00068 00069 private: 00070 typedef PluginLibraryImpl * LibraryPtr; 00071 typedef std::vector<LibraryPtr> Libraries; 00072 typedef std::vector<LibraryPtr>::iterator LibrariesIter; 00073 typedef PluginDocImpl * DocPtr; 00074 typedef std::vector<DocPtr> Documents; 00075 typedef std::vector<DocPtr>::iterator DocumentsIter; 00076 00077 /// All constructured library instances. 00078 static utils::ObjectTable<PluginLibraryImpl> g_instances_table; 00079 Documents documents; ///< All opened documents. 00080 }; 00081 00082 }; // namespace text 00083 00084 #endif 00085