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
23 //%% (c) Copyright 1993, 1994 Hewlett-Packard Company
24 //%% (c) Copyright 1993, 1994 International Business Machines Corp.
25 //%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
26 //%% (c) Copyright 1993, 1994 Novell, Inc.
27 //%% $XConsortium: mp_msg_context.C /main/3 1995/10/23 10:25:15 rswiston $
29 * @(#)mp_msg_context.C 1.14 94/11/17
31 * @(#)mp_msg_context.C 1.9 93/09/07
33 * Implementation of the _Tt_msg_context: a context slot in a message.
36 #include "mp/mp_arg.h"
37 #include "mp/mp_msg_context.h"
38 #include "util/tt_iostream.h"
40 _Tt_msg_context::_Tt_msg_context()
45 _Tt_msg_context::~_Tt_msg_context()
50 _Tt_msg_context::setValue(
51 const _Tt_string &value
54 _value->set_mode( TT_INOUT );
55 _value->set_type( "string" );
56 return _value->set_data_string( value );
60 _Tt_msg_context::setValue(
64 _value->set_mode( TT_INOUT );
65 _value->set_type( "integer" );
66 return _value->set_data_int( value );
70 _Tt_msg_context::isEnvEntry() const
72 if (_slotName.len() == 0) {
75 return _slotName[0] == '$';
79 _Tt_msg_context::enVarName() const
81 _Tt_string name( ((char *)_slotName)+1 );
86 _Tt_msg_context::stringRep() const
90 switch (_value->data_type()) {
94 rep = _value->data_string();
97 sprintf( temp, "%d", _value->data_int());
105 _Tt_msg_context::print(
106 const _Tt_ostream &os
109 _Tt_context::print( os );
111 if (!_value.is_null()) {
119 _Tt_msg_context::print_(
120 const _Tt_ostream &os,
121 const _Tt_object *obj
124 ((_Tt_msg_context *)obj)->print( os );
128 _Tt_msg_context::xdr(
132 if (! _Tt_context::xdr( xdrs )) {
135 return _value.xdr( xdrs );