pdf/plugin_impl/search_criteria_impl.cpp

Go to the documentation of this file.
00001 /*
00002  * File Name: search_criteria_impl.cpp
00003  */
00004 
00005 /*
00006  * This file is part of uds-plugin-pdf.
00007  *
00008  * uds-plugin-pdf 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-pdf 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 #include "search_criteria_impl.h"
00028 
00029 namespace pdf
00030 {
00031 
00032 utils::ObjectTable<PluginSearchCriteria> 
00033     PluginSearchCriteria::g_instances_table;
00034 
00035 PluginSearchCriteria::PluginSearchCriteria(void)
00036 : data()
00037 {
00038     // IPluginUnkown
00039     query_interface = query_interface_impl;
00040     release         = release_impl;
00041 
00042     // IPluginSearchCriteria
00043     set_search_text      = set_search_text_impl;
00044     set_case_sensitive   = set_case_sensitive_impl;
00045     set_match_whole_word = set_match_whole_word_impl;
00046     set_forward          = set_forward_impl;
00047 
00048     g_instances_table.add_interface<IPluginUnknown>(this);
00049     g_instances_table.add_interface<IPluginSearchCriteria>(this);
00050 }
00051 
00052 PluginSearchCriteria::~PluginSearchCriteria(void)
00053 {
00054     g_instances_table.remove(this);
00055 }
00056 
00057 PluginStatus 
00058 PluginSearchCriteria::query_interface_impl(IPluginUnknown    *thiz,
00059                                            const UDSString   *id, 
00060                                            void              **ptr )
00061 {
00062     // check object. 
00063     PluginSearchCriteria *instance = g_instances_table.get_object(thiz);
00064 
00065     // check interface.
00066     if (g_instances_table.query_interface(instance, id->get_buffer(id), ptr))
00067     {
00068         return PLUGIN_OK;
00069     }
00070     return PLUGIN_FAIL;
00071 }
00072 
00073 int PluginSearchCriteria::release_impl(IPluginUnknown  *thiz )
00074 {
00075     PluginSearchCriteria * instance = g_instances_table.get_object(thiz);
00076 
00077     delete instance;
00078 
00079     return PLUGIN_OK;
00080 }
00081 
00082 /// IPluginSearchCriteria
00083 PluginStatus 
00084 PluginSearchCriteria::set_search_text_impl(IPluginUnknown    *thiz, 
00085                                            const UDSString   *text )
00086 {
00087     PluginSearchCriteria *instance = g_instances_table.get_object(thiz);
00088     instance->data.text = string(text->get_buffer(text));
00089     return PLUGIN_OK;
00090 }
00091 
00092 PluginStatus 
00093 PluginSearchCriteria::set_case_sensitive_impl(IPluginUnknown   *thiz, 
00094                                               const PluginBool is_sensitive )
00095 {
00096     PluginSearchCriteria *instance = g_instances_table.get_object(thiz);
00097     instance->data.case_sensitive = is_sensitive;
00098     return PLUGIN_OK;
00099 }
00100 
00101 PluginStatus
00102 PluginSearchCriteria::set_match_whole_word_impl(IPluginUnknown   *thiz, 
00103                                                 const PluginBool do_match_word )
00104 {
00105     PluginSearchCriteria *instance = g_instances_table.get_object(thiz);
00106     instance->data.match_whole_word = do_match_word;
00107     return PLUGIN_OK;
00108 }
00109 
00110 PluginStatus 
00111 PluginSearchCriteria::set_forward_impl(IPluginUnknown    *thiz, 
00112                                        const PluginBool  do_search_forward )
00113 {
00114     PluginSearchCriteria *instance = g_instances_table.get_object(thiz);
00115     instance->data.forward = do_search_forward;
00116     return PLUGIN_OK;
00117 }
00118 
00119 }   // namespace pdf
00120 
Generated by  doxygen 1.6.2-20100208