dtinfo subtree dtinfo
[oweals/cde.git] / cde / programs / dtinfo / dtinfo / src / UAS / MMDB / MMDB_StyleSheet.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
23 // $XConsortium: MMDB_StyleSheet.C /main/4 1996/09/04 01:36:27 cde-hal $
24 # include <sstream>
25 using namespace std;
26 # include "MMDB_StyleSheet.hh"
27
28 MMDB_StyleSheet::MMDB_StyleSheet (MMDB &theMMDB,
29                                   info_base *ib,
30                                   const oid_t &ssid,
31                                   StyleSheetType sstype):
32                             MMDB_Common (theMMDB, ib),
33                             UAS_StyleSheet (sstype),
34                             fSSID (ssid),
35                             fStyleSheet (ib, ssid) {
36 }
37
38 MMDB_StyleSheet::~MMDB_StyleSheet () {
39 }
40
41 unsigned int
42 MMDB_StyleSheet::data_length () {
43     if (fSSType == SS_HARDCOPY) {
44         return fStyleSheet.hardcopy_data_size ();
45     } else {
46         return fStyleSheet.online_data_size ();
47     }
48 }
49
50 UAS_String
51 MMDB_StyleSheet::data () {
52     if (fSSType == SS_HARDCOPY) {
53         return UAS_String (fStyleSheet.hardcopy_data(),
54                                fStyleSheet.hardcopy_data_size(),
55                                UAS_NOT_OWNER);
56     } else {
57         return UAS_String (fStyleSheet.online_data(),
58                                fStyleSheet.online_data_size(),
59                                UAS_NOT_OWNER);
60     }
61 }
62
63 int
64 MMDB_StyleSheet::operator == (UAS_Common &obj) {
65     //  First make sure obj is an mmdb stylesheet...
66     if (obj.implementation_type() != "mmdb" || obj.type() != UAS_STYLE_SHEET)
67         return 0;
68
69     //  Because of the above if stmt we know the cast is safe.
70     MMDB_StyleSheet &ss = (MMDB_StyleSheet &) obj;
71     return infobase() == ss.infobase() && fSSID.eq (ss.fSSID);
72 }
73
74 UAS_String
75 MMDB_StyleSheet::locale()
76 {
77     return UAS_String(infobase()->get_info_base_locale());
78 }
79