2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * $XConsortium: graphic_hd.cc /main/4 1996/06/11 17:28:57 cde-hal $
25 * $XConsortium: graphic_hd.cc /main/4 1996/06/11 17:28:57 cde-hal $
27 * Copyright (c) 1992 HAL Computer Systems International, Ltd.
28 * All rights reserved. Unpublished -- rights reserved under
29 * the Copyright Laws of the United States. USE OF A COPYRIGHT
30 * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
33 * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
34 * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
35 * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
36 * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
39 * RESTRICTED RIGHTS LEGEND
40 * Use, duplication, or disclosure by the Government is subject
41 * to the restrictions as set forth in subparagraph (c)(l)(ii)
42 * of the Rights in Technical Data and Computer Software clause
43 * at DFARS 252.227-7013.
45 * HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
52 #include "oliasdb/graphic_hd.h"
55 buffer* graphic_smart_ptr::local_graphic_buffer_ptr = 0;
61 graphic_smart_ptr::init () {
73 graphic_smart_ptr(info_lib* lib_ptr, const char* ibase_name, const char* locator) :
74 smart_ptr(lib_ptr, ibase_name, GRAPHIC_SET_POS,
75 managers::query_mgr -> form_pstring_handler(locator),
76 BASE_COMPONENT_INDEX, smart_ptr::SET
84 graphic_smart_ptr(info_base* base_ptr, const char* locator)
85 : smart_ptr(base_ptr, GRAPHIC_SET_POS,
86 managers::query_mgr -> form_pstring_handler(locator),
87 BASE_COMPONENT_INDEX, smart_ptr::SET
91 //debug(cerr, locator);
96 graphic_smart_ptr(info_base* base_ptr, const oid_t& id)
97 : smart_ptr(base_ptr -> get_set(GRAPHIC_SET_POS) -> its_store(), id),
103 ///////////////////////////////
105 ///////////////////////////////
107 const char* graphic_smart_ptr::locator()
109 return get_string(BASE_COMPONENT_INDEX);
112 const char* graphic_smart_ptr::file_name()
114 return get_string(BASE_COMPONENT_INDEX+1);
117 const char* graphic_smart_ptr::version()
119 return get_string(BASE_COMPONENT_INDEX+2);
122 Boolean graphic_smart_ptr::_convert_to_ints()
124 pstring_handler* x = (pstring_handler*)get_handler(BASE_COMPONENT_INDEX+3, STRING_CODE);
126 char* y = (*x)->get();
127 int ct = (*x) -> size();
130 for ( int i=0; i<ct; i++ )
136 sscanf(y, "%d.%hu.%hu.%hu", &f_type, &f_coding, &f_width, &f_height);
140 sscanf(y, "%d.%hu.%u.%u.%u.%u",
141 &f_type, &f_coding, &f_llx, &f_lly, &f_urx, &f_ury);
142 //debug(cerr, f_llx);
143 //debug(cerr, f_lly);
144 //debug(cerr, f_urx);
145 //debug(cerr, f_ury);
149 throw(stringException("wrong number of dots"));
159 #define local_graphic_buffer (*local_graphic_buffer_ptr)
161 static buffer local_graphic_buffer(LBUFSIZ);
165 const char* graphic_smart_ptr::data()
167 return get_string(BASE_COMPONENT_INDEX+4, local_graphic_buffer);
170 int graphic_smart_ptr::data_size()
172 return get_string_size(BASE_COMPONENT_INDEX+4);
175 const char* graphic_smart_ptr::title()
179 return get_string(BASE_COMPONENT_INDEX+5);
182 mcatch (mmdbException&,e)
191 int graphic_smart_ptr::type() const
193 if ( _converted == false )
194 // cast away to achieve logical constness
195 ((graphic_smart_ptr*)this)->_convert_to_ints();
200 unsigned short graphic_smart_ptr::coding()
202 if ( _converted == false )
208 unsigned short graphic_smart_ptr::width()
210 if ( _converted == false )
216 unsigned short graphic_smart_ptr::height()
218 if ( _converted == false )
224 /////////////////////////////////////////////
225 unsigned int graphic_smart_ptr::llx()
227 if ( _converted == false )
233 unsigned int graphic_smart_ptr::lly()
235 if ( _converted == false )
241 unsigned int graphic_smart_ptr::urx()
243 if ( _converted == false )
249 unsigned int graphic_smart_ptr::ury()
251 if ( _converted == false )